技术范围:SpringBoot、Vue、SSM、HLMT、Jsp、PHP、Nodejs、Python、爬虫、数据可视化、小程序、安卓app、大数据、物联网、机器学习等设计与开发。
主要内容:免费功能设计、开题报告、任务书、中期检查PPT、系统功能实现、代码编写、论文编写和辅导、论文降重、长期答辩答疑辅导、腾讯会议一对一专业讲解辅导答辩、模拟答辩演练、和理解代码逻辑思路。
🍅文末获取源码联系🍅
🍅文末获取源码联系🍅
🍅文末获取源码联系🍅
👇🏻 精彩专栏推荐订阅👇🏻 不然下次找不到哟
《课程设计专栏》
《Java专栏》
《Python专栏》
⛺️心若有所向往,何惧道阻且长
文章目录
- 一、运行环境要求
- 二、开发工具推荐
- (一)后端开发工具
- (二)前端开发工具
- 三、项目适用场景
- 四、项目介绍
- 管理员角色功能:
- 员工角色功能:
- 五、环境搭建与项目运行
- 六、使用说明
- 七、文档介绍展示
- 八、功能页面展示
- 九、部分代码展示
在科技飞速发展的当下,智能无人仓库管理系统正逐渐成为现代物流行业的关键支撑。今天,为大家带来一款基于 JavaWeb 的 SpringBoot 智能无人仓库管理系统,详细介绍其运行环境、开发工具、适用场景、技术栈以及使用说明等关键信息。
一、运行环境要求
Java:本系统要求 Java 版本为 Java≥8。Java 8 引入了众多实用特性,如 Lambda 表达式、Stream API 等,极大提升了开发效率。其优化的性能与稳定性,为智能无人仓库管理系统在处理大量数据和复杂业务逻辑时提供坚实保障,确保系统能持续高效运行。
MySQL:数据库需采用 MySQL≥5.7。高版本 MySQL 在数据存储可靠性上表现卓越,面对仓库海量货物信息、员工数据以及各类业务记录,能精准保障数据的完整性与一致性。在事务处理方面,其高效算法可快速应对复杂业务场景,如补货申请、货物出入库等操作涉及的事务处理,保证数据的准确性与操作的原子性。
Node.js:Node.js≥14 是前端运行必不可少的环境。在前后端分离架构中,Node.js 凭借非阻塞 I/O 模型,让前端在处理高并发请求时,能迅速响应,有效提升系统整体性能。但需注意,由于本项目采用前后端分离模式,若无 Node.js 基础,开发过程将困难重重,因此不建议此类开发者参与。
二、开发工具推荐
(一)后端开发工具
eclipse:作为经典的 Java 开发工具,eclipse 拥有庞大的插件生态系统。在开发智能无人仓库管理系统时,通过安装如代码生成、数据库连接优化等插件,能大幅提升开发效率。无论是小型仓库的定制化系统,还是大型物流中心的综合管理平台开发,eclipse 都能凭借其扩展性满足不同规模项目需求。
idea:由 JetBrains 精心打造的 idea,以智能代码提示功能闻名。在编写智能无人仓库管理系统代码时,它能精准预测开发者意图,快速提供代码建议,极大加快代码编写速度。其强大的调试功能在处理复杂业务逻辑,如员工绩效评估、工作任务分配逻辑时,能帮助开发者迅速定位并解决代码问题,节省大量开发时间。
myeclipse:专为企业级 Java 开发设计,myeclipse 集成了丰富的企业级开发功能与插件。在智能无人仓库管理系统开发中,它对各类应用服务器的深度集成,方便开发者将系统部署到不同服务器环境。代码生成工具可根据数据库表结构快速生成 Java 实体类和数据访问层代码,减少重复劳动,提高开发效率。
sts:即 Spring Tool Suite,是专门为 Spring 框架开发定制的工具。对于基于 SpringBoot 的智能无人仓库管理系统,sts 具有显著优势。其自动配置功能可依据项目依赖关系,快速搭建项目基础配置,减少开发者手动配置工作。代码模板功能方便开发者快速生成常见代码结构,如控制器、服务层代码等。可视化的 Spring Bean 管理功能,让开发者能直观管理 Spring 容器中的 Bean,便于进行依赖注入等操作。
(二)前端开发工具
WebStorm:作为 JetBrains 旗下专业前端开发工具,WebStorm 对 Vue 等前端框架的支持近乎完美。在开发智能无人仓库管理系统前端界面时,其强大的代码编辑功能,如代码智能补全、语法检查、代码重构等,可使开发者编写代码更加流畅,减少代码错误。高效的调试工具能帮助开发者快速定位前端页面问题,优化用户体验,确保如货物监控、员工任务操作等界面的流畅性与稳定性。
VSCode:微软推出的轻量级代码编辑器 VSCode,凭借丰富的插件生态系统在前端开发领域迅速崛起。开发者可根据智能无人仓库管理系统前端开发需求,安装代码格式化插件统一代码风格,代码片段管理插件方便复用常用代码,代码调试插件实现高效调试。这些插件让前端开发更加便捷高效,有效提升开发效率。
HBuilderX:专注于 HTML5 开发的 HBuilderX,在智能无人仓库管理系统前端页面开发方面具备诸多便捷功能。它提供的丰富 HTML5 模板,可快速搭建前端页面基本结构。可视化页面设计工具使开发者无需编写大量代码,就能设计出美观的页面,如仓库布局展示、货物分类管理页面等。快速代码生成功能可根据开发者操作自动生成相关代码,有效缩短项目开发周期。
三、项目适用场景
课程设计:对于学习 JavaWeb、SpringBoot、MyBatis 等相关课程的学生而言,智能无人仓库管理系统是一个综合性极强的实践案例。通过参与项目开发,学生能将课堂所学理论知识,如数据库操作、Web 开发框架使用等,应用到实际项目中,深入理解和掌握相关技术,全面提升项目实践能力。
大作业:作为一项大作业,该项目能全面检验学生对多门课程知识的掌握与运用能力。学生需要整合 Java 编程、数据库设计、前端开发等多方面知识,从需求分析开始,逐步完成系统设计、编码实现以及测试等全过程,培养综合运用知识解决实际问题的能力。
毕业设计:对于计算机相关专业的学生,智能无人仓库管理系统是毕业设计的优质选择。项目涵盖前后端开发、数据库设计、系统架构等多方面内容,能充分展示学生的专业能力与综合素质。通过完成这样一个具有实际应用价值的项目,为大学生涯画上圆满句号。
项目练习:对于开发者来说,该项目是练习前后端分离开发技术的理想平台。通过参与智能无人仓库管理系统的开发,开发者可积累实际项目经验,熟练掌握 SpringBoot、MyBatis、Vue、ElementUI 等技术在实际项目中的应用技巧,提升在 JavaWeb 开发领域的技术水平与项目实践能力。
学习演示:该项目能清晰展示基于 SpringBoot 和 Vue 的项目开发流程与架构。无论是初学者了解项目开发基本流程,还是有一定经验的开发者学习新的技术组合,都具有很好的学习与演示价值,便于大家进行学习和交流。
四、项目介绍
本智能无人仓库管理系统基于 Springboot + vue 技术栈构建,包含管理员与员工两个角色。
管理员角色功能:
账户管理:可创建新的管理员账户,对现有管理员账户信息进行编辑,删除不必要的管理员账户,确保管理员团队的合理构成。
权限分配:为不同管理员分配管理权限,依据其职责赋予相应操作权限,如数据查看、修改、删除等权限,保障系统操作的安全性与规范性。
员工管理:详细记录员工出勤情况,合理分配工作任务,实时监控员工工作效率,定期进行绩效评估,全面管理员工工作状态,提升团队整体工作效率。
仓库业务管理:及时查看补货提醒,对补货申请进行审批,维护仓库基础数据,包括货物信息、仓库布局等数据的更新与管理,确保仓库业务的正常运转。
员工角色功能:
操作记录查看:员工可随时查看个人操作记录,了解自己在仓库管理中的各项操作情况,便于自我总结与问题追溯。
任务执行:完成上级分配的工作任务,确保仓库各项业务的顺利进行。
补货提醒提交:在发现货物库存需要补货时,及时提交补货提醒,保障仓库货物的充足供应。
五、环境搭建与项目运行
运行环境:建议使用 java jdk 1.8,本系统在此环境下经过充分测试与运行。理论上其他符合 Java≥8 要求的版本也可支持,但可能存在兼容性差异。
IDE 环境:IDEA、Eclipse、Myeclipse 均可用于项目开发。其中,IDEA 凭借其强大的功能与便捷的操作,成为推荐的开发工具,能显著提升开发体验与效率。
硬件环境:系统可在 windows 7/8/10 操作系统上运行,内存要求 1G 以上;对于使用苹果系统的用户,Mac OS 同样适用,确保系统流畅运行。
数据库:MySql 5.7/8.0 版本均可作为本系统的数据库。用户可根据实际需求与环境选择合适版本,用于存储仓库管理系统中的各类数据。
Maven 项目特性:本项目为 Maven 项目,利用 Maven 强大的项目管理功能,实现项目依赖的自动管理、项目构建与部署的规范化操作。
六、使用说明
数据库创建与导入:使用 Navicat 或其他数据库管理工具,在 mysql 中创建与项目 sql 文件同名的数据库,然后将项目提供的 sql 文件导入该数据库,完成数据库表结构与初始数据的创建。
项目导入与构建:使用 IDEA/Eclipse/MyEclipse 导入项目。导入成功后,在开发工具中执行 maven clean;maven install 命令,清理项目旧文件并重新构建项目,下载项目所需的各种依赖库。
数据库配置修改:打开项目中的 application.yml 配置文件,将其中的数据库配置信息修改为自己实际的数据库配置,包括数据库地址、端口、用户名、密码等,确保项目能正确连接数据库。
项目运行与访问:完成上述步骤后,运行项目。在浏览器地址栏中输入:http://localhost:8080/wurenchangku/admin/dist/index.html,即可访问系统。登录账户信息如下:
管理员:账号 admin,密码 admin
员工账户:账号 a1,密码 123456
七、文档介绍展示
补货提醒展示页面:用于直观展示仓库货物的补货提醒信息,帮助管理员及时了解库存情况,做出补货决策。
员工管理展示页面:集中展示员工的各项信息,包括出勤记录、工作任务分配、绩效评估结果等,方便管理员进行员工管理。
补货申请展示页面:呈现员工提交的补货申请详情,管理员可在此页面进行申请审批操作,确保补货流程的规范进行。
取货申请展示页面:展示客户或其他相关人员的取货申请信息,仓库工作人员可据此安排货物提取工作。
物品类型管理展示:对仓库中的物品类型进行分类管理与展示,方便对不同类型货物进行针对性管理。
修改密码展示页面:为管理员和员工提供修改登录密码的功能界面,保障账户安全。
通过以上全面介绍,相信大家对这款基于 JavaWeb 的 SpringBoot 智能无人仓库管理系统有了清晰认识。无论是用于学习实践还是项目开发,都具有极高的参考价值。
八、功能页面展示
九、部分代码展示
@Controller
@RequestMapping(value = “/**/repositoryAdminManage”)
public class RepositoryAdminManageHandler {
@Autowired
private RepositoryAdminManageService repositoryAdminManageService;
// 查询类型
private static final String SEARCH_BY_ID = “searchByID”;
private static final String SEARCH_BY_NAME = “searchByName”;
private static final String SEARCH_BY_REPOSITORY_ID = “searchByRepositoryID”;
private static final String SEARCH_ALL = “searchAll”;
/**
通用记录查询
@param keyWord 查询关键字
@param searchType 查询类型
@param offset 分页偏移值
@param limit 分页大小
@return 返回所有符合条件的记录
*/
private Map<String, Object> query(String keyWord, String searchType, int offset, int limit) throws RepositoryAdminManageServiceException {
Map<String, Object> queryResult = null;
// query
switch (searchType) {
case SEARCH_ALL:
queryResult = repositoryAdminManageService.selectAll(offset, limit);
break;
case SEARCH_BY_ID:
if (StringUtils.isNumeric(keyWord))
queryResult = repositoryAdminManageService.selectByID(Integer.valueOf(keyWord));
break;
case SEARCH_BY_NAME:
queryResult = repositoryAdminManageService.selectByName(offset, limit, keyWord);
break;
case SEARCH_BY_REPOSITORY_ID:
if (StringUtils.isNumeric(keyWord))
queryResult = repositoryAdminManageService.selectByRepositoryID(Integer.valueOf(keyWord));
break;
default:
// do other things
break;
return queryResult;
/**
查询仓库管理员信息
@param searchType 查询类型
@param offset 分页偏移值
@param limit 分页大小
@param keyWord 查询关键字
@return 返回一个Map,其中key=rows,表示查询出来的记录;key=total,表示记录的总条数
*/
@SuppressWarnings(“unchecked”)
@RequestMapping(value = “getRepositoryAdminList”, method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> getRepositoryAdmin(@RequestParam(“searchType”) String searchType,
@RequestParam(“keyWord”) String keyWord, @RequestParam(“offset”) int offset,
@RequestParam(“limit”) int limit) throws RepositoryAdminManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
List rows = null;
long total = 0;
// 查询
Map<String, Object> queryResult = query(keyWord, searchType, offset, limit);
if (queryResult != null) {
rows = (List) queryResult.get(“data”);
total = (long) queryResult.get(“total”);
// 设置 Response
responseContent.setCustomerInfo(“rows”, rows);
responseContent.setResponseTotal(total);
return responseContent.generateResponse();
/**
添加一条仓库管理员信息
@param repositoryAdmin 仓库管理员信息
@return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
*/
@RequestMapping(value = “addRepositoryAdmin”, method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> addRepositoryAdmin(@RequestBody RepositoryAdmin repositoryAdmin) throws RepositoryAdminManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
// 添加结果
String result = repositoryAdminManageService.addRepositoryAdmin(repositoryAdmin)
? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
// 设置 Response
responseContent.setResponseResult(result);
return responseContent.generateResponse();
/**
查询指定 ID 的仓库管理员信息
@param repositoryAdminID 仓库管理员ID
@return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
的值为仓库管理员信息
*/
@RequestMapping(value = “getRepositoryAdminInfo”, method = RequestMethod.GET)
public
```c
@ResponseBody
Map<String, Object> getRepositoryAdminInfo(Integer repositoryAdminID) throws RepositoryAdminManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
String result = Response.RESPONSE_RESULT_ERROR;
// 查询
RepositoryAdmin repositoryAdmin = null;
Map<String, Object> queryResult = repositoryAdminManageService.selectByID(repositoryAdminID);
if (queryResult != null) {
if ((repositoryAdmin = (RepositoryAdmin) queryResult.get(“data”)) != null)
result = Response.RESPONSE_RESULT_SUCCESS;
// 设置 Response
responseContent.setResponseResult(result);
responseContent.setResponseData(repositoryAdmin);
return responseContent.generateResponse();
/**
更新仓库管理员信息
@param repositoryAdmin 仓库管理员信息
@return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
的值为仓库管理员信息
*/
@RequestMapping(value = “updateRepositoryAdmin”, method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> updateRepositoryAdmin(@RequestBody RepositoryAdmin repositoryAdmin) throws RepositoryAdminManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
// 更新
String result = repositoryAdminManageService.updateRepositoryAdmin(repositoryAdmin)
? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
// 设置 Response
responseContent.setResponseResult(result);
return responseContent.generateResponse();
/**
删除指定 ID 的仓库管理员信息
@param repositoryAdminID 仓库ID
@return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
的值为仓库管理员信息
*/
@RequestMapping(value = “deleteRepositoryAdmin”, method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> deleteRepositoryAdmin(Integer repositoryAdminID) throws RepositoryAdminManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
// 删除记录
String result = repositoryAdminManageService.deleteRepositoryAdmin(repositoryAdminID)
? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
// 设置 Response
responseContent.setResponseResult(result);
return responseContent.generateResponse();
/**
从文件中导入仓库管理员信息
@param file 保存有仓库管理员信息的文件
@return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与
error;key为total表示导入的总条数;key为available表示有效的条数
*/
@RequestMapping(value = “importRepositoryAdmin”, method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> importRepositoryAdmin(MultipartFile file) throws RepositoryAdminManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
String result = Response.RESPONSE_RESULT_ERROR;
// 读取文件
long total = 0;
long available = 0;
if (file != null) {
Map<String, Object> importInfo = repositoryAdminManageService.importRepositoryAdmin(file);
if (importInfo != null) {
total = (long) importInfo.get(“total”);
available = (long) importInfo.get(“available”);
result = Response.RESPONSE_RESULT_SUCCESS;
// 设置 Response
responseContent.setResponseResult(result);
responseContent.setResponseTotal(total);
responseContent.setCustomerInfo(“available”, available);
return responseContent.generateResponse();
/**
导出仓库管理员信息到文件中
@param searchType 查询类型
@param keyWord 查询关键字
@param response HttpServletResponse
*/
@SuppressWarnings(“unchecked”)
@RequestMapping(value = “exportRepositoryAdmin”, method = RequestMethod.GET)
public void exportRepositoryAdmin(@RequestParam(“searchType”) String searchType,
@RequestParam(“keyWord”) String keyWord, HttpServletResponse response) throws RepositoryAdminManageServiceException, IOException {
// 导出文件名
String fileName = “repositoryAdminInfo.xlsx”;
// 查询
List repositoryAdmins;
Map<String, Object> queryResult = query(keyWord, searchType, -1, -1);
if (queryResult != null)
repositoryAdmins = (List) queryResult.get(“data”);
else
repositoryAdmins = new ArrayList<>();
// 生成文件
File file = repositoryAdminManageService.exportRepositoryAdmin(repositoryAdmins);
// 输出文件
if (file != null) {
// 设置响应头
response.addHeader(“Content-Disposition”, “attachment;filename=” + fileName);
FileInputStream inputStream = new FileInputStream(file);
OutputStream outputStream = response.getOutputStream();
byte[] buffer = new byte[8192];
int len;
while ((len = inputStream.read(buffer, 0, buffer.length)) > 0) {
outputStream.write(buffer, 0, len);
outputStream.flush();
inputStream.close();
outputStream.close();
货物信息管理请求:
/**
货物信息管理请求 Handler
@author yy
*/
@RequestMapping(value = “/**/goodsManage”)
@Controller
public class GoodsManageHandler {
@Autowired
private GoodsManageService goodsManageService;
private static final String SEARCH_BY_ID = “searchByID”;
private static final String SEARCH_BY_NAME = “searchByName”;
private static final String SEARCH_ALL = “searchAll”;
/**
通用的记录查询
@param searchType 查询类型
@param keyWord 查询关键字
@param offset 分页偏移值
@param limit 分页大小
@return 返回一个 Map ,包含所有符合要求的查询结果,以及记录的条数
*/
private Map<String, Object> query(String searchType, String keyWord, int offset, int limit) throws GoodsManageServiceException {
Map<String, Object> queryResult = null;
switch (searchType) {
case SEARCH_BY_ID:
if (StringUtils.isNumeric(keyWord))
queryResult = goodsManageService.selectById(Integer.valueOf(keyWord));
break;
case SEARCH_BY_NAME:
queryResult = goodsManageService.selectByName(keyWord);
break;
case SEARCH_ALL:
queryResult = goodsManageService.selectAll(offset, limit);
break;
default:
// do other thing
break;
return queryResult;
/**
搜索货物信息
@param searchType 搜索类型
@param offset 如有多条记录时分页的偏移值
@param limit 如有多条记录时分页的大小
@param keyWord 搜索的关键字
@return 返回所有符合要求的记录
*/
@SuppressWarnings(“unchecked”)
@RequestMapping(value = “getGoodsList”, method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> getGoodsList(@RequestParam(“searchType”) String searchType,
@RequestParam(“offset”) int offset, @RequestParam(“limit”) int limit,
@RequestParam(“keyWord”) String keyWord) throws GoodsManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
List rows = null;
long total = 0;
// 查询
Map<String, Object> queryResult = query(searchType, keyWord, offset, limit);
if (queryResult != null) {
rows = (List) queryResult.get(“data”);
total = (long) queryResult.get(“total”);
// 设置 Response
responseContent.setCustomerInfo(“rows”, rows);
responseContent.setResponseTotal(total);
return responseContent.generateResponse();
/**
添加一条货物信息
@param goods 货物信息
@return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
*/
@RequestMapping(value = “addGoods”, method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> addGoods(@RequestBody Goods goods) throws GoodsManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
// 添加记录
String result = goodsManageService.addGoods(goods) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
// 设置 Response
responseContent.setResponseResult(result);
return responseContent.generateResponse();
/**
查询指定 goods ID 货物的信息
@param goodsID 货物ID
@return 返回一个map,其中:key 为 result 的值为操作的结果,包括:success 与 error;key 为 data
的值为货物信息
*/
@RequestMapping(value = “getGoodsInfo”, method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> getGoodsInfo(@RequestParam(“goodsID”) Integer goodsID) throws GoodsManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
String result = Response.RESPONSE_RESULT_ERROR;
// 获取货物信息
Goods goods = null;
Map<String, Object> queryResult = goodsManageService.selectById(goodsID);
if (queryResult != null) {
goods = (Goods) queryResult.get(“data”);
if (goods != null) {
result = Response.RESPONSE_RESULT_SUCCESS;
// 设置 Response
responseContent.setResponseResult(result);
responseContent.setResponseData(goods);
return responseContent.generateResponse();
/**
更新货物信息
@param goods 货物信息
@return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
*/
@RequestMapping(value = “updateGoods”, method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> updateGoods(@RequestBody Goods goods) throws GoodsManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
// 更新
String result = goodsManageService.updateGoods(goods) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
// 设置 Response
responseContent.setResponseResult(result);
return responseContent.generateResponse();
/**
删除货物记录
@param goodsID 货物ID
@return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
*/
@RequestMapping(value = “deleteGoods”, method = RequestMethod.GET)
public
@ResponseBody
Map<String, Object> deleteGoods(@RequestParam(“goodsID”) Integer goodsID) throws GoodsManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
// 删除
String result = goodsManageService.deleteGoods(goodsID) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
// 设置 Response
responseContent.setResponseResult(result);
return responseContent.generateResponse();
/**
导入货物信息
@param file 保存有货物信息的文件
@return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与
error;key为total表示导入的总条数;key为available表示有效的条数
*/
@RequestMapping(value = “importGoods”, method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> importGoods(@RequestParam(“file”) MultipartFile file) throws GoodsManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
String result = Response.RESPONSE_RESULT_ERROR;
// 读取文件内容
int total = 0;
int available = 0;
if (file != null) {
Map<String, Object> importInfo = goodsManageService.importGoods(file);
if (importInfo != null) {
total = (int) importInfo.get(“total”);
available = (int) importInfo.get(“available”);
result = Response.RESPONSE_RESULT_SUCCESS;
// 设置 Response
responseContent.setResponseResult(result);
responseContent.setResponseTotal(total);
responseContent.setCustomerInfo(“available”, available);
return responseContent.generateResponse();
/**
导出货物信息
@param searchType 查找类型
@param keyWord 查找关键字
@param response HttpServletResponse
*/
@SuppressWarnings(“unchecked”)
@RequestMapping(value = “exportGoods”, method = RequestMethod.GET)
public void exportGoods(@RequestParam(“searchType”) String searchType, @RequestParam(“keyWord”) String keyWord,
HttpServletResponse response) throws GoodsManageServiceException, IOException {
String fileName = “goodsInfo.xlsx”;
List goodsList = null;
Map<String, Object> queryResult = query(searchType, keyWord, -1, -1);
if (queryResult != null) {
goodsList = (List) queryResult.get(“data”);
// 获取生成的文件
File file = goodsManageService.exportGoods(goodsList);
// 写出文件
if (file != null) {
// 设置响应头
response.addHeader(“Content-Disposition”, “attachment;filename=” + fileName);
FileInputStream inputStream = new FileInputStream(file);
OutputStream outputStream = response.getOutputStream();
byte[] buffer = new byte[8192];
int len;
while ((len = inputStream.read(buffer, 0, buffer.length)) > 0) {
outputStream.write(buffer, 0, len);
outputStream.flush();
inputStream.close();
outputStream.close();
客户信息管理请求:
/**
客户信息管理请求
@author yy
*/
@RequestMapping(value = “/**/customerManage”)
@Controller
public class CustomerManageHandler {
@Autowired
private CustomerManageService customerManageService;
private static final String SEARCH_BY_ID = “searchByID”;
private static final String SEARCH_BY_NAME = “searchByName”;
private static final String SEARCH_ALL = “searchAll”;
/**
通用的结果查询方法
@param searchType 查询方式
@param keyWord 查询关键字
@param offset 分页偏移值
@param limit 分页大小
@return 返回指定条件查询的结果
*/