您好,登錄后才能下訂單哦!
這篇文章給大家介紹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<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-rVto0KRi7lC6h5NQIgEa_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的基本數據類型分為:1、整數類型,用來表示整數的數據類型。2、浮點類型,用來表示小數的數據類型。3、字符類型,字符類型的關鍵字是“char”。4、布爾類型,是表示邏輯值的基本數據類型。
關于Java怎么進行電子產品售賣商城系統的實現就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。