基于javaweb+mysql的ssm+maven在线汽车租赁系统(前台+后台)(java+jsp+ssm+layui+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven在线汽车租赁系统(前台+后台)(java+jsp+ssm+layui+mysql)
一、项目简述 环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等
carVo.setCreatetime(new Date());
//如果不是默认图片就去掉图片的_temp的后缀
if (!carVo.getCarimg().equals(SysConstant.DEFAULT_CAR_IMG)) {
String filePath = AppFileUtils.updateFileName(carVo.getCarimg(), SysConstant.FILE_UPLOAD_TEMP);
carVo.setCarimg(filePath);
}
this.carService.addCar(carVo);
return ResultObj.ADD_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.ADD_ERROR;
}
}
/**
* 修改一个车辆
*
* @param carVo
* @return
*/
@RequestMapping("updateCar")
public ResultObj updateCar(CarVo carVo) {
try {
String carimg = carVo.getCarimg();
if (carimg.endsWith(SysConstant.FILE_UPLOAD_TEMP)) {
String filePath = AppFileUtils.updateFileName(carVo.getCarimg(), SysConstant.FILE_UPLOAD_TEMP);
carVo.setCarimg(filePath);
//把原来的删除
Car car = this.carService.queryCarByCarNumber(carVo.getCarnumber());
AppFileUtils.removeFileByPath(car.getCarimg());
}
this.carService.updateCar(carVo);
return ResultObj.UPDATE_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.UPDATE_ERROR;
}
}
/**
* 删除一个车辆
*
* @param carVo
* @return
*/
@RequestMapping("deleteCar")
public ResultObj deleteCar(CarVo carVo) {
try {
this.carService.deleteCar(carVo.getCarnumber());
return ResultObj.DELETE_SUCCESS;
/**
* (TbUser)表控制层
*
*/
@Controller
public class TbUserController {
/**
* 服务对象
*/
@Autowired
private TbUserService tbUserService;
/*首页*/
@RequestMapping(value = "/user/index.action")
public String showCarIndex(Model mv,HttpSession httpSession){
System.out.println("打开首页成功");
TbUser tbUser = new TbUser();
List<BusCar> arrayList = tbUserService.carAllByLimit(1,6);
mv.addAttribute("car",arrayList);
tbUser = (TbUser) httpSession.getAttribute("tbuser");
mv.addAttribute("tbuser",tbUser);
return "user/index";
}
@RequestMapping("carDetail.action")
public String carDetail(String car,Model model){
BusCar busCarcar = tbUserService.carByCarNumber(car);
model.addAttribute("car",busCarcar);
System.out.println("车牌号是"+car);
return "user/car_detail";
}
/**
* 跳转登录页面
* @param model
* @return
*/
@RequestMapping(value="/user/login.action",method= RequestMethod.GET)
public String login(Model model,HttpSession httpSession) {
model.addAttribute("tbuser",httpSession.getAttribute("tbuser"));
model.addAttribute("error", SysConstant.USER_LOGIN_ERROR_MSG);
return "system/main/login";
}
}else {
model.addAttribute("error", SysConstant.USER_LOGIN_CODE_ERROR_MSG);
return "system/main/login";
}
}
@RequestMapping("getCode")
public void getCode(HttpServletResponse response, HttpSession session) throws IOException {
//定义图形验证码的长和宽
LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(116,36,4,5);
session.setAttribute("code",lineCaptcha.getCode());
ServletOutputStream outputStream = response.getOutputStream();
ImageIO.write(lineCaptcha.getImage(),"JPEG",outputStream);
}
}
package com.alfred.sys.utils;
public class AppFileUtils {
/**
* 得到文件上传的路径
/**
* 添加公告
* @return
*/
@RequestMapping("addNews")
public ResultObj addNews(NewsVo newsVo){
try {
newsVo.setCreatetime(new Date());
User user=(User) WebUtils.getHttpSession().getAttribute("user");
newsVo.setOpername(user.getRealname());
this.newsService.addNews(newsVo);
return ResultObj.ADD_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.ADD_ERROR;
}
}
/**
* 删除公告
* @param newsVo
* @return
*/
@RequestMapping("deleteNews")
public ResultObj deleteNews(NewsVo newsVo){
try {
this.newsService.deleteNews(newsVo.getId());
return ResultObj.DELETE_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.DELETE_ERROR;
}
}
/**
* 批量删除公告
* @param newsVo
* @return
*/
@RequestMapping("deleteBatchNews")
public ResultObj deleteBatchNews(NewsVo newsVo){
try {
this.newsService.deleteBatchNews(newsVo.getIds());
return ResultObj.DELETE_SUCCESS;
}catch (Exception e){
e.printStackTrace();
/**
* 批量删除用户
* @param userVo
* @return
*/
@RequestMapping("deleteBatchUser")
public ResultObj deleteBatchUser(UserVo userVo){
try {
this.userService.deleteBatchUser(userVo.getIds());
return ResultObj.DELETE_SUCCESS;
}catch (Exception e){
return ResultObj.DELETE_ERROR;
}
}
/**
* 重置密码
* @param userVo
* @return
*/
@RequestMapping("resetUserPwd")
public ResultObj resetUserPwd(UserVo userVo){
try {
this.userService.resetUserPwd(userVo.getUserid());
return ResultObj.RESET_SUCCESS;
}catch (Exception e){
return ResultObj.RESET_ERROR;
}
}
/**
* 加载用户管理的分配角色的数据
* @param userVo
* @return
*/
@RequestMapping("initUserRole")
public DataGridView initUserRole(UserVo userVo){
return this.userService.queryUserRole(userVo.getUserid());
}
}
/**
* 跳转到汽车入库管理的页面
* @return
*/
@RequestMapping("toCheckCarManager")
public String toCheckCarManager(){
return "business/check/checkCarManager";
}
/**
* 跳转到检查单管理的页面
* @return
*/
@RequestMapping("toCheckManager")
public String toCheckManager(){
return "business/check/checkManager";
}
}
package com.alfred.sys.utils;
/**
* web的工具类
*
*/
public class WebUtils {
public static ServletRequestAttributes getServletRequestAttributes() {
return (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
}
/**
* 得到当前线程的请求对象
* @return
*/
public static HttpServletRequest getHttpServletRequest() {
return getServletRequestAttributes().getRequest();
* 添加公告
* @return
*/
@RequestMapping("addNews")
public ResultObj addNews(NewsVo newsVo){
try {
newsVo.setCreatetime(new Date());
User user=(User) WebUtils.getHttpSession().getAttribute("user");
newsVo.setOpername(user.getRealname());
this.newsService.addNews(newsVo);
return ResultObj.ADD_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.ADD_ERROR;
}
}
/**
* 删除公告
* @param newsVo
* @return
*/
@RequestMapping("deleteNews")
public ResultObj deleteNews(NewsVo newsVo){
try {
this.newsService.deleteNews(newsVo.getId());
return ResultObj.DELETE_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.DELETE_ERROR;
}
}
/**
* 批量删除公告
* @param newsVo
* @return
*/
@RequestMapping("deleteBatchNews")
public ResultObj deleteBatchNews(NewsVo newsVo){
try {
this.newsService.deleteBatchNews(newsVo.getIds());
return ResultObj.DELETE_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.DELETE_ERROR;
}
}
/**
* 更新公告
* @param newsVo
* @return
*/
return ResultObj.DELETE_ERROR;
}
}
/**
* 批量删除公告
* @param newsVo
* @return
*/
@RequestMapping("deleteBatchNews")
public ResultObj deleteBatchNews(NewsVo newsVo){
try {
this.newsService.deleteBatchNews(newsVo.getIds());
return ResultObj.DELETE_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.DELETE_ERROR;
}
}
/**
* 更新公告
* @param newsVo
* @return
*/
@RequestMapping("updateNews")
public ResultObj updateNews(NewsVo newsVo){
try {
this.newsService.updateNews(newsVo);
return ResultObj.UPDATE_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.UPDATE_ERROR;
}
}
/**
* 根据id查询公告
*/
@RequestMapping("loadNewsById")
public News loadNewsById(Integer id) {
return this.newsService.queryNewsById(id);
}
* 删除菜单
* @param menuVo
* @return
*/
@RequestMapping("deleteMenu")
public ResultObj deleteMenu(MenuVo menuVo){
try {
this.menuService.deleteMenu(menuVo);
return ResultObj.DELETE_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.DELETE_ERROR;
}
}
}
package com.alfred.bus.controller;
/**
*汽车出租管理的控制器
*/
@RestController
@RequestMapping("rent")
public class RentController {
@Autowired
private RentService rentService;
@Autowired
*/
@RestController
@RequestMapping("role")
public class RoleController {
@Autowired
private RoleService roleService;
/**
* 加载角色列表返回DataGridView
*/
@RequestMapping("loadAllRole")
public DataGridView loadAllRole(RoleVo roleVo) {
return this.roleService.queryAllRole(roleVo);
}
/**
* 添加角色
*/
@RequestMapping("addRole")
public ResultObj addRole(RoleVo roleVo) {
try {
this.roleService.addRole(roleVo);
return ResultObj.ADD_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.ADD_ERROR;
}
}
/**
* 修改角色
*/
@RequestMapping("updateRole")
public ResultObj updateRole(RoleVo roleVo) {
try {
this.roleService.updateRole(roleVo);
return ResultObj.UPDATE_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.UPDATE_ERROR;
* @param rentid
*/
@RequestMapping("exportRent")
public ResponseEntity<Object> exportRent(String rentid){
//根据出租单号查询出租单信息
Rent rent = rentService.queryRentByRentId(rentid);
//根据身份证号查询客户信息
Customer customer = customerService.queryCustomerByIdentity(rent.getIdentity());
String fileName=customer.getCustname()+"-的出租单.xls";
String sheetName=customer.getCustname()+"出租单";
ByteArrayOutputStream bos = ExportRentUtils.exportRent(rent,customer,sheetName);
try {
//处理文件名乱码
fileName= URLEncoder.encode(fileName,"UTF-8");
//创建 封装响应头信息的对象
HttpHeaders headers = new HttpHeaders();
//封装响应内容类型(APPLICATION_OCTET_STREAM 响应的内容不限定)
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
//设置下载的文件的名称
headers.setContentDispositionFormData("attachment",fileName);
return new ResponseEntity<Object>(bos.toByteArray(),headers, HttpStatus.CREATED);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
}
package com.alfred.user.controller;
}
package com.alfred.sys.controller;
/**
*/
@RestController
@RequestMapping("menu")
public class MenuController {
@Autowired
private MenuService menuService;
@RequestMapping("loadIndexLeftMenuJson")
public List<TreeNode> loadIndexLeftMenuJson(MenuVo menuVo) {
//得到当前用户登录的对象
User user = (User) WebUtils.getHttpSession().getAttribute("user");
List<Menu> list = null;
menuVo.setAvailable(SysConstant.AVAILABLE_TRUE);//只用于查询可用的
if (user.getType() == SysConstant.USER_TYPE_SUPER) {
list = menuService.queryAllMenuForList(menuVo);
} else {
list = menuService.queryMenuByUserIdForList(menuVo, user.getUserid());
}
List<TreeNode> nodes = new ArrayList<>();
//把list里的数据方到nodes
for (Menu menu : list) {
Integer id = menu.getId();
Integer pid = menu.getPid();
@RequestMapping("checkCustomerExist")
public ResultObj checkCustomerExist(RentVo rentVo){
Customer customer = customerService.queryCustomerByIdentity(rentVo.getIdentity());
if(customer!=null){
return ResultObj.STATUS_TRUE;
}else {
return ResultObj.STATUS_FALSE;
}
}
/**
* 初始化添加出租单的表单的数据
* @param rentVo
* @return
*/
@RequestMapping("initRentFrom")
public RentVo initRentFrom(RentVo rentVo){
//生成出租单号
rentVo.setRentid(RandomUtils.createRandomStringUseTime(SysConstant.CAR_ORDER_CZ));
//设置起租时间
rentVo.setBegindate(new Date());
//设置操作员
User user = (User) WebUtils.getHttpSession().getAttribute("user");
rentVo.setOpername(user.getRealname());
return rentVo;
}
/**
* 保存出租单信息
* @param rentVo
* @return
*/
@RequestMapping("saveRent")
public ResultObj saveRent(RentVo rentVo) {
try {
//设置创建时间
rentVo.setCreatetime(new Date());
//设置归还状态
rentVo.setRentflag(SysConstant.RENT_BACK_FALSE);
//保存
this.rentService.addRent(rentVo);
return ResultObj.ADD_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.ADD_ERROR;
}
}
/******************出租单管理*******************/
/**
* 查询
@RequestMapping("loadIndexLeftMenuJson")
public List<TreeNode> loadIndexLeftMenuJson(MenuVo menuVo) {
//得到当前用户登录的对象
User user = (User) WebUtils.getHttpSession().getAttribute("user");
List<Menu> list = null;
menuVo.setAvailable(SysConstant.AVAILABLE_TRUE);//只用于查询可用的
if (user.getType() == SysConstant.USER_TYPE_SUPER) {
list = menuService.queryAllMenuForList(menuVo);
} else {
list = menuService.queryMenuByUserIdForList(menuVo, user.getUserid());
}
List<TreeNode> nodes = new ArrayList<>();
//把list里的数据方到nodes
for (Menu menu : list) {
Integer id = menu.getId();
Integer pid = menu.getPid();
String title = menu.getTitle();
String icon = menu.getIcon();
String href = menu.getHref();
Boolean spread = menu.getSpread() == SysConstant.SPREAD_TRUE ? true : false;
String target = menu.getTarget();
nodes.add(new TreeNode(id, pid, title, icon, href, spread, target));
}
return TreeNodeBuilder.builder(nodes, 1);
}
/**
* 加载菜单管理左边的菜单树
* @param menuVo
* @return
*/
@RequestMapping("loadMenuManagerLeftTreeJson")
public DataGridView loadMenuManagerLeftTreeJson(MenuVo menuVo) {
menuVo.setAvailable(SysConstant.AVAILABLE_TRUE);
List<Menu> list = this.menuService.queryAllMenuForList(menuVo);
List<TreeNode> nodes = new ArrayList<>();
for (Menu menu : list) {
Integer id = menu.getId();
Integer pid = menu.getPid();
return this.rentService.queryAllRent(rentVo);
}
/**
* 删除出租单信息
* @param rentVo
* @return
*/
@RequestMapping("deleteRent")
public ResultObj deleteRent(RentVo rentVo){
try {
//删除
this.rentService.deleteRent(rentVo.getRentid());
return ResultObj.DELETE_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.DELETE_ERROR;
}
}
/**
* 修改出租单信息
* @param rentVo
* @return
*/
@RequestMapping("updateRent")
public ResultObj updateRent(RentVo rentVo){
try {
//修改
this.rentService.updateRent(rentVo);
return ResultObj.UPDATE_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.UPDATE_ERROR;
}
}
}
package com.alfred.sys.controller;
/**
* 用户管理控制器
@Autowired
private UserService userService;
@Autowired
private LogInfoService logInfoService;
/**
* @return 跳转到登录页面的方法
*/
@RequestMapping("toLogin")
public String toLogin(){
return "system/main/login";
}
/**
* .登陆方法
* @param userVo
* @param model
* @return
*/
@RequestMapping("login")
public String login(UserVo userVo, Model model){
String code = "";
if(WebUtils.getHttpSession().getAttribute("code").toString() == null){
return "/";
}else{
code = WebUtils.getHttpSession().getAttribute("code").toString();
}
if(userVo.getCode().equals(code)){
User user = this.userService.login(userVo);
System.out.println("user = " + user);
if(null!=user){
//放入到session
WebUtils.getHttpSession().setAttribute("user",user);
//记录登录日志向sys_login_log里插入数据
LogInfoVo logInfoVo = new LogInfoVo();
logInfoVo.setLogintime(new Date());
logInfoVo.setLoginname(user.getRealname()+"-"+user.getLoginname());
logInfoVo.setLoginip(WebUtils.getHttpServletRequest().getRemoteAddr());
logInfoService.addLogInfo(logInfoVo);
WebUtils.getServletRequestAttributes().setAttribute("user",user,1);
return "system/main/index";
}else {
model.addAttribute("error", SysConstant.USER_LOGIN_ERROR_MSG);
return "system/main/login";
}
}else {
e.printStackTrace();
}
//把file转成一个bytes
byte [] bytes=FileUtils.readFileToByteArray(file);
HttpHeaders header=new HttpHeaders();
//封装响应内容类型(APPLICATION_OCTET_STREAM 响应的内容不限定)
header.setContentType(MediaType.APPLICATION_OCTET_STREAM);
//设置下载的文件的名称
header.setContentDispositionFormData("attachment", oldName);
//创建ResponseEntity对象
ResponseEntity<Object> entity=
new ResponseEntity<Object>(bytes, header, HttpStatus.CREATED);
return entity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}else {
PrintWriter out;
try {
out = response.getWriter();
out.write("文件不存在");
out.flush();
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
/**
* 根据相对路径删除硬盘上文件
* @param path
*/
public static void deleteFileUsePath(String path) {
String realPath=PATH+path;
//根据文件
List<Double> entities = this.statService.loadCompanyYearGradeStatList(year);
for (int i = 0; i < entities.size(); i++) {
if (null==entities.get(i)){
entities.set(i,0.0);
}
}
return entities;
}
/**
* 导出客户数据
* @param customerVo
* @param response
*/
@RequestMapping("exportCustomer")
public ResponseEntity<Object> exportCustomer(CustomerVo customerVo, HttpServletResponse response){
List<Customer> customers = customerService.queryAllCustomerForList(customerVo);
String fileName="客户数据.xls";
String sheetName="客户数据";
ByteArrayOutputStream bos = ExportCustomerUtils.exportCustomer(customers,sheetName);
try {
//处理文件名乱码
fileName= URLEncoder.encode(fileName,"UTF-8");
//创建 封装响应头信息的对象
HttpHeaders headers = new HttpHeaders();
//封装响应内容类型(APPLICATION_OCTET_STREAM 响应的内容不限定)
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
//设置下载的文件的名称
headers.setContentDispositionFormData("attachment",fileName);
return new ResponseEntity<Object>(bos.toByteArray(),headers, HttpStatus.CREATED);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
/**
* 导出出租单数据
* @param rentid
*/
@RequestMapping("exportRent")
public ResponseEntity<Object> exportRent(String rentid){
//根据出租单号查询出租单信息
Rent rent = rentService.queryRentByRentId(rentid);
//根据身份证号查询客户信息
Customer customer = customerService.queryCustomerByIdentity(rent.getIdentity());
* @return
*/
@RequestMapping("toRentManager")
public String toRentManager(){
return "business/rent/rentManager";
}
/**
* 跳转到汽车入库管理的页面
* @return
*/
@RequestMapping("toCheckCarManager")
public String toCheckCarManager(){
return "business/check/checkCarManager";
}
/**
* 跳转到检查单管理的页面
* @return
*/
@RequestMapping("toCheckManager")
public String toCheckManager(){
return "business/check/checkManager";
}
}
package com.alfred.sys.utils;
/**
* web的工具类
*/
@RestController
@RequestMapping("news")
public class NewsController {
@Autowired
private NewsService newsService;
/**
* 加载公告列表返回DataGridView
* @param newsVo
* @return
*/
@RequestMapping("loadAllNews")
public DataGridView loadAllNews(NewsVo newsVo){
return this.newsService.queryAllNews(newsVo);
}
/**
* 添加公告
* @return
*/
@RequestMapping("addNews")
public ResultObj addNews(NewsVo newsVo){
try {
newsVo.setCreatetime(new Date());
User user=(User) WebUtils.getHttpSession().getAttribute("user");
newsVo.setOpername(user.getRealname());
this.newsService.addNews(newsVo);
return ResultObj.ADD_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.ADD_ERROR;
}
}
/**
* 删除公告
* @param newsVo
* @return
*/
@RequestMapping("deleteNews")
public ResultObj deleteNews(NewsVo newsVo){
try {
this.newsService.deleteNews(newsVo.getId());
return ResultObj.DELETE_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.DELETE_ERROR;
}
}
return "user/index";
}
}
/*登录成功后进入用户中心*/
@RequestMapping("/user/userCenter.action")
public String userCenter(Model model,HttpSession httpSession){
TbUser tbUser = new TbUser();
tbUser = (TbUser) httpSession.getAttribute("tbuser");
model.addAttribute("tbuser",tbUser);
return "user/user_center";
}
/**
* 登录成功后用户可以退出
* @param request
* @return
*/
@RequestMapping(value = "/user/user_out.action",method = RequestMethod.GET)
public String user_out(HttpServletRequest request){
ModelAndView mav = new ModelAndView();
HttpSession session = request.getSession();
session.removeAttribute("tbuser");
System.out.println("用户退出成功");
return "user/user_out";
}
/**
* 跳转注册页面
* @returner
*/
@RequestMapping("/user/register.action")
public String register(Model model) {
TbUser tbUser = new TbUser();
model.addAttribute("tbuser",tbUser);
return "user/user_register";
}
/**
*/
@RestController
@RequestMapping("menu")
public class MenuController {
@Autowired
private MenuService menuService;
@RequestMapping("loadIndexLeftMenuJson")
public List<TreeNode> loadIndexLeftMenuJson(MenuVo menuVo) {
//得到当前用户登录的对象
User user = (User) WebUtils.getHttpSession().getAttribute("user");
List<Menu> list = null;
menuVo.setAvailable(SysConstant.AVAILABLE_TRUE);//只用于查询可用的
if (user.getType() == SysConstant.USER_TYPE_SUPER) {
list = menuService.queryAllMenuForList(menuVo);
} else {
list = menuService.queryMenuByUserIdForList(menuVo, user.getUserid());
}
List<TreeNode> nodes = new ArrayList<>();
//把list里的数据方到nodes
for (Menu menu : list) {
Integer id = menu.getId();
Integer pid = menu.getPid();
String title = menu.getTitle();
String icon = menu.getIcon();
String href = menu.getHref();
Boolean spread = menu.getSpread() == SysConstant.SPREAD_TRUE ? true : false;
String target = menu.getTarget();
nodes.add(new TreeNode(id, pid, title, icon, href, spread, target));
}
return TreeNodeBuilder.builder(nodes, 1);
}
/**
* 加载菜单管理左边的菜单树
* @param menuVo
* @return
*/
private RentService rentService;
/**
* 跳转到客户地区统计页面
*/
@RequestMapping("toCustomerAreaStat")
public String toCustomerAreaStat(){
return "stat/customerAreaStat";
}
/**
* 加载客户地区数据
* @return
*/
@RequestMapping("loadCustomerAreaStatJson")
@ResponseBody
public List<BaseEntity> loadCustomerAreaStatJson(){
return this.statService.loadCustomerAreaStatList();
}
/**
* 跳转到客户地区性别统计页面
*/
@RequestMapping("toCustomerAreaSexStat")
public String toCustomerAreaSexStat(){
return "stat/customerAreaSexStat";
}
/**
* 加载客户地区性别统计数据
* @return
*/
@RequestMapping("loadCustomerAreaSexStatJson")
@ResponseBody
public List<BaseEntity> loadCustomerAreaSexStatJson(String area){
System.out.println("HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH");
System.out.println(this.statService.loadCustomerAreaSexStatList(area));
return this.statService.loadCustomerAreaSexStatList(area);
}
/**
* 跳转到业务员年度业务统计
* @return
*/
@RequestMapping("toOpernameYearGradeStat")
public String toOpernameYearGradeStat(){
return "stat/opernameYearGradeStat";
}
/**
}
}
/**
* 更新公告
* @param newsVo
* @return
*/
@RequestMapping("updateNews")
public ResultObj updateNews(NewsVo newsVo){
try {
this.newsService.updateNews(newsVo);
return ResultObj.UPDATE_SUCCESS;
}catch (Exception e){
e.printStackTrace();
return ResultObj.UPDATE_ERROR;
}
}
/**
* 根据id查询公告
*/
@RequestMapping("loadNewsById")
public News loadNewsById(Integer id) {
return this.newsService.queryNewsById(id);
}
}
package com.alfred.bus.controller;
@RestController //以json形式响应数据
try {
this.carService.deleteBatchCar(carVo.getIds());
return ResultObj.DELETE_SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return ResultObj.DELETE_ERROR;
}
}
}
package com.alfred.sys.controller;
/**
* 用户登录控制器
*/
@Controller
@RequestMapping("login")
public class LoginController {
@Autowired
private UserService userService;
@Autowired
private LogInfoService logInfoService;
/**
BusCar busCarcar = tbUserService.carByCarNumber(car);
model.addAttribute("car",busCarcar);
System.out.println("车牌号是"+car);
return "user/car_detail";
}
/**
* 跳转登录页面
* @param model
* @return
*/
@RequestMapping(value="/user/login.action",method= RequestMethod.GET)
public String login(Model model,HttpSession httpSession) {
model.addAttribute("tbuser",httpSession.getAttribute("tbuser"));
return "user/user_login";
}
@RequestMapping("/user/loginCheck.action")
public String loginCheck(String username, String password, Model model,HttpSession httpSession) {
System.out.println("账号:" + username);
System.out.println("密码:" + password);
TbUser tbUser = tbUserService.loginCheck(username, password);
//如果登录失败
if (tbUser == null)
{
return "user/user_login";
}
else {
System.out.println("登录成功跳转至首页");
List<BusCar> arrayList = tbUserService.carAllByLimit(0,6);
LinkedList linkedList = new LinkedList();
BusCar busCar = new BusCar();
Set<BusCar> set = new HashSet<>();
for (int i = 0; i < arrayList.size(); i++) {
//车号
busCar.setCarnumber(arrayList.get(i).getCarnumber());
//车封面
busCar.setCarimg(arrayList.get(i).getCarimg());
//车名
busCar.setDescription(arrayList.get(i).getDescription());
//车价
busCar.setPrice(arrayList.get(i).getPrice());
//租金
busCar.setRentprice(arrayList.get(i).getRentprice());
linkedList.add(busCar);
}