欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-06-16 10:56:38
项目描述:这是一个基于springboot+vue框架开发的仿小米电子产品售卖商城系统。首先,这是一个前后端分离的项目,代码简洁规范,注释说明详细。其次,这项目功能丰富,具有一个电子产品售卖商城系统该...

项目描述:这是一个基于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

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

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

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

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

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

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

后台管理员订单管理:

@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 仿小米商城系统内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!