亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Java畢業(yè)設(shè)計(jì)實(shí)戰(zhàn)項(xiàng)目之倉(cāng)庫(kù)管理系統(tǒng)的實(shí)現(xiàn)流程

 更新時(shí)間:2022年01月24日 11:19:36   作者:OldWinePot  
這是一個(gè)使用了java+SSM+Maven+Bootstrap+mysql開(kāi)發(fā)的倉(cāng)庫(kù)管理系統(tǒng),是一個(gè)畢業(yè)設(shè)計(jì)的實(shí)戰(zhàn)練習(xí),具有一個(gè)倉(cāng)庫(kù)管理系統(tǒng)該有的所有功能,感興趣的朋友快來(lái)看看吧

基于SSM框架的倉(cāng)庫(kù)管理系統(tǒng)

功能:

  • 系統(tǒng)操作權(quán)限管理。系統(tǒng)提供基本的登入登出功能,同時(shí)系統(tǒng)包含兩個(gè)角色:系統(tǒng)超級(jí)管理員和普通管理員,超級(jí)管理員具有最高的操作權(quán)限,而普通管理員僅具有最基本的操作權(quán)限,而且僅能操作自己被指派的倉(cāng)庫(kù)。
  • 請(qǐng)求URL鑒權(quán)。對(duì)于系統(tǒng)使用者登陸后進(jìn)行操作發(fā)送請(qǐng)求的URL,后臺(tái)會(huì)根據(jù)當(dāng)前用戶的角色判斷是否擁有請(qǐng)求該URL的權(quán)限。
  • 基礎(chǔ)數(shù)據(jù)信息管理。對(duì)包括:貨物信息、供應(yīng)商信息、客戶信息、倉(cāng)庫(kù)信息在內(nèi)的基礎(chǔ)數(shù)據(jù)信息進(jìn)行管理,提供的操作有:添加、刪除、修改、條件查詢、導(dǎo)出為Excel和到從Excel導(dǎo)入。
  • 倉(cāng)庫(kù)管理員管理。對(duì)倉(cāng)庫(kù)管理員信息CRUD操作,或者為指定的倉(cāng)庫(kù)管理員指派所管理的倉(cāng)庫(kù)。上述中的倉(cāng)庫(kù)管理員可以以普通管理員身份登陸到系統(tǒng)。
  • 庫(kù)存信息管理。對(duì)庫(kù)存信息的CRUD操作,導(dǎo)入導(dǎo)出操作,同時(shí)查詢的時(shí)候可以根據(jù)倉(cāng)庫(kù)以及商品ID等信息進(jìn)行多條件查詢。
  • 基本倉(cāng)庫(kù)事務(wù)操作。執(zhí)行貨物的入庫(kù)與出庫(kù)操作。
  • 系統(tǒng)登陸日志查詢。超級(jí)管理員可以查詢某一用戶在特定時(shí)間段內(nèi)的系統(tǒng)登陸日志。
  • 系統(tǒng)操作日志查詢。超級(jí)管理員可以查詢某一用戶在特定時(shí)間段內(nèi)對(duì)系統(tǒng)進(jìn)行操作的操作記錄。
  • 密碼修改。

使用到的框架和庫(kù):

  • Apache POI
  • MyBatis
  • Spring Framework
  • Spring MVC
  • Apache Shiro
  • Ehcache
  • Apache Commons
  • Log4j
  • Slf4j
  • Jackson
  • C3P0
  • Junit
  • MySQL-Connector
  • jQuery
  • Bootstrap

倉(cāng)庫(kù)管理員管理請(qǐng)求:

/**
 * 倉(cāng)庫(kù)管理員管理請(qǐng)求 Handler
 *
 * @author yy
 */
@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    查詢關(guān)鍵字
     * @param searchType 查詢類型
     * @param offset     分頁(yè)偏移值
     * @param limit      分頁(yè)大小
     * @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;
    }
 
    /**
     * 查詢倉(cāng)庫(kù)管理員信息
     *
     * @param searchType 查詢類型
     * @param offset     分頁(yè)偏移值
     * @param limit      分頁(yè)大小
     * @param keyWord    查詢關(guān)鍵字
     * @return 返回一個(gè)Map,其中key=rows,表示查詢出來(lái)的記錄;key=total,表示記錄的總條數(shù)
     */
    @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");
        }
 
        // 設(shè)置 Response
        responseContent.setCustomerInfo("rows", rows);
        responseContent.setResponseTotal(total);
        return responseContent.generateResponse();
    }
 
    /**
     * 添加一條倉(cāng)庫(kù)管理員信息
     *
     * @param repositoryAdmin 倉(cāng)庫(kù)管理員信息
     * @return 返回一個(gè)map,其中:key 為 result表示操作的結(jié)果,包括:success 與 error
     */
    @RequestMapping(value = "addRepositoryAdmin", method = RequestMethod.POST)
    public
    @ResponseBody
    Map<String, Object> addRepositoryAdmin(@RequestBody RepositoryAdmin repositoryAdmin) throws RepositoryAdminManageServiceException {
        // 初始化 Response
        Response responseContent = ResponseFactory.newInstance();
 
        // 添加結(jié)果
        String result = repositoryAdminManageService.addRepositoryAdmin(repositoryAdmin)
                ? Response.RESPONSE_RESULT_SUCCESS : Response.RESPONSE_RESULT_ERROR;
 
        // 設(shè)置 Response
        responseContent.setResponseResult(result);
        return responseContent.generateResponse();
    }
 
    /**
     * 查詢指定 ID 的倉(cāng)庫(kù)管理員信息
     *
     * @param repositoryAdminID 倉(cāng)庫(kù)管理員ID
     * @return 返回一個(gè)map,其中:key 為 result 的值為操作的結(jié)果,包括:success 與 error;key 為 data
     * 的值為倉(cāng)庫(kù)管理員信息
     */
    @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;
        }
 
        // 設(shè)置 Response
        responseContent.setResponseResult(result);
        responseContent.setResponseData(repositoryAdmin);
        return responseContent.generateResponse();
    }
 
    /**
     * 更新倉(cāng)庫(kù)管理員信息
     *
     * @param repositoryAdmin 倉(cāng)庫(kù)管理員信息
     * @return 返回一個(gè)map,其中:key 為 result 的值為操作的結(jié)果,包括:success 與 error;key 為 data
     * 的值為倉(cāng)庫(kù)管理員信息
     */
    @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;
 
        // 設(shè)置 Response
        responseContent.setResponseResult(result);
        return responseContent.generateResponse();
    }
 
    /**
     * 刪除指定 ID 的倉(cāng)庫(kù)管理員信息
     *
     * @param repositoryAdminID 倉(cāng)庫(kù)ID
     * @return 返回一個(gè)map,其中:key 為 result 的值為操作的結(jié)果,包括:success 與 error;key 為 data
     * 的值為倉(cāng)庫(kù)管理員信息
     */
    @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;
 
        // 設(shè)置 Response
        responseContent.setResponseResult(result);
        return responseContent.generateResponse();
    }
 
    /**
     * 從文件中導(dǎo)入倉(cāng)庫(kù)管理員信息
     *
     * @param file 保存有倉(cāng)庫(kù)管理員信息的文件
     * @return 返回一個(gè)map,其中:key 為 result表示操作的結(jié)果,包括:success 與
     * error;key為total表示導(dǎo)入的總條數(shù);key為available表示有效的條數(shù)
     */
    @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;
            }
        }
 
        // 設(shè)置 Response
        responseContent.setResponseResult(result);
        responseContent.setResponseTotal(total);
        responseContent.setCustomerInfo("available", available);
        return responseContent.generateResponse();
    }
 
    /**
     * 導(dǎo)出倉(cāng)庫(kù)管理員信息到文件中
     *
     * @param searchType 查詢類型
     * @param keyWord    查詢關(guān)鍵字
     * @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 {
 
        // 導(dǎo)出文件名
        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) {
            // 設(shè)置響應(yīng)頭
            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();
        }
    }
}

貨物信息管理請(qǐng)求:?

/**
 * 貨物信息管理請(qǐng)求 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    查詢關(guān)鍵字
     * @param offset     分頁(yè)偏移值
     * @param limit      分頁(yè)大小
     * @return 返回一個(gè) Map ,包含所有符合要求的查詢結(jié)果,以及記錄的條數(shù)
     */
    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     如有多條記錄時(shí)分頁(yè)的偏移值
     * @param limit      如有多條記錄時(shí)分頁(yè)的大小
     * @param keyWord    搜索的關(guān)鍵字
     * @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<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");
        }
 
        // 設(shè)置 Response
        responseContent.setCustomerInfo("rows", rows);
        responseContent.setResponseTotal(total);
        return responseContent.generateResponse();
    }
 
    /**
     * 添加一條貨物信息
     *
     * @param goods 貨物信息
     * @return 返回一個(gè)map,其中:key 為 result表示操作的結(jié)果,包括: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;
 
        // 設(shè)置 Response
        responseContent.setResponseResult(result);
 
        return responseContent.generateResponse();
    }
 
    /**
     * 查詢指定 goods ID 貨物的信息
     *
     * @param goodsID 貨物ID
     * @return 返回一個(gè)map,其中:key 為 result 的值為操作的結(jié)果,包括: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;
            }
        }
 
        // 設(shè)置 Response
        responseContent.setResponseResult(result);
        responseContent.setResponseData(goods);
        return responseContent.generateResponse();
    }
 
    /**
     * 更新貨物信息
     *
     * @param goods 貨物信息
     * @return 返回一個(gè)map,其中:key 為 result表示操作的結(jié)果,包括: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;
 
        // 設(shè)置 Response
        responseContent.setResponseResult(result);
        return responseContent.generateResponse();
    }
 
    /**
     * 刪除貨物記錄
     *
     * @param goodsID 貨物ID
     * @return 返回一個(gè)map,其中:key 為 result表示操作的結(jié)果,包括: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;
 
        // 設(shè)置 Response
        responseContent.setResponseResult(result);
        return responseContent.generateResponse();
    }
 
    /**
     * 導(dǎo)入貨物信息
     *
     * @param file 保存有貨物信息的文件
     * @return 返回一個(gè)map,其中:key 為 result表示操作的結(jié)果,包括:success 與
     * error;key為total表示導(dǎo)入的總條數(shù);key為available表示有效的條數(shù)
     */
    @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;
 
        // 讀取文件內(nèi)容
        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;
            }
        }
 
        // 設(shè)置 Response
        responseContent.setResponseResult(result);
        responseContent.setResponseTotal(total);
        responseContent.setCustomerInfo("available", available);
        return responseContent.generateResponse();
    }
 
    /**
     * 導(dǎo)出貨物信息
     *
     * @param searchType 查找類型
     * @param keyWord    查找關(guān)鍵字
     * @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<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);
 
        // 寫(xiě)出文件
        if (file != null) {
            // 設(shè)置響應(yīng)頭
            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();
 
        }
    }
}

客戶信息管理請(qǐng)求:

/**
 * 客戶信息管理請(qǐng)求 
 *
 * @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";
 
    /**
     * 通用的結(jié)果查詢方法
     *
     * @param searchType 查詢方式
     * @param keyWord    查詢關(guān)鍵字
     * @param offset     分頁(yè)偏移值
     * @param limit      分頁(yè)大小
     * @return 返回指定條件查詢的結(jié)果
     */
    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;
    }
 
    /**
     * 搜索客戶信息
     *
     * @param searchType 搜索類型
     * @param offset     如有多條記錄時(shí)分頁(yè)的偏移值
     * @param limit      如有多條記錄時(shí)分頁(yè)的大小
     * @param keyWord    搜索的關(guān)鍵字
     * @return 返回查詢的結(jié)果,其中鍵值為 rows 的代表查詢到的每一記錄,若有分頁(yè)則為分頁(yè)大小的記錄;鍵值為 total 代表查詢到的符合要求的記錄總條數(shù)
     */
    @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");
        }
 
        // 設(shè)置 Response
        responseContent.setCustomerInfo("rows", rows);
        responseContent.setResponseTotal(total);
        responseContent.setResponseResult(Response.RESPONSE_RESULT_SUCCESS);
        return responseContent.generateResponse();
    }
 
    /**
     * 添加一條客戶信息
     *
     * @param customer 客戶信息
     * @return 返回一個(gè)map,其中:key 為 result表示操作的結(jié)果,包括:success 與 error
     */
    @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();
    }
 
    /**
     * 查詢指定 customer ID 客戶的信息
     *
     * @param customerID 客戶ID
     * @return 返回一個(gè)map,其中:key 為 result 的值為操作的結(jié)果,包括:success 與 error;key 為 data
     * 的值為客戶信息
     */
    @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;
            }
        }
 
        // 設(shè)置 Response
        responseContent.setResponseResult(result);
        responseContent.setResponseData(customer);
 
        return responseContent.generateResponse();
    }
 
    /**
     * 更新客戶信息
     *
     * @param customer 客戶信息
     * @return 返回一個(gè)map,其中:key 為 result表示操作的結(jié)果,包括: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();
    }
 
    /**
     * 刪除客戶記錄
     *
     * @param customerIDStr 客戶ID
     * @return 返回一個(gè)map,其中:key 為 result表示操作的結(jié)果,包括:success 與 error
     */
    @RequestMapping(value = "deleteCustomer", method = RequestMethod.GET)
    public
    @ResponseBody
    Map<String, Object> deleteCustomer(@RequestParam("customerID") String customerIDStr) throws CustomerManageServiceException {
        // 初始化 Response
        Response responseContent = ResponseFactory.newInstance();
 
        // 參數(shù)檢查
        if (StringUtils.isNumeric(customerIDStr)) {
            // 轉(zhuǎn)換為 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();
    }
 
    /**
     * 導(dǎo)入客戶信息
     *
     * @param file 保存有客戶信息的文件
     * @return 返回一個(gè)map,其中:key 為 result表示操作的結(jié)果,包括:success 與
     * error;key為total表示導(dǎo)入的總條數(shù);key為available表示有效的條數(shù)
     */
    @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;
 
        // 讀取文件內(nèi)容
        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();
    }
 
    /**
     * 導(dǎo)出客戶信息
     *
     * @param searchType 查找類型
     * @param keyWord    查找關(guān)鍵字
     * @param response   HttpServletResponse
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "exportCustomer", method = RequestMethod.GET)
    public void exportCustomer(@RequestParam("searchType") String searchType, @RequestParam("keyWord") String keyWord,
                               HttpServletResponse response) throws CustomerManageServiceException, IOException {
 
        String fileName = "customerInfo.xlsx";
 
        List<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);
 
        // 寫(xiě)出文件
        if (file != null) {
            // 設(shè)置響應(yīng)頭
            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();
 
        }
    }
}

商品出入庫(kù)管理請(qǐng)求:

/**
 * 商品出入庫(kù)管理請(qǐng)求
 *
 * @author yy
 */
@Controller
@RequestMapping(value = "stockRecordManage")
public class StockRecordManageHandler {
 
    @Autowired
    private StockRecordManageService stockRecordManageService;
 
    /**
     * 貨物出庫(kù)操作
     *
     * @param customerID      客戶ID
     * @param goodsID         貨物ID
     * @param repositoryIDStr 倉(cāng)庫(kù)ID
     * @param number          出庫(kù)數(shù)量
     * @return 返回一個(gè)map,key為result的值表示操作是否成功
     */
    @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;
 
        // 參數(shù)檢查
        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();
 
        // 設(shè)置非管理員請(qǐng)求的倉(cāng)庫(kù)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;
        }
 
        // 設(shè)置 Response
        responseContent.setResponseResult(result);
        return responseContent.generateResponse();
    }
 
    /**
     * 貨物入庫(kù)操作
     *
     * @param supplierID      供應(yīng)商ID
     * @param goodsID         貨物ID
     * @param repositoryIDStr 倉(cāng)庫(kù)ID
     * @param number          入庫(kù)數(shù)目
     * @return 返回一個(gè)map,key為result的值表示操作是否成功
     */
    @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;
 
        // 參數(shù)檢查
        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();
 
        // 設(shè)置非管理員請(qǐng)求的倉(cāng)庫(kù)ID
        if (!currentUser.hasRole("systemAdmin")) {
            if (repositoryIDBelong < 0) {
                authorizeCheck = false;
                responseContent.setResponseMsg("You are not authorized");
            } else {
                repositoryID = repositoryIDBelong;
            }
        }
 
        // 執(zhí)行 Service
        if (authorizeCheck && argumentCheck) {
            if (stockRecordManageService.stockInOperation(supplierID, goodsID, repositoryID, number, personInCharge)) {
                result = Response.RESPONSE_RESULT_SUCCESS;
            }
        }
 
        // 設(shè)置 Response
        responseContent.setResponseResult(result);
        return responseContent.generateResponse();
    }
 
    /**
     * 查詢出入庫(kù)記錄
     *
     * @param searchType      查詢類型(查詢所有或僅查詢?nèi)霂?kù)記錄或僅查詢出庫(kù)記錄)
     * @param repositoryIDStr 查詢記錄所對(duì)應(yīng)的倉(cāng)庫(kù)ID
     * @param endDateStr      查詢的記錄起始日期
     * @param startDateStr    查詢的記錄結(jié)束日期
     * @param limit           分頁(yè)大小
     * @param offset          分頁(yè)偏移值
     * @return 返回一個(gè)Map,其中:Key為rows的值代表所有記錄數(shù)據(jù),Key為total的值代表記錄的總條數(shù)
     */
    @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;
 
        // 參數(shù)檢查
        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);
            }
 
            // 轉(zhuǎn)到 Service 執(zhí)行查詢
            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();
    }
}

到此這篇關(guān)于Java畢業(yè)設(shè)計(jì)實(shí)戰(zhàn)項(xiàng)目之倉(cāng)庫(kù)管理系統(tǒng)的實(shí)現(xiàn)流程的文章就介紹到這了,更多相關(guān)Java 倉(cāng)庫(kù)管理系統(tǒng)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Java中深拷貝和淺拷貝的區(qū)別解析

    Java中深拷貝和淺拷貝的區(qū)別解析

    這篇文章主要介紹了Java中深拷貝和淺拷貝的區(qū)別解析,淺拷貝是源對(duì)象和拷貝對(duì)象的存放地址不同,但被復(fù)制的源對(duì)象的引用類型屬性存放的地址仍然和源對(duì)象的引用類型屬性相同,修改引用類型屬性的屬性會(huì)影響相互影響,需要的朋友可以參考下
    2024-01-01
  • Java?導(dǎo)出?CSV?文件操作詳情

    Java?導(dǎo)出?CSV?文件操作詳情

    這篇文章主要介紹了Java導(dǎo)出CSV文件操作詳情,文章通過(guò)導(dǎo)入坐標(biāo)展開(kāi)詳細(xì)內(nèi)容介紹,具有一定的參考價(jià)值,需要的小伙伴可以參考一下
    2022-08-08
  • 圖數(shù)據(jù)庫(kù)NebulaGraph的Java 數(shù)據(jù)解析實(shí)踐與指導(dǎo)詳解

    圖數(shù)據(jù)庫(kù)NebulaGraph的Java 數(shù)據(jù)解析實(shí)踐與指導(dǎo)詳解

    這篇文章主要介紹了圖數(shù)據(jù)庫(kù)NebulaGraph的Java 數(shù)據(jù)解析實(shí)踐與指導(dǎo)詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-04-04
  • Mybatis 傳輸List的實(shí)現(xiàn)代碼

    Mybatis 傳輸List的實(shí)現(xiàn)代碼

    本文通過(guò)實(shí)例代碼給大家介紹了mybatis傳輸list的實(shí)現(xiàn)代碼,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下吧
    2017-09-09
  • HttpClient HttpRoutePlanner接口確定請(qǐng)求目標(biāo)路由

    HttpClient HttpRoutePlanner接口確定請(qǐng)求目標(biāo)路由

    這篇文章主要為大家介紹了使用HttpClient HttpRoutePlanner接口確定請(qǐng)求目標(biāo)路由,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-10-10
  • Java線程的調(diào)度與優(yōu)先級(jí)詳解

    Java線程的調(diào)度與優(yōu)先級(jí)詳解

    這篇文章主要為大家詳細(xì)介紹了Java線程的調(diào)度與優(yōu)先級(jí),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來(lái)幫助
    2022-03-03
  • Intellij idea 代碼提示忽略字母大小寫(xiě)和常用快捷鍵及設(shè)置步驟

    Intellij idea 代碼提示忽略字母大小寫(xiě)和常用快捷鍵及設(shè)置步驟

    這篇文章主要介紹了Intellij idea 代碼提示忽略字母大小寫(xiě)和常用快捷鍵及設(shè)置步驟,本文通過(guò)圖文并茂的形式給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-02-02
  • Java那點(diǎn)兒事之Map集合不為人知的秘密有哪些

    Java那點(diǎn)兒事之Map集合不為人知的秘密有哪些

    Map用于保存具有映射關(guān)系的數(shù)據(jù),Map集合里保存著兩組值,一組用于保存Map的key,另一組保存著Map的value,和查字典類似,通過(guò)key找到對(duì)應(yīng)的value,通過(guò)頁(yè)數(shù)找到對(duì)應(yīng)的信息。用學(xué)生類來(lái)說(shuō),key相當(dāng)于學(xué)號(hào),value對(duì)應(yīng)name,age,sex等信息。用這種對(duì)應(yīng)關(guān)系方便查找
    2021-10-10
  • SWT JFace 小制作 文本閱讀器

    SWT JFace 小制作 文本閱讀器

    SWT JFace 小制作 文本閱讀器
    2009-06-06
  • Java原生操作JDBC連接以及原理詳解

    Java原生操作JDBC連接以及原理詳解

    這篇文章主要給大家介紹了關(guān)于Java原生操作JDBC連接以及原理的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-01-01

最新評(píng)論