# zlp-shop **Repository Path**: temper/zlp-shop ## Basic Information - **Project Name**: zlp-shop - **Description**: 该项目"基于SpringCloud2.x+SpringBoot2.0+Mybatis微服务敏捷开发系统架构,配置中心采用Apollo分布式配置中心,网关安全采用SpringCloud-Zuul网关框架管理服务请求入口,保证服务RPC安全,SSO单点登入,提供整套公共微服务服务模块:商品管理、聚合支付平台中心、会员管理、微信平台、存储系统、配置中心、日志分析、任务和通知等,支持服务治理、监控和追踪搭建微服务电商项目。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 3 - **Created**: 2020-03-07 - **Last Updated**: 2024-12-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SHOP ## 前言   `shop`为搭建一套微服务框架平台,从 **前端模板** - **基础框架** - **分布式架构** - **分布式配置中心** - **自动化部署** - **系统监测** - **无缝升级** 的全方位微服务高并发解决方案。 ## 项目介绍   该项目"基于SpringCloud2.x+SpringBoot2.0+Mybatis微服务敏捷开发系统架构,配置中心采用Apollo分布式配置中心,网关安全采用SpringCloud-Zuul网关框架管理服务请求入口,保证服务RPC安全,SSO单点登入,提供整套公共微服务服务模块:商品管理、聚合支付平台中心、会员管理、微信平台、存储系统、配置中心、日志分析、任务和通知等,支持服务治理、监控和追踪搭建微服务电商项目。 ### 组织结构 ``` lua shop ├── zlp-shop-parent -- 公共Pranet接口 ├── zlp-shop-basics --分布式基础设施 ├── zlp-shop-basics-eureka—注册中心 ├── zlp-shop-basics-zuul—统一请求入口 ├── zlp-shop-basics-xxljob—分布式任务调度平台 ├── zlp-shop-basics-lcn—分布式事务解决框架 ├── zlp-shop-basics-ZipKin —分布式调用链系统 ├── zlp-shop-service-api提供公共接口 ├── zlp-shop-service-api-weixin 微信服务接口 ├── zlp-shop-service-api-member会员服务接口 ├── zlp-shop-service-api-sso sso服务接口 ├── zlp-shop-service-api-item商品服务接口 ├── zlp-shop-service-api-search 搜索服务接口 ├── zlp-shop-service-api-pay聚合支付平台 ├── zlp-shop-service-api-spike 秒杀服务接口 ├── zlp-shop-service-impl公共接口的实现 ├── zlp-shop-service-weixin 微信服务接口实现 ├── zlp-shop-service-member会员服务接口实现 ├── zlp-shop-service-api-sso sso服务接口实现 ├── zlp-shop-service-tem商品服务接口实现 ├── zlp-shop-service-search 搜索服务接口实现 ├── zlp-shop-service-pay聚合支付平台接口实现 ├── zlp-shop-common 工具类 ├── zlp-shop-common-core—核心工具类 ├── zlp-shop-common-web-core—web核心工具类 ├── zlp-shop-portal 门户平台 ├── zlp-shop-portal-web 门户网站 ├── zlp-shop-portal-sso 单点登陆系统 ├── zlp-shop-portal-search 搜索系统 ├── zlp-shop-portal-spike 秒杀系统 ├── zlp-shop-portal-cms 系统 ``` ### 技术选型 #### 后端技术: 技术 | 说明 | 官网 ----|------|---- SpringBoot2.x | 快速搭建框架 | [https://spring.io/projects/spring-boot/](https://spring.io/projects/spring-boot/) SpringCloud2.x | 微服务框架 | [https://spring.io/projects/spring-cloud/https://spring.io/projects/spring-cloud](http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#mvc) Spring | 容器 | [http://projects.spring.io/spring-framework/](http://projects.spring.io/spring-framework/) MyBatis | ORM框架 | [http://www.mybatis.org/mybatis-3/zh/index.html](http://www.mybatis.org/mybatis-3/zh/index.html) Zuul | 服务网关 | [http://cloud.spring.io/spring-cloud-static/Edgware.SR3/multi/multi__router_and_filter_zuul.html](http://cloud.spring.io/spring-cloud-static/Edgware.SR3/multi/multi__router_and_filter_zuul.html) Spring session | 分布式Session管理 | [http://projects.spring.io/spring-session/](http://projects.spring.io/spring-session/) Ribbon | 实现本地负载均衡器 | Hystrix | 服务保护框架(服务降级、隔离、熔断、限流) | RabbitMQ | 中间件 | [https://www.rabbitmq.com/](https://www.rabbitmq.com/) Kafka | 中间件 | [http://kafka.apache.org/](http://kafka.apache.org/) CAS+JWT+Oauth2.0 | 安全框架 | [https://oauth.net/2/](https://oauth.net/2/) MyBatis Generator | 代码生成 | [http://www.mybatis.org/generator/index.html](http://www.mybatis.org/generator/index.html) PageHelper | MyBatis物理分页插件 | [http://git.oschina.net/free/Mybatis_PageHelper](http://git.oschina.net/free/Mybatis_PageHelper) Druid | 数据库连接池 | [https://github.com/alibaba/druid](https://github.com/alibaba/druid) Apollo | 分布式配置中心 | [https://github.com/ctripcorp/apollo/](https://github.com/ctripcorp/apollo/) Thymeleaf | 模板引擎 | [http://www.thymeleaf.org/](http://www.thymeleaf.org/) xxl-job | 分布式调度框架 | [https://github.com/xuxueli/xxl-job/releases](https://github.com/xuxueli/xxl-job/releases) Redis | 分布式缓存数据库 | [https://redis.io/](https://redis.io/) Elasticsearch | 分布式全文搜索引擎 | [https://www.elastic.co//]([https://www.elastic.co/) ) Quartz | 作业调度框架 | [http://www.quartz-scheduler.org/](http://www.quartz-scheduler.org/) Log4J | 日志组件 | [http://logging.apache.org/log4j/1.2/](http://logging.apache.org/log4j/1.2/) Swagger2 | 接口测试框架 | [http://swagger.io/](http://swagger.io/) AliOSS & Qiniu & QcloudCOS | 云存储 | [https://www.aliyun.com/product/oss/](https://www.aliyun.com/product/oss/) [http://www.qiniu.com/](http://www.qiniu.com/) [https://www.qcloud.com/product/cos](https://www.qcloud.com/product/cos) Jenkins | 持续集成工具 | [https://jenkins.io/index.html](https://jenkins.io/index.html) Maven | 项目构建管理 | [http://maven.apache.org/](http://maven.apache.org/) Netty-socketio | 实时推送 | [https://github.com/mrniko/netty-socketio](https://github.com/mrniko/netty-socketio) #### 前端技术: 技术 | 名称 | 官网 ----|------|---- jQuery | 函式库 | [http://jquery.com/](http://jquery.com/) layui | 字体图标 | [https://www.layui.com/doc/modules/layer.html#layer.close](https://www.layui.com/doc/modules/layer.html#layer.close) zTree | 树插件 | [http://www.treejs.cn/v3/](http://www.treejs.cn/v3/) Select2 | 选择框插件 | [https://github.com/select2/select2](https://github.com/select2/select2) Editor.md | Markdown编辑器 | [https://github.com/pandao/editor.md](https://github.com/pandao/editor.md) #### 架构图 ![拓扑图](project-bootstrap/architect.jpg) #### 模块介绍 > zlp-shop-basics 分布式基础设施模块,包括注册中心(eureka)、统一网关入库(Zuul)、分布式任务调度平台(xxljob)、分布式事务解决框架(lcn)和分布式调用链系统(ZipKin) > zlp-shop-service-api 提供公共接口,其中包括了微信服务接口、会员服务接口、sso服务接口、商品服务接口、搜索服务接口、聚合支付平台、订单服务接口、秒杀服务接口 > zlp-shop-service-impl 公共接口的实现类 > zlp-shop-common 核心工具类,包括日志、异常、redis、日期等等 > zlp-shop-portal 门户网站包括单点登入、搜索系统、秒杀系统、cms 系统 文件存储系统 - **阿里云** OSS 服务网关,对外暴露统一规范的接口和包装响应结果,包括各个子系统的交互接口、对外开放接口、开发加密接口、接口文档等服务,可在该模块支持验签、鉴权、路由、限流、监控、容错、日志等功能 #### 分布式配置中心 ![Apollo](project-bootstrap/Aopllo.png) ## 环境搭建 #### 开发工具: - MySql: 数据库 - Tomcat: 开发服务器|应用服务器 - Git: 版本管理 - Nginx: 反向代理服务器 - Apollo: 分布式配置中心 - IntelliJ IDEA|Eclipse: 开发IDE - PDMAN: 建模工具 - Navicat|MySQL: 数据库客户端 - Elasticsearch: 搜索引擎 #### 开发环境: - Jdk8+ - Mysql5.7+ - Redis - SpringBoot2.0+ - SpringCloud2.0+ - RabbitMQ - Apollo - Elasticsearch ### 资源下载 - Maven [http://maven.apache.org/download.cgi](http://maven.apache.org/download.cgi "Maven") - Redis [https://redis.io/download](https://redis.io/download "Redis") - ActiveMQ [http://activemq.apache.org/download-archives.html](http://activemq.apache.org/download-archives.html "ActiveMQ") - ZooKeeper [http://www.apache.org/dyn/closer.cgi/zookeeper/](http://www.apache.org/dyn/closer.cgi/zookeeper/ "ZooKeeper") - Dubbo [http://dubbo.io/Download-zh.htm](http://dubbo.io/Download-zh.htm "Dubbo") - Elastic Stack [https://www.elastic.co/downloads](https://www.elastic.co/downloads "Elastic Stack") - Nginx [http://nginx.org/en/download.html](http://nginx.org/en/download.html "Nginx") - Jenkins [http://updates.jenkins-ci.org/download/war/](http://updates.jenkins-ci.org/download/war/ "Jenkins") ## 开发指南: - 1、本机安装Jdk8、Mysql、Redis、Apollo、RabbitMQ**启动相关服务**,使用默认配置默认端口即可 ### 编译流程 maven编译安装 ### 启动顺序(后台) > 准备工作 - 新建shop数据库,导入shop-sql文件夹下的shop.sql - 修改各dao模块和rpc-service模块的redis.properties、jdbc.properties、generator.properties数据库连接等配置信息,其中master.redis.password、master.jdbc.password、slave.jdbc.password、generator.jdbc.password密码值使用了AES加密,请使用com.zheng.common.util.AESUtil工具类修改这些值 - 启动Eureka、Redis、RabbitMQ、Nginx、 - 部署工作请关注微公众号"给自己一个smile",后面有详细教程 ### 框架规范约定 约定优于配置(convention over configuration),此框架约定了很多编程规范,下面一一列举: ``` - service类,需要在叫名`service`的包下,并以`Service`结尾,如`CmsArticleServiceImpl` - controller类,需要在以`controller`结尾的包下,类名以Controller结尾,如`CmsArticleController.java`,并继承`BaseController` - spring task类,需要在叫名`task`的包下,并以`Task`结尾,如`TestTask.java` - mapper.xml,需要在名叫`mapper`的包下,并以`Mapper.xml`结尾,如`CmsArticleMapper.xml` - mapper接口,需要在名叫`mapper`的包下,并以`Mapper`结尾,如`CmsArticleMapper.java` ``` ## 演示地址 演示地址:待定...... ### 预览图 待定...... ### 数据模型 待定...... ## 附件 ### 优秀文章和博客 - [创业互联网公司如何搭建自己的技术框架](http://shuzheng5201314.iteye.com/blog/2330151 "创业互联网公司如何搭建自己的技术框架") - [微服务实战](https://segmentfault.com/a/1190000004634172 "微服务实战") - [单点登录原理与简单实现](http://shuzheng5201314.iteye.com/blog/2343910 "单点登录原理与简单实现") - [ITeye论坛关于权限控制的讨论](http://www.iteye.com/magazines/82 "ITeye论坛关于权限控制的讨论") - [RBAC新解:基于资源的权限管理(Resource-Based Access Control)](http://globeeip.iteye.com/blog/1236167 "RBAC新解:基于资源的权限管理(Resource-Based Access Control)") - [网站架构经验随笔](http://jinnianshilongnian.iteye.com/blog/2289904 "网站架构经验随笔") - [支付系统架构](http://shuzheng5201314.iteye.com/blog/2355431 "支付系统架构") - [Spring整合JMS](http://elim.iteye.com/blog/1893038 "Spring整合JMS") - [跟我学Shiro目录贴](http://jinnianshilongnian.iteye.com/blog/2018398 "跟我学Shiro目录贴") - [跟我学SpringMVC目录汇总贴](http://jinnianshilongnian.iteye.com/blog/1752171 "跟我学SpringMVC目录汇总贴") - [跟我学spring3 目录贴](http://jinnianshilongnian.iteye.com/blog/1482071 "跟我学spring3 目录贴") - [跟我学OpenResty(Nginx+Lua)开发目录贴](http://jinnianshilongnian.iteye.com/blog/2190344 "跟我学OpenResty(Nginx+Lua)开发目录贴") - [Redis中文网](http://www.redis.net.cn/ "Redis中文网") - [读懂Redis并配置主从集群及高可用部署](http://mp.weixin.qq.com/s?__biz=MzIxNTYzOTQ0Ng==&mid=2247483668&idx=1&sn=cd31574877d38cf7ff9c047b86c9bf23&chksm=979475eda0e3fcfb6b5006bcd19c5a838eca9e369252847dbdf97820bf418201dd75c1dadda3&mpshare=1&scene=23&srcid=0117KUiiITwi2ETRan16xRVg#rd "读懂Redis并配置主从集群及高可用部署") - [Redis哨兵-实现Redis高可用](http://redis.majunwei.com/topics/sentinel.html "Redis哨兵-实现Redis高可用") - [ELK(ElasticSearch, Logstash, Kibana)搭建实时日志分析平台](http://www.open-open.com/lib/view/open1451801542042.html "ELK(ElasticSearch, Logstash, Kibana)搭建实时日志分析平台") - [Nginx基本功能极速入门](http://xxgblog.com/2015/05/17/nginx-start/ "Nginx基本功能极速入门") - [mybatis-genarator 自定义插件](https://my.oschina.net/alexgaoyh/blog/702791 "mybatis-genarator 自定义插件") - [Elasticsearch权威指南(中文版)](https://es.xiaoleilu.com/510_Deployment/20_hardware.html "Elasticsearch权威指南(中文版)") - [springMVC对简单对象、Set、List、Map的数据绑定和常见问题.](http://blog.csdn.net/z_dendy/article/details/12648641 "springMVC对简单对象、Set、List、Map的数据绑定和常见问题.") - [如何细粒度地控制你的MyBatis二级缓存](http://blog.csdn.net/luanlouis/article/details/41800511 "如何细粒度地控制你的MyBatis二级缓存") - [Git 在团队中的最佳实践--如何正确使用Git Flow](hhttps://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow "Git 在团队中的最佳实践--如何正确使用Git Flow") - [做个男人,做个成熟的男人,做个有城府的男人](http://shuzheng5201314.iteye.com/blog/1387820 "做个男人,做个成熟的男人,做个有城府的男人") ### 在线小工具 - [在线Cron表达式生成器](http://cron.qqe2.com/ "在线Cron表达式生成器") - [在线工具 - 程序员的工具箱](http://tool.lu/ "在线工具 - 程序员的工具箱") ## 许可证 [MIT](LICENSE "MIT")