基于ssm框架的水果商城,
00-1010一、项目介绍二、环境介绍三、系统展示四、核心代码展示五、项目总结
00-1010项目编号:BS-SC-029
该系统主要为种子水果、农民和水果经销商搭建一个B2B电子商务平台。该系统由三个角色组成:农民、经销商和管理员。
1.农民的角色功能
首页、用户注册、新闻公告、查看水果详情、收藏、留言、个人中心、我的收藏、反馈、发布水果、我的销售等功能。
2.经销商角色职能
首页、用户注册登录、新闻公告、查看水果详情、收藏、留言、个人中心、我的收藏、反馈、在线购买、订单结算、查看我的订单等。
3.管理员后台功能
用户管理、管理员管理、网站内容管理、水果类型管理、水果信息管理、购买订单管理、用户评价管理、反馈管理、消息交流管理等。
00-1010区域设置:Java: jdk1.8
数据库:Mysql:
服务器:Tomcat: tomcat8.5.31
开发工具:IDEA还是eclipse
后台开发技术:SSM框架
开发技术:H-UI框架
00-1010用户注册
登录
系统主页
新闻稿
商品展示
全文检索
在线消息
添加购物车
经销商个人中心
农民个人中心
后台管理功能模块
目录
包com.controller导入Java . util . ArrayList;导入Java . util . list;导入org . spring framework . beans . factory . annotation . auto wired;导入org . spring framework . stereotype . controller;导入org . spring framework . web . bind . annotation . request mapping;导入com . entity . admin;导入com . service . adminservice;导入com . util . page helper;导入com . util . vedate;//定义为controller @Controller//设置路径@ requestmapping (value=/admin ,products= text/plain;Charset=UTF-8 )由于标记的存在,公共类管理控制器扩展基本控制器{//注入服务不需要getter setter @ autowiredPrivate Adminservice Adminservice;//管理员准备@ requestmapping (index.action )公共字符串index(){ return admin/index ;}//管理员登录1验证用户名是否存在2验证密码是否正确@ request mapping( log in . action )public string log in(){ string username=this . get request()。GetParameter(“用户名”);String password=this.getRequest()。getParameter(“password”);Admin Admin entity=new Admin();adminEntity.setUsername(用户名);ListAdmin adminlist=this . adminservice . getadmininbycond(admin entity);如果(公元
minlist.size() == 0) {this.getRequest().setAttribute("message", "用户名不存在");return "redirect:/admin/index.action";} else {Admin admin = adminlist.get(0);if (password.equals(admin.getPassword())) {this.getSession().setAttribute("adminid", admin.getAdminid());this.getSession().setAttribute("adminname", admin.getUsername());this.getSession().setAttribute("realname", admin.getRealname());} else {this.getRequest().setAttribute("message", "密码错误");return "redirect:/admin/index.action";}}return "admin/main";}// 管理员准备修改密码@RequestMapping("prePwd.action")public String prePwd() {return "admin/editpwd";}// 修改密码@RequestMapping("editpwd.action")public String editpwd() {String adminid = (String) this.getSession().getAttribute("adminid");String password = this.getRequest().getParameter("password");String repassword = this.getRequest().getParameter("repassword");Admin admin = this.adminService.getAdminById(adminid);if (password.equals(admin.getPassword())) {admin.setPassword(repassword);this.adminService.updateAdmin(admin);} else {this.getRequest().setAttribute("message", "旧密码错误");}return "redirect:/admin/prePwd.action";}// 管理员退出登录@RequestMapping("exit.action")public String exit() {this.getSession().removeAttribute("adminid");this.getSession().removeAttribute("adminname");this.getSession().removeAttribute("realname");return "redirect:/admin/index.action";}// 准备添加数据@RequestMapping("createAdmin.action")public String createAdmin() {return "admin/addadmin";}// 添加数据@RequestMapping("addAdmin.action")public String addAdmin(Admin admin) {admin.setAddtime(VeDate.getStringDateShort());this.adminService.insertAdmin(admin);return "redirect:/admin/createAdmin.action";}// 通过主键删除数据@RequestMapping("deleteAdmin.action")public String deleteAdmin(String id) {this.adminService.deleteAdmin(id);return "redirect:/admin/getAllAdmin.action";}// 批量删除数据@RequestMapping("deleteAdminByIds.action")public String deleteAdminByIds() {String[] ids = this.getRequest().getParameterValues("adminid");for (String adminid : ids) {this.adminService.deleteAdmin(adminid);}return "redirect:/admin/getAllAdmin.action";}// 更新数据@RequestMapping("updateAdmin.action")public String updateAdmin(Admin admin) {this.adminService.updateAdmin(admin);return "redirect:/admin/getAllAdmin.action";}// 显示全部数据@RequestMapping("getAllAdmin.action")public String getAllAdmin(String number) {List<Admin> adminList = this.adminService.getAllAdmin();PageHelper.getPage(adminList, "admin", null, null, 10, number, this.getRequest(), null);return "admin/listadmin";}// 按条件查询数据 (模糊查询)@RequestMapping("queryAdminByCond.action")public String queryAdminByCond(String cond, String name, String number) {Admin admin = new Admin();if(cond != null){if ("username".equals(cond)) {admin.setUsername(name);}if ("password".equals(cond)) {admin.setPassword(name);}if ("realname".equals(cond)) {admin.setRealname(name);}if ("contact".equals(cond)) {admin.setContact(name);}if ("addtime".equals(cond)) {admin.setAddtime(name);}}List<String> nameList = new ArrayList<String>();List<String> valueList = new ArrayList<String>();nameList.add(cond);valueList.add(name);PageHelper.getPage(this.adminService.getAdminByLike(admin), "admin", nameList, valueList, 10, number, this.getRequest(), "query");name = null;cond = null;return "admin/queryadmin";}// 按主键查询数据@RequestMapping("getAdminById.action")public String getAdminById(String id) {Admin admin = this.adminService.getAdminById(id);this.getRequest().setAttribute("admin", admin);return "admin/editadmin";}}
package com.controller;import java.util.ArrayList;import java.util.List;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import com.entity.Article;import com.service.ArticleService;import com.entity.Banner;import com.service.BannerService;import com.util.PageHelper;import com.util.VeDate;//定义为控制器@Controller// 设置路径@RequestMapping(value = "/article" , produces = "text/plain;charset=utf-8")public class ArticleController extends BaseController {// 注入Service 由于标签的存在 所以不需要getter setter@Autowiredprivate ArticleService articleService;@Autowiredprivate BannerService bannerService;// 准备添加数据@RequestMapping("createArticle.action")public String createArticle() {List<Banner> bannerList = this.bannerService.getAllBanner();this.getRequest().setAttribute("bannerList", bannerList);return "admin/addarticle";}// 添加数据@RequestMapping("addArticle.action")public String addArticle(Article article) {article.setAddtime(VeDate.getStringDateShort());article.setHits("0");this.articleService.insertArticle(article);return "redirect:/article/createArticle.action";}// 通过主键删除数据@RequestMapping("deleteArticle.action")public String deleteArticle(String id) {this.articleService.deleteArticle(id);return "redirect:/article/getAllArticle.action";}// 批量删除数据@RequestMapping("deleteArticleByIds.action")public String deleteArticleByIds() {String[] ids = this.getRequest().getParameterValues("articleid");for (String articleid : ids) {this.articleService.deleteArticle(articleid);}return "redirect:/article/getAllArticle.action";}// 更新数据@RequestMapping("updateArticle.action")public String updateArticle(Article article) {this.articleService.updateArticle(article);return "redirect:/article/getAllArticle.action";}// 显示全部数据@RequestMapping("getAllArticle.action")public String getAllArticle(String number) {List<Article> articleList = this.articleService.getAllArticle();PageHelper.getPage(articleList, "article", null, null, 10, number, this.getRequest(), null);return "admin/listarticle";}// 按条件查询数据 (模糊查询)@RequestMapping("queryArticleByCond.action")public String queryArticleByCond(String cond, String name, String number) {Article article = new Article();if(cond != null){if ("title".equals(cond)) {article.setTitle(name);}if ("bannerid".equals(cond)) {article.setBannerid(name);}if ("image".equals(cond)) {article.setImage(name);}if ("contents".equals(cond)) {article.setContents(name);}if ("addtime".equals(cond)) {article.setAddtime(name);}if ("hits".equals(cond)) {article.setHits(name);}}List<String> nameList = new ArrayList<String>();List<String> valueList = new ArrayList<String>();nameList.add(cond);valueList.add(name);PageHelper.getPage(this.articleService.getArticleByLike(article), "article", nameList, valueList, 10, number, this.getRequest(), "query");name = null;cond = null;return "admin/queryarticle";}// 按主键查询数据@RequestMapping("getArticleById.action")public String getArticleById(String id) {Article article = this.articleService.getArticleById(id);this.getRequest().setAttribute("article", article);List<Banner> bannerList = this.bannerService.getAllBanner();this.getRequest().setAttribute("bannerList", bannerList);return "admin/editarticle";}}
package com.controller;import java.util.ArrayList;import java.util.List;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import com.entity.Banner;import com.service.BannerService;import com.util.PageHelper;import com.util.VeDate;//定义为控制器@Controller// 设置路径@RequestMapping(value = "/banner" , produces = "text/plain;charset=utf-8")public class BannerController extends BaseController {// 注入Service 由于标签的存在 所以不需要getter setter@Autowiredprivate BannerService bannerService;// 准备添加数据@RequestMapping("createBanner.action")public String createBanner() {return "admin/addbanner";}// 添加数据@RequestMapping("addBanner.action")public String addBanner(Banner banner) {banner.setAddtime(VeDate.getStringDateShort());this.bannerService.insertBanner(banner);return "redirect:/banner/createBanner.action";}// 通过主键删除数据@RequestMapping("deleteBanner.action")public String deleteBanner(String id) {this.bannerService.deleteBanner(id);return "redirect:/banner/getAllBanner.action";}// 批量删除数据@RequestMapping("deleteBannerByIds.action")public String deleteBannerByIds() {String[] ids = this.getRequest().getParameterValues("bannerid");for (String bannerid : ids) {this.bannerService.deleteBanner(bannerid);}return "redirect:/banner/getAllBanner.action";}// 更新数据@RequestMapping("updateBanner.action")public String updateBanner(Banner banner) {this.bannerService.updateBanner(banner);return "redirect:/banner/getAllBanner.action";}// 显示全部数据@RequestMapping("getAllBanner.action")public String getAllBanner(String number) {List<Banner> bannerList = this.bannerService.getAllBanner();PageHelper.getPage(bannerList, "banner", null, null, 10, number, this.getRequest(), null);return "admin/listbanner";}// 按条件查询数据 (模糊查询)@RequestMapping("queryBannerByCond.action")public String queryBannerByCond(String cond, String name, String number) {Banner banner = new Banner();if(cond != null){if ("bannername".equals(cond)) {banner.setBannername(name);}if ("addtime".equals(cond)) {banner.setAddtime(name);}if ("memo".equals(cond)) {banner.setMemo(name);}}List<String> nameList = new ArrayList<String>();List<String> valueList = new ArrayList<String>();nameList.add(cond);valueList.add(name);PageHelper.getPage(this.bannerService.getBannerByLike(banner), "banner", nameList, valueList, 10, number, this.getRequest(), "query");name = null;cond = null;return "admin/querybanner";}// 按主键查询数据@RequestMapping("getBannerById.action")public String getBannerById(String id) {Banner banner = this.bannerService.getBannerById(id);this.getRequest().setAttribute("banner", banner);return "admin/editbanner";}}
package com.controller;import java.util.ArrayList;import java.util.List;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import com.entity.Complains;import com.service.ComplainsService;import com.entity.Users;import com.service.UsersService;import com.util.PageHelper;//定义为控制器@Controller// 设置路径@RequestMapping(value = "/complains" , produces = "text/plain;charset=utf-8")public class ComplainsController extends BaseController {// 注入Service 由于标签的存在 所以不需要getter setter@Autowiredprivate ComplainsService complainsService;@Autowiredprivate UsersService usersService;// 准备添加数据@RequestMapping("createComplains.action")public String createComplains() {List<Users> usersList = this.usersService.getAllUsers();this.getRequest().setAttribute("usersList", usersList);return "admin/addcomplains";}// 添加数据@RequestMapping("addComplains.action")public String addComplains(Complains complains) {this.complainsService.insertComplains(complains);return "redirect:/complains/createComplains.action";}// 通过主键删除数据@RequestMapping("deleteComplains.action")public String deleteComplains(String id) {this.complainsService.deleteComplains(id);return "redirect:/complains/getAllComplains.action";}// 批量删除数据@RequestMapping("deleteComplainsByIds.action")public String deleteComplainsByIds() {String[] ids = this.getRequest().getParameterValues("complainsid");for (String complainsid : ids) {this.complainsService.deleteComplains(complainsid);}return "redirect:/complains/getAllComplains.action";}// 更新数据@RequestMapping("updateComplains.action")public String updateComplains(Complains complains) {this.complainsService.updateComplains(complains);return "redirect:/complains/getAllComplains.action";}// 更新状态@RequestMapping("status.action")public String status(String id) {String status = "";Complains complains = this.complainsService.getComplainsById(id);if (status.equals(complains.getStatus())) {status = "";}complains.setStatus(status);this.complainsService.updateComplains(complains);return "redirect:/complains/getAllComplains.action";}// 显示全部数据@RequestMapping("getAllComplains.action")public String getAllComplains(String number) {List<Complains> complainsList = this.complainsService.getAllComplains();PageHelper.getPage(complainsList, "complains", null, null, 10, number, this.getRequest(), null);return "admin/listcomplains";}// 按条件查询数据 (模糊查询)@RequestMapping("queryComplainsByCond.action")public String queryComplainsByCond(String cond, String name, String number) {Complains complains = new Complains();if(cond != null){if ("usersid".equals(cond)) {complains.setUsersid(name);}if ("title".equals(cond)) {complains.setTitle(name);}if ("contents".equals(cond)) {complains.setContents(name);}if ("addtime".equals(cond)) {complains.setAddtime(name);}if ("status".equals(cond)) {complains.setStatus(name);}if ("reps".equals(cond)) {complains.setReps(name);}}List<String> nameList = new ArrayList<String>();List<String> valueList = new ArrayList<String>();nameList.add(cond);valueList.add(name);PageHelper.getPage(this.complainsService.getComplainsByLike(complains), "complains", nameList, valueList, 10, number, this.getRequest(), "query");name = null;cond = null;return "admin/querycomplains";}// 按主键查询数据@RequestMapping("getComplainsById.action")public String getComplainsById(String id) {Complains complains = this.complainsService.getComplainsById(id);this.getRequest().setAttribute("complains", complains);List<Users> usersList = this.usersService.getAllUsers();this.getRequest().setAttribute("usersList", usersList);return "admin/editcomplains";}}
五,项目总结
本系统功能主要是针对农户、经销商买卖双方进行业务对接,平台管理员负责基础数据的管理,是一个B2B的商城平台,功能比较完整,页面简洁大方,适合做毕业设计使用。
到此这篇关于Java通过SSM完成水果商城批发平台流程的文章就介绍到这了,更多相关Java水果商城内容请搜索盛行IT以前的文章或继续浏览下面的相关文章希望大家以后多多支持盛行IT!
郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。