Java项目:仿小米商城系统(前后端分离+java+vue+Springboot+ssm+mysql+maven+redis)

源码获取:博客首页 "资源" 里下载!

一、项目简述

本系统功能包括: 基于vue + Springboot前后端分离项目精简版仿小米商城 系统,注册登录,首页展示,商品展示,商品购买,下单支 付(支付有点小问题仅支持单个商品支付)后台维护等 等。

二、项目运行 

环境配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX ( Webstorm也 行)+ Eclispe ( IntelliJ IDEA,Eclispe,MyEclispe,Sts都支 持)。

项目技术: Springboot + Maven + Mybatis + Vue + Redis, B/S 模式+ Maven等等。

Java项目:仿小米商城系统(前后端分离+java+vue+Springboot+ssm+mysql+maven+redis)_第1张图片

Java项目:仿小米商城系统(前后端分离+java+vue+Springboot+ssm+mysql+maven+redis)_第2张图片

Java项目:仿小米商城系统(前后端分离+java+vue+Springboot+ssm+mysql+maven+redis)_第3张图片

Java项目:仿小米商城系统(前后端分离+java+vue+Springboot+ssm+mysql+maven+redis)_第4张图片

Java项目:仿小米商城系统(前后端分离+java+vue+Springboot+ssm+mysql+maven+redis)_第5张图片

后台控制器品类管理:

@CrossOrigin
@RestController
@RequestMapping("category")
public class CategoryController {

    @Autowired
    private CategServiceImp categServiceImp;
    @GetMapping("/getCategory")
        private CateResult getCategory(@RequestParam("pageIndex") int pageIndex,
                                    @RequestParam("pageSize") int pageSize) throws IOException {
        CateResult cateResult = categServiceImp.getCategory(pageIndex, pageSize);
        return cateResult;
    }

    @PostMapping("/updateCategory")
    private void updateCategory(@RequestBody Category category) throws IOException {
        categServiceImp.updCategory(category.getName(),category.getCategoryId());
    }
}

商品信息管理控制器:

@CrossOrigin
@RestController
@RequestMapping("Good")
public class GoodController {

    @Autowired
    private GoodServiceImp goodServiceImp;

    @GetMapping("/getGood")
    private GoodResult getGood(@RequestParam("pageIndex") int pageIndex,
                               @RequestParam("pageSize") int pageSize,
                               @RequestParam("name") String goodname
                               ) throws IOException {
        GoodResult goodResult = goodServiceImp.getGood(pageIndex,pageSize,goodname);
        return goodResult;
    }

    @GetMapping("/getGoodById")
    private GoodResult getGoodById(@RequestParam("category") int pageIndex,
                               @RequestParam("pageSize") int pageSize
    ) throws IOException {
        GoodResult goodResult = goodServiceImp.getGoodById(pageIndex,pageSize);
        return goodResult;
    }
    @RequestMapping("/getGoodByName")
    private GoodResult getGoodByName(@RequestParam("name") String goodname) throws IOException {
        GoodResult goodResult = goodServiceImp.getGoodByName(goodname);
        return goodResult;
    }

    @RequestMapping("/updGood")
    private GoodResult getGoodByName(@RequestParam("good_id") int goodid,
                                     @RequestParam("name") String goodname,
                                     @RequestParam("newhot") int newhot) throws IOException {
        GoodResult goodResult = goodServiceImp.updGood(goodid,goodname,newhot);
        return goodResult;
    }


    @GetMapping("/getGoodPicById")
    private GoodPicResult getGoodPicById(@RequestParam("category") int pageIndex,
                                   @RequestParam("pageSize") int pageSize
    ) throws IOException {
        GoodPicResult goodpicResult = goodServiceImp.getGoodPic(pageIndex,pageSize);
        return goodpicResult;
    }
    @RequestMapping("/getGoodPicByName")
    private GoodPicResult getGoodPicByName(@RequestParam("name") String goodname) throws IOException {
//        int categor = Integer.parseInt(category);
        GoodPicResult goodResult = goodServiceImp.getGoodPicByName(goodname);
        return goodResult;
    }


    @PostMapping("/pushGood")
    private GoodPushResult pushGood(@RequestBody good good) throws IOException {
        GoodPushResult goodPushResult = goodServiceImp.getGoodPush(good);
        return goodPushResult;
    }

    @PostMapping("/delGood")
    private void delGood(@RequestBody good good) throws IOException {
          goodServiceImp.delGood(good);
    }

    @PostMapping("/delMulGood")
    private void delMulGood(@RequestBody List goods) throws IOException {
        goodServiceImp.delMulGood(goods);
    }

    @GetMapping("/getGoodPic")
    private GoodPicResult getGoodPic(@RequestParam("pageIndex") int pageIndex,
                                     @RequestParam("pageSize") int pageSize) throws IOException {
        GoodPicResult goodPicResult = goodServiceImp.getGoodPic(pageIndex,pageSize);
        return goodPicResult;
    }

    @PostMapping("/updGoodPic")
    private void upGoodPic(@RequestBody GoodPic goodPic) throws IOException {
        int goodid= goodPic.getGood_id();
        String icon= goodPic.getIcon();
        String imageHead = goodPic.getImageHead();
        String imageFoot = goodPic.getImageFoot();

        goodServiceImp.updGoodPic(goodid,icon,1);
        goodServiceImp.updGoodPic(goodid,imageHead,2);
        goodServiceImp.updGoodPic(goodid,imageFoot,3);
    }
}

后台用户控制器:

@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 = "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,mysql,maven,spring,boot,vue.js)