文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

Java实战中怎样进行仓库管理系统的实现

2023-06-28 23:25

关注

这篇文章主要为大家分析了Java实战中怎样进行仓库管理系统的实现的相关知识点,内容详细易懂,操作细节合理,具有一定参考价值。如果感兴趣的话,不妨跟着跟随小编一起来看看,下面跟着小编一起深入学习“Java实战中怎样进行仓库管理系统的实现”的知识吧。

基于SSM框架的仓库管理系统

功能:

使用到的框架和库:

Java实战中怎样进行仓库管理系统的实现

Java实战中怎样进行仓库管理系统的实现

Java实战中怎样进行仓库管理系统的实现

Java实战中怎样进行仓库管理系统的实现

Java实战中怎样进行仓库管理系统的实现

Java实战中怎样进行仓库管理系统的实现

仓库管理员管理请求:

@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";         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;    }         @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<RepositoryAdmin> rows = null;        long total = 0;         // 查询        Map<String, Object> queryResult = query(keyWord, searchType, offset, limit);         if (queryResult != null) {            rows = (List<RepositoryAdmin>) queryResult.get("data");            total = (long) queryResult.get("total");        }         // 设置 Response        responseContent.setCustomerInfo("rows", rows);        responseContent.setResponseTotal(total);        return responseContent.generateResponse();    }         @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();    }         @RequestMapping(value = "getRepositoryAdminInfo", method = RequestMethod.GET)    public    @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();    }         @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();    }         @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();    }         @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();    }         @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<RepositoryAdmin> repositoryAdmins;        Map<String, Object> queryResult = query(keyWord, searchType, -1, -1);         if (queryResult != null)            repositoryAdmins = (List<RepositoryAdmin>) 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();        }    }}

货物信息管理请求: 

@RequestMapping(value = "goodsManage")@Controllerpublic 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";         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;    }         @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<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();    }         @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();    }         @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();    }         @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();    }         @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();    }         @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();    }         @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<Goods> goodsList = null;        Map<String, Object> queryResult = query(searchType, keyWord, -1, -1);         if (queryResult != null) {            goodsList = (List<Goods>) 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();         }    }}

客户信息管理请求:

@RequestMapping(value = "customerManage")@Controllerpublic 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";         private Map<String, Object> query(String searchType, String keyWord, int offset, int limit) throws CustomerManageServiceException {        Map<String, Object> queryResult = null;         switch (searchType) {            case SEARCH_BY_ID:                if (StringUtils.isNumeric(keyWord))                    queryResult = customerManageService.selectById(Integer.valueOf(keyWord));                break;            case SEARCH_BY_NAME:                queryResult = customerManageService.selectByName(offset, limit, keyWord);                break;            case SEARCH_ALL:                queryResult = customerManageService.selectAll(offset, limit);                break;            default:                // do other thing                break;        }        return queryResult;    }         @SuppressWarnings("unchecked")    @RequestMapping(value = "getCustomerList", method = RequestMethod.GET)    public    @ResponseBody    Map<String, Object> getCustomerList(@RequestParam("searchType") String searchType,                                        @RequestParam("offset") int offset,                                        @RequestParam("limit") int limit,                                        @RequestParam("keyWord") String keyWord) throws CustomerManageServiceException {        // 初始化 Response        Response responseContent = ResponseFactory.newInstance();         List<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);        responseContent.setResponseResult(Response.RESPONSE_RESULT_SUCCESS);        return responseContent.generateResponse();    }         @RequestMapping(value = "addCustomer", method = RequestMethod.POST)    public    @ResponseBody    Map<String, Object> addCustomer(@RequestBody Customer customer) throws CustomerManageServiceException {        // 初始化 Response        Response responseContent = ResponseFactory.newInstance();         // 添加记录        String result = customerManageService.addCustomer(customer) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;         responseContent.setResponseResult(result);        return responseContent.generateResponse();    }         @RequestMapping(value = "getCustomerInfo", method = RequestMethod.GET)    public    @ResponseBody    Map<String, Object> getCustomerInfo(@RequestParam("customerID") String customerID) throws CustomerManageServiceException {        // 初始化 Response        Response responseContent = ResponseFactory.newInstance();        String result = Response.RESPONSE_RESULT_ERROR;         // 获取客户信息        Customer customer = null;        Map<String, Object> queryResult = query(SEARCH_BY_ID, customerID, -1, -1);        if (queryResult != null) {            customer = (Customer) queryResult.get("data");            if (customer != null) {                result = Response.RESPONSE_RESULT_SUCCESS;            }        }         // 设置 Response        responseContent.setResponseResult(result);        responseContent.setResponseData(customer);         return responseContent.generateResponse();    }         @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();    }         @RequestMapping(value = "deleteCustomer", method = RequestMethod.GET)    public    @ResponseBody    Map<String, Object> deleteCustomer(@RequestParam("customerID") String customerIDStr) throws CustomerManageServiceException {        // 初始化 Response        Response responseContent = ResponseFactory.newInstance();         // 参数检查        if (StringUtils.isNumeric(customerIDStr)) {            // 转换为 Integer            Integer customerID = Integer.valueOf(customerIDStr);             // 刪除            String result = customerManageService.deleteCustomer(customerID) ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;            responseContent.setResponseResult(result);        } else            responseContent.setResponseResult(Response.RESPONSE_RESULT_ERROR);         return responseContent.generateResponse();    }         @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);        if (importInfo != null) {            total = (int) importInfo.get("total");            available = (int) importInfo.get("available");        }         responseContent.setResponseResult(result);        responseContent.setResponseTotal(total);        responseContent.setCustomerInfo("available", available);        return responseContent.generateResponse();    }         @SuppressWarnings("unchecked")    @RequestMapping(value = "exportCustomer", method = RequestMethod.GET)    public void exportCustomer(@RequestParam("searchType") String searchType, @RequestParam("keyWord") String keyWord,                               HttpServletResponse response) throws CustomerManageServiceException, IOException {         String fileName = "customerInfo.xlsx";         List<Customer> customers = null;        Map<String, Object> queryResult = query(searchType, keyWord, -1, -1);         if (queryResult != null) {            customers = (List<Customer>) queryResult.get("data");        }         // 获取生成的文件        File file = customerManageService.exportCustomer(customers);         // 写出文件        if (file != null) {            // 设置响应头            response.addHeader("Content-Disposition", "attachment;filename=" + fileName);            FileInputStream inputStream = new FileInputStream(file);            OutputStream outputStream = response.getOutputStream();            byte[] buffer = new byte[8192];             int len;            while ((len = inputStream.read(buffer, 0, buffer.length)) > 0) {                outputStream.write(buffer, 0, len);                outputStream.flush();            }             inputStream.close();            outputStream.close();         }    }}

商品出入库管理请求:

@Controller@RequestMapping(value = "stockRecordManage")public class StockRecordManageHandler {     @Autowired    private StockRecordManageService stockRecordManageService;         @RequestMapping(value = "stockOut", method = RequestMethod.POST)    public    @ResponseBody    Map<String, Object> stockOut(@RequestParam("customerID") Integer customerID,                                 @RequestParam("goodsID") Integer goodsID,                                 @RequestParam(value = "repositoryID", required = false) String repositoryIDStr,                                 @RequestParam("number") long number) throws StockRecordManageServiceException {        // 初始化 Response        Response responseContent = ResponseFactory.newInstance();        String result = Response.RESPONSE_RESULT_ERROR;        boolean authorizeCheck = true;        boolean argumentCheck = true;        Integer repositoryID = null;         // 参数检查        if (repositoryIDStr != null) {            if (StringUtils.isNumeric(repositoryIDStr)) {                repositoryID = Integer.valueOf(repositoryIDStr);            } else {                argumentCheck = false;                responseContent.setResponseMsg("request argument error");            }        }         // 获取 session 中的信息        Subject currentUser = SecurityUtils.getSubject();        Session session = currentUser.getSession();        UserInfoDTO userInfo = (UserInfoDTO) session.getAttribute("userInfo");        String personInCharge = userInfo == null ? "none" : userInfo.getUserName();        Integer repositoryIDBelong = userInfo == null ? -1 : userInfo.getRepositoryBelong();         // 设置非管理员请求的仓库ID        if (!currentUser.hasRole("systemAdmin")) {            if (repositoryIDBelong < 0) {                authorizeCheck = false;                responseContent.setResponseMsg("You are not authorized");            } else {                repositoryID = repositoryIDBelong;            }        }         if (authorizeCheck && argumentCheck) {            if (stockRecordManageService.stockOutOperation(customerID, goodsID, repositoryID, number, personInCharge))                result = Response.RESPONSE_RESULT_SUCCESS;        }         // 设置 Response        responseContent.setResponseResult(result);        return responseContent.generateResponse();    }         @RequestMapping(value = "stockIn", method = RequestMethod.POST)    public    @ResponseBody    Map<String, Object> stockIn(@RequestParam("supplierID") Integer supplierID,                                @RequestParam("goodsID") Integer goodsID,                                @RequestParam(value = "repositoryID", required = false) String repositoryIDStr,                                @RequestParam("number") long number) throws StockRecordManageServiceException {        // 初始化 Response        Response responseContent = ResponseFactory.newInstance();        String result = Response.RESPONSE_RESULT_ERROR;        boolean authorizeCheck = true;        boolean argumentCheck = true;        Integer repositoryID = null;         // 参数检查        if (repositoryIDStr != null) {            if (StringUtils.isNumeric(repositoryIDStr)) {                repositoryID = Integer.valueOf(repositoryIDStr);            } else {                argumentCheck = false;                responseContent.setResponseMsg("request argument error");            }        }         // 获取session中的信息        Subject currentUser = SecurityUtils.getSubject();        Session session = currentUser.getSession();        UserInfoDTO userInfo = (UserInfoDTO) session.getAttribute("userInfo");        String personInCharge = userInfo == null ? "none" : userInfo.getUserName();        Integer repositoryIDBelong = userInfo == null ? -1 : userInfo.getRepositoryBelong();         // 设置非管理员请求的仓库ID        if (!currentUser.hasRole("systemAdmin")) {            if (repositoryIDBelong < 0) {                authorizeCheck = false;                responseContent.setResponseMsg("You are not authorized");            } else {                repositoryID = repositoryIDBelong;            }        }         // 执行 Service        if (authorizeCheck && argumentCheck) {            if (stockRecordManageService.stockInOperation(supplierID, goodsID, repositoryID, number, personInCharge)) {                result = Response.RESPONSE_RESULT_SUCCESS;            }        }         // 设置 Response        responseContent.setResponseResult(result);        return responseContent.generateResponse();    }         @SuppressWarnings({"SingleStatementInBlock", "unchecked"})    @RequestMapping(value = "searchStockRecord", method = RequestMethod.GET)    public @ResponseBody    Map<String, Object> getStockRecord(@RequestParam("searchType") String searchType,                                       @RequestParam("repositoryID") String repositoryIDStr,                                       @RequestParam("startDate") String startDateStr,                                       @RequestParam("endDate") String endDateStr,                                       @RequestParam("limit") int limit,                                       @RequestParam("offset") int offset) throws ParseException, StockRecordManageServiceException {        // 初始化 Response        Response responseContent = ResponseFactory.newInstance();        List<StockRecordDTO> rows = null;        long total = 0;         // 参数检查        String regex = "([0-9]{4})-([0-9]{2})-([0-9]{2})";        boolean startDateFormatCheck = (StringUtils.isEmpty(startDateStr) || startDateStr.matches(regex));        boolean endDateFormatCheck = (StringUtils.isEmpty(endDateStr) || endDateStr.matches(regex));        boolean repositoryIDCheck = (StringUtils.isEmpty(repositoryIDStr) || StringUtils.isNumeric(repositoryIDStr));         if (startDateFormatCheck && endDateFormatCheck && repositoryIDCheck) {            Integer repositoryID = -1;            if (StringUtils.isNumeric(repositoryIDStr)) {                repositoryID = Integer.valueOf(repositoryIDStr);            }             // 转到 Service 执行查询            Map<String, Object> queryResult = stockRecordManageService.selectStockRecord(repositoryID, startDateStr, endDateStr, searchType, offset, limit);            if (queryResult != null) {                rows = (List<StockRecordDTO>) queryResult.get("data");                total = (long) queryResult.get("total");            }        } else            responseContent.setResponseMsg("Request argument error");         if (rows == null)            rows = new ArrayList<>(0);         responseContent.setCustomerInfo("rows", rows);        responseContent.setResponseTotal(total);        return responseContent.generateResponse();    }}

关于“Java实战中怎样进行仓库管理系统的实现”就介绍到这了,更多相关内容可以搜索编程网以前的文章,希望能够帮助大家答疑解惑,请多多支持编程网网站!

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-后端开发
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯