源码获取:博客首页 "资源" 里下载!

一、项目简述


本系统功能包括:
数据统计、收件录入、发件录入、到件录入、派件录入、问题件录入、退件录入、留仓录入、装车录入、发车录入、到车录入、卸车录入、运单录入、运单编辑、运单查询、数据导入、签收录入、签收查询、快件跟踪、自定义跟踪、问题件跟踪、预付款管理、财务报表明细、现金账单、月结账单、代收货款、业务员提成、订单分配、订单查询、物品名维护、入库、出库、库存、物料、角色管理、用户管理、系统设置、员工维护、客户维护、网点维护、报价维护、其他维护、收发记录、到件预报。

二、项目运行

环境配置:

Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。

项目技术:

Springboot + Maven + mybatis+ Vue 等等组成,B/S模式 + Maven管理等等。
 

 

 

 

运输点管理控制层代码:

/**
 * 运输点管理控制层
 */

@RequestMapping("/admin/transport")
@Controller
public class TransportController {

    @Autowired
    private UserService userService;
    @Autowired
    private RoleService roleService;
    @Autowired
    private OperaterLogService operaterLogService;
    
    /**
     * 运输点列表页面
     * @param model
     * @param user
     * @param pageBean
     * @return
     */
    @RequestMapping(value="/list")
    public String list(Model model, User user, PageBean<User> pageBean){
        model.addAttribute("title", "运输点列表");
        model.addAttribute("username", user.getUsername());
        model.addAttribute("pageBean", userService.findList(pageBean,user.getUsername(), UserRoleTypeEnum.TRANSPORT));
        return "admin/transport/list";
    }

    /**
     * 新增运输点页面
     * @param model
     * @return
     */
    @RequestMapping(value="/add",method= RequestMethod.GET)
    public String add(Model model){
        model.addAttribute("roles", roleService.findAllByRoleType(UserRoleTypeEnum.TRANSPORT));
        return "admin/transport/add";
    }

    /**
     * 运输点添加表单提交处理
     * @param user
     * @return
     */
    @RequestMapping(value="/add",method= RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> add(User user){
        //用统一验证实体方法验证是否合法
        CodeMsg validate = ValidateEntityUtil.validate(user);
        if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
            return Result.error(validate);
        }
        if(user.getAddress() == null){
            return Result.error(CodeMsg.ADDRESS_ERROR);
        }
        if(user.getRole() == null || user.getRole().getId() == null){
            return Result.error(CodeMsg.TRANSPORT_USER_ROLE_EMPTY);
        }
        //判断运输点名是否存在
        if(userService.isExistUsername(user.getUsername(), 0L)){
            return Result.error(CodeMsg.TRANSPORT_USERNAME_EXIST);
        }
        user.setUserType(UserRoleTypeEnum.TRANSPORT);
        //到这说明一切符合条件,进行数据库新增
        if(userService.save(user) == null){
            return Result.error(CodeMsg.TRANSPORT_USE_ADD_ERROR);
        }
        operaterLogService.add("添加运输点,运输点名:" + user.getUsername());
        return Result.success(true);
    }

    /**
     * 运输点编辑页面
     * @param model
     * @return
     */
    @RequestMapping(value="/edit",method= RequestMethod.GET)
    public String edit(Model model, @RequestParam(name="id")Long id){
        model.addAttribute("roles", roleService.findAllByRoleType(UserRoleTypeEnum.TRANSPORT));
        model.addAttribute("user", userService.find(id));
        return "admin/transport/edit";
    }

    /**
     * 编辑运输点信息表单提交处理
     * @param user
     * @return
     */
    @RequestMapping(value="/edit",method= RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> edit(User user){
        //用统一验证实体方法验证是否合法
        CodeMsg validate = ValidateEntityUtil.validate(user);
        if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
            return Result.error(validate);
        }
        if(user.getAddress() == null){
            return Result.error(CodeMsg.ADDRESS_ERROR);
        }
        if(user.getRole() == null || user.getRole().getId() == null){
            return Result.error(CodeMsg.TRANSPORT_USER_ROLE_EMPTY);
        }
        if(user.getId() == null || user.getId().longValue() <= 0){
            return Result.error(CodeMsg.TRANSPORT_USE_NO_EXIST);
        }
        if(userService.isExistUsername(user.getUsername(), user.getId())){
            return Result.error(CodeMsg.TRANSPORT_USERNAME_EXIST);
        }
        //到这说明一切符合条件,进行数据库保存
        User findById = userService.find(user.getId());
        //讲提交的运输点信息指定字段复制到已存在的user对象中,该方法会覆盖新字段内容
        BeanUtils.copyProperties(user, findById, "id","createTime","updateTime","userType");
        if(userService.save(findById) == null){
            return Result.error(CodeMsg.TRANSPORT_USE_EDIT_ERROR);
        }
        operaterLogService.add("编辑运输点,运输点名:" + user.getUsername());
        return Result.success(true);
    }

    /**
     * 删除运输点
     * @param id
     * @return
     */
    @RequestMapping(value="/delete",method= RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> delete(@RequestParam(name="id")Long id){
        try {
            userService.delete(id);
        } catch (Exception e) {
            return Result.error(CodeMsg.TRANSPORT_USE_DELETE_ERROR);
        }
        operaterLogService.add("删除运输点,运输点ID:" + id);
        return Result.success(true);
    }
    


}

登录控制层:

@RestController
public class LoginController {

    @Autowired
    AuthenticationManager authenticationManager;
    @Autowired
    private SysResourceService sysResourceService;
    @Autowired
    private SysRoleService sysRoleService;
    @Autowired
    private SysRoleResService sysRoleResService;
    @Autowired
    private EmployeeService employeeService;
    @Autowired
    private SysRoleEmpService sysRoleEmpService;
    //登录
    @PostMapping(value = "/login")
    public User login(@RequestBody Map<String,String> params)  {
        System.out.println(params.get("pwd"));
        User userInfo = SecurityUtils.login(params.get("username"), params.get("password"), authenticationManager);
        userInfo.setResources(this.sysResourceService.user_res(userInfo.getId().intValue()));
        return userInfo;
    }

    @RequestMapping("user_res")
    public List<SysResource> user_res(){
        try {
//            System.out.println(SecurityUtils.getUserInfo());

        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    //查询所有的角色
    @RequestMapping("selectRoleAll")
    public IPage<SysRole> selectRoleAll(@RequestBody Page page){
        return  this.sysRoleService.page(page);
    }
    //添加角色
    @RequestMapping("addRole")
    public SysRole addRole(@RequestBody SysRole role){
        this.sysRoleService.save(role);
        return role;
    }
    //修改角色
    @RequestMapping("updateRole")
    public SysRole updateRole(@RequestBody SysRole role){
        this.sysRoleService.updateById(role);
        return role;
    }

    //删除角色
    @RequestMapping("delRole")
    public Boolean delRole(int roleid){
        return this.sysRoleService.removeById(roleid);
    }

    //查询所有的资源
    @RequestMapping("selectRes")
    public List<SysResource> selectRes(){
        return this.sysResourceService.resAll();
    }

    //查询所分配资源的角色拥有的资源
    @RequestMapping("selectRo_Res")
    public List<Integer> selectRo_Res(int roleid){
        return this.sysResourceService.selectRo_Res(roleid);
    }

    //修改角色所拥有的资源
    @RequestMapping("updateRoRes")
    public int updateRoRes(@RequestBody ResDto resDto){
        this.sysRoleResService.updateRoRe(resDto);
        return 1;
    }

    //查询当前网点所有用户
    @RequestMapping("findEmpBran")
    public IPage<Employee> findEmpBran(@RequestBody QueryDto queryDto){
        return this.employeeService.selectEmpByBid(queryDto);
    }

    //查询所有的角色,无分页
    @RequestMapping("findRoleAll")
    public List<SysRole> findRoleAll(){
        return this.sysRoleService.list();
    }

    //查询所分配角色的用户拥有的角色
    @RequestMapping("selectRo_Emp")
    public List<Integer> selectRo_Emp(int empid){
        return this.sysRoleEmpService.selectRoEmp(empid);
    }

    //修改所选用户的角色
    @RequestMapping("updateRoEmp")
    public int updateRoEmp(@RequestBody ResDto resDto){
        return this.sysRoleEmpService.updateRoRe(resDto);
    }

    //逻辑删除员工
    @RequestMapping("delEmp")
    public int delEmp(int empid){
         this.employeeService.removeById(empid);
        return 1;
    }

}

班次管理控制层:

@RestController
@RequestMapping("shift")
public class ShiftController {
    @Autowired
    private ShiftService shiftService;
    //查询所有班次
    @RequestMapping("findShiftAll")
    public IPage<Shift> findShiftAll(@RequestBody Page page){
        return this.shiftService.page(page);
    }
    // 添加班次
    @RequestMapping("addShift")
    public Shift addShift(@RequestBody Shift shift){
        this.shiftService.save(shift);
        return shift;
    }

    //根据id查询班次
    @RequestMapping("findShiftBid")
    public Shift findShiftBid(int shiftid){
       return this.shiftService.getById(shiftid);
    }

    //保存修改的班次
    @RequestMapping("updateShift")
    public int updateShift(@RequestBody Shift shift){
        this.shiftService.updateById(shift);
        return 1;
    }

    //删除班次
    @RequestMapping("delShift")
    public int delShift(int shiftid){
        this.shiftService.removeById(shiftid);
        return 1;
    }

}

网点管理控制层:

@RestController
@RequestMapping("/branch")
public class BranchControllers {
    @Autowired
    private BranchService branchService;

    //父子级别查询网点
    @RequestMapping("findBranch")
    public List<Branch> findBranch(){
        return this.branchService.findBranch();
    }

    //查询所有网点
    @RequestMapping("findBranchAll")
    public List<Branch> findBranchAll(){
        return this.branchService.list();
    }
    //根据ID查询网点
    @RequestMapping("findBranchBid")
    public Branch findBranchBid(int bid){
        return this.branchService.getById(bid);
    }

    //添加网点
    @RequestMapping("addBranch")
    public Branch addBranch(@RequestBody Branch branch){
        this.branchService.save(branch);
        return branch;
    }
    //修改网点
    @RequestMapping("updateBranch")
    public Branch updateBranch(@RequestBody Branch branch){
        this.branchService.updateById(branch);
        return branch;
    }

    @RequestMapping("findPath")
    public List<Branch> findPath(String wid){
        return this.branchService.findPath(wid);
    }
}

 源码获取:博客首页 "资源" 里下载!

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐