基于javaweb+mysql的springboot精美物流管理系统(java+springboot+vue+maven+mysql)
运行环境
Java≥8、MySQL≥5.7、Node.js≥10
开发工具
后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot精美物流管理系统(java+springboot+vue+maven+mysql)
一、项目简述
本系统功能包括: 数据统计、收件录入、发件录入、到件录入、派件录入、问题件录入、退件录入、留仓录入、装车录入、发车录入、到车录入、卸车录入、运单录入、运单编辑、运单查询、数据导入、签收录入、签收查询、快件跟踪、自定义跟踪、问题件跟踪、预付款管理、财务报表明细、现金账单、月结账单、代收货款、业务员提成、订单分配、订单查询、物品名维护、入库、出库、库存、物料、角色管理、用户管理、系统设置、员工维护、客户维护、网点维护、报价维护、其他维护、收发记录、到件预报。
二、项目运行 环境配置:
Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。
项目技术:
Springboot + Maven + mybatis+ Vue 等等组成,B/S模式 + Maven管理等等。
@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);
}
//添加角色
logistics.setLid(pHandling.getLid());
this.logisticsService.updateById(logistics);
this.logisticsService.removeById(logistics);
}
}
@CrossOrigin
@RestController
@RequestMapping("/waybill")
public class WaybillController {
@Autowired
WaybillService waybillService;
@RequestMapping("listwaybilllike")
public IPage<Waybill> listwaybilllike(@RequestBody PageDto pageDto){
Page page=new Page(1,1);
if(pageDto!=null&&pageDto.getCurrent()!=null&& pageDto.getSize()!=null){
page.setCurrent(pageDto.getCurrent());
page.setSize(pageDto.getSize());
}
IPage<Waybill> list=this.waybillService.selectWaybilllike(page,pageDto);
return list;
}
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
// 设置不隐藏 未找到用户异常
provider.setHideUserNotFoundExceptions(true);
// 用户认证service - 查询数据库的逻辑
provider.setUserDetailsService(userDetailsService());
// 设置密码加密算法
provider.setPasswordEncoder(passwordEncoder());
auth.authenticationProvider(provider);
}
/**
* 描述: 通过自定义的UserDetailsService 来实现查询数据库用户数据
**/
@Override
@Bean
protected UserDetailsService userDetailsService() {
return new UserDetailsServiceImpl();
}
/**
* 描述: 密码加密算法 BCrypt 推荐使用
**/
@Bean
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
/**
* 描述: 注入AuthenticationManager管理器
**/
@Override
@Bean
public AuthenticationManager authenticationManager() throws Exception {
return super.authenticationManager();
}
@RestController
public class EmpControlle {
@Autowired
private EmployeeService employeeService;
@Autowired
private GwService gwService;
//添加用户
@RequestMapping("addEmp")
public Employee addEmp(@RequestBody Employee employee){
String pwd= SecurityUtils.encryptPassword(employee.getPwd());
employee.setPwd(pwd);
this.employeeService.save(employee);
return employee;
}
//查询所有岗位
@RequestMapping("findGwAll")
public List<Gw> findGwAll(){
return this.gwService.list();
}
//查询要修改的员工
@RequestMapping("findEmpBid")
public Employee findEmpBid(int empid){
return this.employeeService.getById(empid);
}
//修改员工
@RequestMapping("updateEmp")
public Employee updateEmp(@RequestBody Employee employee){
this.employeeService.updateById(employee);
return employee;
}
}
// } else if (exception instanceof CredentialsExpiredException) {
// Result.error("密码过期,请联系管理员!");
// } else if (exception instanceof AccountExpiredException) {
// Result.error("账户过期,请联系管理员!");
// } else if (exception instanceof DisabledException) {
// Result.error("账户被禁用,请联系管理员!");
// } else if (exception instanceof BadCredentialsException) {
// Result.error("用户名或者密码输入错误,请重新输入!");
// }
// out.write(new ObjectMapper().writeValueAsString(respBean));
// out.flush();
// out.close();
// }
// })
// .permitAll()
// .and()
// //注销的回调
// .logout()
// .logoutSuccessHandler(new LogoutSuccessHandler() {
// @Override
// public void onLogoutSuccess(HttpServletRequest req, HttpServletResponse resp, Authentication authentication) throws IOException, ServletException {
// resp.setContentType("application/json;charset=utf-8");
// PrintWriter out = resp.getWriter();
// out.write(new ObjectMapper().writeValueAsString(Result.ok("注销成功!")));
// out.flush();
// out.close();
// }
// })
// .permitAll()
// .and()
// .csrf().disable().exceptionHandling()
// //没有认证时,在这里处理结果,不要重定向
// .authenticationEntryPoint(new AuthenticationEntryPoint() {
// @Override
// public void commence(HttpServletRequest req, HttpServletResponse resp, AuthenticationException authException) throws IOException, ServletException {
// resp.setContentType("application/json;charset=utf-8");
// //resp.setStatus(401);
// PrintWriter out = resp.getWriter();
// Result respBean = Result.error("访问失败!");
// if (authException instanceof InsufficientAuthenticationException) {
// //respBean.setMsg("请求失败,请联系管理员!");
// }
// //out.write(new ObjectMapper().writeValueAsString(respBean));
// out.flush();
// out.close();
// class DefinedObjectPostProcessor implements ObjectPostProcessor<FilterSecurityInterceptor> {
// @Override
// public <O extends FilterSecurityInterceptor> O postProcess(O object) {
// object.setSecurityMetadataSource(urlRolesFilterHandler);
// return object;
// }
// }
// @Autowired
// CustomUrlDecisionManager customUrlDecisionManager;
//
//
//
// @Override
// protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// auth.userDetailsService(userDetailsService()).passwordEncoder(new BCryptPasswordEncoder());
// }
//
//
//
//
// @Autowired
// private UrlRolesFilterHandler urlRolesFilterHandler;
//
//
// @Override
// protected void configure(HttpSecurity http) throws Exception {
// http.cors().and().csrf().disable();
// http.authorizeRequests()
// //所有的请求认证之后才能进入
// .withObjectPostProcessor(new ObjectPostProcessor<FilterSecurityInterceptor>() {
// @Override
// public <O extends FilterSecurityInterceptor> O postProcess(O object) {
// object.setAccessDecisionManager(customUrlDecisionManager);
// object.setSecurityMetadataSource(urlRolesFilterHandler);
// return object;
// }
// });
// http
// .formLogin()
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
SysRoleService roleService;
// @Autowired
// SysUserService userService;
//
// @Autowired
// AccountService accountService;
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
//用于配置直接放行的请求
.antMatchers("/login").permitAll()
//其余请求都需要验证
.anyRequest().authenticated()
//授权码模式需要 会弹出默认自带的登录框
.and().httpBasic();
//禁用跨站伪造
http.cors().and().csrf().disable();
//如果项目没有前后端分离,还可以通过 formlogin配置登录相关的页面和请求处理
// 使用自定义的认证过滤器
// http.addFilterBefore(new MyLoginFilter(authenticationManager()),UsernamePasswordAuthenticationFilter.class);
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
// 设置不隐藏 未找到用户异常
provider.setHideUserNotFoundExceptions(true);
// 用户认证service - 查询数据库的逻辑
provider.setUserDetailsService(userDetailsService());
// 设置密码加密算法
provider.setPasswordEncoder(passwordEncoder());
auth.authenticationProvider(provider);
}
/**
* 描述: 通过自定义的UserDetailsService 来实现查询数据库用户数据
**/
@CrossOrigin
@RestController
@RequestMapping("pHandling")
public class PHandlingController {
@Autowired
PHandlingService pHandlingService;
@Autowired
LogisticsService logisticsService;
@RequestMapping("savePHandling")
public void savePHandling(@RequestBody PHandling pHandling){
this.pHandlingService.savePHandling(pHandling);
Logistics logistics = new Logistics();
logistics.setSolvingid(pHandling.getSolvingid());
logistics.setLid(pHandling.getLid());
this.logisticsService.updateById(logistics);
this.logisticsService.removeById(logistics);
}
}
@CrossOrigin
@RestController
@RequestMapping("/waybill")
public class WaybillController {
@Autowired
WaybillService waybillService;
@RequestMapping("listwaybilllike")
// .failureHandler(new AuthenticationFailureHandler() {
// @Override
// public void onAuthenticationFailure(HttpServletRequest req, HttpServletResponse resp, AuthenticationException exception) throws IOException, ServletException {
// resp.setContentType("application/json;charset=utf-8");
// PrintWriter out = resp.getWriter();
// Result respBean = Result.error("登录失败!");
// if (exception instanceof LockedException) {
// Result.error("账户被锁定,请联系管理员!");
// } else if (exception instanceof CredentialsExpiredException) {
// Result.error("密码过期,请联系管理员!");
// } else if (exception instanceof AccountExpiredException) {
// Result.error("账户过期,请联系管理员!");
// } else if (exception instanceof DisabledException) {
// Result.error("账户被禁用,请联系管理员!");
// } else if (exception instanceof BadCredentialsException) {
// Result.error("用户名或者密码输入错误,请重新输入!");
// }
// out.write(new ObjectMapper().writeValueAsString(respBean));
// out.flush();
// out.close();
// }
// })
// .permitAll()
// .and()
// //注销的回调
// .logout()
// .logoutSuccessHandler(new LogoutSuccessHandler() {
// @Override
// public void onLogoutSuccess(HttpServletRequest req, HttpServletResponse resp, Authentication authentication) throws IOException, ServletException {
// resp.setContentType("application/json;charset=utf-8");
// PrintWriter out = resp.getWriter();
// out.write(new ObjectMapper().writeValueAsString(Result.ok("注销成功!")));
// out.flush();
// out.close();
// }
// })
// .permitAll()
// .and()
// .csrf().disable().exceptionHandling()
// //没有认证时,在这里处理结果,不要重定向
// .authenticationEntryPoint(new AuthenticationEntryPoint() {
// @Override
// public void commence(HttpServletRequest req, HttpServletResponse resp, AuthenticationException authException) throws IOException, ServletException {
// resp.setContentType("application/json;charset=utf-8");
// //resp.setStatus(401);
// PrintWriter out = resp.getWriter();
// Result respBean = Result.error("访问失败!");
// if (authException instanceof InsufficientAuthenticationException) {
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("deleteCarById")
public void deleteCar(Integer carid){
this.carService.deleteCar(carid);
}
//添加
@RequestMapping("saveCar")
public MsgDto saveCar(@RequestBody Car car){
this.carService.saveCar(car);
return new MsgDto("保存成功",true,car);
}
}
@RestController
public class EmpControlle {
@Autowired
private EmployeeService employeeService;
@Autowired
private GwService gwService;
//添加用户
@RequestMapping("addEmp")
public Employee addEmp(@RequestBody Employee employee){
String pwd= SecurityUtils.encryptPassword(employee.getPwd());
employee.setPwd(pwd);
this.employeeService.save(employee);
return employee;
}
//查询所有岗位
@RequestMapping("findGwAll")
public List<Gw> findGwAll(){
return this.gwService.list();
}
// protected void configure(HttpSecurity http) throws Exception {
//
// // 关闭csrf
// http.csrf().disable();
//
// // 配置登录页面
// http.formLogin().loginPage("/login").permitAll();
//
// // 配置登录成功后的操作
// http.formLogin().successHandler(new LoginSuccessHandler());
//
//
// // 用户权限不足处理器
// http.exceptionHandling().accessDeniedHandler(new AuthLimitHandler());
//
// // 登出授权
// http.logout().permitAll();
//
// // 授权配置
// http.authorizeRequests()
// /* 所有静态文件可以访问 */
// .antMatchers("/js/**", "/css/**", "/images/**").permitAll()
// /* 所有 以/ad 开头的 广告页面可以访问 */
// .antMatchers("/ad/**").permitAll()
// /* 动态url权限 */
// .withObjectPostProcessor(new DefinedObjectPostProcessor())
// /* url决策 */
// .accessDecisionManager(accessDecisionManager())
// .anyRequest().authenticated();
//
// }
//
//
// @Override
// protected UserDetailsService userDetailsService() {
// return username -> {
// if (username == null || username.trim().length() <= 0) {
// throw new UsernameNotFoundException("账号不能为空");
// }
// QueryWrapper wrapper = new QueryWrapper();
// wrapper.eq("accountName", username);
// Account user = accountService.getOne(wrapper);
// if (user != null) {
@CrossOrigin
@RestController
@RequestMapping("problemtype")
public class ProblemtypeController {
@Autowired
ProblemtypeService problemtypeService;
@Autowired
LogisticsService logisticsService;
@Autowired
PHandlingService pHandlingService;
// @RequestMapping("findById")
// public Problemtype findPById(Integer id){
// return this.problemtypeService.findPById(id);
// }
//问题件处理查询所有
@RequestMapping("selectPages")
public IPage<Logistics> selectpages2(@RequestBody PageDto pageDto){
Page page=new Page(1,2);
if(pageDto!=null&&pageDto.getCurrent()!=null&& pageDto.getSize()!=null){
page.setCurrent(pageDto.getCurrent());
page.setSize(pageDto.getSize());
}
IPage<Logistics> list=this.logisticsService.selectlogisticsPage2(page,pageDto);
return list;
}
//问题件处理带条件分页查询
@RequestMapping("selectPages2")
public IPage<Logistics> selectpages3(@RequestBody PageDto pageDto){
Page page=new Page(1,2);
if(pageDto!=null&&pageDto.getCurrent()!=null&& pageDto.getSize()!=null){
page.setCurrent(pageDto.getCurrent());
page.setSize(pageDto.getSize());
}
IPage<Logistics> list=this.problemtypeService.selectLogisticsPage3(page,pageDto);
return list;
}
//问题件类型查询
@RequestMapping("selectAll")
//lsk新增的CURD
@RestController
@RequestMapping("rulesorder")
public class RulesorderController {
@Autowired
RulesorderService rulesorderService;
//分页查询
@RequestMapping("findPage")
public IPage<Rulesorder> findPage(@RequestBody PageDto pageDto){
Page page=new Page(1,4);
if(pageDto!=null&&pageDto.getCurrent()!=null&& pageDto.getSize()!=null){
page.setCurrent(pageDto.getCurrent());
page.setSize(pageDto.getSize());
}
IPage<Rulesorder> list=this.rulesorderService.selectPage(page,pageDto);
return list;
}
//修改
@RequestMapping("updateRulesorder")
public MsgDto updateCar(@RequestBody Rulesorder rulesorder){
this.rulesorderService.updateRulesorder(rulesorder);
return new MsgDto("修改成功",true,rulesorder);
}
//删除
@RequestMapping("deleteRulesorderById")
public void deleteCar(Integer roid){
this.rulesorderService.deleteRulesorder(roid);
}
//添加
@RequestMapping("saveRulesorder")
public MsgDto saveCar(@RequestBody Rulesorder rulesorder){
this.rulesorderService.save(rulesorder);
return new MsgDto("保存成功",true,rulesorder);
}
}
}
}
//LSK新增的CURD
@RestController
@RequestMapping("car")
public class CarController {
@Autowired
CarService carService;
//分页查询
@RequestMapping("findPage")
public IPage<Car> findPage(@RequestBody PageDto pageDto){
Page page=new Page(1,4);
if(pageDto!=null&&pageDto.getCurrent()!=null&& pageDto.getSize()!=null){
page.setCurrent(pageDto.getCurrent());
page.setSize(pageDto.getSize());
}
IPage<Car> list=this.carService.selectPage(page,pageDto);
return list;
}
//修改
@RequestMapping("updateCar")
public MsgDto updateCar(@RequestBody Car car){
this.carService.updateById(car);
return new MsgDto("修改成功",true,car);
}
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);
}
// return object;
// }
// });
// http
// .formLogin()
// .usernameParameter("username")
// .passwordParameter("password")
// .loginProcessingUrl("/login") //登陆请求
// .loginPage("/login")//登陆页面
// //登陆成功的回调
// .successHandler(new AuthenticationSuccessHandler() {
// @Override
// public void onAuthenticationSuccess(HttpServletRequest req, HttpServletResponse resp, Authentication authentication) throws IOException, ServletException {
// resp.setContentType("application/json;charset=utf-8");
// PrintWriter out = resp.getWriter();
// Result ok = Result.ok("登录成功!");
// String s = new ObjectMapper().writeValueAsString(ok);
// out.write(s);
// out.flush();
// out.close();
// }
// })
// //登陆失败的回调
// .failureHandler(new AuthenticationFailureHandler() {
// @Override
// public void onAuthenticationFailure(HttpServletRequest req, HttpServletResponse resp, AuthenticationException exception) throws IOException, ServletException {
// resp.setContentType("application/json;charset=utf-8");
// PrintWriter out = resp.getWriter();
// Result respBean = Result.error("登录失败!");
// if (exception instanceof LockedException) {
// Result.error("账户被锁定,请联系管理员!");
// } else if (exception instanceof CredentialsExpiredException) {
// Result.error("密码过期,请联系管理员!");
// } else if (exception instanceof AccountExpiredException) {
// Result.error("账户过期,请联系管理员!");
// } else if (exception instanceof DisabledException) {
// Result.error("账户被禁用,请联系管理员!");
// } else if (exception instanceof BadCredentialsException) {
// Result.error("用户名或者密码输入错误,请重新输入!");
// }
// out.write(new ObjectMapper().writeValueAsString(respBean));
// out.flush();
// out.close();
public IPage<Logistics> selectpages3(@RequestBody PageDto pageDto){
Page page=new Page(1,2);
if(pageDto!=null&&pageDto.getCurrent()!=null&& pageDto.getSize()!=null){
page.setCurrent(pageDto.getCurrent());
page.setSize(pageDto.getSize());
}
IPage<Logistics> list=this.problemtypeService.selectLogisticsPage3(page,pageDto);
return list;
}
//问题件类型查询
@RequestMapping("selectAll")
public List<Problemtype> SelectAll(){
List <Problemtype> list=this.problemtypeService.list();
return list;
}
//问题件查询所有分页查询
@RequestMapping("selectPages4")
public IPage<Logistics> selectpages4(@RequestBody PageDto pageDto){
Page page=new Page(1,2);
if(pageDto!=null&&pageDto.getCurrent()!=null&& pageDto.getSize()!=null){
page.setCurrent(pageDto.getCurrent());
page.setSize(pageDto.getSize());
}
IPage<Logistics> list=this.pHandlingService.selectlogisticsPage4(page,pageDto);
return list;
}
//问题件查询的带条件查询
@RequestMapping("selectPages5")
public IPage<Logistics> selectpages5(@RequestBody PageDto pageDto){
Page page=new Page(1,2);
if(pageDto!=null&&pageDto.getCurrent()!=null&& pageDto.getSize()!=null){
page.setCurrent(pageDto.getCurrent());
page.setSize(pageDto.getSize());
}
IPage<Logistics> list=this.problemtypeService.selectLogisticsPage5(page,pageDto);
return list;
}
}