Java毕业设计实战之仿小米电子产品售卖商城系统的实现

网友投稿 324 2022-08-31


Java毕业设计实战之仿小米电子产品售卖商城系统的实现

项目描述:这是一个基于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 orderList = orderServiceImp.getOrderList(userid);

for(UserOrdList userOrdList:orderList){

int orderNo = userOrdList.getOrderNo();

List 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 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 goodAlls = new ArrayList<>();

for (int i = 1; i <= 9; i++) {

List 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 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 = "MIIBVAIBADANBgkqOxFzAQRYIyhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAhL70_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;

}

}


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:【Python小试】计算目录下所有DNA序列的Kmer并过滤
下一篇:Windows下的Python多版本管理?(windows更新python版本)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~