Java项目:springboot农业物资管理系统

news2024/10/6 4:09:22

作者主页:源码空间站2022

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

农业物资管理系统,管理员可以对角色进行配置,分配用户角色;
主要功能包含:登录、注册、修改密码、零售出库、零售退货、采购订单管理、采购入库管理、采购退货管理、销售管理、财务管理、报表管理、物资管理、基本资料管理。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;

6.是否Maven项目: 是;

技术栈

1. 后端:springboot MyBatis

2. 前端:HTML+css+javascript+jQuery+easyui

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;
3. 将项目中application.properties配置文件中的数据库配置改为自己的配置;
4. 运行成功后,访问http://localhost:8080/ 到登录页面

管理员用户名:admin 密码:123456

运行截图

 

代码相关

账户相关控制器

@RestController
@RequestMapping(value = "/account")
public class AccountController {
    private Logger logger = LoggerFactory.getLogger(AccountController.class);
    @Resource
    private AccountService accountService;

    /**
     * 查找结算账户信息-下拉框
     *
     * @param request
     * @return
     */
    @GetMapping(value = "/findBySelect")
    public String findBySelect(HttpServletRequest request) throws Exception {
        String res = null;
        try {
            List<Account> dataList = accountService.findBySelect();
            //存放数据json数组
            JSONArray dataArray = new JSONArray();
            if (null != dataList) {
                for (Account account : dataList) {
                    JSONObject item = new JSONObject();
                    item.put("Id", account.getId());
                    //结算账户名称
                    item.put("AccountName", account.getName());
                    dataArray.add(item);
                }
            }
            res = dataArray.toJSONString();
        } catch (Exception e) {
            e.printStackTrace();
            res = "获取数据失败";
        }
        return res;
    }

    /**
     * 获取所有结算账户
     *
     * @param request
     * @return
     */
    @GetMapping(value = "/getAccount")
    public BaseResponseInfo getAccount(HttpServletRequest request) throws Exception {
        BaseResponseInfo res = new BaseResponseInfo();
        Map<String, Object> map = new HashMap<String, Object>();
        try {
            List<Account> accountList = accountService.getAccount();
            map.put("accountList", accountList);
            res.code = 200;
            res.data = map;
        } catch (Exception e) {
            e.printStackTrace();
            res.code = 500;
            res.data = "获取数据失败";
        }
        return res;
    }

    /**
     * 账户流水信息
     *
     * @param currentPage
     * @param pageSize
     * @param accountId
     * @param initialAmount
     * @param request
     * @return
     */
    @GetMapping(value = "/findAccountInOutList")
    public BaseResponseInfo findAccountInOutList(@RequestParam("currentPage") Integer currentPage,
                                                 @RequestParam("pageSize") Integer pageSize,
                                                 @RequestParam("accountId") Long accountId,
                                                 @RequestParam("initialAmount") BigDecimal initialAmount,
                                                 HttpServletRequest request) throws Exception {
        BaseResponseInfo res = new BaseResponseInfo();
        Map<String, Object> map = new HashMap<String, Object>();
        try {
            List<AccountVo4InOutList> dataList = accountService.findAccountInOutList(accountId, (currentPage - 1) * pageSize, pageSize);
            int total = accountService.findAccountInOutListCount(accountId);
            map.put("total", total);
            //存放数据json数组
            JSONArray dataArray = new JSONArray();
            if (null != dataList) {
                for (AccountVo4InOutList aEx : dataList) {
                    String timeStr = aEx.getOperTime().toString();
                    BigDecimal balance = accountService.getAccountSum(accountId, timeStr, "date").add(accountService.getAccountSumByHead(accountId, timeStr, "date"))
                            .add(accountService.getAccountSumByDetail(accountId, timeStr, "date")).add(accountService.getManyAccountSum(accountId, timeStr, "date")).add(initialAmount);
                    aEx.setBalance(balance);
                    dataArray.add(aEx);
                }
            }
            map.put("rows", dataArray);
            res.code = 200;
            res.data = map;
        } catch (Exception e) {
            e.printStackTrace();
            res.code = 500;
            res.data = "获取数据失败";
        }
        return res;
    }


    @PostMapping(value = "/updateAmountIsDefault")
    public String updateAmountIsDefault(@RequestParam("isDefault") Boolean isDefault,
                                        @RequestParam("accountId") Long accountId,
                                        HttpServletRequest request) throws Exception {
        Map<String, Object> objectMap = new HashMap<String, Object>();
        int res = accountService.updateAmountIsDefault(isDefault, accountId);
        if (res > 0) {
            return ResponseJsonUtil.returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
        } else {
            return ResponseJsonUtil.returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
        }
    }

    /**
     * 批量删除账户信息
     *
     * @return java.lang.Object
     * @Param: ids
     */
    @RequestMapping(value = "/batchDeleteAccountByIds")
    public Object batchDeleteAccountByIds(@RequestParam("ids") String ids, @RequestParam(value = "deleteType",
            required = false, defaultValue = BusinessConstants.DELETE_TYPE_NORMAL) String deleteType) throws Exception {

        JSONObject result = ExceptionConstants.standardSuccess();
        /**

         * description:
         *  出于兼容性考虑,没有传递删除类型时,默认为正常删除
         */
        int i = 0;
        if (BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)) {
            i = accountService.batchDeleteAccountByIdsNormal(ids);
        } else if (BusinessConstants.DELETE_TYPE_FORCE.equals(deleteType)) {
            i = accountService.batchDeleteAccountByIds(ids);
        } else {
            logger.error("异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]",
                    ExceptionConstants.DELETE_REFUSED_CODE, ExceptionConstants.DELETE_REFUSED_MSG, ids, deleteType);
            throw new BusinessRunTimeException(ExceptionConstants.DELETE_REFUSED_CODE,
                    ExceptionConstants.DELETE_REFUSED_MSG);
        }
        if (i < 1) {
            logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
                    ExceptionConstants.ACCOUNT_DELETE_FAILED_CODE, ExceptionConstants.ACCOUNT_DELETE_FAILED_MSG, ids);
            throw new BusinessRunTimeException(ExceptionConstants.ACCOUNT_DELETE_FAILED_CODE,
                    ExceptionConstants.ACCOUNT_DELETE_FAILED_MSG);
        }
        return result;
    }

}

仓库管理控制器

@RestController
@RequestMapping(value = "/depot")
public class DepotController {
    private Logger logger = LoggerFactory.getLogger(DepotController.class);

    @Resource
    private DepotService depotService;

    @Resource
    private UserBusinessService userBusinessService;

    @Resource
    private SystemConfigService systemConfigService;

    @Resource
    private MaterialService materialService;

    @GetMapping(value = "/getAllList")
    public BaseResponseInfo getAllList(HttpServletRequest request) throws Exception {
        BaseResponseInfo res = new BaseResponseInfo();
        try {
            List<Depot> depotList = depotService.getAllList();
            res.code = 200;
            res.data = depotList;
        } catch (Exception e) {
            e.printStackTrace();
            res.code = 500;
            res.data = "获取数据失败";
        }
        return res;
    }

    /**
     * 用户对应仓库显示
     *
     * @param type
     * @param keyId
     * @param request
     * @return
     */
    @PostMapping(value = "/findUserDepot")
    public JSONArray findUserDepot(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
                                   HttpServletRequest request) throws Exception {
        JSONArray arr = new JSONArray();
        try {
            List<Depot> dataList = depotService.findUserDepot();
            //开始拼接json数据
            JSONObject outer = new JSONObject();
            outer.put("id", 1);
            outer.put("text", "仓库列表");
            outer.put("state", "open");
            //存放数据json数组
            JSONArray dataArray = new JSONArray();
            if (null != dataList) {
                for (Depot depot : dataList) {
                    JSONObject item = new JSONObject();
                    item.put("id", depot.getId());
                    item.put("text", depot.getName());
                    //勾选判断1
                    Boolean flag = false;
                    try {
                        flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + depot.getId().toString() + "]");
                    } catch (Exception e) {
                        logger.error(">>>>>>>>>>>>>>>>>设置用户对应的仓库:类型" + type + " KeyId为: " + keyId + " 存在异常!");
                    }
                    if (flag == true) {
                        item.put("checked", true);
                    }
                    //结束
                    dataArray.add(item);
                }
            }
            outer.put("children", dataArray);
            arr.add(outer);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return arr;
    }

    /**
     * 获取用户拥有权限的仓库列表
     *
     * @param type
     * @param keyId
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/findDepotByUserId")
    public JSONArray findDepotByUserId(@RequestParam("UBType") String type, @RequestParam("UBKeyId") String keyId,
                                       HttpServletRequest request) throws Exception {
        JSONArray arr = new JSONArray();
        try {
            List<Depot> dataList = depotService.findUserDepot();
            //开始拼接json数据
            if (null != dataList) {
                boolean depotFlag = systemConfigService.getDepotFlag();
                for (Depot depot : dataList) {
                    JSONObject item = new JSONObject();
                    //勾选判断1
                    Boolean flag = false;
                    try {
                        flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + depot.getId().toString() + "]");
                    } catch (DataAccessException e) {
                        logger.error(">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型" + type + " KeyId为: " + keyId + " 存在异常!");
                    }
                    if (!depotFlag || flag) {
                        item.put("id", depot.getId());
                        item.put("depotName", depot.getName());
                        arr.add(item);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return arr;
    }

    /**
     * 批量删除仓库信息
     *
     * @return java.lang.Object
     * @Param: ids
     */
    @RequestMapping(value = "/batchDeleteDepotByIds")
    public Object batchDeleteDepotByIds(@RequestParam("ids") String ids, @RequestParam(value = "deleteType",
            required = false, defaultValue = BusinessConstants.DELETE_TYPE_NORMAL) String deleteType) throws Exception {
        JSONObject result = ExceptionConstants.standardSuccess();
        int i = 0;
        if (BusinessConstants.DELETE_TYPE_NORMAL.equals(deleteType)) {
            i = depotService.batchDeleteDepotByIdsNormal(ids);
        } else if (BusinessConstants.DELETE_TYPE_FORCE.equals(deleteType)) {
            i = depotService.batchDeleteDepotByIds(ids);
        } else {
            logger.error("异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]",
                    ExceptionConstants.DELETE_REFUSED_CODE, ExceptionConstants.DELETE_REFUSED_MSG, ids, deleteType);
            throw new BusinessRunTimeException(ExceptionConstants.DELETE_REFUSED_CODE,
                    ExceptionConstants.DELETE_REFUSED_MSG);
        }
        if (i < 1) {
            logger.error("异常码[{}],异常提示[{}],参数,ids[{}]",
                    ExceptionConstants.DEPOT_DELETE_FAILED_CODE, ExceptionConstants.DEPOT_DELETE_FAILED_MSG, ids);
            throw new BusinessRunTimeException(ExceptionConstants.DEPOT_DELETE_FAILED_CODE,
                    ExceptionConstants.DEPOT_DELETE_FAILED_MSG);
        }
        return result;
    }

    @PostMapping(value = "/updateDepotIsDefault")
    public String updateDepotIsDefault(@RequestParam("isDefault") Boolean isDefault,
                                       @RequestParam("depotID") Long depotID,
                                       HttpServletRequest request) throws Exception {
        Map<String, Object> objectMap = new HashMap<String, Object>();
        int res = depotService.updateDepotIsDefault(isDefault, depotID);
        if (res > 0) {
            return ResponseJsonUtil.returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
        } else {
            return ResponseJsonUtil.returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
        }
    }

    @GetMapping(value = "/getAllListWithStock")
    public BaseResponseInfo getAllList(@RequestParam("mId") Long mId,
                                       HttpServletRequest request) {
        BaseResponseInfo res = new BaseResponseInfo();
        try {
            List<Depot> list = depotService.getAllList();
            List<DepotEx> depotList = new ArrayList<DepotEx>();
            for (Depot depot : list) {
                DepotEx de = new DepotEx();
                if (mId != 0) {
                    BigDecimal stock = materialService.getInitStock(mId, depot.getId());
                    de.setStock(stock);
                } else {
                    de.setStock(BigDecimal.ZERO);
                }
                de.setId(depot.getId());
                de.setName(depot.getName());
                depotList.add(de);
            }
            res.code = 200;
            res.data = depotList;
        } catch (Exception e) {
            e.printStackTrace();
            res.code = 500;
            res.data = "获取数据失败";
        }
        return res;
    }
}

如果也想学习本系统,下面领取。回复:087springboot

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/115065.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

并查集解决重复员工问题

简介 工作一年多了&#xff0c;天天CRUD&#xff0c;终于以前学习的算法排上用场了。 背景 我们的系统在用户注册时没有校验身份id&#xff08;身份证&#xff09;和电话号码的唯一&#xff0c;可能使用相同的身份id或者电话号码创建多个账号&#xff0c;导致有些人开多个账…

面试者推荐 |【Redis面试专题】「常见问答系列」透析Redis常见技术相关的问题1~10题(进阶)

&#x1f4da; 前提回顾 首先如果没有阅读【面试者推荐 |【Redis面试专题】「常见问答系列」透析Redis常见技术相关的问题1~10题&#xff08;基础&#xff09; 】&#xff0c;简易先去看看基础10题&#xff0c;因为循序渐进才是正道&#xff0c;哈哈。 &#x1f4da; 1. Redis…

WebRTC源码之RTCPReceiver源码分析

WebRTC源码之RTCPReceiver源码分析 WebRTC源码之RTCPReceiver源码分析WebRTC源码之RTCPReceiver源码分析前言一、 RTCP接受数据的流程的堆栈信息的1、网络io 线程读取数据2、 线程切换的代码3、 线程切换 gcc二、 RTCPReceiver::IncomingPacket方法读取RTCP数据的格式1、 Parse…

【PyTorch深度学习项目实战100例】—— 基于DPCNN实现电商情感分析任务 | 第79例

前言 大家好,我是阿光。 本专栏整理了《PyTorch深度学习项目实战100例》,内包含了各种不同的深度学习项目,包含项目原理以及源码,每一个项目实例都附带有完整的代码+数据集。 正在更新中~ ✨ 🚨 我的项目环境: 平台:Windows10语言环境:python3.7编译器:PyCharmPy…

随机种子 3407 is all you need

文 | 天于刀刀你最常用的随机种子是哪个&#xff1f;在刀刀的团队里&#xff0c;关于随机种子的设置主要分化为两派~玄学派&#xff0c;可能设置为自己的纪念日&#xff0c;又或者是星座预测中的本月幸运数字&#xff1b;以及&#xff0c;自然派&#xff0c;随机种子是啥其实无…

Java项目:springboot健身房管理系统

作者主页&#xff1a;源码空间站2022 简介&#xff1a;Java领域优质创作者、Java项目、学习资料、技术互助 文末获取源码 项目介绍 本项目为后台管理系统&#xff1b; 主要功能如下&#xff1a; 管理员登录模块 会员管理模块 教练管理模块 课程管理模块 器材管理模块 物品遗失…

一些常见的移动端适配方案,你了解吗?

前言 移动端设备的尺寸很多&#xff0c;而 UI 设计稿一般只会基于一个尺寸&#xff08;一般是 375px 或 750px &#xff09;进行设计。 目前移动端适配方案有多种&#xff0c;本文将介绍一些具有代表性的适配方案。 媒体查询 media CSS3 中的媒体查询属性 media 分别为不同…

量子计算(十七):量子计算机硬件

文章目录 量子计算机硬件 一、量子芯片支持系统 二、量子计算机控制系统 量子计算机硬件 量子计算机的核心——量子芯片&#xff0c;具有多种不同的呈现形式。绝大多数量子芯片&#xff0c;名副其实地&#xff0c;是一块芯片&#xff0c;由集成在基片表面的电路结构构建出包…

关于 Camera 开始 Tuning 时的一些注意事项

1、问题背景&#xff1a; 最近有调试一个体感游戏机上带 Camera 的项目&#xff0c;原定搭配 ov13855 这颗 sensor, 但由于各种各样的问题&#xff0c;导致做了很多无用功&#xff0c;且各种延期。 本文主要总结下此次项目遇到的问题&#xff0c;及产品开始 tuning 时的一些注意…

【折腾服务器 4】ESXi 中 Ubuntu 安装 NPS 客户端 ( NPC )

Catch Up 书接上回&#xff0c;上一章中&#xff0c;群晖已经能定期给 Windows 物理机服务器做备份了&#xff0c;但是依然无法从外网访问服务器上的内容&#xff0c;本篇讲述如何在 Ubuntu 中安装 NPS 客户端&#xff0c;也就是所谓的 NPC ( Client )。 Chapter 1 准备一个 …

C#语言实例源码系列-实现FTP下载文件

专栏分享点击跳转>Unity3D特效百例点击跳转>案例项目实战源码点击跳转>游戏脚本-辅助自动化点击跳转>Android控件全解手册 &#x1f449;关于作者 众所周知&#xff0c;人生是一个漫长的流程&#xff0c;不断克服困难&#xff0c;不断反思前进的过程。在这个过程中…

SpringSecurity(十)【CSRF 漏洞保护】

十、CSRF 漏洞保护 简介 CSRF&#xff08;Cross-Site Request Forgery 跨站请求伪造&#xff09;&#xff0c;也可称为一键式攻击&#xff08;one-click-attack&#xff09;通常缩写为 CSRF 或者 XSRF。CSRF 攻击是一种挟持用户在当前已登录的浏览器上&#xff0c;发送恶意请求…

Python绘制地磁场

文章目录简介磁场绘制简介 为国际参考磁场对Python的封装&#xff0c;可通过经纬高度以及时间来计算地磁场强度&#xff0c;使用方法简单粗暴&#xff0c;如下 import pyIGRF pyIGRF.igrf_value(lat, lon, alt, date)参数含义为 lat 纬度lon 经度alt 海拔date 日期&#xff…

vuejs中组件的两种不同的编写风格-选项式API及组合式API

前言随着vue3的逐渐稳定,以及周边生态的完善,现在vue3已经成为默认的使用方式了的所以,对于一个前端开发者,Vue2与Vue3都得要会,在vue3中新增很多东西,比如:Fragment,Teleport,Suspense,也去掉了vue2中一些特性,比如:移除keyCode支持作为v-on的修饰符等在编程风格上也有一些区别…

Java项目:springBoot+Vue汽车销售管理系统

作者主页&#xff1a;源码空间站2022 简介&#xff1a;Java领域优质创作者、Java项目、学习资料、技术互助 文末获取源码 项目介绍 本项目基于spring boot以及Vue开发&#xff0c;为前后端分离的项目。针对汽车销售提供客户信息、车辆信息、订单信息、销售人员管理、财务报表等…

【Python百日进阶-数据分析】Day138 - plotly甘特图:px.timeline()

文章目录一、语法二、参数三、返回值四、实例4.1 带有 plotly.express 的甘特图和时间表4.1.1 普通甘特图4.1.2 px.timeline 的离散颜色4.1.3 px.timeline 的连续颜色4.1.4 同一水平线上有多个条4.1.5 Dash中使用甘特图一、语法 甘特图是一种条形图&#xff0c;用于说明项目进…

【C++高阶数据结构】并查集

&#x1f3c6;个人主页&#xff1a;企鹅不叫的博客 ​ &#x1f308;专栏 C语言初阶和进阶C项目Leetcode刷题初阶数据结构与算法C初阶和进阶《深入理解计算机操作系统》《高质量C/C编程》Linux ⭐️ 博主码云gitee链接&#xff1a;代码仓库地址 ⚡若有帮助可以【关注点赞收藏】…

Linux之top命令详解

Linux之top命令详解 一、简单介绍 top是Linux性能分析工具&#xff0c;显示系统占用资源情况&#xff0c;和windows的任务管理器一样。top动态显示进程暂用资源情况&#xff0c;top对系统处理器的状态监视&#xff0c;它将显示CPU任务列表&#xff0c;按照CPU使用、内存使用和…

You are not allowed to create a user with GRANT

8.0之后的mysql不支持授权的时候就进行用户创建&#xff0c;所以创建之后才能授权; USE mysqlSELECT USER, PASSWORD, HOST FROM USER;SELECT USER ,grant_priv FROM USERCREATE USER zjy IDENTIFIED BY 123456; #host默认是%GRANT ALL PRIVILEGES ON *.* TO zjy% MySql-Ser…

【正点原子I.MX6U-MINI移植篇】rootfs移植过程详解(三)

Linux三巨头己经完成了2个了&#xff0c;就剩最后一个rootfs&#xff08;根文件系统&#xff09;了&#xff0c;根文件系统的组成以及如何构建根文件系统是Liux移植的最后一步&#xff0c;根文件系统构建好以后就意味着我们己经拥有了一个完整的、可以运行的最小系统。以后我们…