package com.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.entity.Article;
import com.entity.Asks;
import com.entity.Cart;
import com.entity.Cate;
import com.entity.Complains;
import com.entity.Fav;
import com.entity.Goods;
import com.entity.Hist;
import com.entity.Items;
import com.entity.Orders;
import com.entity.Seller;
import com.entity.Topic;
import com.entity.Users;
import com.github.pagehelper.Page;
import com.service.ArticleService;
import com.service.AsksService;
import com.service.CartService;
import com.service.CateService;
import com.service.ComplainsService;
import com.service.FavService;
import com.service.GoodsService;
import com.service.HistService;
import com.service.OrdersService;
import com.service.SellerService;
import com.service.TopicService;
import com.service.UsersService;
import com.util.VeDate;
@RestController // 定义为控制器 返回JSON类型数据
@RequestMapping(value = "/index", produces = "application/json; charset=utf-8") // 设置请求路径
@CrossOrigin // 允许跨域访问其资源
//
public class IndexController extends BaseController {
// @Autowired的作用是自动注入依赖的ServiceBean
@Autowired
private AsksService asksService;
@Autowired
private SellerService sellerService;
@Autowired
private UsersService usersService;
@Autowired
private ArticleService articleService;
@Autowired
private CateService cateService;
@Autowired
private GoodsService goodsService;
@Autowired
private CartService cartService;
@Autowired
private HistService histService;
@Autowired
private OrdersService ordersService;
@Autowired
private TopicService topicService;
@Autowired
private ComplainsService complainsService;
@Autowired
private FavService favService;
// TODO Auto-generated method stub
// 预处理 获取基础参数
@GetMapping(value = "front.action")
public Map<String, Object> front() {
Map<String, Object> map = new HashMap<String, Object>();
List<Cate> cateList = this.cateService.getAllCate();
map.put("cateList", cateList);
List<Goods> hotList = this.goodsService.getGoodsByHot();
//视图调用
//List<Goods> hotList = this.goodsService.getGoodsByHotView();
map.put("hotList", hotList);
return map;
}
// 前台首页
@GetMapping(value = "index.action")
public Map<String, Object> index() {
Map<String, Object> map = new HashMap<String, Object>();
List<Cate> cateList = this.cateService.getCateFront();
List<Cate> frontList = new ArrayList<Cate>();
for (Cate cate : cateList) {
List<Goods> goodsList = this.goodsService.getGoodsByCate(cate.getCateid());
cate.setGoodsList(goodsList);
frontList.add(cate);
}
map.put("frontList", frontList);
return map;
}
// 新闻公告
@GetMapping(value = "article.action")
public Map<String, Object> article(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "20") Integer limit) {
Map<String, Object> map = new HashMap<String, Object>();
Page<Article> pager = com.github.pagehelper.PageHelper.startPage(page, limit);// 定义当前页和分页条数
List<Article> list = this.articleService.getAllArticle();
// 返回的map中定义数据格式
map.put("count", pager.getTotal());
map.put("total", list.size());
map.put("data", list);
map.put("code", 0);
map.put("msg", "");
map.put("page", page);
map.put("limit", limit);
return map;
}
// 公告详情
@GetMapping(value = "read.action")
public Map<String, Object> read(String id) {
Map<String, Object> map = new HashMap<String, Object>();
Article article = this.articleService.getArticleById(id);
article.setHits("" + (Integer.parseInt(article.getHits()) + 1));
this.articleService.updateArticle(article);
map.put("article", article);
return map;
}
// 用户登录
@PostMapping(value = "login.action")
public Map<String, Object> login(@RequestBody String jsonStr) {
Map<String, Object> map = new HashMap<String, Object>();
JSONObject obj = JSONObject.parseObject(jsonStr);
String username = obj.getString("username");
String password = obj.getString("password");
Users usersEntity = new Users();
usersEntity.setUsername(username);
List<Users> userslist = this.usersService.getUsersByCond(usersEntity);
if (userslist.size() == 0) {
map.put("success", false);
map.put("message", "用户名不存在");
} else {
Users users = userslist.get(0);
if (password.equals(users.getPassword())) {
map.put("success", true);
map.put("message", "登录成功");
map.put("userid", users.getUsersid());
map.put("username", users.getUsername());
map.put("realname", users.getRealname());
} else {
map.put("success", false);
map.put("message", "密码错误");
}
}
return map;
}
@PostMapping(value = "slogin.action")
public Map<String, Object> slogin(@RequestBody String jsonStr) {
Map<String, Object> map = new HashMap<String, Object>();
JSONObject obj = JSONObject.parseObject(jsonStr);
String username = obj.getString("username");
String password = obj.getString("password");
Seller sellerEntity = new Seller();
sellerEntity.setUsername(username);
List<Seller> sellerlist = this.sellerService.getSellerByCond(sellerEntity);
if (sellerlist.size() == 0) {
map.put("success", false);
map.put("message", "商户不存在");
} else {
Seller seller = sellerlist.get(0);
if ("待审核".equals(seller.getStatus())) {
map.put("success", false);
map.put("message", "商户待审核");
} else if (password.equals(seller.getPassword())) {
map.put("success", true);
map.put("message", "登录成功");
map.put("sellerid", seller.getSellerid());
map.put("username", seller.getUsername());
map.put("sellername", seller.getSellername());
} else {
map.put("success", false);
map.put("message", "密码错误");
}
}
return map;
}
// 忘记密码1
@PostMapping(value = "forget.action")
public Map<String, Object> forget(@RequestBody String jsonStr) {
Map<String, Object> map = new HashMap<String, Object>();
JSONObject obj = JSONObject.parseObject(jsonStr);
String username = obj.getString("username");
Users usersEntity = new Users();
usersEntity.setUsername(username);
List<Users> userslist = this.usersService.getUsersByCond(usersEntity);
if (userslist.size() == 0) {
map.put("success", false);
map.put("message", "用户名不存在");
} else {
map.put("success", true);
map.put("message", "验证成功");
map.put("users", userslist.get(0));
}
return map;
}
// 获取提示问题
@GetMapping(value = "asks.action")
public List<Asks> asks() {
return this.asksService.getAllAsks();
}
// 用户注册
@PostMapping(value = "register.action")
public Map<String, Object> register(@RequestBody String jsonStr) {
Map<String, Object> map = new HashMap<String, Object>();
JSONObject obj = JSONObject.parseObject(jsonStr); // 将JSON字符串转换成object
Users users = new Users();
users.setUsername(obj.getString("username"));
没有合适的资源?快使用搜索试试~ 我知道了~
基于Springboot和Vue的汽车保养服务推荐系统设计源码
共1394个文件
gif:634个
js:168个
xml:111个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 52 浏览量
2024-04-15
02:41:37
上传
评论
收藏 38.76MB ZIP 举报
温馨提示
基于Springboot和Vue的汽车保养服务推荐系统设计源码,该项目包含1394个文件,主要文件类型有634个gif图像文件,168个javascript文件,以及111个xml配置文件。此外,还包括92个png图像文件,79个java源文件,78个css样式文件,以及68个html页面文件。该项目是一个基于Springboot和Vue的汽车保养服务推荐系统,可能涉及用户界面设计、应用逻辑实现、数据存储等多个方面。
资源推荐
资源详情
资源评论
收起资源包目录
基于Springboot和Vue的汽车保养服务推荐系统设计源码 (1394个子文件)
layui.css 73KB
layui.css 73KB
layui.css 73KB
layui.css 73KB
common.css 56KB
common.css 56KB
common.css 56KB
common.css 56KB
style.css 46KB
style.css 46KB
default.css 23KB
default.css 23KB
default.css 23KB
default.css 23KB
icomoon.css 14KB
icomoon.css 14KB
icomoon.css 14KB
icomoon.css 14KB
layer.css 14KB
layer.css 14KB
layer.css 14KB
layer.css 14KB
layer.css 14KB
layer.css 14KB
layer.css 14KB
layer.css 14KB
animate.css 11KB
animate.css 11KB
animate.css 11KB
animate.css 11KB
xadmin.css 10KB
xadmin.css 10KB
xadmin.css 10KB
xadmin.css 10KB
layui.mobile.css 10KB
layui.mobile.css 10KB
layui.mobile.css 10KB
layui.mobile.css 10KB
laydate.css 7KB
laydate.css 7KB
laydate.css 7KB
laydate.css 7KB
laydate.css 7KB
laydate.css 7KB
laydate.css 7KB
laydate.css 7KB
datepicker.css 4KB
datepicker.css 4KB
datepicker.css 4KB
datepicker.css 4KB
style.css 3KB
style.css 3KB
highlight.css 2KB
highlight.css 2KB
highlight.css 2KB
highlight.css 2KB
login.css 2KB
login.css 2KB
login.css 2KB
login.css 2KB
reset.css 1KB
reset.css 1KB
reset.css 1KB
reset.css 1KB
code.css 1KB
code.css 1KB
code.css 1KB
code.css 1KB
code.css 1KB
code.css 1KB
code.css 1KB
code.css 1KB
index.css 870B
index.css 870B
index.css 776B
index.css 776B
WdatePicker.css 192B
WdatePicker.css 192B
orders表.docx 3KB
users表.docx 3KB
goods表.docx 3KB
seller表.docx 3KB
complains表.docx 3KB
topic表.docx 3KB
article表.docx 3KB
admin表.docx 3KB
cart表.docx 3KB
asks表.docx 3KB
hist表.docx 3KB
cate表.docx 3KB
icomoon.eot 50KB
icomoon.eot 50KB
icomoon.eot 50KB
icomoon.eot 50KB
iconfont.eot 46KB
iconfont.eot 46KB
iconfont.eot 46KB
iconfont.eot 46KB
iconfont.eot 40KB
iconfont.eot 40KB
共 1394 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14
资源评论
沐知全栈开发
- 粉丝: 5037
- 资源: 5025
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功