0
点赞
收藏
分享

微信扫一扫

Java项目:农业物资管理系统(java+SpringBoot+Easyui+HTML+maven+mysql)

独兜曲 2022-04-29 阅读 95

项目介绍

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

环境需要

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

 

 

 

 

组织机构控制器:

/**
 * 组织机构控制器
 */

@Controller
@RequestMapping("/organization")
public class OrgController {
    @Autowired
    private OrganizationService organizationService;

    /**
     * 根据条件动态查询组织,数据加载到表格
     */
    @PostMapping("/list")
    public String listOrganizationByLevel(Organization example, ModelMap map){
        List<Organization> list = organizationService.listOrganizationByExample(example);
        int sublevel = example.getOrgLevel();
        map.put("dtoList",list);
        String pageName = null;
        switch (sublevel) {  //根据参数确定返回页面目标
            case  1: pageName= "friDepartments" ;break;
            case  2: pageName= "secDepartments" ;break;
            case  3: pageName= "macAddress" ;break;
        }
        return  pageName+"::table-refresh";
    }

    /**
     * 根据条件动态查询子级组织
     */
    @PostMapping("/sub/list")
    @ResponseBody
    public List listOrganization(Organization example){
        List<Organization> list = organizationService.listOrganizationByExample(example);
        return  list;
    }

    /**
     * 根据一级部门和二级部门id查询物理位置
     */
    @PostMapping("/macAddress/list")
    public String listMacaddress(String fristId,String secondId,ModelMap map){
        List<Organization> list = organizationService.listMacaddressByRootID(fristId,secondId);
        map.put("dtoList",list);
        return  "macAddress::table-refresh";
    }



    /**
     * 添加组织
     * @param organization
     * @return
     */
    @PostMapping
    @ResponseBody
    public int addOrganization(Organization organization){
        return organizationService.insertOrganization(organization);
    }

    /**
     * 删除组织
     * @param orgId
     * @return
     */
    @DeleteMapping("/{orgId}")
    @ResponseBody
    public int delteOrganizationByid(@PathVariable("orgId") String orgId){
        return organizationService.deleteOrganizationById(orgId);
    }

    /**
     * 修改组织名称
     * @param organization
     * @return
     */
    @PutMapping
    @ResponseBody
    public int updateDeviceType(Organization organization){
        return organizationService.updateOrganizationName(organization);
    }

    /**
     * 获取组织树
     * @return
     */
    @GetMapping("/tree")
    @ResponseBody
    public OrganizationDTO getOrganizationTree(){
        return organizationService.getOrgTree();
    }

}

用户访问控制器:

@Controller
@RequestMapping("/account")
public class AccountController {
    //自动注入服务类
    @Autowired
    private AccountService accountService;

    /**
     * 管理员账户信息
     * @return
     */
    @GetMapping("/admins")
    public String listAdmins(ModelMap map){
        List<AccountDTO> adminList = accountService.listAccountByLevel(2);
        List<AccountDTO> superAdminList = accountService.listAccountByLevel(1);
        adminList.addAll(superAdminList);
        map.put("adminsList", adminList);
        return "system::table-refresh";
    }

    /**
     * 获取所有账户信息
     * @param map
     * @return
     */
    @GetMapping("/list")
    public String listAccounts(ModelMap map){
       List<AccountDTO> accountList = accountService.listAccount();
        map.put("accountDTOList", accountList);
        return "account::table-refresh";
    }

    /**
     * 通过用户名称搜索用户
     * @param map
     * @param userName
     * @return
     */
    @GetMapping("/list/{userName}")
    public String listAccountsByUserName(ModelMap map,@PathVariable("userName")String userName){
       List<AccountDTO> accountList = accountService.listAccountByName(userName);
        map.put("accountDTOList", accountList);
        return "account::table-refresh";
    }
    /**
     * 添加管理员页面
     * @param map
     * @return
     */
    @GetMapping("/users")
    public String listUsers(ModelMap map){
        List<AccountDTO> accountList = accountService.listAccountByLevel(3);
        map.put("usersDTOList", accountList);
        return "system::list-refresh";
    }

    /**
     * 获取设备使用人信息
     * @param map
     * @param devId
     * @return
     */
    @GetMapping("/ownerList")
    public String getOwnerList(ModelMap map, String devId){
        Map resMap  = accountService.listOwenrByDevId(devId);
        map.put("ownerMap", resMap);
        return "allotDevice::list-refresh";
    }

    /**
     * 添加账户
     * @param account
     * @return
     */
    @PostMapping
    @ResponseBody
    public int addAccount(Account account){
        return accountService.addAccount(account);
    }

    /**
     * 根据uuid删除账户
     * @param uuid
     * @return
     */
    @DeleteMapping("/{uuid}")
    @ResponseBody
    public int deleteAccount(@PathVariable("uuid")String uuid){
        return accountService.deleteAccountById(uuid);
    }

    /**
     * 修改账户密码
     * @param uuid
     * @param password
     * @return
     */
    @PutMapping("/password")
    @ResponseBody
    public int updatePassword(String uuid, String password){
        return accountService.updatePasswordByid(uuid,password);
    }

    /**
     * 修改账户状态
     * @param uuid
     * @param status
     * @return
     */
    @PutMapping("/status")
    @ResponseBody
    public int updateStatus(String uuid,int status){
        return accountService.updateStatusByid(uuid,status);
    }

    /**
     * 更改管理员
     * @return
     */
    @PutMapping("/admins")
    @ResponseBody
    public int updateDevOwner(HttpServletRequest request){
        String[] groups = request.getParameter("groups").split(",");
        int level = Integer.parseInt(request.getParameter("level"));
        return  accountService.updateAccountLevel(level,groups);
    };

}

物资设备管理控制层:

@Controller
@RequestMapping("/baseInfos")
public class BaseInfoController {

    @Autowired
    private BaseInfoService baseInfoService;
    @Autowired
    private LogService logService;

    /**
     * 获取所有设备类型信息
     * @param map
     * @return
     */
    @RequestMapping("/type/list")
    public String listDeviceType(ModelMap map){
        List<DeviceType> typeList = baseInfoService.listDeviceType();
        map.put("typeList",typeList);
     return "deviceTypes::table-refresh";
    }

    /**
     * 添加设备类型
     * @param deviceType
     * @return
     */
    @PostMapping("/type")
    @ResponseBody
    public int addtDeviceType(DeviceType deviceType){
        return baseInfoService.addtDeviceType(deviceType);
    }

    /**
     * 删除设备类型
     * @param typeId
     * @return
     */
    @DeleteMapping("/type/{typeId}")
    @ResponseBody
    public int delteDeviceTypByid(@PathVariable("typeId") String typeId){
        return baseInfoService.deleteDeviceTypeById(typeId);
    }

    /**
     * 修改设备类型
     * @param deviceType
     * @return
     */
    @PutMapping("/type")
    @ResponseBody
    public int updateDeviceType(DeviceType deviceType){
        return baseInfoService.updateDeviceType(deviceType);
    }

    /**
     * 获取所有设备品牌信息
     * @param map
     * @return
     */
    @RequestMapping("/brand/list")
    public String listDeviceBrand(ModelMap map){
        List<DeviceBrand> brandList = baseInfoService.listDeviceBrand();
        map.put("brandList",brandList);
        return "deviceBrands::table-refresh";
    }

    /**
     * 添加设备品牌
     * @param deviceBrand
     * @return
     */
    @PostMapping("/brand")
    @ResponseBody
    public int addtDeviceBrand(DeviceBrand deviceBrand){
        return baseInfoService.addtDeviceBrand(deviceBrand);
    }

    /**
     * 删除设备品牌
     * @param brandId
     * @return
     */
    @DeleteMapping("/brand/{brandId}")
    @ResponseBody
    public int delteDeviceBrandByid(@PathVariable("brandId") String brandId){
        return baseInfoService.deleteDeviceBrandById(brandId);
    }

    /**
     * 修改品牌
     * @param deviceBrand
     * @return
     */
    @PutMapping("/brand")
    @ResponseBody
    public int updateDeviceBrand(DeviceBrand deviceBrand){
        return baseInfoService.updateDeviceBrand(deviceBrand);
    }


    /**
     * 获取系统日志
     * @param map
     * @return
     */
    @RequestMapping("/log")
    public String listLog(ModelMap map, HttpServletRequest request){
        String startTime = request.getParameter("startTime");
        String endTime = request.getParameter("endTime");
        List<SystemLog> logs = logService.listLogsByDate(startTime,endTime);
        map.put("logList",logs);
        return "system::logList-refresh";
    }


}
举报

相关推荐

0 条评论