javaweb 网上商城系统,前台+后台管理,用户注册,登录,上哦展示,分组展示,搜索,收货地址管理,购物车管理,添加,购买,个人信息修改。订单查询等等,后台商品管理,分类管理,库存管理,订单管理,用户管理,信息修改等等.
环境配置: jdk1.8 + tomcats . 5 + mysql + eclispe ( intellij idea ,eclispe , myeclispe , sts 都支持)
项目技术: jsp + spring + springmvc + mybatis + html + css + javascript + jquery + ajax + layui + maven 等等。
/*** 后台管理-主页*/@controllerpublic class adminhomecontroller extends bacontroller {@resource(name = "adminrvice")private adminrvice adminrvice;@resource(name = "productorderrvice")private productorderrvice productorderrvice;@resource(name = "productrvice")private productrvice productrvice;@resource(name = "urrvice")private urrvice urrvice;/*** 转到后台管理-主页* @param ssion ssion对象* @param map 前台传入的map* @return 响应数据* @throws parexception 转换异常*/@requestmapping(value = "admin", method = requestmethod.get)public string gotopage(httpssion ssion, map<string, object> map) throws parexception {logger.info("获取管理员信息");object adminid = checkadmin(ssion);if (adminid == null) {return "redirect:/admin/login";}admin admin = adminrvice.get(null, integer.parint(adminid.tostring()));map.put("admin", admin);logger.info("获取统计信息");//产品总数integer producttotal = productrvice.gettotal(null, new byte[]{0, 2});//用户总数integer urtotal = urrvice.gettotal(null);//订单总数integer ordertotal = productorderrvice.gettotal(null, new byte[]{3});logger.info("获取图表信息");map.put("jsonobject", getchartdata(null,null,7));map.put("producttotal", producttotal);map.put("urtotal", urtotal);map.put("ordertotal", ordertotal);logger.info("转到后台管理-主页");return "admin/homepage";}/*** 转到后台管理-主页(ajax方式)* @param ssion ssion对象* @param map 前台传入的map* @return 响应数据* @throws parexception 转换异常*/@requestmapping(value = "admin/home", method = requestmethod.get)public string gotopagebyajax(httpssion ssion, map<string, object> map) throws parexception {logger.info("获取管理员信息");object adminid = checkadmin(ssion);if (adminid == null) {return "admin/include/loginmessage";}admin admin = adminrvice.get(null, integer.parint(adminid.tostring()));map.put("admin", admin);logger.info("获取统计信息");integer producttotal = productrvice.gettotal(null, new byte[]{0, 2});integer urtotal = urrvice.gettotal(null);integer ordertotal = productorderrvice.gettotal(null, new byte[]{3});logger.info("获取图表信息");map.put("jsonobject", getchartdata(null, null,7));logger.info("获取图表信息");map.put("jsonobject", getchartdata(null,null,7));map.put("producttotal", producttotal);map.put("urtotal", urtotal);map.put("ordertotal", ordertotal);logger.info("转到后台管理-主页-ajax方式");return "admin/homemanagepage";}/*** 按日期查询图表数据(ajax方式)* @param begindate 开始日期* @param enddate 结束日期* @return 响应数据* @throws parexception 转换异常*/@responbody@requestmapping(value = "admin/home/charts", method = requestmethod.get, produces = "application/json;chart=utf-8")public string getchartdatabydate(@requestparam(required = fal) string begindate, @requestparam(required = fal) string enddate) throws parexception {if (begindate != null && enddate != null) {//转换日期格式simpledateformat simpledateformat = new simpledateformat("yyyy-mm-dd");return getchartdata(simpledateformat.par(begindate), simpledateformat.par(enddate),7).tojsonstring();} el {return getchartdata(null, null,7).tojsonstring();}}/*** 按日期获取图表数据* @param begindate 开始日期* @param enddate 结束日期* @param days 天数* @return 图表数据的json对象* @throws parexception 转换异常*/private jsonobject getchartdata(date begindate,date enddate,int days) throws parexception {jsonobject jsonobject = new jsonobject();simpledateformat time = new simpledateformat("yyyy-mm-dd", locale.uk);simpledateformat time2 = new simpledateformat("mm/dd", locale.uk);simpledateformat timespecial = new simpledateformat("yyyy-mm-dd hh:mm:ss", locale.uk);//如果没有指定开始和结束日期if (begindate == null || enddate == null) {//指定一周前的日期为开始日期calendar cal = calendar.getinstance();cal.add(calendar.date, 1-days);begindate = time.par(time.format(cal.gettime()));//指定当前日期为结束日期cal = calendar.getinstance();enddate = cal.gettime();} el {begindate = time.par(time.format(begindate));enddate = timespecial.par(time.format(enddate) + " 23:59:59");}logger.info("根据订单状态分类");//未付款订单数统计数组int[] orderunpaidarray = new int[7];//未发货订单数统计叔祖int[] ordernotshippedarray = new int[7];//未确认订单数统计数组int[] orderunconfirmedarray = new int[7];//交易成功订单数统计数组int[] ordersuccessarray = new int[7];//总交易订单数统计数组int[] ordertotalarray = new int[7];logger.info("从数据库中获取统计的订单集合数据");list<ordergroup> ordergrouplist = productorderrvice.gettotalbydate(begindate, enddate);//初始化日期数组jsonarray datestr = new jsonarray(days);//按指定的天数进行循环for (int i = 0; i < days; i++) {//格式化日期串(mm/dd)并放入日期数组中calendar cal = calendar.getinstance();cal.ttime(begindate);cal.add(calendar.date, i);string formatdate = time2.format(cal.gettime());datestr.add(formatdate);//该天ma和a换算的订单总数int ordercount = 0;//循环订单集合数据的结果集for(int j = 0; j < ordergrouplist.size(); j++){ordergroup ordergroup = ordergrouplist.get(j);//如果该订单日期与当前日期一致if(ordergroup.getproductorder_pay_date().equals(formatdate)){//从结果集中移除数据ordergrouplist.remove(j);//根据订单状态将统计结果存入对应的订单状态数组中switch (ordergroup.getproductorder_status()) {ca 0://未昆虫的资料付款订单orderunpaidarray[i] = ordergroup.getproductorder_count();break;ca 1://未发货订单ordernotshippedarray[i] = ordergroup.getproductorder_count();break;ca 2://未确认订单orderunconfirmedarray[i] = ordergroup.getproductorder_count();break;ca 3://交易成功订单ordersuccessarray[i] = ordergroup.getproductorder_count();break;}//累加当前日期的订单总数ordercount += ordergroup.getproductorder_count();}}//将统计的订单总数存入总交易订单数统计数组ordertotalarray[i] = ordercount;}logger.info("返回结果集map");jsonobject.put("ordertotalarray", ordertotalarray);jsonobject.put("orderunpaidarray", orderunpaidarray);jsonobject.put("ordernotshippedarray", o英文自我介绍 面试rdernotshippedarray);jsonobject.put("orderunconfirmedarray", orderunconfirmedarray);jsonobject.put("ordersuccessarray", ordersuccessarray);jsonobject.put("datestr",datestr);return jsonobject;}}
/*** @author yy*/@controller@requestmapping("/admin")public class newbeemallgoodscontroller {@resourceprivate newbeemallgoodsrvice newbeemallgoodsrvice;@resourceprivate newbeemallcategoryrvice newbeemallcategoryrvice;@getmapping("/goods")public string goodspage(httprvletrequest request) {request.tattribute("path", "newbee_mall_goods");return "admin/newbee_mall_goods";}@getmapping("/goods/edit")public string edit(httprvletrequest request) {request.tattribute("path", "edit");//查询所有的一级分类list<goodscategory> firstlevelcategories = newbeemallcategoryrvice.lectbylevelandparentidsandnumber(collections.singletonlist(0l), newbeemallcategorylevelenum.level_one.getlevel());if (!collectionutils.impty(firstlevelcategories)) {//查询一级分类列表中第一个实体的所有二级分类list<goodscategory> condlevelcategories = newbeemallcategoryrvice.lectbylevelandparentidsandnumber(collections.singletonlist(firstlevelcategories.get(0).getcategoryid()), newbeemallcategorylevelenum.level_two.getlevel());if (!collectionutils.impty(condlevelcategories)) {//查询二级分类列表中第一个实体的所有三级分类list<goodscategory> thirdlevelcategories = newbeemallcategoryrvice.lectbylevelandparentidsandnumber(collections.singletonlist(condlevelcategories.get(0).getcategoryid()), newbeemallcategorylevelenum.level_three.getlevel());request.tattribute("firstlevelcategories", firstlevelcategories);request.tattribute("condlevelcategories", condlevelcategories);request.tattribute("thirdlevelcategories", thirdlevelcategories);request.tattribute("path", "goods-edit");return "admin/newbee_mall_goods_edit";}}return "error/error_5xx";}@getmapping("/goods/edit/{goodsid}")public string edit(httprvletrequest request, @pathvariable("goodsid") long goodsid) {request.tattribute("path", "edit");newbeemallgoods newbeemallgoods = newbeemallgoodsrvice.getnewbeemallgoodsbyid(goodsid);if (newbeemallgoods == null) {return "error/error_400";}if (newbeemallgoods.getgoodscategoryid() > 0) {if (newbeemallgoods.getgoodscategoryid() != null || newbeemallgoods.getgoodscategoryid() > 0) {//有分类字段则查询相关分类数据返回给前端以供分类的三级联动显示goodscategory currentgoodscategory = newbeemallcategoryrvice.getgoodscategorybyid(newbeemallgoods.getgoodscategoryid());//商品表中存储的分类id字段为三级分类的id,不为三级分类则是错误数据if (currentgoodscategory != null && currentgoodscategory.getcategorylevel() == newbeemallcategorylevelenum.level_three.getlevel()) {//查询所有的一级分类list<goodscategory> firstlevelcategories = newbeemallcategoryrvice.lectbylevelandparentidsandnumber(collections.singletonlist(0l), newbeemallcategorylevelenum.level_one.getlevel());//根据parentid查询当前parentid下所有的三级分类list<goodscategory> thirdlevelcategories = newbeemallcategoryrvice.lectbylevelandparentidsandnumber(collections.singletonlist(currentgoodscategory.getparentid()), newbeemallcategorylevelenum.level_three.getlevel());//查询当前三级分类的父级二级分类goodscategory condcategory = newbeemallcategoryrvice.getgoodscategorybyid(currentgoodscategory.getparentid());if (condcategory != null) {//根据parentid查询当前parentid下所有的二级分类list<goodscategory> condlevelcategories = newbeemallcategoryrvice.lectbylevelandparentidsandnumber(collections.singletonlist(condcategory.getparentid()), newbeemallcategorylevelenum.level_two.getlevel());//查询当前二级分类的父级一级分类goodscategory firestcategory = newbeemallcategoryrvice.getgoodscategorybyid(condcategory.getparentid());if (firestcategory != null) {//所有分类数据都得到之后放到request对象中供前端读取request.tattribute("firstlevelcategories", firstlevelcategories);request.tattribute("condlevelcategories", condlevelcategories);request.tattribute("thirdlevelcategories", thirdlevelcategories);request.tattribute("firstlevelcategoryid", firestcategory.getcategoryid());request.tattribute("condlevelcategoryid", condcategory.getcategoryid());request.tattribute("thirdlevelcategoryid", currentgoodscategory.getcategoryid());}}}}}if (newbeemallgoods.getgoodscategoryid() == 0) {//查询所有的一级分类list<goodscategory> firstlevelcategories = newbeemallcategoryrvice.lectbylevelandparentidsandnumber(collections.singletonlist(0l), newbeemallcategorylevelenum.level_one.getlevel());if (!collectionutils.impty(firstlevelcategories)) {//查询一级分类列表中第一个实体的所有二级分类list<goodscategory> condlevelcategories = newbeemallcategoryrvice.lectbylevelandparentidsandnumber(collections.singletonlist(firstlevelcategories.get(0).getcategoryid()), newbeemallcategorylevelenum.level_two.getlevel());if (!collectionutils.impty(condlevelcategories)) {//查询二级分类列表中第一个实体的所有三级分类list<goodscategory> thirdlevelcategories = newbeemallcategoryrvice.lectbylevelandparentidsandnumber(collections.singletonlist(condlevelcategories.get(0).getcategoryid()), newbeemallcategorylevelenum.level_three.getlevel());request.tattribute("firstlevelcategories", firstlevelcategories);request.tattribute("condlevelcategories", condlevelcategories);request.tattribute("thirdlevelcategories", thirdlevelcategories);}}}request.tattribute("goods", newbeemallgoods);request.tattribute("path", "goods-edit");return "admin/newbee_mall_goods_edit";}/*** 列表*/@requestmapping(value = "/goods/list", method = requestmethod.get)@responbodypublic result list(@requestparam map<string, object> params) {if (stringutils.impty(params.get("page")) || stringutils.impty(params.get("limit"))) {return resultgenerator.genfailresult("参数异常!");}pagequeryutil pageutil = new pagequeryutil(params);return resultgenerator.gensuccessresult(newbeemallgoodsrvice.getnewbeemallgoodspage(pageutil));}/*** 添加*/@requestmapping(value = "/goods/save", method = requestmethod.post)@responbodypublic result save(@requestbody newbeemallgoods newbeemallgoods) {if (stringutils.impty(newbeemallgoods.getgoodsname())|| stringutils.impty(newbeemallgoods.getgoodsintro())|| stringutils.impty(newbeemallgoods.gettag())|| objects.isnull(newbeemallgoods.getoriginalprice())|| objects.isnull(newbeemallgoods.getgoodscategoryid())|| objects.isnull(newbeemallgoods.getllingprice())|| objects.isnull(newbeemallgoods.getstocknum())|| objects.isnull(newbeemallgoods.getgoodsllstatus())|| stringutils.impty(newbeemallgoods.getgoodscoverimg())|| stringutils.impty(newbeemallgoods.getgoodsdetailcontent())) {return resultgenerator.genfailresult("参数异常!");}string result = newbeemallgoodsrvice.savenewbeemallgoods(newbeemallgoods);if (rviceresultenum.success.getresult().equals(result)) {return resultgenerator.gensuccessresult();} el {return resultgenerator.genfailresult(result);}}/*** 修改*/@requestmapping(value = "/goods/update", method = requestmethod.post)@responbodypublic result update(@requestbody newbeemallgoods newbeemallgoods) {if (objects.isnull(newbeemallgoods.getgoodsid())|| stringutils.impty(newbeemallgoods.getgoodsname())|| stringutils.impty(newbeemallgoods.getgoodsintro())|| stringutils.impty(newbeemallgoods.gettag())|| objects.isnull(newbeemallgoods.ge党代会心得体会toriginalprice())|| objects.isnull(newbeemallgoods.getllingprice())|| objects.isnull(newbeemallgoods.getgoodscategoryid())|| objects.isnull(newbeemallgoods.getstocknum())|| objects.isnull(newbeemallgoods.getgoodsllstatus())|| stringutils.impty(newbeemallgoods.getgoodscoverimg())|| stringutils.impty(newbeemallgoods.getgoodsdetailcontent())) {return resultgenerator.genfailresult("参数异常!");}string result = newbeemallgoodsrvice.updatenewbeemallgoods(newbeemallgoods);if (rviceresultenum.success.getresult().equals(result)) {return resultgenerator.gensuccessresult();} el {return resultgenerator.genfailresult(result);}}/*** 详情*/@getmapping("/goods/info/{id}")@responbodypublic result info(@pathvariable("id") long id) {newbeemallgoods goods = newbeemallgoodsrvice.getnewbeemallgoodsbyid(id);if (goods == null) {return resultgenerator.genfailresult(rviceresultenum.data_not_exist.getresult());}return resultgenerator.gensuccessresult(goods);}/*** 批量修改销售状态*/@requestmapping(value = "/goods/status/{llstatus}", method = requestmethod.put)@responbodypublic result delete(@requestbody long[] ids, @pathvariable("llstatus") int llstatus) {if (ids.length < 1) {return resultgenerator.genfailresult("参数异常!");}if (llstatus != constants.ll_status_up && llstatus != constants.ll_status_down) {return resultgenerator.genfailresult("状态异常!");}if (newbeemallgoodsrvice.batchupdatellstatus(ids, llstatus)) {return resultgenerator.gensuccessresult();} el {return resultgenerator.genfailresult("修改失败");}}}
/*** @author yy*/@controller@requestmapping("/admin")public class newbeemallgoodscategorycontroller {@resourceprivate newbeemallcategoryrvice newbeemallcategoryrvice;@getmapping("/categories")public string categoriespage(httprvletrequest request, @requestparam("categorylevel") byte categorylevel, @requestparam("parentid") long parentid, @requestparam("backparentid") long backparentid) {if (categorylevel == null || categorylevel < 1 || categorylevel > 3) {return "error/error_5xx";}requ深圳的学校est.tattribute("path", "newbee_mall_category");request.tattribute("parentid", parentid);request.tattribute("backparentid", backparentid);request.tattribute("categorylevel", categorylevel);return "admin/newbee_mall_category";}/*** 列表*/@requestmapping(value = "/categories/list", method = requestmethod.get)@responbodypublic result list(@requestparam map<string, object> params) {if (stringutils.impty(params.get("page")) || stringutils.impty(params.get("limit"))) {return resultgenerator.genfailresult("参数异常!");}pagequeryutil pageutil = new pagequeryutil(params);return resultgenerator.gensuccessresult(newbeemallcategoryrvice.getcategorispage(pageutil));}/*** 列表*/@requestmapping(value = "/categories/listforlect", method = requestmethod.get)@responbodypublic result listforlect(@requestparam("categoryid") long categoryid) {if (categoryid == null || categoryid < 1) {return resultgenerator.genfailresult("缺少参数!");}goodscategory category = newbeemallcategoryrvice.getgoodscategorybyid(categoryid);//既不是一级分类也不是二级分类则为不返回数据if (category == null || category.getcategorylevel() == newbeemallcategorylevelenum.level_three.getlevel()) {return resultgenerator.genfailresult("参数异常!");}map categoryresult = new hashmap(2);if (category.getcategorylevel() == newbeemallcategorylevelenum.level_one.getlevel()) {//如果是一级分类则返回当前一级分类下的所有二级分类,以及二级分类列表中第一条数据下的所有三级分类列表//查询一级分类列表中第一个实体的所有二级分类list<goodscategory> condlevelcategories = newbeemallcategoryrvice.lectbylevelandparentidsandnumber(collections.singletonlist(categoryid), newbeemallcategorylevelenum.level_two.getlevel());if (!collectionutils.impty(condlevelcategories)) {//查询二级分类列表中第一个实体的所有三级分类list<goodscategory> thirdlevelcategories = newbeemallcategoryrvice.lectbylevelandparentidsandnumber(collections.singletonlist(condlevelcategories.get(0).getcategoryid()), newbeemallcategorylevelenum.level_three.getlevel());categoryresult.put("condlevelcategories", condlevelcategories);categoryresult.put("thirdlevelcategories", thirdlevelcategories);}}if (category.getcategorylevel() == newbeemallcategorylevelenum.level_two.getlevel()) {//如果是二级分类则返回当前分类下的所有三级分类列表list<goodscategory> thirdlevelcategories = newbeemallcategoryrvice.lectbylevelandparentidsandnumber(collections.singletonlist(categoryid), newbeemallcategorylevelenum.level_three.getlevel());categoryresult.put("thirdlevelcategories", thirdlevelcategories);}return resultgenerator.gensuccessresult(categoryresult);}/*** 添加*/@requestmapping(value = "/categories/save", method = requestmethod.post)@responbodypublic result save(@requestbody goodscategory goodscategory) {if (objects.isnull(goodscategory.getcategorylevel())|| stringutils.impty(goodscategory.getcategoryname())|| objects.isnull(goodscategory.getparentid())|| objects.isnull(goodscategory.getcategoryrank())) {return resultgenerator.genfailresult("参数异常!");}string result = newbeemallcategoryrvice.savecategory(goodscategory);if (rviceresultenum.success.getresult().equals(result)) {return resultgenerator.gensuccessresult();} el {return resultgenerator.genfailresult(result);}}/*** 修改*/@requestmapping(value = "/categories/update", method = requestmethod.post)@responbodypublic result update(@requestbody goodscategory goodscategory) {if (objects.isnull(goodscategory.getcategoryid())|| objects.isnull(goodscategory.getcategorylevel())|| stringutils.impty(goodscategory.getcategoryname())|| objects.isnull(goodscategory.getparentid())|| objects.isnull(goodscategory.getcategoryrank())) {return resultgenerator.genfailresult("参数异常!");}string result = newbeemallcategoryrvice.updategoodscategory(goodscategory);if (rviceresultenum.success.getresult().equals(result)) {return resultgenerator.gensuccessresult();} el {return resultgenerator.genfailresult(result);}}/*** 详情*/@getmapping("/categories/info/{id}")@responbodypublic result info(@pathvariable("id") long id) {goodscategory goodscategory = newbeemallcategoryrvice.getgoodscategorybyid(id);if (goodscategory == null) {return resultgenerator.genfailresult("未查询到数据");}return resultgenerator.gensuccessresult(goodscategory);}/*** 分类删除*/@requestmapping(value = "/categories/delete", method = requestmethod.post)@responbodypublic result delete(@requestbody integer[] ids) {if (ids.length < 1) {return resultgenerator.genfailresult("参数异常!");}if (newbeemallcategoryrvice.deletebatch(ids)) {return resultgenerator.gensuccessresult();} el {return resultgenerator.genfailresult("删除失败");}}}
到此这篇关于java女装商城系统的实现流程的文章就介绍到这了,更多相关java 女装商城系统内容请搜索www.887551.com以前的文章或继续浏览下面的相关文章希望大家以后多多支持www.887551.com!
本文发布于:2023-04-03 22:23:20,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/44940b191c567d46012fc640253b64eb.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:Java女装商城系统的实现流程.doc
本文 PDF 下载地址:Java女装商城系统的实现流程.pdf
留言与评论(共有 0 条评论) |