Java毕业设计实战之仿小米电子产品售卖商城系统的实现
作者:OldWinePot 时间:2022-09-29 10:19:47
项目描述:这是一个基于SpringBoot+Vue框架开发的仿小米电子产品售卖商城系统。首先,这是一个前后端分离的项目,代码简洁规范,注释说明详细。其次,这项目功能丰富,具有一个电子产品售卖商城系统该有的所有功能。
项目功能:此项目分为两个角色:普通用户和管理员。普通用户有登录注册、浏览商品信息、添加购物车、结算订单、查看个人信息、查看个人订单详情等等功能。管理员有管理所有商品信息、管理所有订单信息、管理所有用户信息、查看收益数据图表等等功能。
应用技术:SpringBoot + VueCli + MySQL + MyBatis + Redis + ElementUI
运行环境:IntelliJ IDEA2019.3.5+ MySQL5.7+ Redis5.0.5 + JDK1.8 + Maven3.6.3+ Node14.16.1
后台管理员订单管理:
@CrossOrigin
@RestController
@RequestMapping("orders")
public class OrderController {
@Autowired
private OrderServiceImp orderServiceImp;
@Autowired
private RegLogServiceImp regLogServiceImp;
@PostMapping("/createorder")
public OrderResult createOrder(@RequestBody OrdCreaParm ordCreaParm) throws IOException {
OrderResult orderResult = new OrderResult();
orderResult.setStatus(0);
OrderList orderList = orderServiceImp.creatOrder(ordCreaParm);
orderResult.setData(orderList);
return orderResult;
}
@RequestMapping("/getorderlist")
public UserOrdListResult getUserOrdList(String username) throws IOException {
UserOrdListResult userOrdListResult = new UserOrdListResult();
User user = regLogServiceImp.getUserByUserName(username);
String userid = user.getUserid();
List<UserOrdList> orderList = orderServiceImp.getOrderList(userid);
for(UserOrdList userOrdList:orderList){
int orderNo = userOrdList.getOrderNo();
List<UserOrdItemList> orderListItems = orderServiceImp.getOrderListItems(orderNo);
userOrdList.setItems(orderListItems);
}
userOrdListResult.setStatus(0);
userOrdListResult.setTotal(orderList.size());
userOrdListResult.setList(orderList);
return userOrdListResult;
}
//下单成功后调用下面两个方法
@RequestMapping("/getorder")
public OrdFinaResult getOrder(@RequestParam("id") int id) throws IOException{
OrdFinaResult orderResult = new OrdFinaResult();
orderResult.setStatus(0);
OrdFina orderList = orderServiceImp.getOrderById(id);
orderResult.setOrdFina(orderList);
return orderResult;
}
@RequestMapping("/getorderdetail")
public OrdFinaResult getOrderDetail(@RequestParam("username") String username) throws IOException{
User user = regLogServiceImp.getUserByUserName(username);
String userid = user.getUserid();
List<orderItemVoList> orderItems = orderServiceImp.getOrderItems(userid);
OrdFinaResult orderResult = new OrdFinaResult();
orderResult.setStatus(0);
orderResult.setLists(orderItems);
return orderResult;
}
}
后台商品信息管理:
@CrossOrigin
@RestController
@RequestMapping("goods")
public class GoodController {
@Autowired
private GoodServiceImp goodServiceImp;
@RequestMapping("getGoodsAll")
private GoodsAll getGoodByCategory() {
GoodsAll goodsAll = new GoodsAll();
ArrayList<GoodAll> goodAlls = new ArrayList<>();
for (int i = 1; i <= 9; i++) {
List<Good> good = goodServiceImp.getGood(i);
GoodCategory goodCategory = goodServiceImp.getGoodCategory(i);
GoodAll goodAll = new GoodAll();
goodAll.setName(goodCategory.getName());
goodAll.setFoods(good);
goodAlls.add(goodAll);
}
goodsAll.setData(goodAlls);
return goodsAll;
}
}
用户信息控制层:
import java.io.IOException;
@CrossOrigin
@RestController
@RequestMapping("User")
public class UserController {
@Autowired
private UserServiceImp userServiceImp;
@RequestMapping("/getUsers")
public UserResult getUsers() throws IOException {
UserResult userResult = userServiceImp.getUsers();
return userResult;
}
}
登录控制层:
@CrossOrigin
@RestController
@RequestMapping("Login")
public class LoginController {
@Autowired
private LoginServiceImp loginServiceImp;
Map<String, String> keyMap = RSAUtils.createKeys(512);
// String publicKey = keyMap.get("publicKey");
// String privateKey = keyMap.get("privateKey");
// private String publicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIS-9P6aiWK-mNIJxz0R_XXIbHM21pS_ZncpQcE8T5Mu6P6sJfoi5Cw6S4jcSqxNbRs5FSUc59GAkU1Ek9onrz8CAwEAAQ";
private String privateKey = "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAhL70_pqJYr6Y0gnHPRH9dchsczbWlL9mdylBwTxPky7o_qwl-iLkLDpLiNxKrE1tGzkVJRzn0YCRTUST2ievPwIDAQABAkAviOHaOiRwQ6gdrnq2F7cXcknDiCOW6GMc0J1HQP2Nyn52HKtc9E9Ailm-eQesTw6P-qTsvHMyfuVYz8fLhfkhAiEAvhvoG2Dz6qSN6IHeuPboJP7YHK9zTt6M_NGCJKAenasCIQCywU7eStITcHFTRDjjShH0CfO-vR6q-zgWQPjtNI_YvQIgY8UNiODW4bu-ZdlSY8vghRnhnRxO7YNKhpwFKueFacUCIQCZ-P65ZVNs4ScMZTBnP48VWVk2S-rVto0KRi7lC6h4NQIgEa_GhBO6U2p6G5cGAR25ZiQVH9dFnrMVyPxY7P7-WsA";
@PostMapping("/login")
public LoginResult Login(@RequestBody User adminUser) throws IOException, InvalidKeySpecException, NoSuchAlgorithmException {
User user = loginServiceImp.getUserByUserName(adminUser.getUsername());
LoginResult result = new LoginResult();
LoginData loginData = new LoginData();
if (user == null) {
result.setMsg("无此用户,请重新输入正确用户名");
result.setStatus(2008);
} else {
if (RSAUtils.privateDecrypt(user.getPwd(), RSAUtils.getPrivateKey(privateKey)).equals(adminUser.getPwd())){
result.setStatus(0);
String token = TokenUtil.token(user.getId().trim());
loginData.setToken(token);
result.setMsg("登录成功");
result.setStatus(1010);
result.setData(loginData);
}else{
result.setStatus(2007);
result.setMsg("密码错误");
}
}
return result;
}
}
来源:https://blog.csdn.net/pastclouds/article/details/121788293
标签:Java,仿小米商城系统,毕业设计,大作业
0
投稿
猜你喜欢
Android系统永不锁屏永不休眠的方法
2023-03-11 00:06:21
java数据类型和运算符的深入讲解
2021-09-14 07:06:08
mybatis-plus 扩展批量新增的实现
2023-07-14 14:24:13
C#中Convert.ToDecimal()报错问题的解决
2022-05-09 06:05:56
C#中const,readonly和static关键字的用法介绍
2021-08-17 15:33:45
介绍C# 泛型类在使用中约束
2023-06-23 21:39:40
Java采用循环链表结构求解约瑟夫问题
2022-07-27 16:35:59
MyBatis快速入门之环境搭建和单表映射
2022-10-17 12:41:55
SpringBoot防止大量请求攻击的实现
2023-11-24 16:42:54
SpringCloud Eureka服务注册中心应用入门详解
2022-02-23 08:48:44
解决Jackson解析嵌套类问题(MismatchedInputException)
2023-07-26 03:09:31
Springboot分页插件使用实例解析
2023-03-29 21:29:57
Kotlin中的对象表达式和对象声明的具体使用
2022-05-31 04:08:18
Android webview与js的数据交互
2021-08-18 02:56:32
老生常谈java中cookie的使用
2023-11-11 04:37:59
SpringCloudConfig之client端报错Could not resolve placeholder问题
2023-11-23 11:19:17
C#多线程学习之Thread、ThreadPool、Task、Parallel四者区别
2023-08-27 05:32:14
Java异常处理中同时有finally和return语句的执行问题
2022-08-14 15:28:30
Java的接口调用时的权限验证功能的实现
2023-08-09 11:15:06
Android自定义TextView实现drawableLeft内容居中
2022-04-24 18:20:14