基于javaweb+jsp的仓库管理系统(SSM+jsp+mysql+maven)
一、项目简述功能包括: 仓库管理,出入库管理,仓库人员管理,基本信息管理, 供应商信息,系统管理等等。二、项目运行环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaS
·
一、项目简述
功能包括: 仓库管理,出入库管理,仓库人员管理,基本信息管理, 供应商信息,系统管理等等。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
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 offset 分页的偏移值
* @param limit 分页的大小
* @return 返回 JSON 数据 其中:Key为rows的值代表所有记录数据,Key为total的值代表记录的总条数
* @throws SystemLogServiceException SystemLogServiceException
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "getAccessRecords", method = RequestMethod.GET)
public @ResponseBody
Map<String, Object> getAccessRecords(@RequestParam("userID") String userIDStr,
@RequestParam("accessType") String accessType,
@RequestParam("startDate") String startDateStr,
@RequestParam("endDate") String endDateStr,
@RequestParam("offset") int offset,
@RequestParam("limit") int limit) throws SystemLogServiceException {
// 创建 Response 对象
Response response = ResponseFactory.newInstance();
List<AccessRecordDO> rows = null;
long total = 0;
// 检查参数
String regex = "([0-9]{4})-([0-9]{2})-([0-9]{2})";
boolean startDateFormatCheck = (StringUtils.isEmpty(startDateStr) || startDateStr.matches(regex));
outputStream.close();
}
}
}
客户信息管理请求:
/**
* 客户信息管理请求 Handler
*
*/
@RequestMapping(value = "/**/customerManage")
@Controller
public class CustomerManageHandler {
@Autowired
private CustomerManageService customerManageService;
* 更新客户信息
*
* @param customer 客户信息
* @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
*/
@RequestMapping(value = "updateCustomer", method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> updateCustomer(@RequestBody Customer customer) throws CustomerManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
// 更新
String result = customerManageService.updateCustomer(customer) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
responseContent.setResponseResult(result);
return responseContent.generateResponse();
@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<Supplier> rows = null;
long total = 0;
// 查询
Map<String, Object> queryResult = query(searchType, keyWord, offset, limit);
Map<String, Object> updateCustomer(@RequestBody Customer customer) throws CustomerManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
// 更新
String result = customerManageService.updateCustomer(customer) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
responseContent.setResponseResult(result);
return responseContent.generateResponse();
}
/**
* 删除客户记录
*
boolean userIDCheck = (StringUtils.isEmpty(userIDStr) || StringUtils.isNumeric(userIDStr));
if (startDateFormatCheck && endDateFormatCheck && userIDCheck) {
// 转到 Service 进行查询
Integer userID = -1;
if (StringUtils.isNumeric(userIDStr))
userID = Integer.valueOf(userIDStr);
Map<String, Object> queryResult = systemLogService.selectUserOperationRecord(userID, startDateStr, endDateStr, offset, limit);
if (queryResult != null) {
rows = (List<UserOperationRecordDTO>) queryResult.get("data");
total = (long) queryResult.get("total");
boolean userIDCheck = (StringUtils.isEmpty(userIDStr) || StringUtils.isNumeric(userIDStr));
if (startDateFormatCheck && endDateFormatCheck && userIDCheck) {
// 转到 Service 进行查询
Integer userID = -1;
if (StringUtils.isNumeric(userIDStr))
userID = Integer.valueOf(userIDStr);
Map<String, Object> queryResult = systemLogService.selectUserOperationRecord(userID, startDateStr, endDateStr, offset, limit);
if (queryResult != null) {
rows = (List<UserOperationRecordDTO>) queryResult.get("data");
total = (long) queryResult.get("total");
}
} else
response.setResponseMsg("Request argument error");
if (rows == null)
rows = new ArrayList<>(0);
response.setCustomerInfo("rows", rows);
response.setResponseTotal(total);
return response.generateResponse();
}
}
if (customer != null) {
result = Response.RESPONSE_RESULT_SUCCESS;
}
}
// 设置 Response
responseContent.setResponseResult(result);
responseContent.setResponseData(customer);
return responseContent.generateResponse();
}
/**
* 更新客户信息
*
* @param customer 客户信息
* @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
*/
@RequestMapping(value = "updateCustomer", method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> updateCustomer(@RequestBody Customer customer) throws CustomerManageServiceException {
@RequestMapping(value = "getAccessRecords", method = RequestMethod.GET)
public @ResponseBody
Map<String, Object> getAccessRecords(@RequestParam("userID") String userIDStr,
@RequestParam("accessType") String accessType,
@RequestParam("startDate") String startDateStr,
@RequestParam("endDate") String endDateStr,
@RequestParam("offset") int offset,
@RequestParam("limit") int limit) throws SystemLogServiceException {
// 创建 Response 对象
Response response = ResponseFactory.newInstance();
List<AccessRecordDO> rows = null;
long total = 0;
// 检查参数
String regex = "([0-9]{4})-([0-9]{2})-([0-9]{2})";
boolean startDateFormatCheck = (StringUtils.isEmpty(startDateStr) || startDateStr.matches(regex));
boolean endDateFormatCheck = (StringUtils.isEmpty(endDateStr) || endDateStr.matches(regex));
boolean userIDCheck = (StringUtils.isEmpty(userIDStr) || StringUtils.isNumeric(userIDStr));
if (startDateFormatCheck && endDateFormatCheck && userIDCheck) {
// 转到 Service 执行查询
Integer userID = -1;
if (StringUtils.isNumeric(userIDStr))
userID = Integer.valueOf(userIDStr);
Map<String, Object> queryResult = systemLogService.selectAccessRecord(userID, accessType, startDateStr, endDateStr, offset, limit);
if (queryResult != null) {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
List<Supplier> rows = null;
long total = 0;
// 查询
Map<String, Object> queryResult = query(searchType, keyWord, offset, limit);
if (queryResult != null) {
rows = (List<Supplier>) queryResult.get("data");
total = (long) queryResult.get("total");
}
// 设置 Response
responseContent.setCustomerInfo("rows", rows);
responseContent.setResponseTotal(total);
return responseContent.generateResponse();
}
/**
* 添加一条货物信息
*
* @param goods 货物信息
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();
/**
* 导入客户信息
*
* @param file 保存有客户信息的文件
* @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与
* error;key为total表示导入的总条数;key为available表示有效的条数
*/
@RequestMapping(value = "importCustomer", method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> importCustomer(@RequestParam("file") MultipartFile file) throws CustomerManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
String result = Response.RESPONSE_RESULT_SUCCESS;
// 读取文件内容
int total = 0;
int available = 0;
if (file == null)
}
// 设置 Response
responseContent.setResponseResult(result);
responseContent.setResponseData(customer);
return responseContent.generateResponse();
}
/**
* 更新客户信息
*
* @param customer 客户信息
* @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
*/
@RequestMapping(value = "updateCustomer", method = RequestMethod.POST)
// 创建 Response
Response response = ResponseFactory.newInstance();
List<UserOperationRecordDTO> rows = null;
long total = 0;
// 检查参数
String regex = "([0-9]{4})-([0-9]{2})-([0-9]{2})";
boolean startDateFormatCheck = (StringUtils.isEmpty(startDateStr) || startDateStr.matches(regex));
boolean endDateFormatCheck = (StringUtils.isEmpty(endDateStr) || endDateStr.matches(regex));
boolean userIDCheck = (StringUtils.isEmpty(userIDStr) || StringUtils.isNumeric(userIDStr));
if (startDateFormatCheck && endDateFormatCheck && userIDCheck) {
// 转到 Service 进行查询
Integer userID = -1;
if (StringUtils.isNumeric(userIDStr))
// 设置响应头
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
*
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
List<Supplier> rows = null;
long total = 0;
// 查询
Map<String, Object> queryResult = query(searchType, keyWord, offset, limit);
if (queryResult != null) {
rows = (List<Supplier>) 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
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();
}
/**
responseContent.setCustomerInfo("rows", rows);
responseContent.setResponseTotal(total);
responseContent.setResponseResult(Response.RESPONSE_RESULT_SUCCESS);
return responseContent.generateResponse();
}
/**
* 添加一条客户信息
*
* @param customer 客户信息
* @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
*/
@RequestMapping(value = "addCustomer", method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> addCustomer(@RequestBody Customer customer) throws CustomerManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
// 添加记录
}
/**
* 导入客户信息
*
* @param file 保存有客户信息的文件
* @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与
* error;key为total表示导入的总条数;key为available表示有效的条数
*/
@RequestMapping(value = "importCustomer", method = RequestMethod.POST)
public
@ResponseBody
Map<String, Object> importCustomer(@RequestParam("file") MultipartFile file) throws CustomerManageServiceException {
// 初始化 Response
Response responseContent = ResponseFactory.newInstance();
String result = Response.RESPONSE_RESULT_SUCCESS;
// 读取文件内容
int total = 0;
int available = 0;
if (file == null)
result = Response.RESPONSE_RESULT_ERROR;
Map<String, Object> importInfo = customerManageService.importCustomer(file);
userID = Integer.valueOf(userIDStr);
Map<String, Object> queryResult = systemLogService.selectUserOperationRecord(userID, startDateStr, endDateStr, offset, limit);
if (queryResult != null) {
rows = (List<UserOperationRecordDTO>) queryResult.get("data");
total = (long) queryResult.get("total");
}
} else
response.setResponseMsg("Request argument error");
if (rows == null)
rows = new ArrayList<>(0);
response.setCustomerInfo("rows", rows);
response.setResponseTotal(total);
return response.generateResponse();
}
}
货物信息管理请求:
/**
*
* @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();
}
/**
}
// 设置 Response
responseContent.setCustomerInfo("rows", rows);
responseContent.setResponseTotal(total);
return responseContent.generateResponse();
}
/**
* 添加一条货物信息
*
* @param goods 货物信息
* @return 返回一个map,其中:key 为 result表示操作的结果,包括:success 与 error
*/
*
*/
@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 分页大小
List<UserOperationRecordDTO> rows = null;
long total = 0;
// 检查参数
String regex = "([0-9]{4})-([0-9]{2})-([0-9]{2})";
boolean startDateFormatCheck = (StringUtils.isEmpty(startDateStr) || startDateStr.matches(regex));
boolean endDateFormatCheck = (StringUtils.isEmpty(endDateStr) || endDateStr.matches(regex));
boolean userIDCheck = (StringUtils.isEmpty(userIDStr) || StringUtils.isNumeric(userIDStr));
if (startDateFormatCheck && endDateFormatCheck && userIDCheck) {
// 转到 Service 进行查询
Integer userID = -1;
if (StringUtils.isNumeric(userIDStr))
userID = Integer.valueOf(userIDStr);
Map<String, Object> queryResult = systemLogService.selectUserOperationRecord(userID, startDateStr, endDateStr, offset, limit);
if (queryResult != null) {
* @param startDateStr 记录的起始日期
* @param endDateStr 记录的结束日期
* @param offset 分页的偏移值
* @param limit 分页的大小
* @return 返回 JSON 数据 其中:Key为rows的值代表所有记录数据,Key为total的值代表记录的总条数
* @throws SystemLogServiceException SystemLogServiceException
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "getUserOperationRecords")
public @ResponseBody
Map<String, Object> selectUserOperationRecords(@RequestParam("userID") String userIDStr,
@RequestParam("startDate") String startDateStr,
@RequestParam("endDate") String endDateStr,
@RequestParam("offset") int offset,
@RequestParam("limit") int limit) throws SystemLogServiceException {
// 创建 Response
String regex = "([0-9]{4})-([0-9]{2})-([0-9]{2})";
boolean startDateFormatCheck = (StringUtils.isEmpty(startDateStr) || startDateStr.matches(regex));
boolean endDateFormatCheck = (StringUtils.isEmpty(endDateStr) || endDateStr.matches(regex));
boolean userIDCheck = (StringUtils.isEmpty(userIDStr) || StringUtils.isNumeric(userIDStr));
if (startDateFormatCheck && endDateFormatCheck && userIDCheck) {
// 转到 Service 进行查询
Integer userID = -1;
if (StringUtils.isNumeric(userIDStr))
userID = Integer.valueOf(userIDStr);
Map<String, Object> queryResult = systemLogService.selectUserOperationRecord(userID, startDateStr, endDateStr, offset, limit);
if (queryResult != null) {
rows = (List<UserOperationRecordDTO>) queryResult.get("data");
total = (long) queryResult.get("total");
}
} else
response.setResponseMsg("Request argument error");
if (rows == null)
rows = new ArrayList<>(0);
response.setCustomerInfo("rows", rows);
response.setResponseTotal(total);
return response.generateResponse();
}
}
货物信息管理请求:
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> 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();
}
/**
* 导入货物信息
// 设置 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();
@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 {

更多推荐
所有评论(0)