当前位置:   article > 正文

SpringBoot vue uniapp小程序的简洁的单商户商城系统(有单独的小程序、单独移动端Vue_uniapp基础商城后台管理系统

uniapp基础商城后台管理系统

博主介绍:✌在职Java研发工程师、专注于程序设计、源码分享、技术交流、专注于Java技术领域和毕业设计
温馨提示:文末有 CSDN 平台官方提供的老师 Wechat / QQ 名片 :)

项目名称

SpringBoot  vue uniapp小程序的简洁的单商户商城系统(有单独的小程序、单独移动端Vue

演示视频

SpringBoot vue uniapp小程序的简洁的单商户商城系统(有单独的小程序、单独移动端Vue_哔哩哔哩_bilibili

系统介绍

包含了后台管理功能和手机端商城业务功能

基础模块
部门管理
用户管理
角色管理
菜单管理
权限分配
参数管理
数据字典管理
定时任务管理
操作日志shi
登录日志
cms内容管理
消息管理:配置消息模板,发送短信,邮件消息
基于idea插件的代码生成
商城功能
会员管理
商品类别
商品管理
订单管理
购物车
banner管理
收藏列表
手机端 -完整的商城购物功能

系统截图

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 
5.数据库:MySql 5.7版本;
6.是否Maven项目:否;

技术栈

1. 后端:Spring+SpringMVC+Mybatis
2. 前端:JSP+CSS+JavaScript+jQuery

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中springmvc-servlet.xml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入http://localhost:8080/ 登录

POM依赖:

  1. <dependencies>
  2. <dependency>
  3. <groupId>org.springframework.boot</groupId>
  4. <artifactId>spring-boot-starter-data-jpa</artifactId>
  5. </dependency>
  6. <dependency>
  7. <groupId>mysql</groupId>
  8. <artifactId>mysql-connector-java</artifactId>
  9. <scope>runtime</scope>
  10. </dependency>
  11. <dependency>
  12. <groupId>org.springframework.boot</groupId>
  13. <artifactId>spring-boot-starter-freemarker</artifactId>
  14. </dependency>
  15. <dependency>
  16. <groupId>org.springframework.boot</groupId>
  17. <artifactId>spring-boot-starter-web</artifactId>
  18. </dependency>
  19. <dependency>
  20. <groupId>org.springframework.boot</groupId>
  21. <artifactId>spring-boot-starter-test</artifactId>
  22. <scope>test</scope>
  23. </dependency>
  24. <dependency>
  25. <groupId>org.apache.commons</groupId>
  26. <artifactId>commons-lang3</artifactId>
  27. </dependency>
  28. <dependency>
  29. <groupId>commons-codec</groupId>
  30. <artifactId>commons-codec</artifactId>
  31. </dependency>
  32. <dependency>
  33. <groupId>com.alibaba</groupId>
  34. <artifactId>fastjson</artifactId>
  35. <version>1.2.31</version>
  36. </dependency>
  37. <dependency>
  38. <groupId>org.springframework.boot</groupId>
  39. <artifactId>spring-boot-devtools</artifactId>
  40. <!-- optional=true, 依赖不会传递, 该项目依赖devtools;
  41. 之后依赖boot项目的项目如果想要使用devtools, 需要重新引入 -->
  42. <optional>true</optional>
  43. </dependency>
  44. <dependency>
  45. <groupId>org.springframework.boot</groupId>
  46. <artifactId>spring-boot-starter-websocket</artifactId>
  47. <version>2.1.3.RELEASE</version><!--$NO-MVN-MAN-VER$-->
  48. </dependency>
  49. <!-- webSocket 开始-->
  50. <dependency>
  51. <groupId>javax.websocket</groupId>
  52. <artifactId>javax.websocket-api</artifactId>
  53. <scope>provided</scope>
  54. </dependency>
  55. <dependency>
  56. <groupId>javax</groupId>
  57. <artifactId>javaee-api</artifactId>
  58. <version>8.0</version>
  59. <scope>provided</scope>
  60. </dependency>
  61. <!-- webSocket 结束-->
  62. </dependencies>

管理员管理控制层:

  1. package com.sxl.controller.admin;
  2. import java.util.List;
  3. import java.util.Map;
  4. import javax.servlet.http.HttpServletRequest;
  5. import org.springframework.http.ResponseEntity;
  6. import org.springframework.stereotype.Controller;
  7. import org.springframework.ui.Model;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import com.sxl.controller.MyController;
  10. @Controller("adminController")
  11. @RequestMapping(value = "/admin")
  12. public class AdminController extends MyController {
  13. @RequestMapping(value = "/index")
  14. public String frame(Model model, HttpServletRequest request)throws Exception {
  15. return "/admin/index";
  16. }
  17. @RequestMapping(value = "/main")
  18. public String main(Model model, HttpServletRequest request)throws Exception {
  19. return "/admin/main";
  20. }
  21. @RequestMapping(value = "/tj1")
  22. public String tj1(Model model, HttpServletRequest request)throws Exception {
  23. String sql="select DATE_FORMAT(insertDate,'%Y-%m-%d') dates,sum(allPrice) price from t_order order by DATE_FORMAT(insertDate,'%Y-%m-%d') desc";
  24. List<Map> list = db.queryForList(sql);
  25. model.addAttribute("list", list);
  26. System.out.println(list);
  27. return "/admin/tj/tj1";
  28. }
  29. @RequestMapping(value = "/password")
  30. public String password(Model model, HttpServletRequest request)throws Exception {
  31. return "/admin/password";
  32. }
  33. @RequestMapping(value = "/changePassword")
  34. public ResponseEntity<String> loginSave(Model model,HttpServletRequest request,String oldPassword,String newPassword) throws Exception {
  35. Map admin = getAdmin(request);
  36. if(oldPassword.equals(admin.get("password").toString())){
  37. String sql="update t_admin set password=? where id=?";
  38. db.update(sql, new Object[]{newPassword,admin.get("id")});
  39. return renderData(true,"1",null);
  40. }else{
  41. return renderData(false,"1",null);
  42. }
  43. }
  44. }

修改密码业务逻辑:

  1. package com.sxl.controller.admin;
  2. import java.util.Map;
  3. import javax.servlet.http.HttpServletRequest;
  4. import org.springframework.http.ResponseEntity;
  5. import org.springframework.stereotype.Controller;
  6. import org.springframework.ui.Model;
  7. import org.springframework.web.bind.annotation.RequestMapping;
  8. import com.sxl.controller.MyController;
  9. @Controller("userController")
  10. @RequestMapping(value = "/user")
  11. public class UserController extends MyController {
  12. @RequestMapping(value = "/index")
  13. public String frame(Model model, HttpServletRequest request)throws Exception {
  14. return "/user/index";
  15. }
  16. @RequestMapping(value = "/main")
  17. public String main(Model model, HttpServletRequest request)throws Exception {
  18. return "/user/main";
  19. }
  20. @RequestMapping(value = "/password")
  21. public String password(Model model, HttpServletRequest request)throws Exception {
  22. return "/user/password";
  23. }
  24. @RequestMapping(value = "/changePassword")
  25. public ResponseEntity<String> loginSave(Model model,HttpServletRequest request,String oldPassword,String newPassword) throws Exception {
  26. Map user = getUser(request);
  27. if(oldPassword.equals(user.get("password").toString())){
  28. String sql="update t_user set password=? where id=?";
  29. db.update(sql, new Object[]{newPassword,user.get("id")});
  30. return renderData(true,"1",null);
  31. }else{
  32. return renderData(false,"1",null);
  33. }
  34. }
  35. @RequestMapping(value = "/mine")
  36. public String mine(Model model, HttpServletRequest request)throws Exception {
  37. Map user =getUser(request);Map map = db.queryForMap("select * from t_user where id=?",new Object[]{user.get("id")});model.addAttribute("map", map); return "/user/mine";
  38. }
  39. @RequestMapping(value = "/mineSave")
  40. public ResponseEntity<String> mineSave(Model model,HttpServletRequest request,Long id
  41. ,String username,String password,String name,String gh,String mobile) throws Exception{
  42. int result = 0;
  43. String sql="update t_user set name=?,gh=?,mobile=? where id=?";
  44. result = db.update(sql, new Object[]{name,gh,mobile,id});
  45. if(result==1){
  46. return renderData(true,"操作成功",null);
  47. }else{
  48. return renderData(false,"操作失败",null);
  49. }
  50. }
  51. }

通用管理模块:

  1. package com.sxl.controller;
  2. import java.nio.charset.Charset;
  3. import java.util.Locale;
  4. import java.util.ResourceBundle;
  5. import javax.servlet.http.HttpServletRequest;
  6. import org.apache.commons.lang.StringUtils;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.http.HttpHeaders;
  9. import org.springframework.http.HttpStatus;
  10. import org.springframework.http.MediaType;
  11. import org.springframework.http.ResponseEntity;
  12. import com.sxl.util.JacksonJsonUtil;
  13. import com.sxl.util.StringUtil;
  14. import com.sxl.util.SystemProperties;
  15. public class BaseController {
  16. public static final Long EXPIRES_IN = 1000 * 3600 * 24 * 1L;// 1
  17. @Autowired
  18. private SystemProperties systemProperties;
  19. /**
  20. * 获得配置文件内容
  21. */
  22. public String getConfig(String key) {
  23. return systemProperties.getProperties(key);
  24. }
  25. /**
  26. * 返回服务器地址 like http://192.168.1.1:8441/UUBean/
  27. */
  28. public String getHostUrl(HttpServletRequest request) {
  29. String hostName = request.getServerName();
  30. Integer hostPort = request.getServerPort();
  31. String path = request.getContextPath();
  32. if (hostPort == 80) {
  33. return "http://" + hostName + path + "/";
  34. } else {
  35. return "http://" + hostName + ":" + hostPort + path + "/";
  36. }
  37. }
  38. /***
  39. * 获取当前的website路径 String
  40. */
  41. public static String getWebSite(HttpServletRequest request) {
  42. String returnUrl = request.getScheme() + "://"
  43. + request.getServerName();
  44. if (request.getServerPort() != 80) {
  45. returnUrl += ":" + request.getServerPort();
  46. }
  47. returnUrl += request.getContextPath();
  48. return returnUrl;
  49. }
  50. /**
  51. * 初始化HTTP头.
  52. *
  53. * @return HttpHeaders
  54. */
  55. public HttpHeaders initHttpHeaders() {
  56. HttpHeaders headers = new HttpHeaders();
  57. MediaType mediaType = new MediaType("text", "html",
  58. Charset.forName("utf-8"));
  59. headers.setContentType(mediaType);
  60. return headers;
  61. }
  62. /**
  63. * 返回 信息数据
  64. *
  65. * @param status
  66. * @param msg
  67. * @return
  68. */
  69. public ResponseEntity<String> renderMsg(Boolean status, String msg) {
  70. if (StringUtils.isEmpty(msg)) {
  71. msg = "";
  72. }
  73. String str = "{\"status\":\"" + status + "\",\"msg\":\"" + msg + "\"}";
  74. ResponseEntity<String> responseEntity = new ResponseEntity<String>(str,
  75. initHttpHeaders(), HttpStatus.OK);
  76. return responseEntity;
  77. }
  78. /**
  79. * 返回obj数据
  80. *
  81. * @param status
  82. * @param msg
  83. * @param obj
  84. * @return
  85. */
  86. public ResponseEntity<String> renderData(Boolean status, String msg,
  87. Object obj) {
  88. if (StringUtils.isEmpty(msg)) {
  89. msg = "";
  90. }
  91. StringBuffer sb = new StringBuffer();
  92. sb.append("{");
  93. sb.append("\"status\":\"" + status + "\",\"msg\":\"" + msg + "\",");
  94. sb.append("\"data\":" + JacksonJsonUtil.toJson(obj) + "");
  95. sb.append("}");
  96. ResponseEntity<String> responseEntity = new ResponseEntity<String>(
  97. sb.toString(), initHttpHeaders(), HttpStatus.OK);
  98. return responseEntity;
  99. }
  100. /***
  101. * 获取IP(如果是多级代理,则得到的是一串IP值)
  102. */
  103. public static String getIpAddr(HttpServletRequest request) {
  104. String ip = request.getHeader("x-forwarded-for");
  105. if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
  106. ip = request.getHeader("Proxy-Client-IP");
  107. }
  108. if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
  109. ip = request.getHeader("WL-Proxy-Client-IP");
  110. }
  111. if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
  112. ip = request.getRemoteAddr();
  113. }
  114. if (ip != null && ip.length() > 0) {
  115. String[] ips = ip.split(",");
  116. for (int i = 0; i < ips.length; i++) {
  117. if (!"unknown".equalsIgnoreCase(ips[i])) {
  118. ip = ips[i];
  119. break;
  120. }
  121. }
  122. }
  123. return ip;
  124. }
  125. /**
  126. * 国际化获得语言内容
  127. *
  128. * @param key
  129. * 语言key
  130. * @param args
  131. * @param argsSplit
  132. * @param defaultMessage
  133. * @param locale
  134. * @return
  135. */
  136. public static String getLanguage(String key, String args, String argsSplit,
  137. String defaultMessage, String locale) {
  138. String language = "zh";
  139. String contry = "cn";
  140. String returnValue = defaultMessage;
  141. if (!StringUtil.isEmpty(locale)) {
  142. try {
  143. String[] localeArray = locale.split("_");
  144. language = localeArray[0];
  145. contry = localeArray[1];
  146. } catch (Exception e) {
  147. }
  148. }
  149. try {
  150. ResourceBundle resource = ResourceBundle.getBundle("lang.resource",
  151. new Locale(language, contry));
  152. returnValue = resource.getString(key);
  153. if (!StringUtil.isEmpty(args)) {
  154. String[] argsArray = args.split(argsSplit);
  155. for (int i = 0; i < argsArray.length; i++) {
  156. returnValue = returnValue.replace("{" + i + "}",
  157. argsArray[i]);
  158. }
  159. }
  160. } catch (Exception e) {
  161. }
  162. return returnValue;
  163. }
  164. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/码创造者/article/detail/812988
推荐阅读
相关标签
  

闽ICP备14008679号