├── .gitignore ├── README.md ├── pom.xml ├── sql └── createtable.sql └── src ├── main ├── java │ └── com │ │ └── ken │ │ └── wms │ │ ├── common │ │ ├── controller │ │ │ ├── CustomerManageHandler.java │ │ │ ├── FileSourceHandler.java │ │ │ ├── GoodsManageHandler.java │ │ │ ├── RepositoryAdminManageHandler.java │ │ │ ├── RepositoryManageHandler.java │ │ │ ├── StockRecordManageHandler.java │ │ │ ├── StorageManageHandler.java │ │ │ ├── SupplierManageHandler.java │ │ │ └── SystemLogHandler.java │ │ ├── service │ │ │ ├── Impl │ │ │ │ ├── CustomerManageServiceImpl.java │ │ │ │ ├── GoodsManageServiceImpl.java │ │ │ │ ├── RepositoryAdminManageServiceImpl.java │ │ │ │ ├── RepositoryManageServiceImpl.java │ │ │ │ ├── StockRecordManageServiceImpl.java │ │ │ │ ├── StorageManageServiceImpl.java │ │ │ │ ├── SupplierManageServiceImpl.java │ │ │ │ └── SystemLogServiceImpl.java │ │ │ └── Interface │ │ │ │ ├── CustomerManageService.java │ │ │ │ ├── GoodsManageService.java │ │ │ │ ├── RepositoryAdminManageService.java │ │ │ │ ├── RepositoryService.java │ │ │ │ ├── StockRecordManageService.java │ │ │ │ ├── StorageManageService.java │ │ │ │ ├── SupplierManageService.java │ │ │ │ └── SystemLogService.java │ │ └── util │ │ │ ├── ExcelUtil.java │ │ │ ├── Response.java │ │ │ └── ResponseUtil.java │ │ ├── dao │ │ ├── AccessRecordMapper.java │ │ ├── AccessRecordMapper.xml │ │ ├── CustomerMapper.java │ │ ├── CustomerMapper.xml │ │ ├── GoodsMapper.java │ │ ├── GoodsMapper.xml │ │ ├── RepositoryAdminMapper.java │ │ ├── RepositoryAdminMapper.xml │ │ ├── RepositoryMapper.java │ │ ├── RepositoryMapper.xml │ │ ├── RolePermissionMapper.java │ │ ├── RolePermissionMapper.xml │ │ ├── RolesMapper.java │ │ ├── RolesMapper.xml │ │ ├── StockInMapper.java │ │ ├── StockInMapper.xml │ │ ├── StockOutMapper.java │ │ ├── StockOutMapper.xml │ │ ├── StorageMapper.java │ │ ├── StorageMapper.xml │ │ ├── SupplierMapper.java │ │ ├── SupplierMapper.xml │ │ ├── UserInfoMapper.java │ │ ├── UserInfoMapper.xml │ │ ├── UserOperationRecordMapper.java │ │ ├── UserOperationRecordMapper.xml │ │ ├── UserPermissionMapper.java │ │ └── UserPermissionMapper.xml │ │ ├── domain │ │ ├── AccessRecordDO.java │ │ ├── AccessRecordDTO.java │ │ ├── Customer.java │ │ ├── Goods.java │ │ ├── Repository.java │ │ ├── RepositoryAdmin.java │ │ ├── RoleDO.java │ │ ├── RolePermissionDO.java │ │ ├── StockInDO.java │ │ ├── StockOutDO.java │ │ ├── StockRecordDTO.java │ │ ├── Storage.java │ │ ├── Supplier.java │ │ ├── User.java │ │ ├── UserInfoDO.java │ │ ├── UserInfoDTO.java │ │ ├── UserOperationRecordDO.java │ │ └── UserOperationRecordDTO.java │ │ ├── exception │ │ ├── BusinessException.java │ │ ├── CustomerManageServiceException.java │ │ ├── GoodsManageServiceException.java │ │ ├── RepositoryAdminManageServiceException.java │ │ ├── RepositoryManageServiceException.java │ │ ├── StockRecordManageServiceException.java │ │ ├── StorageManageServiceException.java │ │ ├── SupplierManageServiceException.java │ │ ├── SystemLogServiceException.java │ │ ├── UserAccountServiceException.java │ │ └── UserInfoServiceException.java │ │ ├── security │ │ ├── controller │ │ │ ├── AccountHandler.java │ │ │ └── PageForwardHandler.java │ │ ├── filter │ │ │ ├── AnyOfRolesAuthorizationFilter.java │ │ │ └── ExtendFormAuthenticationFilter.java │ │ ├── listener │ │ │ └── AccountSessionListener.java │ │ ├── realms │ │ │ └── UserAuthorizingRealm.java │ │ ├── service │ │ │ ├── FilterChainDefinitionMapBuilder.java │ │ │ ├── Impl │ │ │ │ ├── AccountServiceImpl.java │ │ │ │ └── UserInfoServiceImpl.java │ │ │ └── Interface │ │ │ │ ├── AccountService.java │ │ │ │ └── UserInfoService.java │ │ └── util │ │ │ ├── CheckCodeGenerator.java │ │ │ └── EncryptingModel.java │ │ └── util │ │ ├── GlobalExceptionHandler.java │ │ └── aop │ │ ├── ServiceLogging.java │ │ ├── UserOperation.java │ │ └── UserOperationLogging.java ├── resources │ └── config │ │ ├── DBConfig.properties │ │ ├── ExcelUtilConfig.xml │ │ ├── MyBatisConfiguration.xml │ │ ├── SpringApplicationConfiguration.xml │ │ ├── SpringMVCConfiguration.xml │ │ ├── ehcache.xml │ │ └── log4j.properties └── webapp │ ├── WEB-INF │ ├── download │ │ ├── customerInfo.xlsx │ │ ├── goodsInfo.xlsx │ │ ├── repositoryAdminInfo.xlsx │ │ ├── repositoryInfo.xlsx │ │ ├── storageRecord.xlsx │ │ └── supplierInfo.xlsx │ ├── jsp │ │ ├── login.jsp │ │ └── mainPage.jsp │ └── web.xml │ ├── css │ ├── bootstrap-datetimepicker.min.css │ ├── bootstrap-table.css │ ├── bootstrap-theme.css │ ├── bootstrap-theme.css.map │ ├── bootstrap-theme.min.css │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css │ ├── bootstrapValidator.min.css │ ├── jquery-ui.css │ ├── mainPage.css │ └── model │ │ └── login │ │ └── login.css │ ├── errorPage │ ├── 404Error.html │ └── 500Error.html │ ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 │ ├── js │ ├── ajaxfileupload.js │ ├── bootstrap-datetimepicker.min.js │ ├── bootstrap-datetimepicker.zh-CN.js │ ├── bootstrap-table-zh-CN.min.js │ ├── bootstrap-table.min.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── bootstrapValidator.min.js │ ├── jquery-2.2.3.min.js │ ├── jquery-ui.min.js │ ├── jquery.md5.js │ ├── mainPage.js │ ├── npm.js │ └── zh_CN.js │ ├── media │ ├── icons │ │ ├── error-icon.png │ │ ├── stock_in-512.png │ │ ├── stock_out-512.png │ │ ├── stock_search-512.png │ │ ├── success-icon.png │ │ └── warning-icon.png │ └── images │ │ ├── 404.jpg │ │ ├── 500.jpg │ │ └── backgroundPic.png │ └── pagecomponent │ ├── accessRecordManagement.html │ ├── customerManagement.jsp │ ├── goodsManagement.jsp │ ├── passwordModification.jsp │ ├── repositoryAdminManagement.jsp │ ├── repositoryManagement.jsp │ ├── stock-inManagement.jsp │ ├── stock-outManagement.jsp │ ├── stockRecordManagement.html │ ├── storageManagement.jsp │ ├── storageManagementCommon.jsp │ ├── supplierManagement.jsp │ ├── userOperationRecorderManagement.html │ └── welcomePage.jsp └── test └── java └── com └── ken └── wms ├── MapperTest.java └── security └── util ├── CheckCodeGeneratorTest.java └── EncryptingModelTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | ## .gitignore 2 | 3 | # .gitignore for maven 4 | target/ 5 | 6 | # web application file 7 | src/main/webapp/WEB-INF/lib/ 8 | src/main/webapp/WEB-INF/temp/ 9 | src/main/webapp/WEB-INF/logs/ 10 | 11 | # IDE support file 12 | .idea 13 | WMS.iml -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WMS 2 | 基于SSM框架的仓库管理系统 3 | 4 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/common/controller/FileSourceHandler.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.common.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.PathVariable; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RequestMethod; 7 | 8 | import javax.servlet.ServletContext; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import java.io.IOException; 12 | import java.nio.file.Files; 13 | import java.nio.file.Path; 14 | import java.nio.file.Paths; 15 | 16 | /** 17 | * 处理文件下载请求 18 | */ 19 | @Controller 20 | @RequestMapping("/commons/fileSource") 21 | public class FileSourceHandler { 22 | 23 | @RequestMapping(value = "download/{fileName:.+}", method = RequestMethod.GET) 24 | public void fileDownload(@PathVariable("fileName") String fileName, HttpServletRequest request, 25 | HttpServletResponse response) throws IOException { 26 | 27 | if (fileName == null) 28 | return; 29 | 30 | // 获取文件 31 | ServletContext context = request.getServletContext(); 32 | String directory = context.getRealPath("/WEB-INF/download"); 33 | Path file = Paths.get(directory, fileName); 34 | if (Files.exists(file)) { 35 | // 设置响应头 36 | response.addHeader("Content-Disposition", "attachment;filename=" + file.getFileName()); 37 | Files.copy(file, response.getOutputStream()); 38 | response.getOutputStream().flush(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/common/controller/SystemLogHandler.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.common.controller; 2 | 3 | import com.ken.wms.common.service.Interface.SystemLogService; 4 | import com.ken.wms.common.util.Response; 5 | import com.ken.wms.common.util.ResponseUtil; 6 | import com.ken.wms.domain.AccessRecordDO; 7 | import com.ken.wms.domain.UserOperationRecordDTO; 8 | import com.ken.wms.exception.SystemLogServiceException; 9 | import org.apache.commons.lang3.StringUtils; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Controller; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RequestMethod; 14 | import org.springframework.web.bind.annotation.RequestParam; 15 | import org.springframework.web.bind.annotation.ResponseBody; 16 | 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | import java.util.Map; 20 | 21 | /** 22 | * 系统操作日志请求 Handler 23 | */ 24 | @Controller 25 | @RequestMapping(value = "/systemLog") 26 | public class SystemLogHandler { 27 | 28 | @Autowired 29 | private SystemLogService systemLogService; 30 | @Autowired 31 | private ResponseUtil responseUtil; 32 | 33 | /** 34 | * 查询系统的登入登出日志 35 | * 36 | * @param userIDStr 用户ID 37 | * @param accessType 记录类型(登入、登出或全部) 38 | * @param startDateStr 记录的起始日期 39 | * @param endDateStr 记录的结束日期 40 | * @param offset 分页的偏移值 41 | * @param limit 分页的大小 42 | * @return 返回 JSON 数据 其中:Key为rows的值代表所有记录数据,Key为total的值代表记录的总条数 43 | * @throws SystemLogServiceException SystemLogServiceException 44 | */ 45 | @SuppressWarnings("unchecked") 46 | @RequestMapping(value = "getAccessRecords", method = RequestMethod.GET) 47 | public @ResponseBody 48 | Map getAccessRecords(@RequestParam("userID") String userIDStr, 49 | @RequestParam("accessType") String accessType, 50 | @RequestParam("startDate") String startDateStr, 51 | @RequestParam("endDate") String endDateStr, 52 | @RequestParam("offset") int offset, 53 | @RequestParam("limit") int limit) throws SystemLogServiceException { 54 | // 创建 Response 对象 55 | Response response = responseUtil.newResponseInstance(); 56 | List rows = null; 57 | long total = 0; 58 | 59 | // 检查参数 60 | String regex = "([0-9]{4})-([0-9]{2})-([0-9]{2})"; 61 | boolean startDateFormatCheck = (StringUtils.isEmpty(startDateStr) || startDateStr.matches(regex)); 62 | boolean endDateFormatCheck = (StringUtils.isEmpty(endDateStr) || endDateStr.matches(regex)); 63 | boolean userIDCheck = (StringUtils.isEmpty(userIDStr) || StringUtils.isNumeric(userIDStr)); 64 | 65 | if (startDateFormatCheck && endDateFormatCheck && userIDCheck) { 66 | // 转到 Service 执行查询 67 | Integer userID = -1; 68 | if (StringUtils.isNumeric(userIDStr)) 69 | userID = Integer.valueOf(userIDStr); 70 | Map queryResult = systemLogService.selectAccessRecord(userID, accessType, startDateStr, endDateStr, offset, limit); 71 | if (queryResult != null) { 72 | rows = (List) queryResult.get("data"); 73 | total = (long) queryResult.get("total"); 74 | } 75 | } else 76 | response.setResponseMsg("Request Argument Error"); 77 | 78 | if (rows == null) 79 | rows = new ArrayList<>(0); 80 | 81 | // 返回 Response 82 | response.setCustomerInfo("rows", rows); 83 | response.setResponseTotal(total); 84 | return response.generateResponse(); 85 | } 86 | 87 | /** 88 | * 查询系统的操作日志 89 | * 90 | * @param userIDStr 用户ID 91 | * @param startDateStr 记录的起始日期 92 | * @param endDateStr 记录的结束日期 93 | * @param offset 分页的偏移值 94 | * @param limit 分页的大小 95 | * @return 返回 JSON 数据 其中:Key为rows的值代表所有记录数据,Key为total的值代表记录的总条数 96 | * @throws SystemLogServiceException SystemLogServiceException 97 | */ 98 | @SuppressWarnings("unchecked") 99 | @RequestMapping(value = "getUserOperationRecords") 100 | public @ResponseBody 101 | Map selectUserOperationRecords(@RequestParam("userID") String userIDStr, 102 | @RequestParam("startDate") String startDateStr, 103 | @RequestParam("endDate") String endDateStr, 104 | @RequestParam("offset") int offset, 105 | @RequestParam("limit") int limit) throws SystemLogServiceException { 106 | // 创建 Response 107 | Response response = responseUtil.newResponseInstance(); 108 | List rows = null; 109 | long total = 0; 110 | 111 | // 检查参数 112 | String regex = "([0-9]{4})-([0-9]{2})-([0-9]{2})"; 113 | boolean startDateFormatCheck = (StringUtils.isEmpty(startDateStr) || startDateStr.matches(regex)); 114 | boolean endDateFormatCheck = (StringUtils.isEmpty(endDateStr) || endDateStr.matches(regex)); 115 | boolean userIDCheck = (StringUtils.isEmpty(userIDStr) || StringUtils.isNumeric(userIDStr)); 116 | 117 | if (startDateFormatCheck && endDateFormatCheck && userIDCheck) { 118 | // 转到 Service 进行查询 119 | Integer userID = -1; 120 | if (StringUtils.isNumeric(userIDStr)) 121 | userID = Integer.valueOf(userIDStr); 122 | Map queryResult = systemLogService.selectUserOperationRecord(userID, startDateStr, endDateStr, offset, limit); 123 | if (queryResult != null) { 124 | rows = (List) queryResult.get("data"); 125 | total = (long) queryResult.get("total"); 126 | } 127 | } else 128 | response.setResponseMsg("Request argument error"); 129 | 130 | if (rows == null) 131 | rows = new ArrayList<>(0); 132 | 133 | response.setCustomerInfo("rows", rows); 134 | response.setResponseTotal(total); 135 | return response.generateResponse(); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/common/service/Interface/CustomerManageService.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.common.service.Interface; 2 | 3 | 4 | import com.ken.wms.domain.Customer; 5 | import com.ken.wms.exception.CustomerManageServiceException; 6 | import org.springframework.web.multipart.MultipartFile; 7 | 8 | import java.io.File; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * 客户信息管理 service 14 | */ 15 | public interface CustomerManageService { 16 | 17 | /** 18 | * 返回指定customer id 的客户记录 19 | * 20 | * @param customerId 客户ID 21 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 22 | */ 23 | Map selectById(Integer customerId) throws CustomerManageServiceException; 24 | 25 | /** 26 | * 返回指定 customer name 的客户记录 27 | * 支持查询分页以及模糊查询 28 | * 29 | * @param offset 分页的偏移值 30 | * @param limit 分页的大小 31 | * @param customerName 客户的名称 32 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 33 | */ 34 | Map selectByName(int offset, int limit, String customerName) throws CustomerManageServiceException; 35 | 36 | /** 37 | * 返回指定 customer Name 的客户记录 38 | * 支持模糊查询 39 | * 40 | * @param customerName 客户名称 41 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 42 | */ 43 | Map selectByName(String customerName) throws CustomerManageServiceException; 44 | 45 | /** 46 | * 分页查询客户的记录 47 | * 48 | * @param offset 分页的偏移值 49 | * @param limit 分页的大小 50 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 51 | */ 52 | Map selectAll(int offset, int limit) throws CustomerManageServiceException; 53 | 54 | /** 55 | * 查询所有客户的记录 56 | * 57 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 58 | */ 59 | Map selectAll() throws CustomerManageServiceException; 60 | 61 | /** 62 | * 添加客户信息 63 | * 64 | * @param customer 客户信息 65 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 66 | */ 67 | boolean addCustomer(Customer customer) throws CustomerManageServiceException; 68 | 69 | /** 70 | * 更新客户信息 71 | * 72 | * @param customer 客户信息 73 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 74 | */ 75 | boolean updateCustomer(Customer customer) throws CustomerManageServiceException; 76 | 77 | /** 78 | * 删除客户信息 79 | * 80 | * @param customerId 客户ID 81 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 82 | */ 83 | boolean deleteCustomer(Integer customerId) throws CustomerManageServiceException; 84 | 85 | /** 86 | * 从文件中导入客户信息 87 | * 88 | * @param file 导入信息的文件 89 | * @return 返回一个Map,其中:key为total代表导入的总记录数,key为available代表有效导入的记录数 90 | */ 91 | Map importCustomer(MultipartFile file) throws CustomerManageServiceException; 92 | 93 | /** 94 | * 导出客户信息到文件中 95 | * 96 | * @param customers 包含若干条 customer 信息的 List 97 | * @return Excel 文件 98 | */ 99 | File exportCustomer(List customers); 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/common/service/Interface/GoodsManageService.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.common.service.Interface; 2 | 3 | 4 | import com.ken.wms.domain.Goods; 5 | import com.ken.wms.exception.GoodsManageServiceException; 6 | import org.springframework.web.multipart.MultipartFile; 7 | 8 | import java.io.File; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * 货物信息管理 service 14 | */ 15 | public interface GoodsManageService { 16 | 17 | /** 18 | * 返回指定goods ID 的货物记录 19 | * 20 | * @param goodsId 货物ID 21 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 22 | */ 23 | Map selectById(Integer goodsId) throws GoodsManageServiceException; 24 | 25 | /** 26 | * 返回指定 goods name 的货物记录 27 | * 支持查询分页以及模糊查询 28 | * 29 | * @param offset 分页的偏移值 30 | * @param limit 分页的大小 31 | * @param goodsName 货物的名称 32 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 33 | */ 34 | Map selectByName(int offset, int limit, String goodsName) throws GoodsManageServiceException; 35 | 36 | /** 37 | * 返回指定 goods name 的货物记录 38 | * 支持模糊查询 39 | * 40 | * @param goodsName 货物名称 41 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 42 | */ 43 | Map selectByName(String goodsName) throws GoodsManageServiceException; 44 | 45 | /** 46 | * 分页查询货物记录 47 | * 48 | * @param offset 分页的偏移值 49 | * @param limit 分页的大小 50 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 51 | */ 52 | Map selectAll(int offset, int limit) throws GoodsManageServiceException; 53 | 54 | /** 55 | * 查询所有的货物记录 56 | * 57 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 58 | */ 59 | Map selectAll() throws GoodsManageServiceException; 60 | 61 | /** 62 | * 添加货物记录 63 | * 64 | * @param goods 货物信息 65 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 66 | */ 67 | boolean addGoods(Goods goods) throws GoodsManageServiceException; 68 | 69 | /** 70 | * 更新货物记录 71 | * 72 | * @param goods 供应商信息 73 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 74 | */ 75 | boolean updateGoods(Goods goods) throws GoodsManageServiceException; 76 | 77 | /** 78 | * 删除货物记录 79 | * 80 | * @param goodsId 货物ID 81 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 82 | */ 83 | boolean deleteGoods(Integer goodsId) throws GoodsManageServiceException; 84 | 85 | /** 86 | * 从文件中导入货物信息 87 | * 88 | * @param file 导入信息的文件 89 | * @return 返回一个Map,其中:key为total代表导入的总记录数,key为available代表有效导入的记录数 90 | */ 91 | Map importGoods(MultipartFile file) throws GoodsManageServiceException; 92 | 93 | /** 94 | * 导出货物信息到文件中 95 | * 96 | * @param goods 包含若干条 Supplier 信息的 List 97 | * @return excel 文件 98 | */ 99 | File exportGoods(List goods); 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/common/service/Interface/RepositoryAdminManageService.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.common.service.Interface; 2 | 3 | 4 | import com.ken.wms.domain.RepositoryAdmin; 5 | import com.ken.wms.exception.RepositoryAdminManageServiceException; 6 | import org.springframework.web.multipart.MultipartFile; 7 | 8 | import java.io.File; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * 仓库管理员管理 service 14 | */ 15 | public interface RepositoryAdminManageService { 16 | 17 | /** 18 | * 返回指定repository id 的仓库管理员记录 19 | * 20 | * @param repositoryAdminID 仓库管理员ID 21 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 22 | */ 23 | Map selectByID(Integer repositoryAdminID) throws RepositoryAdminManageServiceException; 24 | 25 | /** 26 | * 返回所属指定 repositoryID 的仓库管理员信息 27 | * 28 | * @param repositoryID 仓库ID 其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 29 | * @return 返回一个Map, 30 | */ 31 | Map selectByRepositoryID(Integer repositoryID) throws RepositoryAdminManageServiceException; 32 | 33 | /** 34 | * 返回指定 repository address 的仓库管理员记录 35 | * 支持查询分页以及模糊查询 36 | * 37 | * @param offset 分页的偏移值 38 | * @param limit 分页的大小 39 | * @param name 仓库管理员的名称 40 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 41 | */ 42 | Map selectByName(int offset, int limit, String name); 43 | 44 | /** 45 | * 返回指定 repository Name 的仓库管理员记录 46 | * 支持模糊查询 47 | * 48 | * @param name 仓库管理员名称 49 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 50 | */ 51 | Map selectByName(String name); 52 | 53 | /** 54 | * 分页查询仓库管理员的记录 55 | * 56 | * @param offset 分页的偏移值 57 | * @param limit 分页的大小 58 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 59 | */ 60 | Map selectAll(int offset, int limit) throws RepositoryAdminManageServiceException; 61 | 62 | /** 63 | * 查询所有仓库管理员的记录 64 | * 65 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 66 | */ 67 | Map selectAll() throws RepositoryAdminManageServiceException; 68 | 69 | /** 70 | * 添加仓库管理员信息 71 | * 72 | * @param repositoryAdmin 仓库管理员信息 73 | * @return 返回一个boolean值,值为true代表添加成功,否则代表失败 74 | */ 75 | boolean addRepositoryAdmin(RepositoryAdmin repositoryAdmin) throws RepositoryAdminManageServiceException; 76 | 77 | /** 78 | * 更新仓库管理员信息 79 | * 80 | * @param repositoryAdmin 仓库管理员信息 81 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 82 | */ 83 | boolean updateRepositoryAdmin(RepositoryAdmin repositoryAdmin) throws RepositoryAdminManageServiceException; 84 | 85 | /** 86 | * 删除仓库管理员信息 87 | * 88 | * @param repositoryAdminID 仓库管理员ID 89 | * @return 返回一个boolean值,值为true代表删除成功,否则代表失败 90 | */ 91 | boolean deleteRepositoryAdmin(Integer repositoryAdminID) throws RepositoryAdminManageServiceException; 92 | 93 | /** 94 | * 为仓库管理员指派指定 ID 的仓库 95 | * 96 | * @param repositoryAdminID 仓库管理员ID 97 | * @param repositoryID 所指派的仓库ID 98 | * @return 返回一个 boolean 值,值为 true 表示仓库指派成功,否则表示失败 99 | */ 100 | boolean assignRepository(Integer repositoryAdminID, Integer repositoryID) throws RepositoryAdminManageServiceException; 101 | 102 | /** 103 | * 从文件中导入仓库管理员信息 104 | * 105 | * @param file 导入信息的文件 106 | * @return 返回一个Map,其中:key为total代表导入的总记录数,key为available代表有效导入的记录数 107 | */ 108 | Map importRepositoryAdmin(MultipartFile file) throws RepositoryAdminManageServiceException; 109 | 110 | /** 111 | * 导出仓库管理员信息到文件中 112 | * 113 | * @param repositoryAdmins 包含若干条 repository 信息的 List 114 | * @return Excel 文件 115 | */ 116 | File exportRepositoryAdmin(List repositoryAdmins); 117 | } 118 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/common/service/Interface/RepositoryService.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.common.service.Interface; 2 | 3 | 4 | import com.ken.wms.domain.Repository; 5 | import com.ken.wms.exception.RepositoryManageServiceException; 6 | import org.springframework.web.multipart.MultipartFile; 7 | 8 | import java.io.File; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * 仓库信息管理 service 14 | */ 15 | public interface RepositoryService { 16 | 17 | /** 18 | * 返回指定 repository ID 的仓库记录 19 | * 20 | * @param repositoryId 仓库ID 21 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 22 | */ 23 | Map selectById(Integer repositoryId) throws RepositoryManageServiceException; 24 | 25 | /** 26 | * 返回指定 repository address 的仓库记录 27 | * 支持查询分页以及模糊查询 28 | * 29 | * @param offset 分页的偏移值 30 | * @param limit 分页的大小 31 | * @param address 仓库的地址 32 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 33 | */ 34 | Map selectByAddress(int offset, int limit, String address) throws RepositoryManageServiceException; 35 | 36 | /** 37 | * 返回指定 repository address 的仓库记录 38 | * 支持模糊查询 39 | * 40 | * @param address 仓库名称 41 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 42 | */ 43 | Map selectByAddress(String address) throws RepositoryManageServiceException; 44 | 45 | /** 46 | * 分页查询仓库记录 47 | * 48 | * @param offset 分页的偏移值 49 | * @param limit 分页的大小 50 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 51 | */ 52 | Map selectAll(int offset, int limit) throws RepositoryManageServiceException; 53 | 54 | /** 55 | * 查询所有的仓库记录 56 | * 57 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 58 | */ 59 | Map selectAll() throws RepositoryManageServiceException; 60 | 61 | /** 62 | * 查询所有未指派仓库管理员的仓库记录 63 | * 64 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 65 | */ 66 | Map selectUnassign() throws RepositoryManageServiceException; 67 | 68 | /** 69 | * 添加仓库记录 70 | * 71 | * @param repository 仓库信息 72 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 73 | */ 74 | boolean addRepository(Repository repository) throws RepositoryManageServiceException; 75 | 76 | /** 77 | * 更新仓库记录 78 | * 79 | * @param repository 仓库信息 80 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 81 | */ 82 | boolean updateRepository(Repository repository) throws RepositoryManageServiceException; 83 | 84 | /** 85 | * 删除仓库记录 86 | * 87 | * @param repositoryId 仓库ID 88 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 89 | */ 90 | boolean deleteRepository(Integer repositoryId) throws RepositoryManageServiceException; 91 | 92 | /** 93 | * 从文件中导入仓库信息 94 | * 95 | * @param file 导入信息的文件 96 | * @return 返回一个Map,其中:key为total代表导入的总记录数,key为available代表有效导入的记录数 97 | */ 98 | Map importRepository(MultipartFile file) throws RepositoryManageServiceException; 99 | 100 | /** 101 | * 导出仓库信息到文件中 102 | * 103 | * @param repositories 包含若干条 Supplier 信息的 List 104 | * @return excel 文件 105 | */ 106 | File exportRepository(List repositories); 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/common/service/Interface/StockRecordManageService.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.common.service.Interface; 2 | 3 | import com.ken.wms.exception.StockRecordManageServiceException; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * 出入库管理 9 | */ 10 | public interface StockRecordManageService { 11 | 12 | /** 13 | * 货物入库操作 14 | * 15 | * @param supplierID 供应商ID 16 | * @param goodsID 货物ID 17 | * @param repositoryID 入库仓库ID 18 | * @param number 入库数量 19 | * @return 返回一个boolean 值,若值为true表示入库成功,否则表示入库失败 20 | */ 21 | boolean stockInOperation(Integer supplierID, Integer goodsID, Integer repositoryID, long number, String personInCharge) throws StockRecordManageServiceException; 22 | 23 | /** 24 | * 货物出库操作 25 | * 26 | * @param customerID 客户ID 27 | * @param goodsID 货物ID 28 | * @param repositoryID 出库仓库ID 29 | * @param number 出库数量 30 | * @return 返回一个boolean值,若值为true表示出库成功,否则表示出库失败 31 | */ 32 | boolean stockOutOperation(Integer customerID, Integer goodsID, Integer repositoryID, long number, String personInCharge) throws StockRecordManageServiceException; 33 | 34 | /** 35 | * 查询出入库记录 36 | * 37 | * @param repositoryID 仓库ID 38 | * @param endDateStr 查询记录起始日期 39 | * @param startDateStr 查询记录结束日期 40 | * @param searchType 记录查询方式 41 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 42 | */ 43 | Map selectStockRecord(Integer repositoryID, String startDateStr, String endDateStr, String searchType) throws StockRecordManageServiceException; 44 | 45 | /** 46 | * 分页查询出入库记录 47 | * 48 | * @param repositoryID 仓库ID 49 | * @param endDateStr 查询记录起始日期 50 | * @param startDateStr 查询记录结束日期 51 | * @param searchType 记录查询方式 52 | * @param offset 分页偏移值 53 | * @param limit 分页大小 54 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 55 | */ 56 | Map selectStockRecord(Integer repositoryID, String startDateStr, String endDateStr, String searchType, int offset, int limit) throws StockRecordManageServiceException; 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/common/service/Interface/StorageManageService.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.common.service.Interface; 2 | 3 | 4 | import com.ken.wms.domain.Storage; 5 | import com.ken.wms.exception.StorageManageServiceException; 6 | import org.springframework.web.multipart.MultipartFile; 7 | 8 | import java.io.File; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * 库存信息管理 service 14 | */ 15 | public interface StorageManageService { 16 | 17 | /** 18 | * 返回所有的库存记录 19 | * 20 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 21 | */ 22 | Map selectAll(Integer repositoryID) throws StorageManageServiceException; 23 | 24 | /** 25 | * 分页返回所有的库存记录 26 | * 27 | * @param offset 分页偏移值 28 | * @param limit 分页大小 29 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 30 | */ 31 | Map selectAll(Integer repositoryID, int offset, int limit) throws StorageManageServiceException; 32 | 33 | /** 34 | * 返回指定货物ID的库存记录 35 | * 36 | * @param goodsID 指定的货物ID 37 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 38 | */ 39 | Map selectByGoodsID(Integer goodsID, Integer repositoryID) throws StorageManageServiceException; 40 | 41 | /** 42 | * 分页返回指定的货物库存记录 43 | * 44 | * @param goodsID 指定的货物ID 45 | * @param offset 分页偏移值 46 | * @param limit 分页大小 47 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 48 | */ 49 | Map selectByGoodsID(Integer goodsID, Integer repositoryID, int offset, int limit) throws StorageManageServiceException; 50 | 51 | /** 52 | * 返回指定货物名称的库存记录 53 | * 54 | * @param goodsName 货物名称 55 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 56 | */ 57 | Map selectByGoodsName(String goodsName, Integer repositoryID) throws StorageManageServiceException; 58 | 59 | /** 60 | * 分页返回指定货物名称的库存记录 61 | * 62 | * @param goodsName 货物名称 63 | * @param offset 分页偏移值 64 | * @param limit 分页大小 65 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 66 | */ 67 | Map selectByGoodsName(String goodsName, Integer repositoryID, int offset, int limit) throws StorageManageServiceException; 68 | 69 | /** 70 | * 返回指定货物类型的库存记录 71 | * 72 | * @param goodsType 指定的货物类型 73 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 74 | */ 75 | Map selectByGoodsType(String goodsType, Integer Repository) throws StorageManageServiceException; 76 | 77 | /** 78 | * 分页返回指定货物类型的库存记录 79 | * 80 | * @param goodsType 指定的货物类型 81 | * @param offset 分页偏移值 82 | * @param limit 分页大小 83 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 84 | */ 85 | Map selectByGoodsType(String goodsType, Integer repositoryID, int offset, int limit) throws StorageManageServiceException; 86 | 87 | /** 88 | * 添加一条库存记录 89 | * 90 | * @param goodsID 指定的货物ID 91 | * @param repositoryID 指定的仓库ID 92 | * @param number 库存数量 93 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 94 | */ 95 | boolean addNewStorage(Integer goodsID, Integer repositoryID, long number) throws StorageManageServiceException; 96 | 97 | /** 98 | * 更新一条库存记录 99 | * 100 | * @param goodsID 指定的货物ID 101 | * @param repositoryID 指定的仓库ID 102 | * @param number 更新的库存数量 103 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 104 | */ 105 | boolean updateStorage(Integer goodsID, Integer repositoryID, long number) throws StorageManageServiceException; 106 | 107 | /** 108 | * 为指定的货物库存记录增加指定数目 109 | * 110 | * @param goodsID 货物ID 111 | * @param repositoryID 仓库ID 112 | * @param number 增加的数量 113 | * @return 返回一个 boolean 值,若值为true表示数目增加成功,否则表示增加失败 114 | */ 115 | boolean storageIncrease(Integer goodsID, Integer repositoryID, long number) throws StorageManageServiceException; 116 | 117 | /** 118 | * 为指定的货物库存记录减少指定的数目 119 | * 120 | * @param goodsID 货物ID 121 | * @param repositoryID 仓库ID 122 | * @param number 减少的数量 123 | * @return 返回一个 boolean 值,若值为 true 表示数目减少成功,否则表示增加失败 124 | */ 125 | boolean storageDecrease(Integer goodsID, Integer repositoryID, long number) throws StorageManageServiceException; 126 | 127 | /** 128 | * 删除一条库存记录 129 | * 货物ID与仓库ID可唯一确定一条库存记录 130 | * 131 | * @param goodsID 指定的货物ID 132 | * @param repositoryID 指定的仓库ID 133 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 134 | */ 135 | boolean deleteStorage(Integer goodsID, Integer repositoryID) throws StorageManageServiceException; 136 | 137 | /** 138 | * 导入库存记录 139 | * 140 | * @param file 保存有的库存记录的文件 141 | * @return 返回一个Map,其中:key为total代表导入的总记录数,key为available代表有效导入的记录数 142 | */ 143 | Map importStorage(MultipartFile file) throws StorageManageServiceException; 144 | 145 | /** 146 | * 导出库存记录 147 | * 148 | * @param storages 保存有库存记录的List 149 | * @return excel 文件 150 | */ 151 | File exportStorage(List storages); 152 | } 153 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/common/service/Interface/SupplierManageService.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.common.service.Interface; 2 | 3 | 4 | import com.ken.wms.domain.Supplier; 5 | import com.ken.wms.exception.SupplierManageServiceException; 6 | import org.springframework.web.multipart.MultipartFile; 7 | 8 | import java.io.File; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * 供应商信息管理 service 14 | */ 15 | public interface SupplierManageService { 16 | 17 | /** 18 | * 返回指定supplierID 的供应商记录 19 | * 20 | * @param supplierId 供应商ID 21 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 22 | */ 23 | Map selectById(Integer supplierId) throws SupplierManageServiceException; 24 | 25 | /** 26 | * 返回指定 supplierName 的供应商记录 27 | * 支持查询分页以及模糊查询 28 | * 29 | * @param offset 分页的偏移值 30 | * @param limit 分页的大小 31 | * @param supplierName 供应商的名称 32 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 33 | */ 34 | Map selectByName(int offset, int limit, String supplierName) throws SupplierManageServiceException; 35 | 36 | /** 37 | * 返回指定 supplierName 的供应商记录 38 | * 支持模糊查询 39 | * 40 | * @param supplierName supplierName 供应商名称 41 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 42 | */ 43 | Map selectByName(String supplierName) throws SupplierManageServiceException; 44 | 45 | /** 46 | * 分页查询供应商记录 47 | * 48 | * @param offset 分页的偏移值 49 | * @param limit 分页的大小 50 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 51 | */ 52 | Map selectAll(int offset, int limit) throws SupplierManageServiceException; 53 | 54 | /** 55 | * 查询所有的供应商记录 56 | * 57 | * @return 结果的一个Map,其中: key为 data 的代表记录数据;key 为 total 代表结果记录的数量 58 | */ 59 | Map selectAll() throws SupplierManageServiceException; 60 | 61 | /** 62 | * 添加供应商记录 63 | * 64 | * @param supplier 供应商信息 65 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 66 | */ 67 | boolean addSupplier(Supplier supplier) throws SupplierManageServiceException; 68 | 69 | /** 70 | * 更新供应商记录 71 | * 72 | * @param supplier 供应商信息 73 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 74 | */ 75 | boolean updateSupplier(Supplier supplier) throws SupplierManageServiceException; 76 | 77 | /** 78 | * 删除供应商记录 79 | * 80 | * @param supplierId 供应商ID 81 | * @return 返回一个boolean值,值为true代表更新成功,否则代表失败 82 | */ 83 | boolean deleteSupplier(Integer supplierId); 84 | 85 | /** 86 | * 从文件中导入供应商信息 87 | * 88 | * @param file 导入信息的文件 89 | * @return 返回一个Map,其中:key为total代表导入的总记录数,key为available代表有效导入的记录数 90 | */ 91 | Map importSupplier(MultipartFile file); 92 | 93 | /** 94 | * 导出供应商信息到文件中 95 | * 96 | * @param suppliers 包含若干条 Supplier 信息的 List 97 | * @return excel 文件 98 | */ 99 | File exportSupplier(List suppliers); 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/common/service/Interface/SystemLogService.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.common.service.Interface; 2 | 3 | import com.ken.wms.exception.SystemLogServiceException; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * 系统操作日志Service接口 9 | */ 10 | public interface SystemLogService { 11 | 12 | String ACCESS_TYPE_LOGIN = "login"; 13 | String ACCESS_TYPE_LOGOUT = "logout"; 14 | 15 | /** 16 | * 插入用户登入登出记录 17 | * 18 | * @param userID 用户ID 19 | * @param userName 用户名 20 | * @param accessIP 登陆IP 21 | * @param accessType 记录类型 22 | */ 23 | void insertAccessRecord(Integer userID, String userName, String accessIP, String accessType) throws SystemLogServiceException; 24 | 25 | /** 26 | * 查询指定用户ID、记录类型或日期范围的登入登出记录 27 | * 28 | * @param userID 用户ID 29 | * @param accessType 记录类型 30 | * @param startDateStr 记录起始日期 31 | * @param endDateStr 记录结束日期 32 | * @return 返回一个Map, 其中键值为 data 的值为所有符合条件的记录, 而键值为 total 的值为符合条件的记录总条数 33 | */ 34 | Map selectAccessRecord(Integer userID, String accessType, String startDateStr, String endDateStr) throws SystemLogServiceException; 35 | 36 | /** 37 | * 分页查询指定用户ID、记录类型或日期范围的登入登出记录 38 | * 39 | * @param userID 用户ID 40 | * @param accessType 记录类型 41 | * @param startDateStr 记录起始日期 42 | * @param endDateStr 记录结束日期 43 | * @param offset 分页偏移值 44 | * @param limit 分页大小 45 | * @return 返回一个Map, 其中键值为 data 的值为所有符合条件的记录, 而键值为 total 的值为符合条件的记录总条数 46 | */ 47 | Map selectAccessRecord(Integer userID, String accessType, String startDateStr, String endDateStr, int offset, int limit) throws SystemLogServiceException; 48 | 49 | /** 50 | * 插入用户操作记录 51 | * 52 | * @param userID 执行操作的用户ID 53 | * @param userName 执行操作的用户名 54 | * @param operationName 操作的名称 55 | * @param operationResult 操作的记过 56 | */ 57 | void insertUserOperationRecord(Integer userID, String userName, String operationName, String operationResult) throws SystemLogServiceException; 58 | 59 | /** 60 | * 查询指定用户ID或日期范围的用户操作记录 61 | * 62 | * @param userID 用户ID 63 | * @param startDateStr 记录的起始日期 64 | * @param endDateStr 记录的结束日期 65 | * @return 返回一个Map, 其中键值为 data 的值为所有符合条件的记录, 而键值为 total 的值为符合条件的记录总条数 66 | */ 67 | Map selectUserOperationRecord(Integer userID, String startDateStr, String endDateStr) throws SystemLogServiceException; 68 | 69 | /** 70 | * 分页查询指定用户ID或日期范围的用户操作记录 71 | * 72 | * @param userID 用户ID 73 | * @param startDateStr 记录的起始日期 74 | * @param endDateStr 记录的结束日期 75 | * @param offset 分页的偏移值 76 | * @param limit 分页的大小 77 | * @return 返回一个Map, 其中键值为 data 的值为所有符合条件的记录, 而键值为 total 的值为符合条件的记录总条数 78 | */ 79 | Map selectUserOperationRecord(Integer userID, String startDateStr, String endDateStr, int offset, int limit) throws SystemLogServiceException; 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/common/util/Response.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.common.util; 2 | 3 | import org.apache.commons.collections.map.HashedMap; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * controller 返回的信息载体 response 9 | */ 10 | public class Response { 11 | 12 | public static final String RESPONSE_RESULT_SUCCESS = "success"; 13 | public static final String RESPONSE_RESULT_ERROR = "error"; 14 | 15 | // response 中可能使用的值 16 | private static final String RESPONSE_RESULT = "result"; 17 | private static final String RESPONSE_MSG = "msg"; 18 | private static final String RESPONSE_DATA = "data"; 19 | private static final String RESPONSE_TOTAL = "total"; 20 | 21 | // 存放响应中的信息 22 | private Map responseContent; 23 | 24 | // Constructor 25 | Response() { 26 | this.responseContent = new HashedMap(10); 27 | } 28 | 29 | /** 30 | * 设置 response 的状态 31 | * 32 | * @param result response 的状态,值为 success 或 error 33 | */ 34 | public void setResponseResult(String result) { 35 | this.responseContent.put(Response.RESPONSE_RESULT, result); 36 | } 37 | 38 | /** 39 | * 设置 response 的附加信息 40 | * 41 | * @param msg response 的附加信息 42 | */ 43 | public void setResponseMsg(String msg) { 44 | this.responseContent.put(Response.RESPONSE_MSG, msg); 45 | } 46 | 47 | /** 48 | * 设置 response 中携带的数据 49 | * 50 | * @param data response 中携带的数据 51 | */ 52 | public void setResponseData(Object data) { 53 | this.responseContent.put(Response.RESPONSE_DATA, data); 54 | } 55 | 56 | /** 57 | * 设置 response 中携带数据的数量,与 RESPONSE_DATA 配合使用 58 | * 59 | * @param total 携带数据的数量 60 | */ 61 | public void setResponseTotal(long total) { 62 | this.responseContent.put(Response.RESPONSE_TOTAL, total); 63 | } 64 | 65 | /** 66 | * 设置 response 自定义信息 67 | * 68 | * @param key 自定义信息的 key 69 | * @param value 自定义信息的值 70 | */ 71 | public void setCustomerInfo(String key, Object value) { 72 | this.responseContent.put(key, value); 73 | } 74 | 75 | /** 76 | * 生成 response 77 | * 78 | * @return 代表 response 的一个 Map 对象 79 | */ 80 | public Map generateResponse() { 81 | return this.responseContent; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/common/util/ResponseUtil.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.common.util; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | /** 6 | * 7 | */ 8 | @Component 9 | public class ResponseUtil { 10 | 11 | /** 12 | * 生成一个 Response 对象 13 | * 14 | * @return response 对象 15 | */ 16 | public Response newResponseInstance() { 17 | Response response = new Response(); 18 | 19 | return response; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/AccessRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | import com.ken.wms.domain.AccessRecordDO; 4 | import org.apache.ibatis.annotations.Param; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | /** 11 | * 用户登入登出记录因映射器 12 | */ 13 | @Repository 14 | public interface AccessRecordMapper { 15 | 16 | /** 17 | * 插入一条用户用户登入登出记录 18 | * 19 | * @param accessRecordDO 用户登入登出记录 20 | */ 21 | void insertAccessRecord(AccessRecordDO accessRecordDO); 22 | 23 | /** 24 | * 选择指定用户ID、记录类型、时间范围的登入登出记录 25 | * 26 | * @param userID 用户ID 27 | * @param accessType 记录类型(登入、登出或所有) 28 | * @param startDate 记录的起始日期 29 | * @param endDate 记录的结束日期 30 | * @return 返回所有符合条件的记录 31 | */ 32 | List selectAccessRecords(@Param("userID") Integer userID, 33 | @Param("accessType") String accessType, 34 | @Param("startDate") Date startDate, 35 | @Param("endDate") Date endDate); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/AccessRecordMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | insert into wms_access_record(USER_ID, USER_NAME, ACCESS_TYPE, ACCESS_TIME, ACCESS_IP) 18 | values(#{userID}, #{userName}, #{accessType}, #{accessTime}, #{accessIP}) 19 | 20 | 21 | 46 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/CustomerMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | import com.ken.wms.domain.Customer; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 客户信息 Customer 映射器 10 | */ 11 | @Repository 12 | public interface CustomerMapper { 13 | 14 | /** 15 | * 选择所有的 Customer 16 | * 17 | * @return 返回所有的 Customer 18 | */ 19 | List selectAll(); 20 | 21 | /** 22 | * 选择指定 id 的 Customer 23 | * 24 | * @param id Customer的ID 25 | * @return 返回指定ID对应的Customer 26 | */ 27 | Customer selectById(Integer id); 28 | 29 | /** 30 | * 选择指定 Customer name 的 customer 31 | * 32 | * @param customerName 客户的名称 33 | * @return 返回指定CustomerName对应的Customer 34 | */ 35 | Customer selectByName(String customerName); 36 | 37 | /** 38 | * 选择指定 customer name 的 Customer 39 | * 与 selectByName 方法的区别在于本方法将返回相似匹配的结果 40 | * 41 | * @param customerName Customer 供应商名 42 | * @return 返回模糊匹配指定customerName 对应的Customer 43 | */ 44 | List selectApproximateByName(String customerName); 45 | 46 | /** 47 | * 插入 Customer 到数据库中 48 | * 不需要指定 Customer 的主键,采用的数据库 AI 方式 49 | * 50 | * @param customer Customer 实例 51 | */ 52 | void insert(Customer customer); 53 | 54 | /** 55 | * 批量插入 Customer 到数据库中 56 | * 57 | * @param customers 存放 Customer 实例的 List 58 | */ 59 | void insertBatch(List customers); 60 | 61 | /** 62 | * 更新 Customer 到数据库 63 | * 该 Customer 必须已经存在于数据库中,即已经分配主键,否则将更新失败 64 | * 65 | * @param customer customer 实例 66 | */ 67 | void update(Customer customer); 68 | 69 | /** 70 | * 删除指定 id 的 customer 71 | * 72 | * @param id customer ID 73 | */ 74 | void deleteById(Integer id); 75 | 76 | /** 77 | * 删除指定 customerName 的 customer 78 | * 79 | * @param customerName 客户名称 80 | */ 81 | void deleteByName(String customerName); 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/CustomerMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 28 | 29 | 42 | 43 | 56 | 57 | 70 | 71 | 72 | insert into wms_customer(CUSTOMER_NAME,CUSTOMER_PERSON,CUSTOMER_TEL,CUSTOMER_EMAIL,CUSTOMER_ADDRESS) 73 | values (#{name},#{personInCharge},#{tel},#{email},#{address}) 74 | 75 | 76 | 77 | insert into wms_customer(CUSTOMER_NAME,CUSTOMER_PERSON,CUSTOMER_TEL,CUSTOMER_EMAIL,CUSTOMER_ADDRESS) 78 | values 79 | 80 | (#{customer.name},#{customer.personInCharge},#{customer.tel},#{customer.email},#{customer.address}) 81 | 82 | 83 | 84 | 85 | update 86 | wms_customer 87 | set 88 | CUSTOMER_NAME = #{name}, 89 | CUSTOMER_PERSON = #{personInCharge}, 90 | CUSTOMER_TEL = #{tel}, 91 | CUSTOMER_EMAIL = #{email}, 92 | CUSTOMER_ADDRESS = #{address} 93 | where 94 | CUSTOMER_ID = #{id} 95 | 96 | 97 | 98 | delete from wms_customer 99 | where CUSTOMER_ID = #{id} 100 | 101 | 102 | 103 | delete from wms_customer 104 | where CUSTOMER_NAME = #{name} 105 | 106 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/GoodsMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | 4 | import com.ken.wms.domain.Goods; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 货物信息映射器 11 | */ 12 | @Repository 13 | public interface GoodsMapper { 14 | 15 | /** 16 | * 选择所有的 Goods 17 | * 18 | * @return 返回所有的Goods 19 | */ 20 | List selectAll(); 21 | 22 | /** 23 | * 选择指定 id 的 Goods 24 | * 25 | * @param id 货物的ID 26 | * @return 返回执行ID对应的Goods 27 | */ 28 | Goods selectById(Integer id); 29 | 30 | /** 31 | * 选择指定 Goods name 的 Goods 32 | * 33 | * @param goodsName 货物的名称 34 | * @return 返回指定GoodsName对应的货物 35 | */ 36 | Goods selectByName(String goodsName); 37 | 38 | /** 39 | * 选择制定 goods name 的 goods 40 | * 模糊匹配 41 | * 42 | * @param goodsName 货物德名称 43 | * @return 返回模糊匹配指定goodsName的货物 44 | */ 45 | List selectApproximateByName(String goodsName); 46 | 47 | /** 48 | * 插入一条新的记录到数据库 49 | * 50 | * @param goods 货物信息 51 | */ 52 | void insert(Goods goods); 53 | 54 | /** 55 | * 批量插入新的记录到数据库中 56 | * 57 | * @param goods 存放 goods 信息的 List 58 | */ 59 | void insertBatch(List goods); 60 | 61 | /** 62 | * 更新 Goods 到数据库中 63 | * 该 Customer 必须已经存在于数据库中,即已经分配主键,否则将更新失败 64 | * 65 | * @param goods 货物信息 66 | */ 67 | void update(Goods goods); 68 | 69 | /** 70 | * 删除指定 id 的 goods 71 | * 72 | * @param id 货物ID 73 | */ 74 | void deleteById(Integer id); 75 | 76 | /** 77 | * 删除指定 goods name 的 goods 78 | * 79 | * @param goodsName 货物的名称 80 | */ 81 | void deleteByName(String goodsName); 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/GoodsMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 26 | 27 | 39 | 40 | 52 | 53 | 65 | 66 | 67 | insert into wms_goods(GOOD_NAME,GOOD_RYPE,GOOD_SIZE,GOOD_VALUE) 68 | values (#{name},#{type},#{size},#{value}) 69 | 70 | 71 | 72 | insert into wms_goods(GOOD_NAME,GOOD_RYPE,GOOD_SIZE,GOOD_VALUE) 73 | values 74 | 75 | (#{goods.name},#{goods.type},#{goods.size},#{goods.value}) 76 | 77 | 78 | 79 | 80 | update 81 | wms_goods 82 | set 83 | GOOD_NAME = #{name}, 84 | GOOD_RYPE = #{type}, 85 | GOOD_SIZE = #{size}, 86 | GOOD_VALUE = #{value} 87 | where 88 | GOOD_ID = #{id} 89 | 90 | 91 | 92 | delete from wms_goods 93 | where GOOD_ID = #{id} 94 | 95 | 96 | 97 | delete from wms_goods 98 | where GOOD_NAME = #{goodsName} 99 | 100 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/RepositoryAdminMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | import com.ken.wms.domain.RepositoryAdmin; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * RepositoryAdmin 映射器 10 | */ 11 | @Repository 12 | public interface RepositoryAdminMapper { 13 | 14 | /** 15 | * 选择指定 ID 的仓库管理员信息 16 | * 17 | * @param id 仓库管理员ID 18 | * @return 返回指定 ID 的仓库管理员信息 19 | */ 20 | RepositoryAdmin selectByID(Integer id); 21 | 22 | /** 23 | * 选择指定 name 的仓库管理员信息。 24 | * 支持模糊查找 25 | * 26 | * @param name 仓库管理员名字 27 | * @return 返回若干条指定 name 的仓库管理员信息 28 | */ 29 | List selectByName(String name); 30 | 31 | /** 32 | * 选择所有的仓库管理员信息 33 | * 34 | * @return 返回所有的仓库管理员信息 35 | */ 36 | List selectAll(); 37 | 38 | /** 39 | * 选择已指派指定 repositoryID 的仓库管理员信息 40 | * 41 | * @param repositoryID 指派的仓库ID 42 | * @return 返回已指派指定 repositoryID 的仓库管理员信息 43 | */ 44 | RepositoryAdmin selectByRepositoryID(Integer repositoryID); 45 | 46 | /** 47 | * 插入一条仓库管理员信息 48 | * 49 | * @param repositoryAdmin 仓库管理员信息 50 | */ 51 | void insert(RepositoryAdmin repositoryAdmin); 52 | 53 | /** 54 | * 批量插入仓库管理员信息 55 | * 56 | * @param repositoryAdmins 存放若干条仓库管理员信息的 List 57 | */ 58 | void insertBatch(List repositoryAdmins); 59 | 60 | /** 61 | * 更新仓库管理员信息 62 | * 63 | * @param repositoryAdmin 仓库管理员信息 64 | */ 65 | void update(RepositoryAdmin repositoryAdmin); 66 | 67 | /** 68 | * 删除指定 ID 的仓库管理员信息 69 | * 70 | * @param id 仓库管理员 ID 71 | */ 72 | void deleteByID(Integer id); 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/RepositoryAdminMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 30 | 31 | 45 | 46 | 60 | 61 | 75 | 76 | 77 | insert into 78 | wms_repo_admin(REPO_ADMIN_NAME,REPO_ADMIN_SEX,REPO_ADMIN_TEL,REPO_ADMIN_ADDRESS,REPO_ADMIN_BIRTH,REPO_ADMIN_REPOID) 79 | values(#{name},#{sex},#{tel},#{address},#{birth},#{repositoryBelongID}) 80 | 81 | 82 | 83 | insert into 84 | wms_repo_admin(REPO_ADMIN_NAME,REPO_ADMIN_SEX,REPO_ADMIN_TEL,REPO_ADMIN_ADDRESS,REPO_ADMIN_BIRTH,REPO_ADMIN_REPOID) 85 | values 86 | 87 | (#{repositoryAdmin.name},#{repositoryAdmin.sex},#{repositoryAdmin.tel},#{repositoryAdmin.address},#{repositoryAdmin.birth},#{repositoryAdmin.repositoryBelongID}) 88 | 89 | 90 | 91 | 92 | update 93 | wms_repo_admin 94 | set 95 | REPO_ADMIN_NAME = #{name}, 96 | REPO_ADMIN_SEX = #{sex}, 97 | REPO_ADMIN_TEL = #{tel}, 98 | REPO_ADMIN_ADDRESS = #{address}, 99 | REPO_ADMIN_BIRTH = #{birth}, 100 | REPO_ADMIN_REPOID = #{repositoryBelongID} 101 | where 102 | REPO_ADMIN_ID = #{id} 103 | 104 | 105 | 106 | delete from wms_repo_admin 107 | where REPO_ADMIN_ID = #{id} 108 | 109 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/RepositoryMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | import com.ken.wms.domain.Repository; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Repository 映射器 9 | */ 10 | @org.springframework.stereotype.Repository 11 | public interface RepositoryMapper { 12 | 13 | /** 14 | * 选择全部的 Repository 记录 15 | * 16 | * @return 返回全部的 Repository 17 | */ 18 | List selectAll(); 19 | 20 | /** 21 | * 选择全部的未分配的 repository 记录 22 | * 23 | * @return 返回所有未分配的 Repository 24 | */ 25 | List selectUnassign(); 26 | 27 | /** 28 | * 选择指定 Repository ID 的 Repository 记录 29 | * 30 | * @param repositoryID 仓库ID 31 | * @return 返回指定的Repository 32 | */ 33 | Repository selectByID(Integer repositoryID); 34 | 35 | /** 36 | * 选择指定 repository Address 的 repository 记录 37 | * 38 | * @param address 仓库地址 39 | * @return 返回指定的Repository 40 | */ 41 | List selectByAddress(String address); 42 | 43 | /** 44 | * 插入一条新的 Repository 记录 45 | * 46 | * @param repository 仓库信息 47 | */ 48 | void insert(Repository repository); 49 | 50 | /** 51 | * 批量插入 Repository 记录 52 | * 53 | * @param repositories 存有若干条记录的 List 54 | */ 55 | void insertbatch(List repositories); 56 | 57 | /** 58 | * 更新 Repository 记录 59 | * 60 | * @param repository 仓库信息 61 | */ 62 | void update(Repository repository); 63 | 64 | /** 65 | * 删除指定 Repository ID 的 Repository 记录 66 | * 67 | * @param repositoryID 仓库ID 68 | */ 69 | void deleteByID(Integer repositoryID); 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/RepositoryMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 28 | 29 | 47 | 48 | 61 | 62 | 75 | 76 | 77 | insert into wms_respository(REPO_ADDRESS,REPO_STATUS,REPO_AREA,REPO_DESC) 78 | values(#{address},#{status},#{area},#{desc}) 79 | 80 | 81 | 82 | insert into wms_respository(REPO_ADDRESS,REPO_STATUS,REPO_AREA,REPO_DESC) 83 | values 84 | 85 | (#{repository.address},#{repository.status},#{repository.area},#{repository.desc}) 86 | 87 | 88 | 89 | 90 | update 91 | wms_respository 92 | set 93 | REPO_ADDRESS = #{address}, 94 | REPO_STATUS = #{status}, 95 | REPO_AREA = #{area}, 96 | REPO_desc = #{desc} 97 | where 98 | REPO_ID = #{id} 99 | 100 | 101 | 102 | delete from wms_respository 103 | where REPO_ID = #{id} 104 | 105 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/RolePermissionMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | import com.ken.wms.domain.RolePermissionDO; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 角色权限信息 Mapper 10 | */ 11 | @Repository 12 | public interface RolePermissionMapper { 13 | 14 | List selectAll(); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/RolePermissionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 23 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/RolesMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | import org.springframework.stereotype.Repository; 4 | 5 | /** 6 | * 7 | */ 8 | @Repository 9 | public interface RolesMapper { 10 | 11 | /** 12 | * 获取角色对应的ID 13 | * 14 | * @param roleName 角色名 15 | * @return 返回角色的ID 16 | */ 17 | Integer getRoleID(String roleName); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/RolesMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 16 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/StockInMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | import com.ken.wms.domain.StockInDO; 4 | import org.apache.ibatis.annotations.Param; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | /** 11 | * 入库记录映射器 12 | */ 13 | @Repository 14 | public interface StockInMapper { 15 | 16 | /** 17 | * 选择全部的入库记录 18 | * 19 | * @return 返回全部的入库记录 20 | */ 21 | List selectAll(); 22 | 23 | /** 24 | * 选择指定供应商ID相关的入库记录 25 | * 26 | * @param supplierID 指定的供应商ID 27 | * @return 返回指定供应商相关的入库记录 28 | */ 29 | List selectBySupplierId(Integer supplierID); 30 | 31 | /** 32 | * 选择指定货物ID相关的入库记录 33 | * 34 | * @param goodID 指定的货物ID 35 | * @return 返回指定货物相关的入库记录 36 | */ 37 | List selectByGoodID(Integer goodID); 38 | 39 | /** 40 | * 选择指定仓库ID相关的入库记录 41 | * 42 | * @param repositoryID 指定的仓库ID 43 | * @return 返回指定仓库相关的入库记录 44 | */ 45 | List selectByRepositoryID(Integer repositoryID); 46 | 47 | /** 48 | * 选择指定仓库ID以及指定日期范围内的入库记录 49 | * 50 | * @param repositoryID 指定的仓库ID 51 | * @param startDate 记录的起始日期 52 | * @param endDate 记录的结束日期 53 | * @return 返回所有符合要求的入库记录 54 | */ 55 | List selectByRepositoryIDAndDate(@Param("repositoryID") Integer repositoryID, 56 | @Param("startDate") Date startDate, 57 | @Param("endDate") Date endDate); 58 | 59 | /** 60 | * 选择指定入库记录的ID的入库记录 61 | * 62 | * @param id 入库记录ID 63 | * @return 返回指定ID的入库记录 64 | */ 65 | StockInDO selectByID(Integer id); 66 | 67 | /** 68 | * 添加一条新的入库记录 69 | * 70 | * @param stockInDO 入库记录 71 | */ 72 | void insert(StockInDO stockInDO); 73 | 74 | /** 75 | * 更新入库记录 76 | * 77 | * @param stockInDO 入库记录 78 | */ 79 | void update(StockInDO stockInDO); 80 | 81 | /** 82 | * 删除指定ID的入库记录 83 | * 84 | * @param id 指定删除入库记录的ID 85 | */ 86 | void deleteByID(Integer id); 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/StockOutMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | import com.ken.wms.domain.StockOutDO; 4 | import org.apache.ibatis.annotations.Param; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | /** 11 | * 出库记录 映射器 12 | */ 13 | @Repository 14 | public interface StockOutMapper { 15 | 16 | /** 17 | * 选择全部的出库记录 18 | * 19 | * @return 返回所有的出库记录 20 | */ 21 | List selectAll(); 22 | 23 | /** 24 | * 选择指定客户ID相关的出库记录 25 | * 26 | * @param customerId 指定的客户ID 27 | * @return 返回指定客户相关的出库记录 28 | */ 29 | List selectByCustomerId(Integer customerId); 30 | 31 | /** 32 | * 选择指定货物ID相关的出库记录 33 | * 34 | * @param goodId 指定的货物ID 35 | * @return 返回指定货物ID相关的出库记录 36 | */ 37 | List selectByGoodId(Integer goodId); 38 | 39 | /** 40 | * 选择指定仓库ID关联的出库记录 41 | * 42 | * @param repositoryID 指定的仓库ID 43 | * @return 返回指定仓库ID相关的出库记录 44 | */ 45 | List selectByRepositoryID(Integer repositoryID); 46 | 47 | /** 48 | * 选择指定仓库ID以及指定日期范围内的出库记录 49 | * 50 | * @param repositoryID 指定的仓库ID 51 | * @param startDate 记录起始日期 52 | * @param endDate 记录结束日期 53 | * @return 返回所有符合指定要求的出库记录 54 | */ 55 | List selectByRepositoryIDAndDate(@Param("repositoryID") Integer repositoryID, 56 | @Param("startDate") Date startDate, 57 | @Param("endDate") Date endDate); 58 | 59 | /** 60 | * 选择指定ID的出库记录 61 | * 62 | * @param id 指定的出库记录ID 63 | * @return 返回指定ID的出库记录 64 | */ 65 | StockOutDO selectById(Integer id); 66 | 67 | /** 68 | * 插入一条新的出库记录 69 | * 70 | * @param stockOutDO 出库记录 71 | */ 72 | void insert(StockOutDO stockOutDO); 73 | 74 | /** 75 | * 更新出库记录 76 | * 77 | * @param stockOutDO 出库记录 78 | */ 79 | void update(StockOutDO stockOutDO); 80 | 81 | /** 82 | * 删除指定ID的出库记录 83 | * 84 | * @param id 指定的出库记录ID 85 | */ 86 | void deleteById(Integer id); 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/StorageMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | import com.ken.wms.domain.Storage; 4 | import org.apache.ibatis.annotations.Param; 5 | import org.springframework.stereotype.Repository; 6 | 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 库存信息映射器 12 | */ 13 | @Repository 14 | public interface StorageMapper { 15 | 16 | /** 17 | * 选择所有的库存信息 18 | * 19 | * @return 返回所有的库存信息 20 | */ 21 | List selectAllAndRepositoryID(@Param("repositoryID") Integer repositoryID); 22 | 23 | /** 24 | * 选择指定货物ID和仓库ID的库存信息 25 | * 26 | * @param goodsID 货物ID 27 | * @param repositoryID 库存ID 28 | * @return 返回所有指定货物ID和仓库ID的库存信息 29 | */ 30 | List selectByGoodsIDAndRepositoryID(@Param("goodsID") Integer goodsID, 31 | @Param("repositoryID") Integer repositoryID); 32 | 33 | /** 34 | * 选择指定货物名的库存信息 35 | * 36 | * @param goodsName 货物名称 37 | * @return 返回所有指定货物名称的库存信息 38 | */ 39 | List selectByGoodsNameAndRepositoryID(@Param("goodsName") String goodsName, 40 | @Param("repositoryID") Integer repositoryID); 41 | 42 | /** 43 | * 选择指定货物类型的库存信息 44 | * 45 | * @param goodsType 货物类型 46 | * @return 返回所有指定货物类型的库存信息 47 | */ 48 | List selectByGoodsTypeAndRepositoryID(@Param("goodsType") String goodsType, 49 | @Param("repositoryID") Integer repositoryID); 50 | 51 | /** 52 | * 更新库存信息 53 | * 该库存信息必需已经存在于数据库当中,否则更新无效 54 | * 55 | * @param storage 库存信息 56 | */ 57 | void update(Storage storage); 58 | 59 | /** 60 | * 插入新的库存信息 61 | * 62 | * @param storage 库存信息 63 | */ 64 | void insert(Storage storage); 65 | 66 | /** 67 | * 批量导入库存信息 68 | * 69 | * @param storages 若干条库存信息 70 | */ 71 | void insertBatch(List storages); 72 | 73 | /** 74 | * 删除指定货物ID的库存信息 75 | * 76 | * @param goodsID 货物ID 77 | */ 78 | void deleteByGoodsID(Integer goodsID); 79 | 80 | /** 81 | * 删除指定仓库的库存信息 82 | * 83 | * @param repositoryID 仓库ID 84 | */ 85 | void deleteByRepositoryID(Integer repositoryID); 86 | 87 | /** 88 | * 删除指定仓库中的指定货物的库存信息 89 | * 90 | * @param goodsID 货物ID 91 | * @param repositoryID 仓库ID 92 | */ 93 | void deleteByRepositoryIDAndGoodsID(@Param("goodsID") Integer goodsID, @Param("repositoryID") Integer repositoryID); 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/StorageMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 31 | 32 | 50 | 51 | 70 | 71 | 90 | 91 | 110 | 111 | 112 | update 113 | wms_record_storage 114 | set 115 | RECORD_GOODID = #{goodsID}, 116 | RECORD_REPOSITORY = #{repositoryID}, 117 | RECORD_NUMBER = #{number} 118 | where 119 | RECORD_GOODID = #{goodsID} and 120 | RECORD_REPOSITORY = #{repositoryID} 121 | 122 | 123 | 124 | insert into wms_record_storage 125 | ( 126 | RECORD_GOODID, 127 | RECORD_REPOSITORY, 128 | RECORD_NUMBER 129 | ) 130 | values 131 | ( 132 | #{goodsID}, 133 | #{repositoryID}, 134 | #{number} 135 | ) 136 | 137 | 138 | 139 | insert into wms_record_storage(RECORD_GOODID,RECORD_REPOSITORY,RECORD_NUMBER) 140 | values 141 | 142 | ( 143 | #{storage.goodsID},#{storage.repositoryID},#{storage.number}) 144 | 145 | 146 | 147 | 148 | delete from 149 | wms_record_storage 150 | where 151 | RECORD_GOODID = #{goodsID} 152 | 153 | 154 | 155 | delete from 156 | wms_record_storage 157 | where 158 | wms_record_storage.RECORD_REPOSITORY = #{repositoryID} 159 | 160 | 161 | 162 | delete from 163 | wms_record_storage 164 | where 165 | RECORD_GOODID = #{goodsID} and 166 | wms_record_storage.RECORD_REPOSITORY = #{repositoryID} 167 | 168 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/SupplierMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | import com.ken.wms.domain.Supplier; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Supplier 映射器 10 | */ 11 | @Repository 12 | public interface SupplierMapper { 13 | 14 | /** 15 | * 选择全部的 Supplier 16 | * 17 | * @return 返回所有的供应商 18 | */ 19 | List selectAll(); 20 | 21 | /** 22 | * 选择指定 id 的 Supplier 23 | * 24 | * @param id 供应商ID 25 | * @return 返回指定ID对应的供应商 26 | */ 27 | Supplier selectById(Integer id); 28 | 29 | /** 30 | * 选择指定 supplier name 的 Supplier 31 | * 32 | * @param supplierName 供应商名称 33 | * @return 返回supplierName对应的供应商 34 | */ 35 | Supplier selectBuName(String supplierName); 36 | 37 | /** 38 | * 选择指定 supplier name 的 Supplier 39 | * 与 selectBuName 方法的区别在于本方法将返回相似匹配的结果 40 | * 41 | * @param supplierName 供应商名 42 | * @return 返回所有模糊匹配指定supplierName的供应商 43 | */ 44 | List selectApproximateByName(String supplierName); 45 | 46 | /** 47 | * 插入 Supplier 到数据库中 48 | * 不需要指定 Supplier 的主键,采用的数据库 AI 方式 49 | * 50 | * @param supplier Supplier 实例 51 | */ 52 | void insert(Supplier supplier); 53 | 54 | /** 55 | * 批量插入 Supplier 到数据库中 56 | * 57 | * @param suppliers 存放 Supplier 实例的 Lists 58 | */ 59 | void insertBatch(List suppliers); 60 | 61 | /** 62 | * 更新 Supplier 到数据库 63 | * 该 Supplier 必须已经存在于数据库中,即已经分配主键,否则将更新失败 64 | * 65 | * @param supplier Supplier 实例 66 | */ 67 | void update(Supplier supplier); 68 | 69 | /** 70 | * 删除指定 id 的Supplier 71 | * 72 | * @param id 供应商ID 73 | */ 74 | void deleteById(Integer id); 75 | 76 | /** 77 | * 删除指定 supplierName 的 Supplier 78 | * 79 | * @param supplierName 供应商名称 80 | */ 81 | void deleteByName(String supplierName); 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/SupplierMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 28 | 29 | 42 | 43 | 56 | 57 | 70 | 71 | 72 | insert into wms_supplier(SUPPLIER_NAME,SUPPLIER_PERSON,SUPPLIER_TEL,SUPPLIER_EMAIL,SUPPLIER_ADDRESS) 73 | values(#{name},#{personInCharge},#{tel},#{email},#{address}) 74 | 75 | 76 | 77 | insert into wms_supplier(SUPPLIER_NAME,SUPPLIER_PERSON,SUPPLIER_TEL,SUPPLIER_EMAIL,SUPPLIER_ADDRESS) 78 | values 79 | 80 | (#{supplier.name},#{supplier.personInCharge},#{supplier.tel},#{supplier.email},#{supplier.address}) 81 | 82 | 83 | 84 | 85 | update 86 | wms_supplier 87 | set 88 | SUPPLIER_NAME = #{name}, 89 | SUPPLIER_PERSON = #{personInCharge}, 90 | SUPPLIER_TEL = #{tel}, 91 | SUPPLIER_EMAIL = #{email}, 92 | SUPPLIER_ADDRESS = #{address} 93 | where 94 | SUPPLIER_ID = #{id} 95 | 96 | 97 | 98 | delete from wms_supplier 99 | where SUPPLIER_ID = #{id} 100 | 101 | 102 | 103 | delete from wms_supplier 104 | where SUPPLIER_NAME = #{name} 105 | 106 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/UserInfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | import com.ken.wms.domain.UserInfoDO; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 用户账户信息 Mapper 10 | */ 11 | @Repository 12 | public interface UserInfoMapper { 13 | 14 | /** 15 | * 选择指定 id 的 user 信息 16 | * 17 | * @param userID 用户ID 18 | * @return 返回指定 userID 对应的 user 信息 19 | */ 20 | UserInfoDO selectByUserID(Integer userID); 21 | 22 | /** 23 | * 选择指定 userName 的 user 信息 24 | * 25 | * @param userName 用户名 26 | * @return 返回指定 userName 对应的 user 信息 27 | */ 28 | UserInfoDO selectByName(String userName); 29 | 30 | /** 31 | * 选择全部的 user 信息 32 | * 33 | * @return 返回所有的 user 信息 34 | */ 35 | List selectAll(); 36 | 37 | 38 | /** 39 | * 更新 user 对象信息 40 | * 41 | * @param user 更新 user 对象信息 42 | */ 43 | void update(UserInfoDO user); 44 | 45 | /** 46 | * 删除指定 id 的user 信息 47 | * 48 | * @param id 用户ID 49 | */ 50 | void deleteById(Integer id); 51 | 52 | /** 53 | * 插入一个 user 对象信息 54 | * 不需指定对象的主键id,数据库自动生成 55 | * 56 | * @param user 需要插入的用户信息 57 | */ 58 | void insert(UserInfoDO user); 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/UserInfoMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 24 | 25 | 35 | 36 | 44 | 45 | 46 | insert into wms_user(USER_ID,USER_USERNAME,USER_PASSWORD) 47 | values (#{userID},#{userName},#{password}) 48 | 49 | 50 | 51 | update wms_user set 52 | USER_USERNAME = #{userName}, 53 | USER_PASSWORD = #{password} 54 | where 55 | USER_ID = #{userID} 56 | 57 | 58 | 59 | delete from wms_user 60 | where 61 | USER_ID = #{userID} 62 | 63 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/UserOperationRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | import com.ken.wms.domain.UserOperationRecordDO; 4 | import org.apache.ibatis.annotations.Param; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | /** 11 | * 用户操作记录Mapper 12 | */ 13 | @Repository 14 | public interface UserOperationRecordMapper { 15 | 16 | /** 17 | * 选择指定用户ID,或时间范围的用户操作记录 18 | * 19 | * @param userID 指定的用户ID 20 | * @param startDate 记录的起始日期 21 | * @param endDate 记录的结束日期 22 | * @return 返回所有符合条件的记录 23 | */ 24 | List selectUserOperationRecord(@Param("userID") Integer userID, 25 | @Param("startDate") Date startDate, 26 | @Param("endDate") Date endDate); 27 | 28 | /** 29 | * 插入用户操作记录 30 | * 31 | * @param userOperationRecordDO 用户操作记录 32 | */ 33 | void insertUserOperationRecord(UserOperationRecordDO userOperationRecordDO); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/UserOperationRecordMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 37 | 38 | 39 | insert into wms_operation_record(USER_ID, USER_NAME, OPERATION_NAME, OPERATION_TIME, OPERATION_RESULT) 40 | values(#{userID}, #{userName}, #{operationName}, #{operationTime}, #{operationResult}) 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/UserPermissionMapper.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.dao; 2 | 3 | import com.ken.wms.domain.RoleDO; 4 | import org.apache.ibatis.annotations.Param; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 用户角色权限映射器 11 | */ 12 | @Repository 13 | public interface UserPermissionMapper { 14 | 15 | /** 16 | * 为指定 userID 用户指派指定 roleID 的角色 17 | * 18 | * @param userID 用户ID 19 | * @param roleID 角色ID 20 | */ 21 | void insert(@Param("userID") Integer userID, @Param("roleID") Integer roleID); 22 | 23 | /** 24 | * 删除指定用户的角色 25 | * 26 | * @param userID 用户ID 27 | */ 28 | void deleteByUserID(Integer userID); 29 | 30 | /** 31 | * 获取指定 userID 对应用户拥有的角色 32 | * 33 | * @param userID 用户ID 34 | * @return 返回 userID 指定用户的角色 35 | */ 36 | List selectUserRole(Integer userID); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/dao/UserPermissionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 25 | 26 | 27 | insert into wms_user_role(ROLE_ID,USER_ID) 28 | values(#{roleID},#{userID}) 29 | 30 | 31 | 32 | delete from wms_user_role 33 | where USER_ID = #{userID} 34 | 35 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/AccessRecordDO.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * 用户登入登出记录 7 | */ 8 | public class AccessRecordDO { 9 | 10 | /** 11 | * 登入登出记录ID 12 | * 仅当该记录从数据库取出时有效 13 | */ 14 | private Integer id; 15 | 16 | /** 17 | * 登陆用户ID 18 | */ 19 | private Integer userID; 20 | 21 | /** 22 | * 登陆用户名 23 | */ 24 | private String userName; 25 | 26 | /** 27 | * 记录类型,登入或登出 28 | */ 29 | private String accessType; 30 | 31 | /** 32 | * 登入或登出时间 33 | */ 34 | private Date accessTime; 35 | 36 | /** 37 | * 用户登入或登出对应的IP地址 38 | */ 39 | private String accessIP; 40 | 41 | public Integer getId() { 42 | return id; 43 | } 44 | 45 | public Integer getUserID() { 46 | return userID; 47 | } 48 | 49 | public String getUserName() { 50 | return userName; 51 | } 52 | 53 | public String getAccessIP() { 54 | return accessIP; 55 | } 56 | 57 | public String getAccessType() { 58 | return accessType; 59 | } 60 | 61 | public Date getAccessTime() { 62 | return accessTime; 63 | } 64 | 65 | public void setId(Integer id) { 66 | this.id = id; 67 | } 68 | 69 | public void setUserID(Integer userID) { 70 | this.userID = userID; 71 | } 72 | 73 | public void setUserName(String userName) { 74 | this.userName = userName; 75 | } 76 | 77 | public void setAccessType(String accessType) { 78 | this.accessType = accessType; 79 | } 80 | 81 | public void setAccessTime(Date accessTime) { 82 | this.accessTime = accessTime; 83 | } 84 | 85 | public void setAccessIP(String accessIP) { 86 | this.accessIP = accessIP; 87 | } 88 | 89 | @Override 90 | public String toString() { 91 | return "AccessRecordDO{" + 92 | "id=" + id + 93 | ", userID=" + userID + 94 | ", userName='" + userName + '\'' + 95 | ", accessType='" + accessType + '\'' + 96 | ", accessTime=" + accessTime + 97 | ", accessIP='" + accessIP + '\'' + 98 | '}'; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/AccessRecordDTO.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | /** 4 | * 登入登出记录DTO 5 | */ 6 | public class AccessRecordDTO { 7 | 8 | /** 9 | * 登入登出记录ID 10 | */ 11 | private Integer id; 12 | 13 | /** 14 | * 登陆用户ID 15 | */ 16 | private Integer userID; 17 | 18 | /** 19 | * 登陆用户名 20 | */ 21 | private String userName; 22 | 23 | /** 24 | * 登入或登出时间 25 | */ 26 | private String accessTime; 27 | 28 | /** 29 | * 用户登入或登出对应的IP地址 30 | */ 31 | private String accessIP; 32 | 33 | /** 34 | * 记录类型,登入或登出 35 | */ 36 | private String accessType; 37 | 38 | public Integer getId() { 39 | return id; 40 | } 41 | 42 | public Integer getUserID() { 43 | return userID; 44 | } 45 | 46 | public String getUserName() { 47 | return userName; 48 | } 49 | 50 | public String getAccessTime() { 51 | return accessTime; 52 | } 53 | 54 | public String getAccessIP() { 55 | return accessIP; 56 | } 57 | 58 | public String getAccessType() { 59 | return accessType; 60 | } 61 | 62 | public void setId(Integer id) { 63 | this.id = id; 64 | } 65 | 66 | public void setUserID(Integer userID) { 67 | this.userID = userID; 68 | } 69 | 70 | public void setUserName(String userName) { 71 | this.userName = userName; 72 | } 73 | 74 | public void setAccessTime(String accessTime) { 75 | this.accessTime = accessTime; 76 | } 77 | 78 | public void setAccessIP(String accessIP) { 79 | this.accessIP = accessIP; 80 | } 81 | 82 | public void setAccessType(String accessType) { 83 | this.accessType = accessType; 84 | } 85 | 86 | @Override 87 | public String toString() { 88 | return "AccessRecordDTO{" + 89 | "id=" + id + 90 | ", userID=" + userID + 91 | ", userName='" + userName + '\'' + 92 | ", accessTime='" + accessTime + '\'' + 93 | ", accessIP='" + accessIP + '\'' + 94 | ", accessType='" + accessType + '\'' + 95 | '}'; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/Customer.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | /** 4 | * 客户信息 5 | */ 6 | public class Customer { 7 | 8 | private Integer id;// 客户ID 9 | private String name;// 客户名 10 | private String personInCharge;// 负责人 11 | private String tel;// 联系电话 12 | private String email;// 电子邮件 13 | private String address;// 地址 14 | 15 | public Integer getId() { 16 | return id; 17 | } 18 | 19 | public void setId(Integer id) { 20 | this.id = id; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | public String getPersonInCharge() { 32 | return personInCharge; 33 | } 34 | 35 | public void setPersonInCharge(String personInCharge) { 36 | this.personInCharge = personInCharge; 37 | } 38 | 39 | public String getTel() { 40 | return tel; 41 | } 42 | 43 | public void setTel(String tel) { 44 | this.tel = tel; 45 | } 46 | 47 | public String getEmail() { 48 | return email; 49 | } 50 | 51 | public void setEmail(String email) { 52 | this.email = email; 53 | } 54 | 55 | public String getAddress() { 56 | return address; 57 | } 58 | 59 | public void setAddress(String address) { 60 | this.address = address; 61 | } 62 | 63 | @Override 64 | public String toString() { 65 | return "Customer [id=" + id + ", name=" + name + ", personInCharge=" + personInCharge + ", tel=" + tel 66 | + ", email=" + email + ", address=" + address + "]"; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/Goods.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | /** 4 | * 货物信息 5 | */ 6 | public class Goods { 7 | 8 | private Integer id;// 货物ID 9 | private String name;// 货物名 10 | private String type;// 货物类型 11 | private String size;// 货物规格 12 | private Double value;// 货物价值 13 | 14 | public Integer getId() { 15 | return id; 16 | } 17 | 18 | public void setId(Integer id) { 19 | this.id = id; 20 | } 21 | 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | public void setName(String name) { 27 | this.name = name; 28 | } 29 | 30 | public String getType() { 31 | return type; 32 | } 33 | 34 | public void setType(String type) { 35 | this.type = type; 36 | } 37 | 38 | public String getSize() { 39 | return size; 40 | } 41 | 42 | public void setSize(String size) { 43 | this.size = size; 44 | } 45 | 46 | public Double getValue() { 47 | return value; 48 | } 49 | 50 | public void setValue(Double value) { 51 | this.value = value; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return "Goods [id=" + id + ", name=" + name + ", type=" + type + ", size=" + size + ", value=" + value + "]"; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/Repository.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | /** 4 | * 仓库信息 5 | */ 6 | public class Repository { 7 | 8 | private Integer id;// 仓库ID 9 | private String address;// 仓库地址 10 | private String status;// 仓库状态 11 | private String area;// 仓库面积 12 | private String desc;// 仓库描述 13 | private Integer adminID;//仓库管理员ID 14 | private String adminName; //仓库管理员名字 15 | 16 | public Integer getAdminID() { 17 | return adminID; 18 | } 19 | 20 | public void setAdminID(Integer adminID) { 21 | this.adminID = adminID; 22 | } 23 | 24 | public String getArea() { 25 | return area; 26 | } 27 | 28 | public void setArea(String area) { 29 | this.area = area; 30 | } 31 | 32 | public String getDesc() { 33 | return desc; 34 | } 35 | 36 | public void setDesc(String desc) { 37 | this.desc = desc; 38 | } 39 | 40 | public String getAdminName() { 41 | return adminName; 42 | } 43 | 44 | public void setAdminName(String adminName) { 45 | this.adminName = adminName; 46 | } 47 | 48 | public Integer getId() { 49 | return id; 50 | } 51 | 52 | public void setId(Integer id) { 53 | this.id = id; 54 | } 55 | 56 | public String getAddress() { 57 | return address; 58 | } 59 | 60 | public void setAddress(String address) { 61 | this.address = address; 62 | } 63 | 64 | public String getStatus() { 65 | return status; 66 | } 67 | 68 | public void setStatus(String status) { 69 | this.status = status; 70 | } 71 | 72 | @Override 73 | public String toString() { 74 | return "Repository [id=" + id + ", address=" + address + ", status=" + status + ", area=" + area + ", desc=" 75 | + desc + ", adminID=" + adminID + ", adminName=" + adminName + "]"; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/RepositoryAdmin.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | import java.sql.Date; 4 | 5 | /** 6 | * 仓库管理员信息 7 | */ 8 | public class RepositoryAdmin { 9 | 10 | private Integer id;// 仓库管理员ID 11 | private String name;// 姓名 12 | private String sex;// 性别 13 | private String tel;// 联系电话 14 | private String address;// 地址 15 | private Date birth;// 出生日期 16 | private Integer repositoryBelongID;// 所属仓库ID 17 | 18 | 19 | public Integer getRepositoryBelongID() { 20 | return repositoryBelongID; 21 | } 22 | 23 | public void setRepositoryBelongID(Integer repositoryBelongID) { 24 | this.repositoryBelongID = repositoryBelongID; 25 | } 26 | 27 | public Integer getId() { 28 | return id; 29 | } 30 | 31 | public void setId(Integer id) { 32 | this.id = id; 33 | } 34 | 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | public String getSex() { 44 | return sex; 45 | } 46 | 47 | public void setSex(String sex) { 48 | this.sex = sex; 49 | } 50 | 51 | public String getTel() { 52 | return tel; 53 | } 54 | 55 | public void setTel(String tel) { 56 | this.tel = tel; 57 | } 58 | 59 | public String getAddress() { 60 | return address; 61 | } 62 | 63 | public void setAddress(String address) { 64 | this.address = address; 65 | } 66 | 67 | public Date getBirth() { 68 | return birth; 69 | } 70 | 71 | public void setBirth(Date birth) { 72 | this.birth = birth; 73 | } 74 | 75 | @Override 76 | public String toString() { 77 | return "RepositoryAdmin [id=" + id + ", name=" + name + ", sex=" + sex + ", tel=" + tel + ", address=" + address 78 | + ", birth=" + birth + ", repositoryBelongID=" + repositoryBelongID + "]"; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/RoleDO.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | /** 4 | * 系统使用的角色信息 5 | */ 6 | public class RoleDO { 7 | 8 | private Integer id;// 角色ID 9 | private String roleName;// 角色名 10 | private String roleDesc;// 角色描述 11 | 12 | public Integer getId() { 13 | return id; 14 | } 15 | 16 | public void setId(Integer id) { 17 | this.id = id; 18 | } 19 | 20 | public String getRoleName() { 21 | return roleName; 22 | } 23 | 24 | public void setRoleName(String roleName) { 25 | this.roleName = roleName; 26 | } 27 | 28 | public String getRoleDesc() { 29 | return roleDesc; 30 | } 31 | 32 | public void setRoleDesc(String roleDesc) { 33 | this.roleDesc = roleDesc; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return "RoleDO{" + 39 | "id=" + id + 40 | ", roleName='" + roleName + '\'' + 41 | ", roleDesc='" + roleDesc + '\'' + 42 | '}'; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/RolePermissionDO.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | /** 4 | * URL 的角色角色权限信息 5 | */ 6 | public class RolePermissionDO { 7 | 8 | /** 9 | * URL 的角色角色权限信息名称 10 | */ 11 | private String name; 12 | 13 | /** 14 | * URL 的角色角色权限信息对应的 URL 15 | */ 16 | private String url; 17 | 18 | /** 19 | * URL 的角色角色权限信息对应的角色 20 | */ 21 | private String role; 22 | 23 | 24 | /** 25 | * 对应的 getter & setter 26 | */ 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | public void setUrl(String url) { 33 | this.url = url; 34 | } 35 | 36 | public void setRole(String role) { 37 | this.role = role; 38 | } 39 | 40 | public String getName() { 41 | return name; 42 | } 43 | 44 | public String getUrl() { 45 | return url; 46 | } 47 | 48 | public String getRole() { 49 | return role; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "RolePermissionDO{" + 55 | "name='" + name + '\'' + 56 | ", url='" + url + '\'' + 57 | ", role='" + role + '\'' + 58 | '}'; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/StockInDO.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | 4 | import java.util.Date; 5 | 6 | /** 7 | * 入库记录 8 | */ 9 | public class StockInDO { 10 | 11 | /** 12 | * 入库记录 13 | */ 14 | private Integer id; 15 | 16 | /** 17 | * 供应商ID 18 | */ 19 | private Integer supplierID; 20 | 21 | /** 22 | * 供应商名称 23 | */ 24 | private String supplierName; 25 | 26 | /** 27 | * 商品ID 28 | */ 29 | private Integer goodID; 30 | 31 | /** 32 | * 商品名称 33 | */ 34 | private String goodName; 35 | 36 | /** 37 | * 入库仓库ID 38 | */ 39 | private Integer repositoryID; 40 | 41 | /** 42 | * 入库数量 43 | */ 44 | private long number; 45 | 46 | /** 47 | * 入库日期 48 | */ 49 | private Date time; 50 | 51 | /** 52 | * 入库经手人 53 | */ 54 | private String personInCharge; 55 | 56 | public Integer getRepositoryID() { 57 | return repositoryID; 58 | } 59 | 60 | public void setRepositoryID(Integer repositoryID) { 61 | this.repositoryID = repositoryID; 62 | } 63 | 64 | public Integer getSupplierID() { 65 | return supplierID; 66 | } 67 | 68 | public void setSupplierID(Integer supplierID) { 69 | this.supplierID = supplierID; 70 | } 71 | 72 | public Integer getGoodID() { 73 | return goodID; 74 | } 75 | 76 | public void setGoodID(Integer goodID) { 77 | this.goodID = goodID; 78 | } 79 | 80 | public Integer getId() { 81 | return id; 82 | } 83 | 84 | public void setId(Integer id) { 85 | this.id = id; 86 | } 87 | 88 | public String getSupplierName() { 89 | return supplierName; 90 | } 91 | 92 | public void setSupplierName(String supplierName) { 93 | this.supplierName = supplierName; 94 | } 95 | 96 | public String getGoodName() { 97 | return goodName; 98 | } 99 | 100 | public void setGoodName(String goodName) { 101 | this.goodName = goodName; 102 | } 103 | 104 | public long getNumber() { 105 | return number; 106 | } 107 | 108 | public void setNumber(long number) { 109 | this.number = number; 110 | } 111 | 112 | public Date getTime() { 113 | return time; 114 | } 115 | 116 | public void setTime(Date time) { 117 | this.time = time; 118 | } 119 | 120 | public String getPersonInCharge() { 121 | return personInCharge; 122 | } 123 | 124 | public void setPersonInCharge(String personInCharge) { 125 | this.personInCharge = personInCharge; 126 | } 127 | 128 | @Override 129 | public String toString() { 130 | return "StockInDO [id=" + id + ", supplierID=" + supplierID + ", supplierName=" + supplierName + ", goodID=" 131 | + goodID + ", goodName=" + goodName + ", repositoryID=" + repositoryID + ", number=" + number 132 | + ", time=" + time + ", personInCharge=" + personInCharge + "]"; 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/StockOutDO.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | 4 | import java.util.Date; 5 | 6 | /** 7 | * 出库记录 8 | */ 9 | public class StockOutDO { 10 | 11 | /** 12 | * 出库记录ID 13 | */ 14 | private Integer id; 15 | 16 | /** 17 | * 客户ID 18 | */ 19 | private Integer customerID; 20 | 21 | /** 22 | * 客户名称 23 | */ 24 | private String customerName; 25 | 26 | /** 27 | * 商品ID 28 | */ 29 | private Integer goodID; 30 | 31 | /** 32 | * 商品名称 33 | */ 34 | private String goodName; 35 | 36 | /** 37 | * 出库仓库ID 38 | */ 39 | private Integer repositoryID; 40 | 41 | /** 42 | * 商品出库数量 43 | */ 44 | private long number; 45 | 46 | /** 47 | * 出库日期 48 | */ 49 | private Date time; 50 | 51 | /** 52 | * 出库经手人 53 | */ 54 | private String personInCharge;// 经手人 55 | 56 | public Integer getRepositoryID() { 57 | return repositoryID; 58 | } 59 | 60 | public void setRepositoryID(Integer repositoryID) { 61 | this.repositoryID = repositoryID; 62 | } 63 | 64 | public Integer getId() { 65 | return id; 66 | } 67 | 68 | public void setId(Integer id) { 69 | this.id = id; 70 | } 71 | 72 | public Integer getCustomerID() { 73 | return customerID; 74 | } 75 | 76 | public void setCustomerID(Integer customerID) { 77 | this.customerID = customerID; 78 | } 79 | 80 | public String getCustomerName() { 81 | return customerName; 82 | } 83 | 84 | public void setCustomerName(String customerName) { 85 | this.customerName = customerName; 86 | } 87 | 88 | public Integer getGoodID() { 89 | return goodID; 90 | } 91 | 92 | public void setGoodID(Integer goodID) { 93 | this.goodID = goodID; 94 | } 95 | 96 | public String getGoodName() { 97 | return goodName; 98 | } 99 | 100 | public void setGoodName(String goodName) { 101 | this.goodName = goodName; 102 | } 103 | 104 | public long getNumber() { 105 | return number; 106 | } 107 | 108 | public void setNumber(long number) { 109 | this.number = number; 110 | } 111 | 112 | public Date getTime() { 113 | return time; 114 | } 115 | 116 | public void setTime(Date time) { 117 | this.time = time; 118 | } 119 | 120 | public String getPersonInCharge() { 121 | return personInCharge; 122 | } 123 | 124 | public void setPersonInCharge(String personInCharge) { 125 | this.personInCharge = personInCharge; 126 | } 127 | 128 | @Override 129 | public String toString() { 130 | return "StockOutDO [id=" + id + ", customerID=" + customerID + ", customerName=" + customerName + ", goodID=" 131 | + goodID + ", goodName=" + goodName + ", repositoryID=" + repositoryID + ", number=" + number 132 | + ", time=" + time + ", personInCharge=" + personInCharge + "]"; 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/StockRecordDTO.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | /** 4 | * 出库/入库记录DO 5 | */ 6 | public class StockRecordDTO { 7 | 8 | /** 9 | * 记录ID 10 | */ 11 | private Integer recordID; 12 | 13 | /** 14 | * 记录的类型(出库/入库) 15 | */ 16 | private String type; 17 | 18 | /** 19 | * 供应商(入库)或客户(出库)名称 20 | */ 21 | private String supplierOrCustomerName; 22 | 23 | /** 24 | * 商品名称 25 | */ 26 | private String goodsName; 27 | 28 | /** 29 | * 出库或入库仓库ID 30 | */ 31 | private Integer repositoryID; 32 | 33 | /** 34 | * 出库或入库数量 35 | */ 36 | private long number; 37 | 38 | /** 39 | * 出库或入库时间 40 | */ 41 | private String time; 42 | 43 | /** 44 | * 出库或入库经手人 45 | */ 46 | private String personInCharge; 47 | 48 | 49 | public Integer getRecordID() { 50 | return recordID; 51 | } 52 | 53 | public String getType() { 54 | return type; 55 | } 56 | 57 | public String getSupplierOrCustomerName() { 58 | return supplierOrCustomerName; 59 | } 60 | 61 | public String getGoodsName() { 62 | return goodsName; 63 | } 64 | 65 | public Integer getRepositoryID() { 66 | return repositoryID; 67 | } 68 | 69 | public long getNumber() { 70 | return number; 71 | } 72 | 73 | public String getTime() { 74 | return time; 75 | } 76 | 77 | public String getPersonInCharge() { 78 | return personInCharge; 79 | } 80 | 81 | public void setRecordID(Integer recordID) { 82 | this.recordID = recordID; 83 | } 84 | 85 | public void setType(String type) { 86 | this.type = type; 87 | } 88 | 89 | public void setSupplierOrCustomerName(String supplierOrCustomerName) { 90 | this.supplierOrCustomerName = supplierOrCustomerName; 91 | } 92 | 93 | public void setGoodsName(String goodsName) { 94 | this.goodsName = goodsName; 95 | } 96 | 97 | public void setRepositoryID(Integer repositoryID) { 98 | this.repositoryID = repositoryID; 99 | } 100 | 101 | public void setNumber(long number) { 102 | this.number = number; 103 | } 104 | 105 | public void setTime(String time) { 106 | this.time = time; 107 | } 108 | 109 | public void setPersonInCharge(String personInCharge) { 110 | this.personInCharge = personInCharge; 111 | } 112 | 113 | @Override 114 | public String toString() { 115 | return "StockRecordDTO{" + 116 | "recordID=" + recordID + 117 | ", type='" + type + '\'' + 118 | ", supplierOrCustomerName='" + supplierOrCustomerName + '\'' + 119 | ", goodsName='" + goodsName + '\'' + 120 | ", repositoryID=" + repositoryID + 121 | ", number=" + number + 122 | ", time=" + time + 123 | ", personInCharge='" + personInCharge + '\'' + 124 | '}'; 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/Storage.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | /** 4 | * 仓库库存 5 | */ 6 | public class Storage { 7 | 8 | private Integer goodsID;// 货物ID 9 | private String goodsName;// 货物名称 10 | private String goodsSize;// 货物规格 11 | private String goodsType;// 货物类型 12 | private Double goodsValue;// 货物价值 13 | private Integer repositoryID;// 仓库ID 14 | private Long number;// 库存数量 15 | 16 | public Integer getGoodsID() { 17 | return goodsID; 18 | } 19 | 20 | public void setGoodsID(Integer goodsID) { 21 | this.goodsID = goodsID; 22 | } 23 | 24 | public String getGoodsName() { 25 | return goodsName; 26 | } 27 | 28 | public void setGoodsName(String goodsName) { 29 | this.goodsName = goodsName; 30 | } 31 | 32 | public String getGoodsSize() { 33 | return goodsSize; 34 | } 35 | 36 | public void setGoodsSize(String goodsSize) { 37 | this.goodsSize = goodsSize; 38 | } 39 | 40 | public String getGoodsType() { 41 | return goodsType; 42 | } 43 | 44 | public void setGoodsType(String goodsType) { 45 | this.goodsType = goodsType; 46 | } 47 | 48 | public Double getGoodsValue() { 49 | return goodsValue; 50 | } 51 | 52 | public void setGoodsValue(Double goodsValue) { 53 | this.goodsValue = goodsValue; 54 | } 55 | 56 | public Integer getRepositoryID() { 57 | return repositoryID; 58 | } 59 | 60 | public void setRepositoryID(Integer repositoryID) { 61 | this.repositoryID = repositoryID; 62 | } 63 | 64 | public Long getNumber() { 65 | return number; 66 | } 67 | 68 | public void setNumber(Long number) { 69 | this.number = number; 70 | } 71 | 72 | @Override 73 | public String toString() { 74 | return "Storage [goodsID=" + goodsID + ", goodsName=" + goodsName + ", goodsSize=" + goodsSize + ", goodsType=" 75 | + goodsType + ", goodsValue=" + goodsValue + ", repositoryID=" + repositoryID + ", number=" + number 76 | + "]"; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/Supplier.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | /** 4 | * 供应商信息 5 | */ 6 | public class Supplier { 7 | 8 | private Integer id;// 供应商ID 9 | private String name;// 供应商名 10 | private String personInCharge;// 负责人 11 | private String tel;// 联系电话 12 | private String email;// 电子邮件 13 | private String address;// 供应商地址 14 | 15 | public Integer getId() { 16 | return id; 17 | } 18 | 19 | public void setId(Integer id) { 20 | this.id = id; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | public String getPersonInCharge() { 32 | return personInCharge; 33 | } 34 | 35 | public void setPersonInCharge(String personInCharge) { 36 | this.personInCharge = personInCharge; 37 | } 38 | 39 | public String getTel() { 40 | return tel; 41 | } 42 | 43 | public void setTel(String tel) { 44 | this.tel = tel; 45 | } 46 | 47 | public String getEmail() { 48 | return email; 49 | } 50 | 51 | public void setEmail(String email) { 52 | this.email = email; 53 | } 54 | 55 | public String getAddress() { 56 | return address; 57 | } 58 | 59 | public void setAddress(String address) { 60 | this.address = address; 61 | } 62 | 63 | @Override 64 | public String toString() { 65 | return "Supplier [id=" + id + ", name=" + name + ", personInCharge=" + personInCharge + ", tel=" + tel 66 | + ", email=" + email + ", address=" + address + "]"; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/User.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | /** 4 | * 系统的使用用户 5 | */ 6 | public class User { 7 | 8 | private Integer id;// 用户ID 9 | private String userName;// 用户名 10 | private String password;// 用户密码 11 | 12 | public Integer getId() { 13 | return id; 14 | } 15 | 16 | public void setId(Integer id) { 17 | this.id = id; 18 | } 19 | 20 | public String getUserName() { 21 | return userName; 22 | } 23 | 24 | public void setUserName(String userName) { 25 | this.userName = userName; 26 | } 27 | 28 | public String getPassword() { 29 | return password; 30 | } 31 | 32 | public void setPassword(String password) { 33 | this.password = password; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return "User [id=" + id + ", userName=" + userName + ", password=" + password + "]"; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/UserInfoDO.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | /** 4 | * 用户账户信息(数据传输对象) 5 | */ 6 | public class UserInfoDO { 7 | 8 | /** 9 | * 用户ID 10 | */ 11 | private Integer userID; 12 | 13 | /** 14 | * 用户名 15 | */ 16 | private String userName; 17 | 18 | /** 19 | * 用户密码(已加密) 20 | */ 21 | private String password; 22 | 23 | /** 24 | * 用户账户属性的 getter 以及 setter 25 | */ 26 | 27 | public String getUserName() { 28 | return userName; 29 | } 30 | 31 | public Integer getUserID() { 32 | return userID; 33 | } 34 | 35 | public String getPassword() { 36 | return password; 37 | } 38 | 39 | public void setUserID(Integer userID) { 40 | this.userID = userID; 41 | } 42 | 43 | public void setUserName(String userName) { 44 | this.userName = userName; 45 | } 46 | 47 | public void setPassword(String password) { 48 | this.password = password; 49 | } 50 | 51 | @Override 52 | public String toString() { 53 | return "UserInfoDO{" + 54 | "userID=" + userID + 55 | ", userName='" + userName + '\'' + 56 | ", password='" + password + '\'' + 57 | '}'; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/UserInfoDTO.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * 用户账户信息(数据传输对象) 8 | */ 9 | public class UserInfoDTO { 10 | 11 | /** 12 | * 用户ID 13 | */ 14 | private Integer userID; 15 | 16 | /** 17 | * 用户名 18 | */ 19 | private String userName; 20 | 21 | /** 22 | * 用户密码(已加密) 23 | */ 24 | private String password; 25 | 26 | /** 27 | * 用户角色 28 | */ 29 | private List role = new ArrayList<>(); 30 | 31 | /** 32 | * 用户账户属性的 getter 以及 setter 33 | */ 34 | 35 | public String getUserName() { 36 | return userName; 37 | } 38 | 39 | public List getRole() { 40 | return role; 41 | } 42 | 43 | public Integer getUserID() { 44 | return userID; 45 | } 46 | 47 | public String getPassword() { 48 | return password; 49 | } 50 | 51 | public void setUserID(Integer userID) { 52 | this.userID = userID; 53 | } 54 | 55 | public void setUserName(String userName) { 56 | this.userName = userName; 57 | } 58 | 59 | public void setPassword(String password) { 60 | this.password = password; 61 | } 62 | 63 | public void setRole(List role) { 64 | this.role = role; 65 | } 66 | 67 | @Override 68 | public String toString() { 69 | return "UserInfoDTO{" + 70 | "userID=" + userID + 71 | ", userName='" + userName + '\'' + 72 | ", password='" + password + '\'' + 73 | ", role=" + role + 74 | '}'; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/UserOperationRecordDO.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * 用户操作记录DO 7 | */ 8 | public class UserOperationRecordDO { 9 | 10 | /** 11 | * 记录ID 12 | */ 13 | private Integer id; 14 | 15 | /** 16 | * 执行操作的用户ID 17 | */ 18 | private Integer userID; 19 | 20 | /** 21 | * 执行操作的用户名 22 | */ 23 | private String userName; 24 | 25 | /** 26 | * 操作的名称 27 | */ 28 | private String operationName; 29 | 30 | /** 31 | * 执行操作的时间 32 | */ 33 | private Date operationTime; 34 | 35 | /** 36 | * 执行操作结果 37 | */ 38 | private String operationResult; 39 | 40 | public void setId(Integer id) { 41 | this.id = id; 42 | } 43 | 44 | public void setUserID(Integer userID) { 45 | this.userID = userID; 46 | } 47 | 48 | public void setUserName(String userName) { 49 | this.userName = userName; 50 | } 51 | 52 | public void setOperationName(String operationName) { 53 | this.operationName = operationName; 54 | } 55 | 56 | public void setOperationTime(Date operationTime) { 57 | this.operationTime = operationTime; 58 | } 59 | 60 | public void setOperationResult(String operationResult) { 61 | this.operationResult = operationResult; 62 | } 63 | 64 | public Integer getId() { 65 | return id; 66 | } 67 | 68 | public Integer getUserID() { 69 | return userID; 70 | } 71 | 72 | public String getUserName() { 73 | return userName; 74 | } 75 | 76 | public String getOperationName() { 77 | return operationName; 78 | } 79 | 80 | public Date getOperationTime() { 81 | return operationTime; 82 | } 83 | 84 | public String getOperationResult() { 85 | return operationResult; 86 | } 87 | 88 | @Override 89 | public String toString() { 90 | return "UserOperationRecordDO{" + 91 | "id=" + id + 92 | ", userID=" + userID + 93 | ", userName='" + userName + '\'' + 94 | ", operationName='" + operationName + '\'' + 95 | ", operationTime=" + operationTime + 96 | ", operationResult='" + operationResult + '\'' + 97 | '}'; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/domain/UserOperationRecordDTO.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.domain; 2 | 3 | /** 4 | * 用户操作记录DTO 5 | */ 6 | public class UserOperationRecordDTO { 7 | 8 | /** 9 | * 操作记录ID 10 | */ 11 | private Integer id; 12 | 13 | /** 14 | * 执行操作的用户ID 15 | */ 16 | private Integer userID; 17 | 18 | /** 19 | * 执行操作的用户名 20 | */ 21 | private String userName; 22 | 23 | /** 24 | * 操作的名称 25 | */ 26 | private String operationName; 27 | 28 | /** 29 | * 操作执行的时间 30 | */ 31 | private String operationTime; 32 | 33 | /** 34 | * 操作执行的结果 35 | */ 36 | private String operationResult; 37 | 38 | public Integer getId() { 39 | return id; 40 | } 41 | 42 | public Integer getUserID() { 43 | return userID; 44 | } 45 | 46 | public String getUserName() { 47 | return userName; 48 | } 49 | 50 | public String getOperationName() { 51 | return operationName; 52 | } 53 | 54 | public String getOperationTime() { 55 | return operationTime; 56 | } 57 | 58 | public String getOperationResult() { 59 | return operationResult; 60 | } 61 | 62 | public void setId(Integer id) { 63 | this.id = id; 64 | } 65 | 66 | public void setUserID(Integer userID) { 67 | this.userID = userID; 68 | } 69 | 70 | public void setUserName(String userName) { 71 | this.userName = userName; 72 | } 73 | 74 | public void setOperationName(String operationName) { 75 | this.operationName = operationName; 76 | } 77 | 78 | public void setOperationTime(String operationTime) { 79 | this.operationTime = operationTime; 80 | } 81 | 82 | public void setOperationResult(String operationResult) { 83 | this.operationResult = operationResult; 84 | } 85 | 86 | @Override 87 | public String toString() { 88 | return "UserOperationRecordDTO{" + 89 | "id=" + id + 90 | ", userID=" + userID + 91 | ", userName='" + userName + '\'' + 92 | ", operationName='" + operationName + '\'' + 93 | ", operationTime='" + operationTime + '\'' + 94 | ", operationResult='" + operationResult + '\'' + 95 | '}'; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/exception/BusinessException.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.exception; 2 | 3 | /** 4 | * 业务层异常的父类 5 | */ 6 | public class BusinessException extends Exception { 7 | 8 | private String exceptionDesc; 9 | 10 | public BusinessException(Exception e) { 11 | super(e); 12 | } 13 | 14 | BusinessException(Exception e, String exceptionDesc) { 15 | super(e); 16 | this.exceptionDesc = exceptionDesc; 17 | } 18 | 19 | BusinessException(String exceptionDesc) { 20 | this.exceptionDesc = exceptionDesc; 21 | } 22 | 23 | BusinessException() { 24 | } 25 | 26 | public String getExceptionDesc() { 27 | return exceptionDesc; 28 | } 29 | 30 | public void setExceptionDesc(String exceptionDesc) { 31 | this.exceptionDesc = exceptionDesc; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/exception/CustomerManageServiceException.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.exception; 2 | 3 | /** 4 | * CustomerManageService异常 5 | */ 6 | public class CustomerManageServiceException extends BusinessException { 7 | 8 | public CustomerManageServiceException() { 9 | super(); 10 | } 11 | 12 | public CustomerManageServiceException(Exception e, String exception) { 13 | super(e, exception); 14 | } 15 | 16 | public CustomerManageServiceException(Exception e) { 17 | super(e); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/exception/GoodsManageServiceException.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.exception; 2 | 3 | /** 4 | * GoodsManageService异常 5 | */ 6 | public class GoodsManageServiceException extends BusinessException { 7 | 8 | GoodsManageServiceException() { 9 | super(); 10 | } 11 | 12 | public GoodsManageServiceException(Exception e) { 13 | super(e); 14 | } 15 | 16 | GoodsManageServiceException(Exception e, String exceptionDesc) { 17 | super(e, exceptionDesc); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/exception/RepositoryAdminManageServiceException.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.exception; 2 | 3 | /** 4 | * RepositoryAdminManageService异常 5 | */ 6 | public class RepositoryAdminManageServiceException extends BusinessException { 7 | 8 | public RepositoryAdminManageServiceException() { 9 | super(); 10 | } 11 | 12 | public RepositoryAdminManageServiceException(Exception e) { 13 | super(e); 14 | } 15 | 16 | public RepositoryAdminManageServiceException(Exception e, String exceptionDesc) { 17 | super(e, exceptionDesc); 18 | } 19 | 20 | public RepositoryAdminManageServiceException(String exceptionDesc) { 21 | super(exceptionDesc); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/exception/RepositoryManageServiceException.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.exception; 2 | 3 | /** 4 | * RepositoryManageService异常 5 | */ 6 | public class RepositoryManageServiceException extends BusinessException { 7 | 8 | RepositoryManageServiceException() { 9 | super(); 10 | } 11 | 12 | public RepositoryManageServiceException(Exception e) { 13 | super(e); 14 | } 15 | 16 | RepositoryManageServiceException(Exception e, String exceptionDesc) { 17 | super(e, exceptionDesc); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/exception/StockRecordManageServiceException.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.exception; 2 | 3 | /** 4 | * StockRecordManageService异常 5 | */ 6 | public class StockRecordManageServiceException extends BusinessException { 7 | 8 | public StockRecordManageServiceException() { 9 | super(); 10 | } 11 | 12 | public StockRecordManageServiceException(Exception e) { 13 | super(e); 14 | } 15 | 16 | public StockRecordManageServiceException(Exception e, String exceptionDesc) { 17 | super(e, exceptionDesc); 18 | } 19 | 20 | public StockRecordManageServiceException(String exceptionDesc) { 21 | super(exceptionDesc); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/exception/StorageManageServiceException.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.exception; 2 | 3 | /** 4 | * StorageManageServiceException异常 5 | */ 6 | public class StorageManageServiceException extends BusinessException { 7 | 8 | StorageManageServiceException() { 9 | super(); 10 | } 11 | 12 | public StorageManageServiceException(Exception e) { 13 | super(e); 14 | } 15 | 16 | StorageManageServiceException(Exception e, String exceptionDesc) { 17 | super(e, exceptionDesc); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/exception/SupplierManageServiceException.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.exception; 2 | 3 | /** 4 | * SupplierManageService异常 5 | */ 6 | public class SupplierManageServiceException extends BusinessException { 7 | 8 | SupplierManageServiceException() { 9 | super(); 10 | } 11 | 12 | public SupplierManageServiceException(Exception e) { 13 | super(e); 14 | } 15 | 16 | SupplierManageServiceException(Exception e, String exceptionDesc) { 17 | super(e, exceptionDesc); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/exception/SystemLogServiceException.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.exception; 2 | 3 | /** 4 | * 系统操作日志 Service 异常 5 | */ 6 | public class SystemLogServiceException extends BusinessException { 7 | 8 | public SystemLogServiceException() { 9 | super(); 10 | } 11 | 12 | public SystemLogServiceException(Exception e) { 13 | super(e); 14 | } 15 | 16 | public SystemLogServiceException(Exception e, String exceptionDesc) { 17 | super(e, exceptionDesc); 18 | } 19 | 20 | public SystemLogServiceException(String exceptionDesc) { 21 | super(exceptionDesc); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/exception/UserAccountServiceException.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.exception; 2 | 3 | /** 4 | * AccountServiceException异常 5 | */ 6 | public class UserAccountServiceException extends BusinessException { 7 | 8 | public static final String PASSWORD_ERROR = "passwordError"; 9 | public static final String PASSWORD_UNMATCH = "passwordUnmatched"; 10 | 11 | public UserAccountServiceException() { 12 | super(); 13 | } 14 | 15 | public UserAccountServiceException(String exceptionDesc) { 16 | super(null, exceptionDesc); 17 | } 18 | 19 | UserAccountServiceException(Exception e) { 20 | super(e); 21 | } 22 | 23 | UserAccountServiceException(Exception e, String exceptionDesc) { 24 | super(e, exceptionDesc); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/exception/UserInfoServiceException.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.exception; 2 | 3 | /** 4 | * UserInfoService异常 5 | */ 6 | public class UserInfoServiceException extends BusinessException { 7 | 8 | public UserInfoServiceException() { 9 | super(); 10 | } 11 | 12 | public UserInfoServiceException(Exception e) { 13 | super(e); 14 | } 15 | 16 | public UserInfoServiceException(Exception e, String exceptionDesc) { 17 | super(e, exceptionDesc); 18 | } 19 | 20 | public UserInfoServiceException(String exceptionDesc) { 21 | super(exceptionDesc); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/security/controller/PageForwardHandler.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.security.controller; 2 | 3 | import org.apache.shiro.SecurityUtils; 4 | import org.apache.shiro.subject.Subject; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | 8 | /** 9 | * 页面重定向 10 | */ 11 | @RequestMapping("/") 12 | @Controller 13 | public class PageForwardHandler { 14 | 15 | /** 16 | * 内部重定向到登陆页面 17 | * 18 | * @return 跳转的 jsp 19 | */ 20 | @RequestMapping("login") 21 | public String loginPageForward() { 22 | // System.out.println("/login"); 23 | // 判断但钱用户是否已经登陆 24 | Subject currentSubject = SecurityUtils.getSubject(); 25 | if (!currentSubject.isAuthenticated()) 26 | return "login"; 27 | else 28 | return "mainPage"; 29 | } 30 | 31 | /** 32 | * 内部重定向到主页面 33 | * 34 | * @return 跳转的 jsp 35 | */ 36 | @RequestMapping("mainPage") 37 | public String showLoginView() { 38 | // System.out.println("/mainPage"); 39 | Subject currentSubject = SecurityUtils.getSubject(); 40 | if (!currentSubject.isAuthenticated()) 41 | return "login"; 42 | else 43 | return "mainPage"; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/security/filter/AnyOfRolesAuthorizationFilter.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.security.filter; 2 | 3 | import org.apache.shiro.subject.Subject; 4 | import org.apache.shiro.web.filter.authz.RolesAuthorizationFilter; 5 | 6 | import javax.servlet.ServletRequest; 7 | import javax.servlet.ServletResponse; 8 | import java.io.IOException; 9 | 10 | /** 11 | * 自定义过滤器,继承自 RolesAuthorizationFilter ,实现了多个角色可以访问某一条url 12 | */ 13 | public class AnyOfRolesAuthorizationFilter extends RolesAuthorizationFilter { 14 | 15 | @Override 16 | public boolean isAccessAllowed(ServletRequest request, ServletResponse response, 17 | Object mappedValue) throws IOException { 18 | 19 | final Subject subject = getSubject(request, response); 20 | final String[] rolesArray = (String[]) mappedValue; 21 | 22 | if (rolesArray == null || rolesArray.length == 0) { 23 | // no roles specified, so nothing to check - allow access 24 | // System.out.println("no roles"); 25 | return true; 26 | } 27 | 28 | for (String role : rolesArray) { 29 | // System.out.println(role); 30 | if (subject.hasRole(role)) { 31 | return true; 32 | } 33 | } 34 | 35 | return false; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/security/filter/ExtendFormAuthenticationFilter.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.security.filter; 2 | 3 | import org.apache.shiro.authc.AuthenticationException; 4 | import org.apache.shiro.authc.AuthenticationToken; 5 | import org.apache.shiro.subject.Subject; 6 | import org.apache.shiro.web.filter.authc.FormAuthenticationFilter; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | 10 | import javax.servlet.ServletRequest; 11 | import javax.servlet.ServletResponse; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | /** 16 | * 扩展 FormAuthenticationFilter ,对部分方法重写,使其支持 Ajax 请求 17 | */ 18 | public class ExtendFormAuthenticationFilter extends FormAuthenticationFilter { 19 | private static final Logger log = LoggerFactory.getLogger(FormAuthenticationFilter.class); 20 | 21 | @Override 22 | protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { 23 | HttpServletRequest httpServletRequest = (HttpServletRequest) request; 24 | HttpServletResponse httpServletResponse = (HttpServletResponse) response; 25 | 26 | if (!"XMLHttpRequest".equalsIgnoreCase(httpServletRequest.getHeader("X-Requested-with"))) { 27 | // 请求为普通请求 28 | if (this.isLoginRequest(request, response)) { 29 | if (this.isLoginSubmission(request, response)) { 30 | if (log.isTraceEnabled()) { 31 | log.trace("Login submission detected. Attempting to execute login."); 32 | } 33 | 34 | return this.executeLogin(request, response); 35 | } else { 36 | if (log.isTraceEnabled()) { 37 | log.trace("Login page view."); 38 | } 39 | 40 | return true; 41 | } 42 | } else { 43 | if (log.isTraceEnabled()) { 44 | log.trace("Attempting to access a path which requires authentication. Forwarding to the Authentication url [" + this.getLoginUrl() + "]"); 45 | } 46 | 47 | this.saveRequestAndRedirectToLogin(request, response); 48 | return false; 49 | } 50 | } else { 51 | // 请求为 Ajax 请求 52 | httpServletResponse.setStatus(HttpServletResponse.SC_FORBIDDEN); 53 | return false; 54 | } 55 | 56 | } 57 | 58 | @Override 59 | protected boolean onLoginSuccess(AuthenticationToken token, Subject subject, ServletRequest request, ServletResponse response) throws Exception { 60 | HttpServletRequest httpServletRequest = (HttpServletRequest) request; 61 | HttpServletResponse httpServletResponse = (HttpServletResponse) response; 62 | 63 | if (!"XMLHttpRequest".equalsIgnoreCase(httpServletRequest.getHeader("X-Requested-with"))) { 64 | // 请求为普通请求 65 | this.issueSuccessRedirect(request, response); 66 | } else { 67 | // 请求为 Ajax 请求 68 | httpServletResponse.setStatus(HttpServletResponse.SC_OK); 69 | } 70 | 71 | return false; 72 | } 73 | 74 | @Override 75 | protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) { 76 | if (log.isDebugEnabled()) { 77 | log.debug("Authentication exception", e); 78 | } 79 | 80 | HttpServletRequest httpServletRequest = (HttpServletRequest) request; 81 | HttpServletResponse httpServletResponse = (HttpServletResponse) response; 82 | 83 | if (!"XMLHttpRequest".equalsIgnoreCase(httpServletRequest.getHeader("X-Requested-With"))) { 84 | // 请求为普通请求 85 | this.setFailureAttribute(request, e); 86 | return true; 87 | } else { 88 | // 请求为 Ajax 请求 89 | // do some thing to return a json 90 | httpServletResponse.setStatus(HttpServletResponse.SC_FORBIDDEN); 91 | return false; 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/security/listener/AccountSessionListener.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.security.listener; 2 | 3 | import com.ken.wms.common.service.Interface.SystemLogService; 4 | import com.ken.wms.dao.AccessRecordMapper; 5 | import com.ken.wms.domain.AccessRecordDO; 6 | import com.ken.wms.exception.SystemLogServiceException; 7 | import org.springframework.beans.BeansException; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.context.ApplicationContext; 10 | import org.springframework.context.ApplicationContextAware; 11 | import org.springframework.stereotype.Component; 12 | import org.springframework.web.context.WebApplicationContext; 13 | 14 | import javax.servlet.http.HttpSession; 15 | import javax.servlet.http.HttpSessionEvent; 16 | import javax.servlet.http.HttpSessionListener; 17 | import java.util.Date; 18 | 19 | /** 20 | * 用户Session监听器 21 | * 当用户session注销时,记录用户账户登出的时间 22 | */ 23 | @Component 24 | public class AccountSessionListener implements HttpSessionListener, ApplicationContextAware { 25 | 26 | @Autowired 27 | private SystemLogService systemLogService; 28 | 29 | @Override 30 | public void sessionCreated(HttpSessionEvent se) { 31 | // 当session被创建时 32 | } 33 | 34 | @Override 35 | public void sessionDestroyed(HttpSessionEvent se) { 36 | // 获取用户的session 37 | HttpSession session = se.getSession(); 38 | 39 | // 判断是否为已经登陆的用户 40 | // 判断依据是isAuthentication的值 41 | try { 42 | String isAuthenticate = (String) session.getAttribute("isAuthenticate"); 43 | if (isAuthenticate != null && isAuthenticate.equals("true")) { 44 | Integer userID = (Integer) session.getAttribute("userID"); 45 | String userName = (String) session.getAttribute("userName"); 46 | String accessIP = "-"; 47 | systemLogService.insertAccessRecord(userID, userName, accessIP, SystemLogService.ACCESS_TYPE_LOGOUT); 48 | } 49 | } catch (SystemLogServiceException e) { 50 | // do log 51 | } 52 | } 53 | 54 | @Override 55 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 56 | if (applicationContext instanceof WebApplicationContext) { 57 | ((WebApplicationContext) applicationContext).getServletContext().addListener(this); 58 | } else { 59 | throw new RuntimeException(); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/security/realms/UserAuthorizingRealm.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.security.realms; 2 | 3 | import com.ken.wms.common.service.Interface.RepositoryAdminManageService; 4 | import com.ken.wms.common.service.Interface.SystemLogService; 5 | import com.ken.wms.domain.RepositoryAdmin; 6 | import com.ken.wms.domain.UserInfoDTO; 7 | import com.ken.wms.exception.RepositoryAdminManageServiceException; 8 | import com.ken.wms.exception.UserInfoServiceException; 9 | import com.ken.wms.security.service.Interface.UserInfoService; 10 | import com.ken.wms.security.util.EncryptingModel; 11 | import org.apache.commons.lang3.StringUtils; 12 | import org.apache.shiro.SecurityUtils; 13 | import org.apache.shiro.authc.*; 14 | import org.apache.shiro.authz.AuthorizationInfo; 15 | import org.apache.shiro.authz.SimpleAuthorizationInfo; 16 | import org.apache.shiro.realm.AuthorizingRealm; 17 | import org.apache.shiro.session.Session; 18 | import org.apache.shiro.subject.PrincipalCollection; 19 | import org.apache.shiro.subject.Subject; 20 | import org.springframework.beans.factory.annotation.Autowired; 21 | 22 | import java.security.NoSuchAlgorithmException; 23 | import java.util.HashSet; 24 | import java.util.List; 25 | import java.util.Set; 26 | 27 | /** 28 | * 用户的认证与授权 29 | */ 30 | public class UserAuthorizingRealm extends AuthorizingRealm { 31 | 32 | @Autowired 33 | private UserInfoService userInfoService; 34 | @Autowired 35 | private EncryptingModel encryptingModel; 36 | @Autowired 37 | private RepositoryAdminManageService repositoryAdminManageService; 38 | @Autowired 39 | private SystemLogService systemLogService; 40 | 41 | /** 42 | * 对用户进行角色授权 43 | * 44 | * @param principalCollection 用户信息 45 | * @return 返回用户授权信息 46 | */ 47 | @SuppressWarnings("unchecked") 48 | @Override 49 | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { 50 | // 创建存放用户角色的 Set 51 | Set roles = new HashSet<>(); 52 | 53 | //获取用户角色 54 | Object principal = principalCollection.getPrimaryPrincipal(); 55 | if (principal instanceof String) { 56 | String userID = (String) principal; 57 | if (StringUtils.isNumeric(userID)) { 58 | try { 59 | UserInfoDTO userInfo = userInfoService.getUserInfo(Integer.valueOf(userID)); 60 | if (userInfo != null) { 61 | // 设置用户角色 62 | roles.addAll(userInfo.getRole()); 63 | } 64 | } catch (UserInfoServiceException e) { 65 | // do logger 66 | } 67 | } 68 | } 69 | 70 | return new SimpleAuthorizationInfo(roles); 71 | } 72 | 73 | /** 74 | * 对用户进行认证 75 | * 76 | * @param authenticationToken 用户凭证 77 | * @return 返回用户的认证信息 78 | * @throws AuthenticationException 用户认证异常信息 79 | * Realm的认证方法,自动将token传入,比较token与数据库的数据是否匹配 80 | * 验证逻辑是先根据用户名查询用户, 81 | * 如果查询到的话再将查询到的用户名和密码放到SimpleAuthenticationInfo对象中, 82 | * Shiro会自动根据用户输入的密码和查询到的密码进行匹配,如果匹配不上就会抛出异常, 83 | * 匹配上之后就会执行doGetAuthorizationInfo()进行相应的权限验证。 84 | */ 85 | @SuppressWarnings("unchecked") 86 | @Override 87 | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws 88 | AuthenticationException { 89 | 90 | String realmName = getName(); 91 | String credentials = ""; 92 | 93 | // 获取用户名对应的用户账户信息 94 | try { 95 | UsernamePasswordToken usernamePasswordToken = (UsernamePasswordToken) authenticationToken; 96 | String principal = usernamePasswordToken.getUsername(); 97 | 98 | if (!StringUtils.isNumeric(principal)) 99 | throw new AuthenticationException(); 100 | Integer userID = Integer.valueOf(principal); 101 | //依赖于/security.service.Interface.UserInfoService,UserInfoDTO中包含用户ID,用户名,密码,角色 102 | //wms_user表 103 | UserInfoDTO userInfoDTO = userInfoService.getUserInfo(userID); 104 | 105 | if (userInfoDTO != null) { 106 | Subject currentSubject = SecurityUtils.getSubject(); 107 | Session session = currentSubject.getSession(); 108 | 109 | // 设置部分用户信息到 Session 110 | session.setAttribute("userID", userID); 111 | session.setAttribute("userName", userInfoDTO.getUserName()); 112 | //获取该用户的所属仓库 113 | List repositoryAdmin = (List) repositoryAdminManageService.selectByID(userInfoDTO.getUserID()).get("data"); 114 | session.setAttribute("repositoryBelong", (repositoryAdmin.isEmpty()) ? "none" : repositoryAdmin.get(0).getRepositoryBelongID()); 115 | 116 | 117 | // 结合验证码对密码进行处理 118 | String checkCode = (String) session.getAttribute("checkCode"); 119 | String password = userInfoDTO.getPassword(); 120 | if (checkCode != null && password != null) { 121 | checkCode = checkCode.toUpperCase(); 122 | credentials = encryptingModel.MD5(password + checkCode); 123 | } 124 | } 125 | //比对账号密码 126 | //principal前端传来userid 127 | //credentials为数据库的密码,加chexkcode的MD5加密 128 | //realmName为com.ken.wms.security.realms.UserAuthorizingRealm_0 129 | return new SimpleAuthenticationInfo(principal, credentials, realmName); 130 | 131 | } catch (UserInfoServiceException | RepositoryAdminManageServiceException | NoSuchAlgorithmException e) { 132 | throw new AuthenticationException(); 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/security/service/FilterChainDefinitionMapBuilder.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.security.service; 2 | 3 | import com.ken.wms.dao.RolePermissionMapper; 4 | import com.ken.wms.domain.RolePermissionDO; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | 7 | import java.util.LinkedHashMap; 8 | import java.util.List; 9 | 10 | /** 11 | * 获取 URL 权限信息工厂类 12 | */ 13 | public class FilterChainDefinitionMapBuilder { 14 | @Autowired 15 | private RolePermissionMapper rolePermissionMapper; 16 | private StringBuilder builder = new StringBuilder(); 17 | 18 | /** 19 | * 获取授权信息 20 | * 21 | * @return 返回授权信息列表 22 | */ 23 | public LinkedHashMap builderFilterChainDefinitionMap() { 24 | LinkedHashMap permissionMap = new LinkedHashMap<>(); 25 | 26 | // 固定的权限配置 27 | permissionMap.put("/css/**", "anon"); 28 | permissionMap.put("/js/**", "anon"); 29 | permissionMap.put("/fonts/**", "anon"); 30 | permissionMap.put("/media/**", "anon"); 31 | permissionMap.put("/pagecomponent/**", "anon"); 32 | permissionMap.put("/login", "anon"); 33 | permissionMap.put("/account/login", "anon"); 34 | permissionMap.put("/account/checkCode/**", "anon"); 35 | 36 | // 可变化的权限配置 37 | LinkedHashMap permissions = getPermissionDataFromDB(); 38 | if (permissions != null) { 39 | permissionMap.putAll(permissions); 40 | } 41 | 42 | // 其余权限配置 43 | permissionMap.put("/", "authc"); 44 | 45 | // permissionMap.forEach((s, s2) -> {System.out.println(s + ":" + s2);}); 46 | 47 | return permissionMap; 48 | } 49 | 50 | /** 51 | * 获取配置在数据库中的 URL 权限信息 52 | * 53 | * @return 返回所有保存在数据库中的 URL 保存信息 54 | */ 55 | private LinkedHashMap getPermissionDataFromDB() { 56 | LinkedHashMap permissionData = null; 57 | 58 | List rolePermissionDOS = rolePermissionMapper.selectAll(); 59 | if (rolePermissionDOS != null) { 60 | permissionData = new LinkedHashMap<>(rolePermissionDOS.size()); 61 | String url; 62 | String role; 63 | String permission; 64 | for (RolePermissionDO rolePermissionDO : rolePermissionDOS) { 65 | url = rolePermissionDO.getUrl(); 66 | role = rolePermissionDO.getRole(); 67 | 68 | // 判断该 url 是否已经存在 69 | if (permissionData.containsKey(url)) { 70 | builder.delete(0, builder.length()); 71 | builder.append(permissionData.get(url)); 72 | builder.insert(builder.length() - 1, ","); 73 | builder.insert(builder.length() - 1, role); 74 | } else { 75 | builder.delete(0, builder.length()); 76 | builder.append("authc,roles[").append(role).append("]"); 77 | } 78 | permission = builder.toString(); 79 | // System.out.println(url + ":" + permission); 80 | permissionData.put(url, permission); 81 | } 82 | } 83 | 84 | return permissionData; 85 | } 86 | 87 | // /** 88 | // * 构造角色权限 89 | // * @param role 角色 90 | // * @return 返回 roles[role name] 格式的字符串 91 | // */ 92 | // private String permissionStringBuilder(String role){ 93 | // builder.delete(0, builder.length()); 94 | // return builder.append("authc,roles[").append(role).append("]").toString(); 95 | // } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/security/service/Impl/AccountServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.security.service.Impl; 2 | 3 | 4 | import com.ken.wms.domain.UserInfoDTO; 5 | import com.ken.wms.exception.UserAccountServiceException; 6 | import com.ken.wms.exception.UserInfoServiceException; 7 | import com.ken.wms.security.service.Interface.AccountService; 8 | import com.ken.wms.security.service.Interface.UserInfoService; 9 | import com.ken.wms.security.util.EncryptingModel; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.security.NoSuchAlgorithmException; 14 | import java.util.Map; 15 | 16 | /** 17 | * 账户Service 18 | */ 19 | @Service 20 | public class AccountServiceImpl implements AccountService { 21 | 22 | @Autowired 23 | private UserInfoService userInfoService; 24 | @Autowired 25 | private EncryptingModel encryptingModel; 26 | 27 | 28 | private static final String OLD_PASSWORD = "oldPassword"; 29 | private static final String NEW_PASSWORD = "newPassword"; 30 | private static final String REPEAT_PASSWORD = "rePassword"; 31 | 32 | /** 33 | * 密码更改 34 | */ 35 | @Override 36 | public void passwordModify(Integer userID, Map passwordInfo) throws UserAccountServiceException { 37 | 38 | if (passwordInfo == null) 39 | throw new UserAccountServiceException(UserAccountServiceException.PASSWORD_ERROR); 40 | 41 | // 获取更改密码信息 传入的都是加密后的密码 42 | String rePassword = (String) passwordInfo.get(REPEAT_PASSWORD); 43 | String newPassword = (String) passwordInfo.get(NEW_PASSWORD); 44 | String oldPassword = (String) passwordInfo.get(OLD_PASSWORD); 45 | if (rePassword == null || newPassword == null || oldPassword == null) 46 | throw new UserAccountServiceException(UserAccountServiceException.PASSWORD_ERROR); 47 | 48 | try { 49 | // 获取用户的账户信息 50 | UserInfoDTO user = userInfoService.getUserInfo(userID); 51 | if (user == null) { 52 | throw new UserAccountServiceException(UserAccountServiceException.PASSWORD_ERROR); 53 | } 54 | 55 | // 新密码一致性验证 56 | if (!newPassword.equals(rePassword)) { 57 | throw new UserAccountServiceException(UserAccountServiceException.PASSWORD_UNMATCH); 58 | } 59 | 60 | // 原密码正确性验证 61 | String password; 62 | password = encryptingModel.MD5(oldPassword + userID); 63 | if (!password.equals(user.getPassword())) { 64 | throw new UserAccountServiceException(UserAccountServiceException.PASSWORD_ERROR); 65 | } 66 | 67 | // 获得新的密码并加密 68 | password = encryptingModel.MD5(newPassword + userID); 69 | // 验证成功后更新数据库 70 | user.setPassword(password); 71 | userInfoService.updateUserInfo(user); 72 | } catch (NoSuchAlgorithmException | NullPointerException | UserInfoServiceException e) { 73 | throw new UserAccountServiceException(UserAccountServiceException.PASSWORD_ERROR); 74 | } 75 | 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/security/service/Interface/AccountService.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.security.service.Interface; 2 | 3 | import com.ken.wms.exception.UserAccountServiceException; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * 账号相关服务 9 | */ 10 | public interface AccountService { 11 | 12 | /** 13 | * 密码更改 14 | * 15 | * @param userID 用户ID 16 | * @param passwordInfo 更改的密码信息 17 | */ 18 | public void passwordModify(Integer userID, Map passwordInfo) throws UserAccountServiceException; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/security/service/Interface/UserInfoService.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.security.service.Interface; 2 | 3 | import com.ken.wms.domain.UserInfoDTO; 4 | import com.ken.wms.exception.UserInfoServiceException; 5 | 6 | import java.util.List; 7 | import java.util.Set; 8 | 9 | /** 10 | * 用户账户信息 service 11 | */ 12 | public interface UserInfoService { 13 | 14 | /** 15 | * 获取指定用户ID对应的用户账户信息 16 | * 17 | * @param userID 用户ID 18 | * @return 返回用户账户信息 19 | */ 20 | UserInfoDTO getUserInfo(Integer userID) throws UserInfoServiceException; 21 | 22 | /** 23 | * 获取指定 userName 对应的用户账户信息 24 | * 25 | * @param userName 用户名 26 | * @return 返回用户账户信息 27 | */ 28 | UserInfoDTO getUserInfo(String userName) throws UserInfoServiceException; 29 | 30 | /** 31 | * 获取所有用户账户信息 32 | * 33 | * @return 返回所有的用户账户信息 34 | */ 35 | List getAllUserInfo() throws UserInfoServiceException; 36 | 37 | /** 38 | * 更新用户的账户信息 39 | * 40 | * @param userInfoDTO 用户账户信息 41 | */ 42 | void updateUserInfo(UserInfoDTO userInfoDTO) throws UserInfoServiceException; 43 | 44 | /** 45 | * 删除指定 userID 的用户账户信息 46 | * 47 | * @param userID 指定的用户ID 48 | */ 49 | void deleteUserInfo(Integer userID) throws UserInfoServiceException; 50 | 51 | /** 52 | * 添加一条用户账户信息 53 | * 54 | * @param userInfoDTO 需要添加的用户账户信息 55 | */ 56 | boolean insertUserInfo(UserInfoDTO userInfoDTO) throws UserInfoServiceException; 57 | 58 | /** 59 | * 获取用户的权限角色 60 | * 61 | * @param userID 用户 ID 62 | * @return 返回一个保存有用户角色的 Set,若该用户没有任何角色,则返回一个不包含任何元素的 Set 63 | */ 64 | Set getUserRoles(Integer userID) throws UserInfoServiceException; 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/security/util/CheckCodeGenerator.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.security.util; 2 | 3 | 4 | import org.springframework.stereotype.Component; 5 | 6 | import java.awt.*; 7 | import java.awt.geom.Line2D; 8 | import java.awt.image.BufferedImage; 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | import java.util.Random; 12 | 13 | /** 14 | * 15 | * 16 | * 17 | */ 18 | @Component 19 | public class CheckCodeGenerator { 20 | 21 | private static char[] codeSequence = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 22 | 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; 23 | 24 | private static int width = 80;// 生成验证码的宽度 25 | private static int height = 35;// 生成验证码的高度 26 | private static int codeCount = 4;// 验证码个数 27 | private static int lineCounr = 20; 28 | private static Font font;// 验证码字体样式 29 | 30 | static { 31 | font = new Font("楷体", Font.BOLD | Font.ITALIC, 25); 32 | } 33 | 34 | /** 35 | * 获取验证码 36 | * 37 | * @return 38 | */ 39 | public Map generlateCheckCode() { 40 | 41 | // 存储验证码 42 | StringBuilder codeBuilder = new StringBuilder(); 43 | 44 | Random random = new Random(); 45 | 46 | // 创建 BufferedImage 对象 47 | BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR); 48 | // 创建Grapchics2D对象 49 | Graphics graphics = image.getGraphics(); 50 | Graphics2D graphics2d = (Graphics2D) graphics; 51 | 52 | // 设置图片 53 | graphics.setColor(Color.white); 54 | graphics.fillRect(1, 1, width - 2, height - 2); 55 | graphics.setFont(font); 56 | 57 | graphics.setColor(Color.gray); 58 | // 绘制颜色和位置全部为随机产生的线条,该线条为2f 59 | for (int i = 1; i <= lineCounr; i++) { 60 | int x = random.nextInt(width - 1); 61 | int y = random.nextInt(height - 1); 62 | int x1 = random.nextInt(width - 1); 63 | int y1 = random.nextInt(height - 1); 64 | 65 | Line2D line2d = new Line2D.Double(x, y, x1, y1); 66 | 67 | graphics2d.draw(line2d); 68 | } 69 | 70 | // 设置验证码中的内容 71 | for (int i = 0; i < codeCount; i++) { 72 | graphics.setColor(getRandColor()); 73 | char c = codeSequence[random.nextInt(codeSequence.length - 1)]; 74 | codeBuilder.append(c); 75 | graphics2d.drawString(c + "", 10 + 15 * i, 25); 76 | } 77 | 78 | Map checkCode = new HashMap(); 79 | checkCode.put("checkCodeString", codeBuilder.toString()); 80 | checkCode.put("checkCodeImage", image); 81 | 82 | return checkCode; 83 | } 84 | 85 | /** 86 | * 随机生成颜色 87 | * 88 | * @return 89 | */ 90 | private Color getRandColor() { 91 | Random random = new Random(); 92 | 93 | int r, g, b; 94 | r = random.nextInt(255); 95 | g = random.nextInt(255); 96 | b = random.nextInt(255); 97 | 98 | return new Color(r, g, b); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/security/util/EncryptingModel.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.security.util; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import java.security.MessageDigest; 6 | import java.security.NoSuchAlgorithmException; 7 | 8 | /** 9 | * 加密模块 10 | */ 11 | @Component 12 | public class EncryptingModel { 13 | 14 | /** 15 | * 对字符串进行 MD5 加密 16 | * 17 | * @param plainString 需要加密的字符串 18 | * @return 返回加密后的字符串 19 | * @throws NoSuchAlgorithmException 20 | */ 21 | public String MD5(String plainString) throws NoSuchAlgorithmException, NullPointerException { 22 | 23 | if (plainString == null) 24 | throw new NullPointerException(); 25 | 26 | MessageDigest messageDigest = MessageDigest.getInstance("MD5"); 27 | messageDigest.update(plainString.getBytes()); 28 | byte[] byteData = messageDigest.digest(); 29 | 30 | StringBuffer hexString = new StringBuffer(); 31 | for (int i = 0; i < byteData.length; i++) { 32 | String hex = Integer.toHexString(0xff & byteData[i]); 33 | if (hex.length() == 1) 34 | hexString.append('0'); 35 | hexString.append(hex); 36 | } 37 | 38 | return hexString.toString(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/util/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.util; 2 | 3 | import com.ken.wms.exception.BusinessException; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.web.bind.annotation.ControllerAdvice; 7 | import org.springframework.web.bind.annotation.ExceptionHandler; 8 | 9 | /** 10 | * 全局异常处理器 11 | */ 12 | @ControllerAdvice 13 | public class GlobalExceptionHandler { 14 | 15 | private static Logger logger = LoggerFactory.getLogger("ExceptionLogging"); 16 | 17 | /** 18 | * 捕获并记录Controller层抛出的非BusinessException异常 19 | */ 20 | @ExceptionHandler(value = Exception.class) 21 | public void handleException(Exception e) { 22 | if (!(e instanceof BusinessException)) { 23 | if (logger.isErrorEnabled()) { 24 | StringBuilder builder = new StringBuilder(); 25 | builder.append("cause:").append(e.getMessage()); 26 | builder.append("\n\tstackTrack:\n"); 27 | for (StackTraceElement stack : e.getStackTrace()) { 28 | builder.append("\t\t"); 29 | builder.append(stack.toString()); 30 | builder.append("\n"); 31 | } 32 | logger.error(builder.toString()); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/util/aop/ServiceLogging.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.util.aop; 2 | 3 | import org.aspectj.lang.JoinPoint; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | 7 | 8 | /** 9 | * Service层日志处理 10 | */ 11 | public class ServiceLogging { 12 | 13 | private static Logger exceptionLogger = LoggerFactory.getLogger("ExceptionLogging"); 14 | private static Logger methodInvokeLogger = LoggerFactory.getLogger("MethodInvokeLogging"); 15 | 16 | /** 17 | * 捕获Service层抛出的异常并做日志 18 | * 19 | * @param throwable 方法抛出的异常 20 | */ 21 | public void loggingServiceException(Throwable throwable) { 22 | if (exceptionLogger.isErrorEnabled()) { 23 | StringBuilder builder = new StringBuilder(); 24 | builder.append("cause:").append(throwable.getMessage()); 25 | builder.append("\n\tstackTrack:\n"); 26 | for (StackTraceElement stack : throwable.getStackTrace()) { 27 | builder.append("\t\t"); 28 | builder.append(stack.toString()); 29 | builder.append("\n"); 30 | } 31 | exceptionLogger.error(builder.toString()); 32 | } 33 | } 34 | 35 | /** 36 | * 记录Service方法的调用 37 | * 38 | * @param joinPoint 切入点 39 | */ 40 | public void loggingMethodInvoked(JoinPoint joinPoint) { 41 | if (methodInvokeLogger.isDebugEnabled()) { 42 | String methodName = joinPoint.getSignature().getName(); 43 | Object[] args = joinPoint.getArgs(); 44 | StringBuilder builder = new StringBuilder(); 45 | builder.append("Invoked Method:").append(methodName); 46 | builder.append("\targs:"); 47 | for (Object arg : args) { 48 | builder.append(arg.toString()); 49 | } 50 | methodInvokeLogger.debug(builder.toString()); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/util/aop/UserOperation.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.util.aop; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 用户操作注解 7 | * 用于标注用户操作的方法名称 8 | */ 9 | @Inherited 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Target(ElementType.METHOD) 12 | public @interface UserOperation { 13 | String value(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/ken/wms/util/aop/UserOperationLogging.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.util.aop; 2 | 3 | import com.ken.wms.common.service.Interface.SystemLogService; 4 | import com.ken.wms.exception.SystemLogServiceException; 5 | import org.apache.shiro.SecurityUtils; 6 | import org.apache.shiro.session.Session; 7 | import org.apache.shiro.subject.Subject; 8 | import org.aspectj.lang.JoinPoint; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | 11 | /** 12 | * 用户操作日志记录 13 | */ 14 | public class UserOperationLogging { 15 | 16 | @Autowired 17 | private SystemLogService systemLogService; 18 | 19 | /** 20 | * 记录用户操作 21 | * 22 | * @param joinPoint 切入点信息 23 | */ 24 | public void loggingUserOperation(JoinPoint joinPoint, Object returnValue, UserOperation userOperation) { 25 | 26 | if (userOperation != null) { 27 | // 获取 annotation 的值 28 | String userOperationValue = userOperation.value(); 29 | 30 | // 获取调用的方法名 31 | String methodName = joinPoint.getSignature().getName(); 32 | 33 | // 获取除 import* export* 外的方法的返回值 34 | String invokedResult = "-"; 35 | if (!methodName.matches("^import\\w*") && !methodName.matches("^export\\w*")) { 36 | if (returnValue instanceof Boolean) { 37 | boolean result = (boolean) returnValue; 38 | invokedResult = result ? "成功" : "失败"; 39 | } 40 | } 41 | 42 | // 获取用户信息 43 | Subject currentSubject = SecurityUtils.getSubject(); 44 | Session session = currentSubject.getSession(); 45 | Integer userID = (Integer) session.getAttribute("userID"); 46 | String userName = (String) session.getAttribute("userName"); 47 | 48 | // 插入记录 49 | try { 50 | systemLogService.insertUserOperationRecord(userID, userName, userOperationValue, invokedResult); 51 | } catch (SystemLogServiceException e) { 52 | // do log 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/resources/config/DBConfig.properties: -------------------------------------------------------------------------------- 1 | jdbc.user=root 2 | jdbc.password=123 3 | jdbc.driverClass=com.mysql.jdbc.Driver 4 | jdbc.jdbcUrl=jdbc:mysql:///wms_db?characterEncoding=UTF-8 5 | jdbc.testConnectionOnCheckout=true -------------------------------------------------------------------------------- /src/main/resources/config/ExcelUtilConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | name 7 | 供应商名 8 | 9 | 10 | personInCharge 11 | 负责人 12 | 13 | 14 | tel 15 | 联系电话 16 | 17 | 18 | email 19 | 电子邮件 20 | 21 | 22 | address 23 | 供应商地址 24 | 25 | 26 | 27 | 28 | 29 | name 30 | 客户名称 31 | 32 | 33 | personInCharge 34 | 负责人 35 | 36 | 37 | tel 38 | 联系电话 39 | 40 | 41 | email 42 | 电子邮件 43 | 44 | 45 | address 46 | 地址 47 | 48 | 49 | 50 | 51 | 52 | id 53 | 货物ID 54 | 55 | 56 | name 57 | 货物名称 58 | 59 | 60 | type 61 | 货物类型 62 | 63 | 64 | size 65 | 货物规格 66 | 67 | 68 | value 69 | 货物价值 70 | 71 | 72 | 73 | 74 | 75 | id 76 | 仓库ID 77 | 78 | 79 | address 80 | 仓库地址 81 | 82 | 83 | status 84 | 仓库状态 85 | 86 | 87 | area 88 | 仓库面积 89 | 90 | 91 | desc 92 | 仓库描述 93 | 94 | 95 | adminID 96 | 仓库管理员ID 97 | 98 | 99 | adminName 100 | 仓库管理员名字 101 | 102 | 103 | 104 | 105 | 106 | id 107 | ID 108 | 109 | 110 | name 111 | 姓名 112 | 113 | 114 | sex 115 | 性别 116 | 117 | 118 | tel 119 | 联系电话 120 | 121 | 122 | address 123 | 联系地址 124 | 125 | 126 | birth 127 | 出生日期 128 | 129 | 130 | repositoryBelongID 131 | 所属仓库ID 132 | 133 | 134 | 135 | 136 | goodsID 137 | 货物ID 138 | 139 | 140 | goodsName 141 | 货物名称 142 | 143 | 144 | goodsSize 145 | 货物规格 146 | 147 | 148 | goodsType 149 | 货物类型 150 | 151 | 152 | goodsValue 153 | 货物价值 154 | 155 | 156 | repositoryID 157 | 仓库ID 158 | 159 | 160 | number 161 | 库存数量 162 | 163 | 164 | -------------------------------------------------------------------------------- /src/main/resources/config/MyBatisConfiguration.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/resources/config/SpringMVCConfiguration.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/main/resources/config/ehcache.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 18 | 19 | 20 | 21 | 37 | 44 | 45 | 63 | 64 | 73 | 80 | 81 | 84 | 91 | --> 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /src/main/resources/config/log4j.properties: -------------------------------------------------------------------------------- 1 | ##将ibatis log4j运行级别调到DEBUG可以在控制台打印出ibatis运行的sql语句 2 | #log4j.rootLogger=debug,stdout,logfile 3 | #### 把日志信息输出到控制台 ### 4 | #log4j.appender.stdout=org.apache.log4j.ConsoleAppender 5 | ##log4j.appender.stdout.Target=System.err 6 | #log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout 7 | #### 把日志信息输出到文件:jbit.log ### 8 | #log4j.appender.logfile=org.apache.log4j.FileAppender 9 | #log4j.appender.logfile.File=D:/test.log 10 | #log4j.appender.logfile.layout=org.apache.log4j.PatternLayout 11 | #log4j.appender.logfile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %F %p %m%n 12 | ####显示SQL语句部分 13 | #log4j.logger.com.ibatis=DEBUG 14 | #log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG 15 | #log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG 16 | #log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG 17 | #log4j.logger.java.sql.Connection=DEBUG 18 | #log4j.logger.java.sql.Statement=DEBUG 19 | #log4j.logger.java.sql.PreparedStatement=DEBUG 20 | # 21 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/download/customerInfo.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/WEB-INF/download/customerInfo.xlsx -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/download/goodsInfo.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/WEB-INF/download/goodsInfo.xlsx -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/download/repositoryAdminInfo.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/WEB-INF/download/repositoryAdminInfo.xlsx -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/download/repositoryInfo.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/WEB-INF/download/repositoryInfo.xlsx -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/download/storageRecord.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/WEB-INF/download/storageRecord.xlsx -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/download/supplierInfo.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/WEB-INF/download/supplierInfo.xlsx -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | WMS 7 | 8 | 9 | 10 | 11 | springDispatcherServlet 12 | org.springframework.web.servlet.DispatcherServlet 13 | 14 | contextConfigLocation 15 | classpath:config/SpringMVCConfiguration.xml 16 | 17 | 1 18 | 19 | 20 | 21 | 22 | springDispatcherServlet 23 | / 24 | 25 | 26 | 27 | 28 | log4jConfigLocation 29 | classpath:config/log4j.properties 30 | 31 | 32 | org.springframework.web.util.Log4jConfigListener 33 | 34 | 35 | 36 | 37 | 38 | shiroFilter 39 | org.springframework.web.filter.DelegatingFilterProxy 40 | 41 | targetFilterLifecycle 42 | true 43 | 44 | 45 | 46 | shiroFilter 47 | /* 48 | 49 | 50 | 51 | 52 | 53 | contextConfigLocation 54 | classpath:config/SpringApplicationConfiguration.xml 55 | 56 | 57 | 58 | 59 | org.springframework.web.context.ContextLoaderListener 60 | 61 | 62 | 63 | 404 64 | /errorPage/404Error.html 65 | 66 | 67 | 500 68 | /errorPage/500Error.html 69 | 70 | 71 | -------------------------------------------------------------------------------- /src/main/webapp/css/bootstrapValidator.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * BootstrapValidator (http://bootstrapvalidator.com) 3 | * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3 4 | * 5 | * @version v0.5.1-dev, built on 2014-07-23 6:05:15 AM 6 | * @author https://twitter.com/nghuuphuoc 7 | * @copyright (c) 2013 - 2014 Nguyen Huu Phuoc 8 | * @license MIT 9 | */ 10 | 11 | .bv-form .help-block{margin-bottom:0}.bv-form .tooltip-inner{text-align:left}.nav-tabs li.bv-tab-success>a{color:#3c763d}.nav-tabs li.bv-tab-error>a{color:#a94442} -------------------------------------------------------------------------------- /src/main/webapp/css/mainPage.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 70px; 3 | } 4 | 5 | a:link { 6 | text-decoration: none; 7 | } 8 | 9 | .btn-file { 10 | margin-top: 20px; 11 | position: relative; 12 | overflow: hidden; 13 | } 14 | 15 | .btn-file input[type=file] { 16 | position: absolute; 17 | top: 0; 18 | right: 0; 19 | min-width: 100%; 20 | min-height: 100%; 21 | font-size: 100px; 22 | text-align: right; 23 | opacity: 0; 24 | outline: none; 25 | background: white; 26 | cursor: inherit; 27 | display: block; 28 | } 29 | 30 | td, th { 31 | text-align: center; 32 | } 33 | 34 | .bodycontainer { 35 | height: 350px; 36 | width: 100%; 37 | margin: 0; 38 | margin-top: -15px; 39 | overflow-y: auto; 40 | } 41 | 42 | .table-scrollable { 43 | margin: 0; 44 | padding: 0; 45 | } 46 | -------------------------------------------------------------------------------- /src/main/webapp/css/model/login/login.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: url(../../../media/images/backgroundPic.png); 3 | background-size: 100%; 4 | background-position: center; 5 | 6 | margin-top: 150px; 7 | } 8 | 9 | #checkCodeImg:hover { 10 | cursor: pointer; 11 | } -------------------------------------------------------------------------------- /src/main/webapp/errorPage/404Error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 404 6 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/webapp/errorPage/500Error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 500 6 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/webapp/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/main/webapp/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/main/webapp/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/main/webapp/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/main/webapp/js/bootstrap-datetimepicker.zh-CN.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Simplified Chinese translation for bootstrap-datetimepicker 3 | * Yuan Cheung 4 | */ 5 | ;(function ($) { 6 | $.fn.datetimepicker.dates['zh-CN'] = { 7 | days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"], 8 | daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"], 9 | daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"], 10 | months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], 11 | monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], 12 | today: "今天", 13 | suffix: [], 14 | meridiem: ["上午", "下午"] 15 | }; 16 | }(jQuery)); 17 | -------------------------------------------------------------------------------- /src/main/webapp/js/bootstrap-table-zh-CN.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * bootstrap-table - v1.11.0 - 2016-07-02 3 | * https://github.com/wenzhixin/bootstrap-table 4 | * Copyright (c) 2016 zhixin wen 5 | * Licensed MIT License 6 | */ 7 | !function(a){"use strict";a.fn.bootstrapTable.locales["zh-CN"]={formatLoadingMessage:function(){return"正在努力地加载数据中,请稍候……"},formatRecordsPerPage:function(a){return"每页显示 "+a+" 条记录"},formatShowingRows:function(a,b,c){return"显示第 "+a+" 到第 "+b+" 条记录,总共 "+c+" 条记录"},formatSearch:function(){return"搜索"},formatNoMatches:function(){return"没有找到匹配的记录"},formatPaginationSwitch:function(){return"隐藏/显示分页"},formatRefresh:function(){return"刷新"},formatToggle:function(){return"切换"},formatColumns:function(){return"列"},formatExport:function(){return"导出数据"},formatClearFilters:function(){return"清空过滤"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["zh-CN"])}(jQuery); -------------------------------------------------------------------------------- /src/main/webapp/js/mainPage.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | menuClickAction(); 3 | welcomePageInit(); 4 | signOut(); 5 | getRequestPrefix(); 6 | homePage(); 7 | }); 8 | 9 | // 获取请求前缀 10 | function getRequestPrefix() { 11 | requestPrefix = $('#requestPrefix').text(); 12 | } 13 | 14 | // 加载欢迎界面 15 | function welcomePageInit() { 16 | $('#panel').load('pagecomponent/welcomePage.jsp'); 17 | } 18 | 19 | // 跳回首页 20 | function homePage() { 21 | $('.home').click(function () { 22 | $('#panel').load('pagecomponent/welcomePage.jsp'); 23 | }) 24 | } 25 | 26 | // 侧边栏连接点击动作 27 | function menuClickAction() { 28 | $(".menu_item").click(function () { 29 | var url = $(this).attr("name"); 30 | $('#panel').load(url); 31 | }) 32 | } 33 | 34 | // 注销登陆 35 | function signOut() { 36 | $("#signOut").click(function () { 37 | $.ajax({ 38 | type: "GET", 39 | url: "account/logout", 40 | dataType: "json", 41 | contentType: "application/json", 42 | success: function (response) { 43 | //刷新 44 | window.location.reload(true); 45 | }, error: function (response) { 46 | 47 | } 48 | }) 49 | }) 50 | } -------------------------------------------------------------------------------- /src/main/webapp/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /src/main/webapp/media/icons/error-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/media/icons/error-icon.png -------------------------------------------------------------------------------- /src/main/webapp/media/icons/stock_in-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/media/icons/stock_in-512.png -------------------------------------------------------------------------------- /src/main/webapp/media/icons/stock_out-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/media/icons/stock_out-512.png -------------------------------------------------------------------------------- /src/main/webapp/media/icons/stock_search-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/media/icons/stock_search-512.png -------------------------------------------------------------------------------- /src/main/webapp/media/icons/success-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/media/icons/success-icon.png -------------------------------------------------------------------------------- /src/main/webapp/media/icons/warning-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/media/icons/warning-icon.png -------------------------------------------------------------------------------- /src/main/webapp/media/images/404.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/media/images/404.jpg -------------------------------------------------------------------------------- /src/main/webapp/media/images/500.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/media/images/500.jpg -------------------------------------------------------------------------------- /src/main/webapp/media/images/backgroundPic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanguobin/WMS/e84bdf9aa9e732d71cae6588c8c5183a234365b4/src/main/webapp/media/images/backgroundPic.png -------------------------------------------------------------------------------- /src/main/webapp/pagecomponent/accessRecordManagement.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 99 | 100 |
101 | 104 |
105 |
106 |
107 |
108 |
109 | 110 | 111 |
112 |
113 |
114 |
115 |
116 | 117 | 122 |
123 |
124 |
125 | 128 |
129 |
130 |
131 |
132 |
133 | 134 | 135 | 136 | 137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
-------------------------------------------------------------------------------- /src/main/webapp/pagecomponent/userOperationRecorderManagement.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 96 | 97 |
98 | 101 |
102 |
103 |
104 |
105 |
106 | 107 | 108 |
109 |
110 |
111 |
112 |
113 | 114 | 115 | 116 | 117 |
118 |
119 |
120 | 123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
-------------------------------------------------------------------------------- /src/main/webapp/pagecomponent/welcomePage.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | 4 | 19 | 20 |
21 | 22 | 25 | 26 |
27 |
28 |
29 | 61 |
62 |
63 |
64 |
65 | -------------------------------------------------------------------------------- /src/test/java/com/ken/wms/MapperTest.java: -------------------------------------------------------------------------------- 1 | //package com.ken.wms; 2 | // 3 | //import com.ken.wms.common.service.Interface.StockRecordManageService; 4 | //import com.ken.wms.common.service.Interface.SystemLogService; 5 | //import com.ken.wms.dao.AccessRecordMapper; 6 | //import com.ken.wms.dao.StockInMapper; 7 | //import com.ken.wms.dao.StockOutMapper; 8 | //import com.ken.wms.dao.UserOperationRecordMapper; 9 | //import com.ken.wms.domain.*; 10 | //import com.ken.wms.exception.StockRecordManageServiceException; 11 | //import com.ken.wms.exception.SystemLogServiceException; 12 | //import org.junit.Test; 13 | //import org.junit.runner.RunWith; 14 | //import org.springframework.beans.factory.annotation.Autowired; 15 | //import org.springframework.test.context.ContextConfiguration; 16 | //import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 17 | // 18 | //import java.text.DateFormat; 19 | //import java.text.ParseException; 20 | //import java.text.SimpleDateFormat; 21 | //import java.util.Date; 22 | //import java.util.List; 23 | //import java.util.Map; 24 | // 25 | ///** 26 | // * Created by Ken on 2017/4/5. 27 | // */ 28 | //@ContextConfiguration(locations = "classpath:config/SpringApplicationConfiguration.xml") 29 | //@RunWith(SpringJUnit4ClassRunner.class) 30 | //public class MapperTest { 31 | // 32 | // @Autowired 33 | // private 34 | // StockInMapper stockInMapper; 35 | // @Autowired 36 | // private StockOutMapper stockOutMapper; 37 | // @Autowired 38 | // private StockRecordManageService stockRecordManageService; 39 | // @Autowired 40 | // private AccessRecordMapper accessRecordMapper; 41 | // @Autowired 42 | // private SystemLogService systemLogService; 43 | // @Autowired 44 | // private UserOperationRecordMapper userOperationRecordMapper; 45 | // 46 | // @Test 47 | // public void selectUserOperationRecordServiceTest() throws SystemLogServiceException { 48 | // Map result = systemLogService.selectUserOperationRecord(1001, "", ""); 49 | // List userOperationRecordDTOS = (List) result.get("data"); 50 | // userOperationRecordDTOS.forEach(System.out::println); 51 | // } 52 | // 53 | // @Test 54 | // public void addUserOperationRecordServiceTest() throws SystemLogServiceException { 55 | // systemLogService.insertUserOperationRecord(1001, "ken", "insert new row", "fail"); 56 | // } 57 | // 58 | // @Test 59 | // public void addUserOperationRecordTest(){ 60 | // UserOperationRecordDO userOperationRecordDO = new UserOperationRecordDO(); 61 | // userOperationRecordDO.setUserID(1001); 62 | // userOperationRecordDO.setUserName("ken"); 63 | // userOperationRecordDO.setOperationName("set param"); 64 | // userOperationRecordDO.setOperationTime(new Date()); 65 | // userOperationRecordDO.setOperationResult("success"); 66 | // 67 | // userOperationRecordMapper.insertUserOperationRecord(userOperationRecordDO); 68 | // } 69 | // 70 | // @Test 71 | // public void selectUserOperationRecordTest(){ 72 | // List userOperationRecordDOS = userOperationRecordMapper.selectUserOperationRecord(1002, null, null); 73 | // userOperationRecordDOS.forEach(System.out::println); 74 | // } 75 | // 76 | // @Test 77 | // public void selectAccessRecordServiceTest() throws SystemLogServiceException { 78 | // Map result = systemLogService.selectAccessRecord(null, "all", "", ""); 79 | // List accessRecordDOS = (List) result.get("data"); 80 | // accessRecordDOS.forEach(System.out::println); 81 | // } 82 | // 83 | // @Test 84 | // public void selectAccessRecordByUserIDTest(){ 85 | // List accessRecordDOS = accessRecordMapper.selectAccessRecords(null, "all", null, null); 86 | // accessRecordDOS.forEach(System.out::println); 87 | // } 88 | // 89 | // @Test 90 | // public void selectStockRecordTest() throws StockRecordManageServiceException { 91 | // Map result = stockRecordManageService.selectStockRecord(-1, "", "", "all", 5, 5); 92 | // } 93 | // 94 | // @Test 95 | // public void selectByRepositoryIDAndDateTest() throws ParseException { 96 | // String startDateString = "2017-04-03"; 97 | // String endDateString = "2017-04-06"; 98 | // DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); 99 | // Date startDate = dateFormat.parse(startDateString); 100 | // Date endDate = dateFormat.parse(endDateString); 101 | // Date newDate = new Date(); 102 | // System.out.println(endDate); 103 | // System.out.println(newDate); 104 | // List stockInDOS = stockInMapper.selectByRepositoryIDAndDate(1005, startDate, endDate); 105 | // stockInDOS.forEach(System.out::println); 106 | // } 107 | // 108 | // @Test 109 | // public void selectStockOutByRepositoryIDAndDateTest() { 110 | // List stockOutDOS = stockOutMapper.selectByRepositoryIDAndDate(1003, null, null); 111 | // stockOutDOS.forEach(System.out::println); 112 | // } 113 | //} 114 | -------------------------------------------------------------------------------- /src/test/java/com/ken/wms/security/util/CheckCodeGeneratorTest.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.security.util; 2 | 3 | import org.junit.Test; 4 | 5 | import java.util.Map; 6 | 7 | import static org.junit.Assert.*; 8 | 9 | public class CheckCodeGeneratorTest { 10 | 11 | CheckCodeGenerator checkCodeGenerator = new CheckCodeGenerator(); 12 | 13 | @Test 14 | public void generlateCheckCode() { 15 | Map checkCode = checkCodeGenerator.generlateCheckCode(); 16 | System.out.println(checkCode.get("checkCodeString")); 17 | System.out.println(checkCode.get("checkCodeImage")); 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/java/com/ken/wms/security/util/EncryptingModelTest.java: -------------------------------------------------------------------------------- 1 | package com.ken.wms.security.util; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | 6 | import java.security.NoSuchAlgorithmException; 7 | 8 | import static org.junit.Assert.*; 9 | 10 | public class EncryptingModelTest { 11 | 12 | EncryptingModel encryptingModel = new EncryptingModel(); 13 | 14 | @Test 15 | public void MD5() { 16 | try { 17 | System.out.println(encryptingModel.MD5("123456"));//e10adc3949ba59abbe56e057f20f883e 18 | System.out.println(encryptingModel.MD5("12345678"));//25d55ad283aa400af464c76d713c07ad 19 | 20 | System.out.println(encryptingModel.MD5("123456" + 1001));//905cdf7b9e5b8db762504e1b9aea495e 21 | System.out.println(encryptingModel.MD5("12345678" + 1001));//19692048ae10dc9eb25ad8d0e3299ae2 22 | 23 | System.out.println(encryptingModel.MD5("e10adc3949ba59abbe56e057f20f883e1001"));//6f5379e73c1a9eac6163ab8eaec7e41c 24 | System.out.println(encryptingModel.MD5("25d55ad283aa400af464c76d713c07ad1001"));//0ad942712ef7e271d233d2a88a4891ee 25 | } catch (NoSuchAlgorithmException e) { 26 | e.printStackTrace(); 27 | } 28 | } 29 | } --------------------------------------------------------------------------------