Java毕业设计实战之仿小米电子产品售卖商城系统的实现
作者:OldWinePot
这是一个使用了java+SpringBoot+Vue+MySQL+Redis+ElementUI开发的仿小米商城系统,是一个毕业设计的实战练习,具有小米商城该有的所有基础功能,感兴趣的朋友快来看看吧
项目描述:这是一个基于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; } }
到此这篇关于Java毕业设计实战之仿小米电子产品售卖商城系统的实现的文章就介绍到这了,更多相关Java 仿小米商城系统内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!