pull/1/head
dwj 3 months ago
commit 3f9e4dab28

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [2018-2024] [macrozheng]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@ -0,0 +1,207 @@
# mall
<p>
<a href="#公众号"><img src="http://macro-oss.oss-cn-shenzhen.aliyuncs.com/mall/badge/%E5%85%AC%E4%BC%97%E5%8F%B7-macrozheng-blue.svg" alt="公众号"></a>
<a href="#公众号"><img src="http://macro-oss.oss-cn-shenzhen.aliyuncs.com/mall/badge/%E4%BA%A4%E6%B5%81-%E5%BE%AE%E4%BF%A1%E7%BE%A4-2BA245.svg" alt="交流"></a>
<a href="https://github.com/macrozheng/mall-learning"><img src="http://macro-oss.oss-cn-shenzhen.aliyuncs.com/mall/badge/%E5%AD%A6%E4%B9%A0%E6%95%99%E7%A8%8B-mall--learning-green.svg" alt="学习教程"></a>
<a href="https://github.com/macrozheng/mall-swarm"><img src="http://macro-oss.oss-cn-shenzhen.aliyuncs.com/mall/badge/Cloud%E7%89%88%E6%9C%AC-mall--swarm-brightgreen.svg" alt="SpringCloud版本"></a>
<a href="https://github.com/macrozheng/mall-admin-web"><img src="https://macro-oss.oss-cn-shenzhen.aliyuncs.com/mall/badge/%E5%90%8E%E5%8F%B0%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F-mall--admin--web-green.svg" alt="后台管理系统"></a>
<a href="https://github.com/macrozheng/mall-app-web"><img src="https://macro-oss.oss-cn-shenzhen.aliyuncs.com/mall/badge/%E5%89%8D%E5%8F%B0%E5%95%86%E5%9F%8E%E9%A1%B9%E7%9B%AE-mall--app--web-green.svg" alt="前台商城项目"></a>
<a href="https://gitee.com/macrozheng/mall"><img src="http://macro-oss.oss-cn-shenzhen.aliyuncs.com/mall/badge/%E7%A0%81%E4%BA%91-%E9%A1%B9%E7%9B%AE%E5%9C%B0%E5%9D%80-orange.svg" alt="码云"></a>
</p>
## 友情提示
> 1. **快速体验项目**[在线访问地址](https://www.macrozheng.com/admin/index.html) 。
> 2. **全套学习教程**[《mall学习教程》](https://www.macrozheng.com) 。
> 3. **视频教程(最新版)**[《mall视频教程》](https://www.macrozheng.com/mall/foreword/mall_video.html) 。
> 4. **微服务版本**基于Spring Cloud Alibaba的项目[mall-swarm](https://github.com/macrozheng/mall-swarm) 。
> 5. **分支说明**`master`分支基于Spring Boot 2.7+JDK 8`dev-v3`分支基于Spring Boot 3.2+JDK 17。
## 前言
`mall`项目致力于打造一个完整的电商系统,采用现阶段主流技术实现。
## 项目文档
文档地址:[https://www.macrozheng.com](https://www.macrozheng.com)
## 项目介绍
`mall`项目是一套电商系统包括前台商城系统及后台管理系统基于SpringBoot+MyBatis实现采用Docker容器化部署。前台商城系统包含首页门户、商品推荐、商品搜索、商品展示、购物车、订单流程、会员中心、客户服务、帮助中心等模块。后台管理系统包含商品管理、订单管理、会员管理、促销管理、运营管理、内容管理、统计报表、财务管理、权限管理、设置等模块。
### 项目演示
#### 后台管理系统
前端项目`mall-admin-web`地址https://github.com/macrozheng/mall-admin-web
项目演示地址: [https://www.macrozheng.com/admin/index.html](https://www.macrozheng.com/admin/index.html)
![后台管理系统功能演示](./document/resource/mall_admin_show.png)
#### 前台商城系统
前端项目`mall-app-web`地址https://github.com/macrozheng/mall-app-web
项目演示地址(将浏览器切换为手机模式效果更佳):[https://www.macrozheng.com/app/](https://www.macrozheng.com/app/)
![前台商城系统功能演示](./document/resource/re_mall_app_show.jpg)
### 组织结构
``` lua
mall
├── mall-common -- 工具类及通用代码
├── mall-mbg -- MyBatisGenerator生成的数据库操作代码
├── mall-security -- SpringSecurity封装公用模块
├── mall-admin -- 后台商城管理系统接口
├── mall-search -- 基于Elasticsearch的商品搜索系统
├── mall-portal -- 前台商城系统接口
└── mall-demo -- 框架搭建时的测试代码
```
### 技术选型
#### 后端技术
| 技术 | 说明 | 官网 |
| -------------------- | ------------------- | ---------------------------------------------- |
| SpringBoot | Web应用开发框架 | https://spring.io/projects/spring-boot |
| SpringSecurity | 认证和授权框架 | https://spring.io/projects/spring-security |
| MyBatis | ORM框架 | http://www.mybatis.org/mybatis-3/zh/index.html |
| MyBatisGenerator | 数据层代码生成器 | http://www.mybatis.org/generator/index.html |
| Elasticsearch | 搜索引擎 | https://github.com/elastic/elasticsearch |
| RabbitMQ | 消息队列 | https://www.rabbitmq.com/ |
| Redis | 内存数据存储 | https://redis.io/ |
| MongoDB | NoSql数据库 | https://www.mongodb.com |
| LogStash | 日志收集工具 | https://github.com/elastic/logstash |
| Kibana | 日志可视化查看工具 | https://github.com/elastic/kibana |
| Nginx | 静态资源服务器 | https://www.nginx.com/ |
| Docker | 应用容器引擎 | https://www.docker.com |
| Jenkins | 自动化部署工具 | https://github.com/jenkinsci/jenkins |
| Druid | 数据库连接池 | https://github.com/alibaba/druid |
| OSS | 对象存储 | https://github.com/aliyun/aliyun-oss-java-sdk |
| MinIO | 对象存储 | https://github.com/minio/minio |
| JWT | JWT登录支持 | https://github.com/jwtk/jjwt |
| Lombok | Java语言增强库 | https://github.com/rzwitserloot/lombok |
| Hutool | Java工具类库 | https://github.com/looly/hutool |
| PageHelper | MyBatis物理分页插件 | http://git.oschina.net/free/Mybatis_PageHelper |
| Swagger-UI | API文档生成工具 | https://github.com/swagger-api/swagger-ui |
| Hibernator-Validator | 验证框架 | http://hibernate.org/validator |
#### 前端技术
| 技术 | 说明 | 官网 |
| ---------- | --------------------- | -------------------------------------- |
| Vue | 前端框架 | https://vuejs.org/ |
| Vue-router | 路由框架 | https://router.vuejs.org/ |
| Vuex | 全局状态管理框架 | https://vuex.vuejs.org/ |
| Element | 前端UI框架 | https://element.eleme.io |
| Axios | 前端HTTP框架 | https://github.com/axios/axios |
| v-charts | 基于Echarts的图表框架 | https://v-charts.js.org/ |
| Js-cookie | cookie管理工具 | https://github.com/js-cookie/js-cookie |
| nprogress | 进度条控件 | https://github.com/rstacruz/nprogress |
#### 移动端技术
| 技术 | 说明 | 官网 |
| ------------ | ---------------- | --------------------------------------- |
| Vue | 核心前端框架 | https://vuejs.org |
| Vuex | 全局状态管理框架 | https://vuex.vuejs.org |
| uni-app | 移动端前端框架 | https://uniapp.dcloud.io |
| mix-mall | 电商项目模板 | https://ext.dcloud.net.cn/plugin?id=200 |
| luch-request | HTTP请求框架 | https://github.com/lei-mu/luch-request |
#### 架构图
##### 系统架构图
![系统架构图](./document/resource/re_mall_system_arch.jpg)
##### 业务架构图
![业务架构图](./document/resource/re_mall_business_arch.jpg)
#### 模块介绍
##### 后台管理系统 `mall-admin`
- 商品管理:[功能结构图-商品.jpg](document/resource/mind_product.jpg)
- 订单管理:[功能结构图-订单.jpg](document/resource/mind_order.jpg)
- 促销管理:[功能结构图-促销.jpg](document/resource/mind_sale.jpg)
- 内容管理:[功能结构图-内容.jpg](document/resource/mind_content.jpg)
- 用户管理:[功能结构图-用户.jpg](document/resource/mind_member.jpg)
##### 前台商城系统 `mall-portal`
[功能结构图-前台.jpg](document/resource/mind_portal.jpg)
#### 开发进度
![项目开发进度图](./document/resource/re_mall_dev_flow.jpg)
## 环境搭建
### 开发工具
| 工具 | 说明 | 官网 |
| ------------- | ------------------- | ----------------------------------------------- |
| IDEA | 开发IDE | https://www.jetbrains.com/idea/download |
| RedisDesktop | redis客户端连接工具 | https://github.com/qishibo/AnotherRedisDesktopManager |
| Robomongo | mongo客户端连接工具 | https://robomongo.org/download |
| SwitchHosts | 本地host管理 | https://oldj.github.io/SwitchHosts/ |
| X-shell | Linux远程连接工具 | http://www.netsarang.com/download/software.html |
| Navicat | 数据库连接工具 | http://www.formysql.com/xiazai.html |
| PowerDesigner | 数据库设计工具 | http://powerdesigner.de/ |
| Axure | 原型设计工具 | https://www.axure.com/ |
| MindMaster | 思维导图设计工具 | http://www.edrawsoft.cn/mindmaster |
| ScreenToGif | gif录制工具 | https://www.screentogif.com/ |
| ProcessOn | 流程图绘制工具 | https://www.processon.com/ |
| PicPick | 图片处理工具 | https://picpick.app/zh/ |
| Snipaste | 屏幕截图工具 | https://www.snipaste.com/ |
| Postman | API接口调试工具 | https://www.postman.com/ |
| Typora | Markdown编辑器 | https://typora.io/ |
### 开发环境
| 工具 | 版本号 | 下载 |
| ------------- | ------ | ------------------------------------------------------------ |
| JDK | 1.8 | https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html |
| MySQL | 5.7 | https://www.mysql.com/ |
| Redis | 7.0 | https://redis.io/download |
| MongoDB | 5.0 | https://www.mongodb.com/download-center |
| RabbitMQ | 3.10.5 | http://www.rabbitmq.com/download.html |
| Nginx | 1.22 | http://nginx.org/en/download.html |
| Elasticsearch | 7.17.3 | https://www.elastic.co/downloads/elasticsearch |
| Logstash | 7.17.3 | https://www.elastic.co/cn/downloads/logstash |
| Kibana | 7.17.3 | https://www.elastic.co/cn/downloads/kibana |
### 搭建步骤
> Windows环境部署
- Windows环境搭建请参考[mall项目后端开发环境搭建](https://www.macrozheng.com/mall/start/mall_deploy_windows.html);
- 注意:如果只启动`mall-admin`模块仅需安装MySQL、Redis即可;
- 克隆`mall-admin-web`项目并导入到IDEA中完成编译[前端项目地址](https://github.com/macrozheng/mall-admin-web);
- `mall-admin-web`项目的安装及部署请参考:[mall项目前端发环境搭建](https://www.macrozheng.com/mall/start/mall_deploy_web.html) 。
> Docker环境部署
- 使用虚拟机安装CentOS7.6请参考:[虚拟机安装及使用Linux看这一篇就够了](https://www.macrozheng.com/mall/deploy/linux_install.html);
- 本项目Docker镜像构建请参考[使用Maven插件为SpringBoot应用构建Docker镜像](https://www.macrozheng.com/project/maven_docker_fabric8.html);
- 本项目在Docker容器下的部署请参考[mall在Linux环境下的部署基于Docker容器](https://www.macrozheng.com/mall/deploy/mall_deploy_docker.html);
- 本项目使用Docker Compose请参考 [mall在Linux环境下的部署基于Docker Compose](https://www.macrozheng.com/mall/deploy/mall_deploy_docker_compose.html);
- 本项目在Linux下的自动化部署请参考[mall在Linux环境下的自动化部署基于Jenkins](https://www.macrozheng.com/mall/deploy/mall_deploy_jenkins.html);
## 公众号
加微信群交流,关注公众号「**macrozheng**」,回复「**加群**」即可。
![公众号图片](./document/resource/qrcode_for_macrozheng_258.jpg)
## 许可证
[Apache License 2.0](https://github.com/macrozheng/mall/blob/master/LICENSE)
Copyright (c) 2018-2024 macrozheng

@ -0,0 +1,61 @@
## app-design
### 原型尺寸
名称 | 尺寸
----|----
android|360x640
ios|375x667
### 尺寸
#### 字体大小
名称 | 尺寸
----|----
标题栏标题|17
标题栏编辑|15
标题字体1|17
标题字体2|15
正文字体|13
#### 中继器尺寸
名称 | 尺寸
----|----
单列宽度|375
双列宽度|150
双列左右填充|30
双列水平垂直边距|15
#### 图标尺寸
名称 | 尺寸
----|----
图标|24x24
#### 通用尺寸
名称 | 尺寸
----|----
标题栏高度|44
单行列表高度|44或48
矩形内部填充间距|20
分隔条宽度|15
分隔条宽度2|20
### 颜色
名称 | 尺寸
----|----
app主色|#2AB795
屏幕背景色|#EEEEEE
弹框背景色|#04040F(40%)
醒目色1|#FB0017
醒目色2|#FD994B
文字颜色1|#333333
文字颜色2|#666666
文字颜色3|#999999
边框及分隔线颜色|#CCCCCC
图标颜色|#666666或主色
半透明色|纯黑色调整透明度

@ -0,0 +1,42 @@
version: '3'
services:
mall-admin:
image: mall/mall-admin:1.0-SNAPSHOT
container_name: mall-admin
ports:
- 8080:8080
volumes:
- /mydata/app/mall-admin/logs:/var/logs
- /etc/localtime:/etc/localtime
environment:
- 'TZ="Asia/Shanghai"'
external_links:
- mysql:db #可以用db这个域名访问mysql服务
mall-search:
image: mall/mall-search:1.0-SNAPSHOT
container_name: mall-search
ports:
- 8081:8081
volumes:
- /mydata/app/mall-search/logs:/var/logs
- /etc/localtime:/etc/localtime
environment:
- 'TZ="Asia/Shanghai"'
external_links:
- elasticsearch:es #可以用es这个域名访问elasticsearch服务
- mysql:db #可以用db这个域名访问mysql服务
mall-portal:
image: mall/mall-portal:1.0-SNAPSHOT
container_name: mall-portal
ports:
- 8085:8085
volumes:
- /mydata/app/mall-portal/logs:/var/logs
- /etc/localtime:/etc/localtime
environment:
- 'TZ="Asia/Shanghai"'
external_links:
- redis:redis #可以用redis这个域名访问redis服务
- mongo:mongo #可以用mongo这个域名访问mongo服务
- mysql:db #可以用db这个域名访问mysql服务
- rabbitmq:rabbit #可以用rabbit这个域名访问rabbitmq服务

@ -0,0 +1,99 @@
version: '3'
services:
mysql:
image: mysql:5.7
container_name: mysql
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
restart: always
environment:
MYSQL_ROOT_PASSWORD: root #设置root帐号密码
ports:
- 3306:3306
volumes:
- /mydata/mysql/data:/var/lib/mysql #数据文件目录挂载
- /mydata/mysql/conf:/etc/mysql #配置文件目录挂载
- /mydata/mysql/log:/var/log/mysql #日志文件目录挂载
redis:
image: redis:7
container_name: redis
command: redis-server --appendonly yes
volumes:
- /mydata/redis/data:/data #数据文件目录挂载
ports:
- 6379:6379
nginx:
image: nginx:1.22
container_name: nginx
volumes:
- /mydata/nginx/conf:/etc/nginx #配置文件目录挂载
- /mydata/nginx/html:/usr/share/nginx/html #静态资源根目录挂载
- /mydata/nginx/logs:/var/log/nginx #日志文件目录挂载
ports:
- 80:80
rabbitmq:
image: rabbitmq:3.9.11-management
container_name: rabbitmq
volumes:
- /mydata/rabbitmq/data:/var/lib/rabbitmq #数据文件目录挂载
ports:
- 5672:5672
- 15672:15672
elasticsearch:
image: elasticsearch:7.17.3
container_name: elasticsearch
environment:
- "cluster.name=elasticsearch" #设置集群名称为elasticsearch
- "discovery.type=single-node" #以单一节点模式启动
- "ES_JAVA_OPTS=-Xms512m -Xmx1024m" #设置es使用的jvm内存大小
volumes:
- /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins #插件文件目录挂载
- /mydata/elasticsearch/data:/usr/share/elasticsearch/data #数据文件目录挂载
ports:
- 9200:9200
- 9300:9300
logstash:
image: logstash:7.17.3
container_name: logstash
environment:
- TZ=Asia/Shanghai
volumes:
- /mydata/logstash/logstash.conf:/usr/share/logstash/pipeline/logstash.conf #配置文件挂载
depends_on:
- elasticsearch #kibana在elasticsearch启动之后再启动
links:
- elasticsearch:es #可以用es这个域名访问elasticsearch服务
ports:
- 4560:4560
- 4561:4561
- 4562:4562
- 4563:4563
kibana:
image: kibana:7.17.3
container_name: kibana
links:
- elasticsearch:es #可以用es这个域名访问elasticsearch服务
depends_on:
- elasticsearch #kibana在elasticsearch启动之后再启动
environment:
- "elasticsearch.hosts=http://es:9200" #设置访问elasticsearch的地址
ports:
- 5601:5601
mongo:
image: mongo:4
container_name: mongo
volumes:
- /mydata/mongo/db:/data/db #数据文件目录挂载
ports:
- 27017:27017
minio:
image: minio/minio
container_name: minio
command: server /data --console-address ":9001" #指定数据目录及console运行端口启动
volumes:
- /mydata/minio/data:/data #数据目录挂载
environment:
- "MINIO_ROOT_USER=minioadmin"
- "MINIO_ROOT_PASSWORD=minioadmin"
ports:
- 9090:9000
- 9001:9001

@ -0,0 +1,45 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}

@ -0,0 +1,49 @@
input {
tcp {
mode => "server"
host => "0.0.0.0"
port => 4560
codec => json_lines
type => "debug"
}
tcp {
mode => "server"
host => "0.0.0.0"
port => 4561
codec => json_lines
type => "error"
}
tcp {
mode => "server"
host => "0.0.0.0"
port => 4562
codec => json_lines
type => "business"
}
tcp {
mode => "server"
host => "0.0.0.0"
port => 4563
codec => json_lines
type => "record"
}
}
filter{
if [type] == "record" {
mutate {
remove_field => "port"
remove_field => "host"
remove_field => "@version"
}
json {
source => "message"
remove_field => ["message"]
}
}
}
output {
elasticsearch {
hosts => "localhost:9200"
index => "mall-%{type}-%{+YYYY.MM.dd}"
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
{"diagram":{"elements":{"leftChildren":[{"parent":"root","children":[{"parent":"9f28d62a5672","task":{"completion":"10"},"children":[],"id":"c68327c7119f","title":"首页门户","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"117"}]},{"parent":"9f28d62a5672","task":{"completion":"35"},"children":[],"id":"03d7217100d9","title":"商品推荐","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"117"}]},{"parent":"9f28d62a5672","task":{"completion":"50"},"children":[],"id":"f1fe1fc552ab","title":"商品搜索","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"117"}]},{"parent":"9f28d62a5672","task":{"completion":"50"},"children":[],"id":"f6df7fb9d389","title":"商品展示","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"117"}]},{"parent":"9f28d62a5672","task":{"completion":"50"},"children":[],"id":"ef9a76e89256","title":"购物车","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"117"}]},{"parent":"9f28d62a5672","task":{"completion":"50"},"children":[],"id":"b172bea6db59","title":"订单流程","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"117"}]},{"parent":"9f28d62a5672","task":{"completion":"10"},"children":[],"id":"5099daff583b","title":"会员中心","icons":[{"color":"rgb(68, 68, 68)","name":"completion","index":"114"}]},{"parent":"9f28d62a5672","task":{"completion":"10"},"children":[],"id":"d8485d715f62","title":"客户服务","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"110"}]},{"parent":"9f28d62a5672","task":{"completion":"10"},"children":[],"id":"1766943525e6","title":"帮助中心","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"110"}]}],"id":"9f28d62a5672","title":"前台"}],"children":[{"parent":"root","children":[{"parent":"90e923d09398","task":{"completion":"100"},"children":[],"id":"dff7f75a0ed4","title":"商品管理","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"117"}]},{"parent":"90e923d09398","task":{"completion":"100"},"children":[],"id":"6e33db4f10c9","title":"订单管理","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"117"}]},{"parent":"90e923d09398","task":{"completion":"100"},"children":[],"id":"6e37938e8956","title":"促销管理","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"117"}]},{"parent":"90e923d09398","task":{"completion":"100"},"children":[],"id":"efe9e584bd7f","title":"运营管理","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"117"}]},{"parent":"90e923d09398","task":{"completion":"50"},"children":[],"id":"1c2047f6a380","title":"权限管理","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"117"}]},{"parent":"90e923d09398","task":{"completion":"10"},"children":[],"id":"27cc62ad6c28","title":"会员管理","icons":[{"color":"rgb(113, 203, 45)","name":"completion","index":"110"}]},{"parent":"90e923d09398","task":{"completion":"10"},"children":[],"id":"30b686fb8384","title":"内容管理","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"110"}]},{"parent":"90e923d09398","task":{"completion":"10"},"children":[],"id":"885c0538496d","title":"统计报表","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"110"}]},{"parent":"90e923d09398","task":{"completion":"10"},"children":[],"id":"e20400573fac","title":"财务管理","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"110"}]},{"parent":"90e923d09398","task":{"completion":"10"},"children":[],"id":"75c14d3c2f50","title":"设置","icons":[{"color":"rgb(0, 166, 80)","name":"completion","index":"110"}]}],"id":"90e923d09398","title":"后台"}],"root":true,"theme":"theme3","showWatermark":false,"id":"root","isBackground":true,"title":"mall","version":141,"structure":"mind_free"}},"meta":{"exportTime":"2023-07-10 10:30:52","member":"","diagramInfo":{"creator":"","created":"2018-11-27 10:37:22","modified":"2023-05-20 15:19:14","title":"项目开发进度图","category":"mind_free"},"id":"5bfcade2e4b0ef094cbe3658","type":"ProcessOn Schema File","version":"1.0"}}

@ -0,0 +1,188 @@
{
"variables": [],
"info": {
"name": "mall-admin",
"_postman_id": "f4a4382c-ee6c-975f-99ac-7645532458ba",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "添加优惠券",
"request": {
"url": "{{admin.mall}}/coupon/add",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"amount\": 50,\r\n \"count\": 100,\r\n \"enableTime\": \"2018-08-27T08:40:46.973Z\",\r\n \"endTime\": \"2018-08-31T08:40:46.973Z\",\r\n \"minPoint\": 500,\r\n \"name\": \"T恤分类专用优惠券\",\r\n \"note\": \"满500减50\",\r\n \"perLimit\": 1,\r\n \"platform\": 0,\r\n \"publishCount\": 100,\r\n \"receiveCount\": 0,\r\n \"startTime\": \"2018-08-27T08:40:46.973Z\",\r\n \"type\": 0,\r\n \"useCount\": 0,\r\n \"useType\": 1,\r\n \"productCategoryRelationList\": [\r\n {\r\n \"productCategoryId\": 8\r\n }\r\n ]\r\n}"
},
"description": ""
},
"response": []
},
{
"name": "删除指定优惠券",
"request": {
"url": "{{admin.mall}}/coupon/delete/6",
"method": "POST",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "修改指定优惠券",
"request": {
"url": "{{admin.mall}}/coupon/update/6",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"amount\": 300,\r\n \"count\": 100,\r\n \"enableTime\": \"2018-08-27T08:40:46.973Z\",\r\n \"endTime\": \"2018-08-31T08:40:46.973Z\",\r\n \"minPoint\": 2000,\r\n \"name\": \"满2000减200\",\r\n \"note\": \"手机分类专用优惠券\",\r\n \"perLimit\": 1,\r\n \"platform\": 0,\r\n \"publishCount\": 100,\r\n \"receiveCount\": 0,\r\n \"startTime\": \"2018-08-27T08:40:46.973Z\",\r\n \"type\": 0,\r\n \"useCount\": 0,\r\n \"useType\": 1,\r\n \"productCategoryRelationList\": [\r\n {\r\n \"productCategoryId\": 18\r\n }\r\n ]\r\n}"
},
"description": ""
},
"response": []
},
{
"name": "登录",
"request": {
"url": "{{admin.mall}}/admin/login",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"password\": \"123456\",\r\n \"username\": \"admin\"\r\n}"
},
"description": ""
},
"response": []
},
{
"name": "查看商品列表",
"request": {
"url": "{{admin.mall}}/product/list",
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImNyZWF0ZWQiOjE1Mzg5OTExNzkwODAsImV4cCI6MTUzOTU5NTk3OX0.u_fUHf09ONw6CCQW0ERufOgfuGUY1g7hu-o9thMl6wsFlBlkn1QmOZJwlU1ejsc65-N3p3k1pb11vTeqrVnYIw",
"description": ""
}
],
"body": {},
"description": ""
},
"response": []
},
{
"name": "批量修改商品的删除状态",
"request": {
"url": "{{admin.mall}}/product/update/deleteStatus",
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImNyZWF0ZWQiOjE1Mzg5OTExNzkwODAsImV4cCI6MTUzOTU5NTk3OX0.u_fUHf09ONw6CCQW0ERufOgfuGUY1g7hu-o9thMl6wsFlBlkn1QmOZJwlU1ejsc65-N3p3k1pb11vTeqrVnYIw",
"description": ""
},
{
"key": "Content-Type",
"value": "application/x-www-form-urlencoded",
"description": ""
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "ids",
"value": "1,2",
"description": "",
"type": "text"
},
{
"key": "deleteStatus",
"value": "1",
"description": "",
"type": "text"
}
]
},
"description": ""
},
"response": []
},
{
"name": "查询所有一级分类及子分类",
"request": {
"url": "{{admin.mall}}/productCategory/list/withChildren",
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImNyZWF0ZWQiOjE1Mzg5OTExNzkwODAsImV4cCI6MTUzOTU5NTk3OX0.u_fUHf09ONw6CCQW0ERufOgfuGUY1g7hu-o9thMl6wsFlBlkn1QmOZJwlU1ejsc65-N3p3k1pb11vTeqrVnYIw",
"description": ""
}
],
"body": {},
"description": ""
},
"response": []
},
{
"name": "获取全部品牌列表",
"request": {
"url": "{{admin.mall}}/brand/listAll",
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImNyZWF0ZWQiOjE1Mzg5OTExNzkwODAsImV4cCI6MTUzOTU5NTk3OX0.u_fUHf09ONw6CCQW0ERufOgfuGUY1g7hu-o9thMl6wsFlBlkn1QmOZJwlU1ejsc65-N3p3k1pb11vTeqrVnYIw",
"description": ""
}
],
"body": {},
"description": ""
},
"response": []
},
{
"name": "刷新token",
"request": {
"url": "{{admin.mall}}/admin/token/refresh",
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImNyZWF0ZWQiOjE1NTIzNTYzNzg0NjUsImV4cCI6MTU1Mjk2MTE3OH0.cxT6ULWfA17_QOh5nAcdU8FVldrSxLC2yi3y4fiHetCCrNzBBF9k6iRN-gfFmYa1_Ptav4WjgUAspZDBQa7SsA",
"description": ""
}
],
"body": {},
"description": ""
},
"response": []
}
]
}

@ -0,0 +1,328 @@
{
"variables": [],
"info": {
"name": "mall-portal",
"_postman_id": "bb2ab4ed-fa53-9c01-9fe1-ef1568038701",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "会员登录",
"request": {
"url": "{{portal.mall}}/sso/login",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/x-www-form-urlencoded",
"description": ""
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "username",
"value": "test",
"description": "",
"type": "text"
},
{
"key": "password",
"value": "123",
"description": "",
"type": "text"
}
]
},
"description": ""
},
"response": []
},
{
"name": "获取购物车列表",
"request": {
"url": "{{portal.mall}}/cart/list",
"method": "GET",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "清空购物车",
"request": {
"url": "{{portal.mall}}/cart/clear",
"method": "POST",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "加入购物车",
"request": {
"url": "{{portal.mall}}/cart/add",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"price\": 5499,\r\n \"productId\": 29,\r\n \"productName\": \"Apple iPhone 8 Plus\",\r\n \"productSkuCode\": \"201808270029001\",\r\n \"productSkuId\": 106,\r\n \"productSubTitle\": \"【限时限量抢购】Apple产品年中狂欢节好物尽享美在智慧速来 >> 勾选[保障服务][原厂保2年]获得AppleCare+全方位服务计划,原厂延保售后无忧。\",\r\n \"quantity\": 1,\r\n \"sp1\": \"金色\",\r\n \"sp2\": \"32G\",\r\n \"sp3\": null\r\n}"
},
"description": ""
},
"response": []
},
{
"name": "获取购物车列表(包括促销信息)",
"request": {
"url": "{{portal.mall}}/cart/list/promotion",
"method": "GET",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "修改购物车中商品数量",
"request": {
"url": {
"raw": "{{portal.mall}}/cart/update/quantity?id=15&quantity=1",
"host": [
"{{portal.mall}}"
],
"path": [
"cart",
"update",
"quantity"
],
"query": [
{
"key": "id",
"value": "15",
"equals": true,
"description": ""
},
{
"key": "quantity",
"value": "1",
"equals": true,
"description": ""
}
],
"variable": []
},
"method": "GET",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "添加收货地址",
"request": {
"url": "{{portal.mall}}/member/address/add",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"defaultStatus\": 1,\r\n \"name\": \"大梨\",\r\n \"phoneNumber\": \"18033441849\",\r\n \"postCode\": \"518000\",\r\n \"city\": \"深圳市\",\r\n \"detailAddress\": \"东晓街道\",\r\n \"province\": \"广东省\",\r\n \"region\": \"福田区\"\r\n}"
},
"description": ""
},
"response": []
},
{
"name": "删除收货地址",
"request": {
"url": "{{portal.mall}}/member/address/delete/2",
"method": "POST",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "查询指定收货地址",
"request": {
"url": "{{portal.mall}}/member/address/3",
"method": "GET",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "修改收货地址",
"request": {
"url": "{{portal.mall}}/member/address/update/3",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": 3,\n \"memberId\": 1,\n \"name\": \"大梨\",\n \"phoneNumber\": \"18033441849\",\n \"defaultStatus\": 0,\n \"postCode\": \"518000\",\n \"province\": \"广东省\",\n \"city\": \"深圳市\",\n \"region\": \"福田区\",\n \"detailAddress\": \"清水河街道\"\n }"
},
"description": ""
},
"response": []
},
{
"name": "领取优惠券",
"request": {
"url": "{{portal.mall}}/member/coupon/add/7",
"method": "POST",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "获取会员优惠券列表",
"request": {
"url": "{{portal.mall}}/member/coupon/list",
"method": "GET",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "获取购物车可用优惠券",
"request": {
"url": "{{portal.mall}}/member/coupon/list/cart/1",
"method": "GET",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "根据购物车信息生成确认单",
"request": {
"url": "{{portal.mall}}/order/confirmOrder",
"method": "POST",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "下单",
"request": {
"url": "{{portal.mall}}/order/generateOrder",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"couponId\": 2,\r\n \"memberReceiveAddressId\": 4,\r\n \"payType\": 0\r\n}"
},
"description": ""
},
"response": []
},
{
"name": "订单支付成功回调",
"request": {
"url": {
"raw": "{{portal.mall}}/order/paySuccess?orderId=12",
"host": [
"{{portal.mall}}"
],
"path": [
"order",
"paySuccess"
],
"query": [
{
"key": "orderId",
"value": "12",
"equals": true,
"description": ""
}
],
"variable": []
},
"method": "POST",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "取消超时订单",
"request": {
"url": "{{portal.mall}}/order/cancelTimeOutOrder",
"method": "POST",
"header": [],
"body": {},
"description": ""
},
"response": []
},
{
"name": "取消单个超时订单",
"request": {
"url": {
"raw": "{{portal.mall}}/order/cancelOrder?orderId=13",
"host": [
"{{portal.mall}}"
],
"path": [
"order",
"cancelOrder"
],
"query": [
{
"key": "orderId",
"value": "13",
"equals": true,
"description": ""
}
],
"variable": []
},
"method": "POST",
"header": [],
"body": {},
"description": ""
},
"response": []
}
]
}

@ -0,0 +1,105 @@
# windows下环境搭建
## IDEA
- 关于IDEA的安装与使用具体参考[https://github.com/judasn/IntelliJ-IDEA-Tutorial](https://github.com/judasn/IntelliJ-IDEA-Tutorial)
- 搜索插件仓库安装插件lombok
## Eclipse
- 导入项目以maven项目形式导入
![eclipse_import_1.png](https://github.com/macrozheng/mall/blob/master/document/resource/eclipse_import_1.png)
![eclipse_import_2.png](https://github.com/macrozheng/mall/blob/master/document/resource/eclipse_import_2.png)
- 安装lombok插件下载地址https://projectlombok.org/downloads/lombok.jar
- 下载完后双击使用java程序打开
- 按照提示选择eclipse.exe的安装路径安装插件完成后重启Eclipse
- 启动项目右击com.macro.mall.MallAdminApplication的main方法选择run as Java Application
## mysql
- 下载地址https://dev.mysql.com/downloads/mysql/5.7.html#downloads
- 下载后按提示进行安装
- 导入document/sql下的mall.sql文件
## redis
- 下载地址https://github.com/MicrosoftArchive/redis/releases
- 下载后按提示进行安装
- 启动redis:redis-server.exe redis.windows.conf
## elasticsearch
- 下载地址https://www.elastic.co/downloads/past-releases/elasticsearch-6-2-2
- 下载.zip文件解压到指定目录
- 安装kibana用于在浏览器中访问es,请下载6.2.2版本具体参考https://www.elastic.co/downloads/kibana
- 下载.zip包后解压即可运行bin\kibana.bat访问http://localhost:5601 查看是否安装成功
- 中文分词插件地址https://github.com/medcl/elasticsearch-analysis-ik
- 安装中文分词插件在elasticsearch-6.2.2\bin目录下执行以下命令
elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.2.2/elasticsearch-analysis-ik-6.2.2.zip
- 启动elasticsearch:运行elasticsearch-6.2.2\bin\elasticsearch.bat
- 不使用kibana的可以安装head插件具体参考https://github.com/mobz/elasticsearch-head
- 注意如果你修改了mall-search中的es的cluster-name: mall-es你需要在elasticsearch-6.2.2\config\elasticsearch.yml文件中修改cluster.name: mall-es
## mongodb
- 下载地址https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.2.21-signed.msi
- 选择路径c:\mongodb\进行安装在安装路径下创建data\db和data\log两个文件夹
- 服务端运行程序mongodb\bin\mongod.exe
- 客户端运行程序mongodb\bin\mongo.exe
- 创建配置文件mongodb\mongod.cfg
``` lua
systemLog:
destination: file
path: c:\mongodb\data\log\mongod.log
storage:
dbPath: c:\mongodb\data\db
```
- 安装为服务运行命令需要用管理员权限C:\mongodb\bin\mongod.exe --config "C:\mongodb\mongod.cfg" --install
- 启动服务net start MongoDB
- 关闭服务net stop MongoDB
- 移除服务C:\mongodb\bin\mongod.exe --remove
- 下载客户端程序https://download.robomongo.org/1.2.1/windows/robo3t-1.2.1-windows-x86_64-3e50a65.zip
- 解压到指定目录打开robo3t.exe并连接到localhost:27017
## rabbitmq
- 安装Erlanghttp://erlang.org/download/otp_win64_21.3.exe
- 下载rabbitmqhttps://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.14/rabbitmq-server-3.7.14.exe
- 按照提示进行安装安装完成后进入rabbitmq的安装目录:D:\RabbitMQ Server\rabbitmq_server-3.7.14\sbin
- 在地址栏输入cmd并回车启动命令行输入以下命令rabbitmq-plugins enable rabbitmq_management
- 访问地址查看是否安装成功http://127.0.0.1:15672/
- 输入账号密码登录guest guest
- 创建用户并设置其角色为管理员mall mall
![rabbitmq_install_2.png](https://github.com/macrozheng/mall/blob/master/document/resource/rabbitmq_install_2.png)
- 创建virtual host:/mall
![rabbitmq_install_3.png](https://github.com/macrozheng/mall/blob/master/document/resource/rabbitmq_install_3.png)
- 给mall用户配置范围该virtual host的权限
![rabbitmq_install_4.png](https://github.com/macrozheng/mall/blob/master/document/resource/rabbitmq_install_4.png)
- rabbitmq安装延迟消息插件可不装
- 下载延迟消息插件rabbitmq_delayed_message_exchangehttps://www.rabbitmq.com/community-plugins.html
- 复制插件到插件目录D:\RabbitMQ Server\rabbitmq_server-3.7.14\plugins
- 在sbin目录下运行如下命令启用插件rabbitmq-plugins enable rabbitmq_delayed_message_exchange
## OSS
- 该项目文件上传采用OSS需要自行注册OSS账号并配置
- 首先将mall-admin\src\main\resources\application.properties文件中以aliyun.oss.开头的配置改为你自己的配置
- OSS上传文件需要配置跨域资源共享(CORS)规则参考文档https://help.aliyun.com/document_detail/31928.html
- 上传方式采用服务端签名后直传的形式参考文档https://help.aliyun.com/document_detail/31926.html
## mall-admin
- 启动项目直接运行com.macro.mall.MallAdminApplication的main方法即可
- 接口文档地址http://localhost:8080/swagger-ui.html
## mall-search
- 启动项目直接运行com.macro.mall.search.MallSearchApplication的main方法即可
- 接口文档地址http://localhost:8081/swagger-ui.html
- 使用前需要先调用接口导入数据http://localhost:8081/esProduct/importAll
- 如出现无法启动的问题可以先删除elasticsearch里面的数据再启动
## mall-portal
- 启动mall-portal项目直接运行com.macro.mall.portal.MallPortalApplication的main方法即可
- 接口文档地址http://localhost:8085/swagger-ui.html

@ -0,0 +1,329 @@
# mall 功能完成进度
## 框架搭建
功能 | 完成
----|----
集成MyBatis | ✔
集成MyBatisGenerator | ✔
集成SpringSecurity | ✔
集成Swagger-UI | ✔
集成Hibernator-Validator | ✔
集成日志功能 | ✔
集成监控功能 | ✔
crud操作demo | ✔
合理规划包结构 | ✔
SpringAOP通用日志处理 | ✔
SpringAOP通用验证失败结果返回 | ✔
CommonResult对通用返回结果进行封装 | ✔
SpringSecurity登录改为Restful形式 | ✔
JWT登录、注册、获取token | ✔
JTA事务处理 | ✔
集成单元测试 | ✔
OSS上传功能 | ✔
Elasticsearch搜索功能 | ✔
HTTPS支持 | ✔
Redis数字型ID生成 | ✔
SpringTask定时任务支持 | ✔
docker容器化部署 | ✔
配置区分生产和测试环境 | ✔
ELK日志收集功能 | ✔
RabbitMq异步通信 | ✔
RestTemplate服务间调用 | ✔
SpringSecurity权限管理功能 | ✔
集成SpringCloud |
## 后台功能
### 后台登录功能
- 后台用户注册功能
- 后台用户登录后获取token
- 刷新token功能
### 商品管理
> **商品分类管理**
- 按父分类编号分页查看分类列表
- 添加、编辑、删除分类
- 转移分类商品
> **商品品牌管理**
- 按品牌名称搜索分页查看品牌列表
- 添加、编辑、删除品牌
- 查看当前品牌的所有产品
> **商品属性分类管理**
- 添加商品属性分类(名称)
- 分页查询全部商品属性分类
- 删除单个商品属性分类
- 修改单个属性分类名称
- 查询单个属性分类信息
> **商品属性管理**
- 根据分类查询属性列表或参数列表(分页,支持类型)
- 添加商品属性
- 查询单个商品属性
- 编辑商品属性
- 批量删除商品属性
- 分页查询全部商品属性
> **添加商品**
- 选择商品分类根据商品分类id查找分类
- 选择品牌:查询全部品牌
- 选择运费模版:查询全部运费模版
- 设置会员价格查询所有会员等级传入List<PmsMemberPrice>
- 添加阶梯价格: 参数传入List<PmsProductLadder>
- 设置满减价格: 参数传入List<PmsProductFullReduction>
- 选择商品属性类别:获取所有商品属性分类根据商品属性分类的id获取规格和参数(type=0->规格type=1->参数)
- 选择规格并生成库存信息:前端实现
- 添加sku库存信息参数传入List<PmsSkuStock>
- 设置属性图片设置到pic和album_pics字段中去
- 添加商品参数参数传入List<PmsProductAttributeValue>
- 添加自定义商品规格参数传入List<PmsProductAttributeValue>
- 关联专题:参数传入List<CmsSubjectProductRelation>关系
- 关联优选:参数传入List<CmsPrefrenceAreaProductRelation>关系
> **修改商品**
- 根据商品id查询商品信息
- 查询商品基本信息:商品分类名称、品牌名称、运费模版名称
- 查询商品促销信息:商品的会员价格、阶梯价格、满减价格
- 查询商品属性信息商品属性类别名称、sku库存信息、属性分类对应规格和参数值
- 查询商品关联信息:商品关联专题和关联优选
- 修改商品信息商品属性分类及规格不可修改只支持单个sku的修改、删除、新增商品属性分类及规格可以修改修改后同时显示原sku库存及属性分类
> **商品分页查询**
- 商品的状态:全部商品、已上架、未上架、待审核、未通过 (publishStatus verifyStatus)
- 商品名称(%name%)
- 商品货号(productSn)
- 商品分类id(productCategoryId)
- 商品品牌id(brandId)
- 批量操作:上下架、推荐、新品、转移分类、放入回收站、审核
- 查看记录:审核记录,操作日志
- sku:根据产品及sku编号获取sku信息批量修改sku信息
> **商品回收管理**
- 分页展示回收商品列表
- 回收商品还原功能
#### 促销管理
> **秒杀活动管理**
- 活动列表展示
- 活动上下线
- 设置活动商品
- 添加、编辑、删除活动
> **优惠券管理**
- 优惠券列表展示
- 添加、编辑、删除优惠券
- 查看优惠券领取记录
> **活动管理**
- 活动列表展示
- 添加、编辑、删除活动
- 活动上下线
- 发布到广告
> **首页推荐**
- 品牌推荐:列表展示、是否推荐、排序、删除、多选加入品牌
- 新鲜好物:商品列表展示、是否推荐、排序、删除、多选加入商品
- 人气推荐:商品列表展示、是否推荐、排序、删除、多选加入商品
- 专题精选:专题列表展示、是否推荐、排序、删除、多选加入专题
- 广告管理:广告列表展示、是否上线、排序、删除、添加编辑广告
### 内容管理
> **专题管理**
- 专题列表:查看、删除、推荐专题
- 添加、编辑专题:选择专题分类、添加、删除关联商品
- 专题分类管理:控制显示、排序、编辑删除分类
> **优选主题**
- 优选列表:控制显示、排序、删除
- 添加、编辑优选:关联和删除商品
> **话题管理**
- 专题列表:查看、删除、热门话题
- 话题分类管理:控制显示、排序、编辑删除分类
> **帮助管理**
- 帮助列表:查看、删除、控制显示
- 添加、编辑帮助:选择帮助分类
- 帮助分类管理:控制显示、排序、编辑删除分类
### 用户管理
> **用户管理**
- 用户列表:帐号启用、删除、群发短信
- 批量操作:群发短信、站内信、推送、设置标签、赠送优惠券
- 查看、编辑用户信息:用户详情(统计信息、收货地址、订单记录)、编辑资料、登录日志
- 购买力筛选:最近消费、消费次数、消费金额、订单均价、商品分类、会员等级、用户标签
- 用户标签管理:标签列表、添加、编辑、删除
- 会员等级设置:列表、添加、编辑、设置默认会员等级
> **成才值及积分**
- 成长值及积分查询:列表展示、积分明细、成长值明细、修改数值
- 任务奖励设置:新手任务、日常任务
- 更多规则设置:成长值规则、积分规则、积分消费设置
### 订单管理
> **订单列表**
- 订单搜索:订单编号、收货人姓名/号码、订单状态、订单分类、订单来源、提交时间
- 订单操作:查看订单、关闭订单、订单发货、订单跟踪、删除订单
- 批量操作:批量发货、关闭订单、删除订单
> **查看订单**
- 订单状态:提交订单、支付订单、平台发货、确认收货、完成评价
- 订单详情操作:修改发票信息、修改收货人信息、修改商品信息、修改费用信息、发送站内信、关闭订单、备注订单、取消订单、订单跟踪、删除订单
- 订单基本信息:订单信息、优惠信息、用户信息
- 发票信息:类型、抬头、内容、收票人信息
- 收货人信息:收货人、手机号、邮政编码、收货地址
- 商品信息:包含商品基本信息
- 费用信息:合计及优惠信息
- 操作信息:订单状态改变记录
> **订单设置**
- 秒杀订单超时时间
- 正常订单超时时间
- 订单自动完成时间
- 自动结束交易时间
- 自动好评时间
> **退货申请处理**
- 退货申请搜索:服务单号、收货人姓名/号码、处理状态、申请时间、操作人员、处理时间
- 批量操作:删除
- 查看详情:退货商品、服务单信息、确认退货、拒绝退货、确认收货
> **退货原因设置**
- 原因列表:类型、排序、是否启用、添加时间
- 添加、编辑原因:同上
- 批量操作:删除
### 权限管理
> **权限管理**
- 权限管理:添加权限、删除权限、修改权限、以树形结构返回权限
- 角色管理:添加角色、删除角色、更新角色、角色列表、获取相应角色权限、修改相应角色权限
- 成员管理:添加、编辑、删除成员、成员列表、为成员分配角色、获取成员角色、分配+-权限、获取权限列表
角色 | 菜单
----|----
管理员 | 所有菜单权限
运营 | 首页、用户、促销、运营、内容
财务 | 首页、统计、财务
美工 | 首页、商品
客服 | 首页、商品、订单
## 前台功能
### 商品搜索
> **综合搜索功能**
- 搜索:根据商品标题、副标题、关键字进行搜索;
- 筛选:未选择分类时聚合搜索结果,选择出现次数最多的分类,选择分类以后可以根据选择分类的筛选字段进行筛选;
- 排序:按新品、销量、价格进行排序
- 搜索返回结果商品ID、商品图片、名称、副标题、价格、商品销量、新品、商品的参数、品牌名称、分类名称
- 接口从数据库中查询相关数据并导入es,插入(修改)数据接口,删除数据接口
- 品牌分类筛选:根据搜索结果聚合返回品牌、分类及属性
> **商品推荐功能**
- 推荐某商品的相关商品、根据该商品的品牌10、分类6、名称8、关键字2、副标题2
- 根据用户一周浏览记录推荐商品,根据用户搜索记录推荐商品
> **商品热搜功能**
- 根据用户搜索记录聚合生成热搜词
> **商品搜索联想功能**
- 根据用户搜索记录聚合生成热搜词
### 购物流程
> **购物车**
- 添加商品到购物车
- 购物车商品列表(商品主图、商品名称、商品数量、商品规格)
- 修改购物车中商品数量
- 购物车中商品重选规格
- 购物车中商品删除功能
> **生成确认单**
- 生成确认单信息:收货信息、商品信息、价格信息、发票信息、支付方式
- 选择收货地址:默认收货地址
- 选择优惠券及积分抵扣:展示可用优惠券和不可以优惠券
- 计算商品价格:商品合计、运费、优惠券抵扣、积分抵扣、活动优惠
- 选择支付方式:在线支付及货到付款
- 计算应付金额:合计+运费-优惠券抵扣-积分抵扣-活动优惠
> **提交订单**
- 将确认单信息转化为订单
- 删除购物车中相关商品
- 添加订单到数据库并锁定库存
- 在线支付选择支付方式支付宝、微信、银联、ApplePay
> **支付订单**
- 支付完成后修改订单状态为已支付、扣除库存
> **取消订单(未支付情况下)**
- 订单超时后自动取消订单,解除商品库存锁定,返还优惠券,积分
#### 会员模块(我的)
> **我的关注**
- 关注品牌列表品牌logo、名称、地址、关注数量
- 取消关注功能
- 关注列表展示
> **我的收藏**
- 收藏的商品:商品主图、名称、卖点、价格、找相似
- 收藏的专题:专题主图、标题、副标题、收藏数、浏览数、评论数
- 收藏的话题:话题主图、标题、副标题、收藏数、浏览数、评论数
> **我的足迹**
- 浏览过的商品:商品主图、名称、卖点、价格、找相似
- 删除记录功能
- 浏览列表展示
> **会员登录注册**
- 登录功能https登录
- 注册功能:用户名、密码、手机号、手机验证码
- 获取验证码:后台生成验证码,验证码绑定手机号
- 忘记密码:手机号、短信验证码、新密码
- 登出功能

@ -0,0 +1,98 @@
# Docker入门手册
## Docker 镜像常用命令
### 搜索镜像
docker search java
### 下载镜像
- docker pull java:8
- docker pull macro/eureka-server:0.0.1
### 列出镜像
docker images
### 删除镜像
- docker rmi java
- docker rmi -f java
- docker rmi -f $(docker images)
## Docker 容器常用命令
### 新建并启动容器
docker run -d -p 91:80 nginx
### 列出容器
docker ps
### 停止容器
docker stop $ContainerId
### 强制停止容器
docker kill $ContainerId
### 启动已停止的容器
docker start $ContainerId
### 进入容器
- docker inspect --format "{{.State.Pid}}" $ContainerId
- nsenter --target "$pid" --mount --uts --ipc --net --pid
### 删除容器
- docker rm $ContainerId
- docker rm -f $(docker ps -a -q)
### 查看启动错误日志
docker logs $ContainerIdName(或者$ContainerId)
### 查看容器的IP地址172.17.0.*
docker inspect --format '{{ .NetworkSettings.IPAddress }}' $ContainerId
### 同步宿主机时间到容器
docker cp /etc/localtime $ContainerName:/etc/
### 在宿主机查看docker使用cpu、内存、网络、io情况
- 查看指定容器情况docker stats $ContainerName
- 查看所有容器情况docker stats -a
### 进入docker内部的bash
docker exec -it $ContainerName /bin/bash
## Docker Registry
### Docker Registry 2.0搭建
docker run -d -p 5000:5000 --restart=always --name registry2 registry:2
### 推送到私有仓库
docker push localhost:5000/macro/eureka-server:0.0.1
### 修改镜像标签
docker tag macro/eureka-server:0.0.1 localhost:5000/macro/eureka-server:0.0.1
## 使用maven构建Docker镜像
### 构建镜像
- commandmvn clean package docker:build
- tip
Linux服务器需要开启远程api:vi /usr/lib/systemd/system/docker.service
修改为ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
### 推送镜像到私有仓库
- commandmvn clean package docker:build -DpushImage
- tip
pom.xml修改<imageName>192.168.1.71:5000/macro/${project.artifactId}:${project.version}</imageName>
- tip
docker要支持http:echo '{ "insecure-registries":["39.98.190.128:5000"] }' > /etc/docker/daemon.json
### 修改Docker镜像存放位置
1. 查看Docker的存放位置docker info | grep "Docker Root Dir"(默认为/var/lib/docker
2. 关闭Docker服务systemctl stop docker
3. 移动目录到目标路径mv /var/lib/docker /root/data/docker
4. 建立软连接ln -s /root/data/docker /var/lib/docker
## Docker compose
### 安装
1. 下载地址https://github.com/docker/compose/releases
2. 安装地址:/usr/local/bin/docker-compose
3. 设置为可执行sudo chmod +x /usr/local/bin/docker-compose
4. 测试是否安装成功docker-compose --version
### 安装命令补全工具
sudo curl -L https://raw.githubusercontent.com/docker/compose/1.22.0/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
### 常用命令
- 构建、创建、启动相关容器docker-compose up
- 列出所有容器docker-compose ps
- 删除指定服务的容器docker-compose rm eureka
- 对容器进行动态扩容docker-compose scale eureka=3
- 停止相关容器docker-compose stop eureka
- 启动相关容器docker-compose start eureka
### 编排SpringCloud微服务
#### 所使用到的工程
- eureka-server
- hello-service
- feign-consumer
- api-gateway
#### 编排模式
1. 编排SpringCloud微服务见eureka-server/docker-res/docker-compose.yml
2. 简化SpringCloud微服务编排见eureka-server/docker-res/docker-compose-simple.yml
3. 编排高可用的注册中心见eureka-server/docker-res/docker-compose-eureka.yml

@ -0,0 +1,27 @@
# mall功能结构说明
## 后台管理系统
### 商品管理
![功能结构图-商品.jpg](https://github.com/macrozheng/mall/blob/master/document/resource/mind_product.jpg)
### 订单管理
![功能结构图-订单.jpg](https://github.com/macrozheng/mall/blob/master/document/resource/mind_order.jpg)
### 促销管理
![功能结构图-促销.jpg](https://github.com/macrozheng/mall/blob/master/document/resource/mind_sale.jpg)
### 内容管理
![功能结构图-内容.jpg](https://github.com/macrozheng/mall/blob/master/document/resource/mind_content.jpg)
### 用户管理
![功能结构图-用户.jpg](https://github.com/macrozheng/mall/blob/master/document/resource/mind_member.jpg)
## 前台商城系统
![功能结构图-前台.jpg](https://github.com/macrozheng/mall/blob/master/document/resource/mind_portal.jpg)

@ -0,0 +1,148 @@
# Linux常用命令
## 系统服务管理
### systemctl
- 启动服务systemctl start httpd.service
- 关闭服务systemctl stop httpd.service
- 重启服务不管是否在运行systemctl restart httpd.service
- 重新载入配置不中断服务systemctl reload httpd.service
- 查看运行状态systemctl status httpd.service
- 设置开机启动systemctl enable httpd.service
- 禁止开机启动systemctl disable httpd.service
- 查看系统安装的服务systemctl list-units --type=service
## 文件管理
### ls
列出/home目录下的子目录ls -l /home
列出当前文件夹下所有文件夹及文件大小ls -lht
### pwd
显示当前工作目录
### cd
切换目录: cd /usr/local
### date
以指定格式显示日期date '+date:%x time:%X'
### passwd
修改root密码passwd root
### su
普通用户切换到超级用户su -
### clear
清除屏幕信息
### man
查看ls命令的帮助信息man ls
### who
- 查看当前运行级别who -r
- 显示用的登录详情who -buT
### free
以MB显示内存使用状态free -m
### ps
查看系统所有进程ps -ef
查看运行的java进程 ps -ef | grep java
### top
查看系统当前活跃进程信息
### mkdir
创建目录
### more
分页查看
每10行显示一屏查看more -c -10
### cat
查看config文件cat -Ab config
### rm
- 删除文件rm a.txt
- 删除文件夹: rm -rf a/
### touch
创建一个文件touch a.txt
### cp
将目录a的文件拷贝到目录b: cp -r /home/a /home/b
### mv
移动或覆盖文件mv a.txt b.txt
## 压缩与解压
### tar
- 打包文件夹到单独的文件tar -cvf /opt/etc.tar /etc
- 压缩文件夹到压缩文件gziptar -zcvf /opt/etc.tar.gz /etc
- 压缩文件夹到压缩文件bzip2tar -jcvf /opt/etc.tar.bz2 /etc
- 查阅压缩包中内容gziptar -ztvf /opt/etc.tar.gz /etc
- 解压文件到当前目录gziptar -zxvf /opt/etc.tar.gz
## 磁盘和网络管理
### df
查看磁盘占用情况df -hT
### ifconfig
查看当前网络接口状态
### netstat
- 查看路由信息netstat -rn
- 查看所有有效TCP连接netstat -an
- 查看系统中启动的监听服务netstat -tulnp
- 查看处于连接状态的系统资源信息netstat -atunp
### wget
从网络上下载软件
## 软件的安装与管理
### rpm
- 安装软件包rpm -ivh nginx-1.12.2-2.el7.x86_64.rpm
- 模糊搜索软件包rpm -qa | grep nginx
- 精确查找软件包rpm -qa nginx
- 查询软件包的安装路径rpm -ql nginx-1.12.2-2.el7.x86_64
- 查看软件包的概要信息rpm -qi nginx-1.12.2-2.el7.x86_64
- 验证软件包内容和安装文件是否一致rpm -V nginx-1.12.2-2.el7.x86_64
- 更新软件包rpm -Uvh nginx-1.12.2-2.el7.x86_64
- 删除软件包rpm -e nginx-1.12.2-2.el7.x86_64
### yum
- 安装软件包: yum install nginx
- 检查可以更新的软件包yum check-update
- 更新指定的软件包yum update nginx
- 在资源库中查找软件包信息yum info nginx*
- 列出已经安装的所有软件包yum info installed
- 列出软件包名称yum list redis*
- 模糊搜索软件包yum search redis
## 网络安全
### iptables
- 开启防火墙systemctl start iptables.service
- 关闭防火墙systemctl stop iptables.service
- 查看防火墙状态systemctl status iptables.service
- 设置开机启动systemctl enable iptables.service
- 禁用开机启动systemctl disable iptables.service
- 查看filter表的链信息iptables -L -n
- 查看NAT表的链信息iptables -t nat -L -n
- 清除防火墙所有规则iptables -F;iptables -X;iptables -Z;
- 添加过滤规则开发80端口iptables -I INPUT -p tcp --dport 80 -j ACCEPT
- 查找规则所做行号iptables -L INPUT --line-numbers -n
- 根据行号删除过滤规则iptables -D INPUT 1

@ -0,0 +1,78 @@
# Mysql常用命令
## 数据定义语句(DDL)
### 数据库操作
- 登录数据库mysql -uroot -proot
- 创建数据库create database test
- 查看所有数据库show databases
- 使用数据库use test
- 查看所有数据表show tables
- 删除数据库drop database test
### 表操作
- 创建表create table emp(ename varchar(10),hiredate date,sal decimal(10,2),deptno int(2))
create table dept(deptno int(2),deptname varchar(10))
- 查看表的定义desc emp
- 查看表定义详细show create table emp \G
- 删除表drop table emp
- 修改表字段alter table emp modify ename varchar(20)
- 添加表字段alter table emp add column age int(3)
- 删除表字段alter table emp drop column age
- 字段改名alter table emp change age age1 int(4)
- 修改表名alter table emp rename emp1
## 数据操纵语句(DML)
### 插入记录
- 指定名称插入insert into emp (ename,hiredate,sal,deptno) values ('zhangsan','2018-01-01','2000',1)
- 不指定名称插入insert into emp values ('lisi','2018-01-01','2000',1)
- 批量插入数据insert into dept values(1,'dept1'),(2,'dept2')
### 修改记录
update emp set sal='4000',deptno=2 where ename='zhangsan'
### 删除记录
delete from emp where ename='zhangsan'
### 查询记录
- 查询所有记录select * from emp
- 查询不重复的记录select distinct deptno from emp
- 条件查询select * from emp where deptno=1 and sal<3000
- 排序和限制select * from emp order by deptno desc limit 2
- 聚合(查询部门人数大于1的部门编号)select deptno,count(1) from emp group by deptno having count(1) > 1
- 连接查询select * from emp e left join dept d on e.deptno=d.deptno
- 子查询select * from emp where deptno in (select deptno from dept)
- 记录联合select deptno from emp union select deptno from dept
## 数据控制语句(DCL)
- 授予操作权限grant select,insert on test.* to 'test'@'localhost' identified by '123'
- 收回操作权限revoke insert on test.* from 'test'@'localhost'
## 其他
### 字符集相关
- 查看字符集show variables like 'character%'
- 创建数据库时指定字符集create database mall character set utf8
### 修改时区
- 修改mysql全局时区为北京时间即我们所在的东8区set global time_zone = '+8:00';
- 修改当前会话时区set time_zone = '+8:00'
- 立即生效flush privileges
### 权限相关
- 授予所有数据库的所有权限grant all privileges on *.* to z1@localhost identified by '123'
- 授予所有数据库的所有权限(包括grant)grant all privileges on *.* to z1@localhost with grant option
- 授予SUPER PROCESS FILE权限grant super,process,file on *.* to z3@localhost
- 只授予登录权限grant usage on *.* to z4@localhost
- 查看账号权限show grants for z1@localhost
- 修改自己的密码set password = password('123')
- 管理员修改他人密码set password for 'z1'@'localhost' = password('123')
- 删除账号drop user z2@localhost

@ -0,0 +1,32 @@
# 设置IDEA快捷键为Eclipse风格
- 点击File->Settings->Keymap选择快捷键风格为Eclipse
- 按如下表格中的英文描述进行搜索,并改为相应快捷键
Eclipse | IDEA | 英文描述 | 中文描述
----|----|----|----
ctrl+shift+r |ctrl+shift+r |Navigate->File |找工作空间的文件
ctrl+shift+t |ctrl+shift+t |Navigate->Class |找类定义
ctrl+shift+g |ctrl+shift+g |Edit->Find->Find Usages |查找方法在哪里调用.变量在哪里被使用
ctrl+t |ctrl+t |Other->Hierarchy Class |看类继承结构
ctrl+o |ctrl+o |Navigate->File Structure |搜索一个类里面的方法
shift+alt+z |shift+alt+z |Code->Surround With |生成常见的代码块
shift+alt+l |shift+alt+l |Refactor->Extract->Variable |抽取变量
shift+alt+m |shift+alt+m |Refactor->Extract->Method |抽取方法
alt+left |alt+left |Navigate->Back |回退上一个操作位置
alt+right |alt+right |Navigate->Forward |前进上一个操作位置
ctrl+home |ctrl+home |Move Caret to Text Start |回到类最前面
ctrl+end |ctrl+end |Move Caret to Text End |回到类最后面
ctrl+2 L |shift+alt+l |Refactor->Extract->Variable |抽取变量
ctrl+e |alt+r |View->Recent Files |最近打开的文件
ctrl+w |ctrl+w |Close |关闭当前窗口
alt+/ |alt+/ |Code->Completion->Basic |提示变量生成
ctrl+1 |ctrl+1 |Other->Show Intention Actions |提示可能的操作
ctrl+h |ctrl+h |Find in Path |全局搜索
alt+上/下箭头 |alt+上/下箭头 |Code->Move Line Up/Down |移动一行代码
ctrl+alt+上/下箭头 |ctrl+alt+上/下箭头 |Editor Actions->Duplicate Lines |复制一行
ctrl+shift+j |ctrl+shift+j |Other->Fix doc comment |方法注释
暂无|alt+enter |Other->Show Intention Actions |提示常见操作
Ctrl+F |Ctrl+F/Ctrl+R |Find/Replace |查找替换
Shift+Enter |Shift+Enter |Start New Line |开启新的一行
Ctrl+Alt+S |Ctrl+Alt+S |Generate |生成getter,setter,tostring等

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

@ -0,0 +1,10 @@
# 该镜像需要依赖的基础镜像
FROM openjdk:8
# 将当前目录下的jar包复制到docker容器的/目录下
ADD mall-admin-1.0-SNAPSHOT.jar /mall-admin-1.0-SNAPSHOT.jar
# 声明服务运行在8080端口
EXPOSE 8080
# 指定docker容器启动时运行jar包
ENTRYPOINT ["java", "-jar","/mall-admin-1.0-SNAPSHOT.jar"]
# 指定维护者的名字
MAINTAINER macro

@ -0,0 +1,16 @@
#!/usr/bin/env bash
app_name='mall-admin'
docker stop ${app_name}
echo '----stop container----'
docker rm ${app_name}
echo '----rm container----'
docker rmi `docker images | grep none | awk '{print $3}'`
echo '----rm none images----'
docker run -p 8080:8080 --name ${app_name} \
--link mysql:db \
--link redis:redis \
-e TZ="Asia/Shanghai" \
-v /etc/localtime:/etc/localtime \
-v /mydata/app/${app_name}/logs:/var/logs \
-d mall/${app_name}:1.0-SNAPSHOT
echo '----start container----'

@ -0,0 +1,18 @@
#!/usr/bin/env bash
app_name='mall-portal'
docker stop ${app_name}
echo '----stop container----'
docker rm ${app_name}
echo '----rm container----'
docker rmi `docker images | grep none | awk '{print $3}'`
echo '----rm none images----'
docker run -p 8085:8085 --name ${app_name} \
--link mysql:db \
--link redis:redis \
--link mongo:mongo \
--link rabbitmq:rabbit \
-e TZ="Asia/Shanghai" \
-v /etc/localtime:/etc/localtime \
-v /mydata/app/${app_name}/logs:/var/logs \
-d mall/${app_name}:1.0-SNAPSHOT
echo '----start container----'

@ -0,0 +1,16 @@
#!/usr/bin/env bash
app_name='mall-search'
docker stop ${app_name}
echo '----stop container----'
docker rm ${app_name}
echo '----rm container----'
docker rmi `docker images | grep none | awk '{print $3}'`
echo '----rm none images----'
docker run -p 8081:8081 --name ${app_name} \
--link mysql:db \
--link elasticsearch:es \
-e TZ="Asia/Shanghai" \
-v /etc/localtime:/etc/localtime \
-v /mydata/app/${app_name}/logs:/var/logs \
-d mall/${app_name}:1.0-SNAPSHOT
echo '----start container----'

@ -0,0 +1,28 @@
#!/usr/bin/env bash
# 定义应用组名
group_name='mall'
# 定义应用名称
app_name='mall-admin'
# 定义应用版本
app_version='1.0-SNAPSHOT'
# 定义应用环境
profile_active='prod'
echo '----copy jar----'
docker stop ${app_name}
echo '----stop container----'
docker rm ${app_name}
echo '----rm container----'
docker rmi ${group_name}/${app_name}:${app_version}
echo '----rm image----'
# 打包编译docker镜像
docker build -t ${group_name}/${app_name}:${app_version} .
echo '----build image----'
docker run -p 8080:8080 --name ${app_name} \
--link mysql:db \
--link redis:redis \
-e 'spring.profiles.active'=${profile_active} \
-e TZ="Asia/Shanghai" \
-v /etc/localtime:/etc/localtime \
-v /mydata/app/${app_name}/logs:/var/logs \
-d ${group_name}/${app_name}:${app_version}
echo '----start container----'

File diff suppressed because one or more lines are too long

@ -0,0 +1,49 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.macro.mall</groupId>
<artifactId>mall-admin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mall-admin</name>
<description>mall-admin project for mall</description>
<parent>
<groupId>com.macro.mall</groupId>
<artifactId>mall</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.macro.mall</groupId>
<artifactId>mall-mbg</artifactId>
</dependency>
<dependency>
<groupId>com.macro.mall</groupId>
<artifactId>mall-security</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,15 @@
package com.macro.mall;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
*
* Created by macro on 2018/4/26.
*/
@SpringBootApplication
public class MallAdminApplication {
public static void main(String[] args) {
SpringApplication.run(MallAdminApplication.class, args);
}
}

@ -0,0 +1,65 @@
package com.macro.mall.bo;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.UmsResource;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
/**
* SpringSecurity
* Created by macro on 2018/4/26.
*/
public class AdminUserDetails implements UserDetails {
//后台用户
private final UmsAdmin umsAdmin;
//拥有资源列表
private final List<UmsResource> resourceList;
public AdminUserDetails(UmsAdmin umsAdmin,List<UmsResource> resourceList) {
this.umsAdmin = umsAdmin;
this.resourceList = resourceList;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
//返回当前用户所拥有的资源
return resourceList.stream()
.map(resource ->new SimpleGrantedAuthority(resource.getId()+":"+resource.getName()))
.collect(Collectors.toList());
}
@Override
public String getPassword() {
return umsAdmin.getPassword();
}
@Override
public String getUsername() {
return umsAdmin.getUsername();
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return umsAdmin.getStatus().equals(1);
}
}

@ -0,0 +1,34 @@
package com.macro.mall.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
/**
*
* Created by macro on 2019/7/27.
*/
@Configuration
public class GlobalCorsConfig {
/**
*
*/
@Bean
public CorsFilter corsFilter() {
CorsConfiguration config = new CorsConfiguration();
//允许所有域名进行跨域调用
config.addAllowedOriginPattern("*");
//允许跨越发送cookie
config.setAllowCredentials(true);
//放行全部原始头信息
config.addAllowedHeader("*");
//允许所有请求方法跨域调用
config.addAllowedMethod("*");
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
}

@ -0,0 +1,49 @@
package com.macro.mall.config;
import com.macro.mall.model.UmsResource;
import com.macro.mall.security.component.DynamicSecurityService;
import com.macro.mall.service.UmsAdminService;
import com.macro.mall.service.UmsResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.core.userdetails.UserDetailsService;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* mall-security
* Created by macro on 2019/11/9.
*/
@Configuration
public class MallSecurityConfig {
@Autowired
private UmsAdminService adminService;
@Autowired
private UmsResourceService resourceService;
@Bean
public UserDetailsService userDetailsService() {
//获取登录用户信息
return username -> adminService.loadUserByUsername(username);
}
@Bean
public DynamicSecurityService dynamicSecurityService() {
return new DynamicSecurityService() {
@Override
public Map<String, ConfigAttribute> loadDataSource() {
Map<String, ConfigAttribute> map = new ConcurrentHashMap<>();
List<UmsResource> resourceList = resourceService.listAll();
for (UmsResource resource : resourceList) {
map.put(resource.getUrl(), new org.springframework.security.access.SecurityConfig(resource.getId() + ":" + resource.getName()));
}
return map;
}
};
}
}

@ -0,0 +1,15 @@
package com.macro.mall.config;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* MyBatis
* Created by macro on 2019/4/8.
*/
@Configuration
@EnableTransactionManagement
@MapperScan({"com.macro.mall.mapper","com.macro.mall.dao"})
public class MyBatisConfig {
}

@ -0,0 +1,24 @@
package com.macro.mall.config;
import com.aliyun.oss.OSSClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* OSS
* Created by macro on 2018/5/17.
*/
@Configuration
public class OssConfig {
@Value("${aliyun.oss.endpoint}")
private String ALIYUN_OSS_ENDPOINT;
@Value("${aliyun.oss.accessKeyId}")
private String ALIYUN_OSS_ACCESSKEYID;
@Value("${aliyun.oss.accessKeySecret}")
private String ALIYUN_OSS_ACCESSKEYSECRET;
@Bean
public OSSClient ossClient(){
return new OSSClient(ALIYUN_OSS_ENDPOINT,ALIYUN_OSS_ACCESSKEYID,ALIYUN_OSS_ACCESSKEYSECRET);
}
}

@ -0,0 +1,35 @@
package com.macro.mall.config;
import com.macro.mall.common.config.BaseSwaggerConfig;
import com.macro.mall.common.domain.SwaggerProperties;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* Swagger
* Created by macro on 2018/4/26.
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig extends BaseSwaggerConfig {
@Override
public SwaggerProperties swaggerProperties() {
return SwaggerProperties.builder()
.apiBasePackage("com.macro.mall.controller")
.title("mall后台系统")
.description("mall后台相关接口文档")
.contactName("macro")
.version("1.0")
.enableSecurity(true)
.build();
}
@Bean
public BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() {
return generateBeanPostProcessor();
}
}

@ -0,0 +1,36 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.CmsPrefrenceArea;
import com.macro.mall.service.CmsPrefrenceAreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* Controller
* Created by macro on 2018/6/1.
*/
@Controller
@Api(tags = "CmsPrefrenceAreaController")
@Tag(name = "CmsPrefrenceAreaController", description = "商品优选管理")
@RequestMapping("/prefrenceArea")
public class CmsPrefrenceAreaController {
@Autowired
private CmsPrefrenceAreaService prefrenceAreaService;
@ApiOperation("获取所有商品优选")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<CmsPrefrenceArea>> listAll() {
List<CmsPrefrenceArea> prefrenceAreaList = prefrenceAreaService.listAll();
return CommonResult.success(prefrenceAreaList);
}
}

@ -0,0 +1,48 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.CmsSubject;
import com.macro.mall.service.CmsSubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* Controller
* Created by macro on 2018/6/1.
*/
@Controller
@Api(tags = "CmsSubjectController")
@Tag(name = "CmsSubjectController", description = "商品专题管理")
@RequestMapping("/subject")
public class CmsSubjectController {
@Autowired
private CmsSubjectService subjectService;
@ApiOperation("获取全部商品专题")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<CmsSubject>> listAll() {
List<CmsSubject> subjectList = subjectService.listAll();
return CommonResult.success(subjectList);
}
@ApiOperation(value = "根据专题名称分页获取商品专题")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<CmsSubject>> getList(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
List<CmsSubject> subjectList = subjectService.list(keyword, pageNum, pageSize);
return CommonResult.success(CommonPage.restPage(subjectList));
}
}

@ -0,0 +1,119 @@
package com.macro.mall.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.BucketPolicyConfigDto;
import com.macro.mall.dto.MinioUploadDto;
import io.minio.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* MinIOController
* Created by macro on 2019/12/25.
*/
@Controller
@Api(tags = "MinioController")
@Tag(name = "MinioController", description = "MinIO对象存储管理")
@RequestMapping("/minio")
public class MinioController {
private static final Logger LOGGER = LoggerFactory.getLogger(MinioController.class);
@Value("${minio.endpoint}")
private String ENDPOINT;
@Value("${minio.bucketName}")
private String BUCKET_NAME;
@Value("${minio.accessKey}")
private String ACCESS_KEY;
@Value("${minio.secretKey}")
private String SECRET_KEY;
@ApiOperation("文件上传")
@RequestMapping(value = "/upload", method = RequestMethod.POST)
@ResponseBody
public CommonResult upload(@RequestPart("file") MultipartFile file) {
try {
//创建一个MinIO的Java客户端
MinioClient minioClient =MinioClient.builder()
.endpoint(ENDPOINT)
.credentials(ACCESS_KEY,SECRET_KEY)
.build();
boolean isExist = minioClient.bucketExists(BucketExistsArgs.builder().bucket(BUCKET_NAME).build());
if (isExist) {
LOGGER.info("存储桶已经存在!");
} else {
//创建存储桶并设置只读权限
minioClient.makeBucket(MakeBucketArgs.builder().bucket(BUCKET_NAME).build());
BucketPolicyConfigDto bucketPolicyConfigDto = createBucketPolicyConfigDto(BUCKET_NAME);
SetBucketPolicyArgs setBucketPolicyArgs = SetBucketPolicyArgs.builder()
.bucket(BUCKET_NAME)
.config(JSONUtil.toJsonStr(bucketPolicyConfigDto))
.build();
minioClient.setBucketPolicy(setBucketPolicyArgs);
}
String filename = file.getOriginalFilename();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
// 设置存储对象名称
String objectName = sdf.format(new Date()) + "/" + filename;
// 使用putObject上传一个文件到存储桶中
PutObjectArgs putObjectArgs = PutObjectArgs.builder()
.bucket(BUCKET_NAME)
.object(objectName)
.contentType(file.getContentType())
.stream(file.getInputStream(), file.getSize(), ObjectWriteArgs.MIN_MULTIPART_SIZE).build();
minioClient.putObject(putObjectArgs);
LOGGER.info("文件上传成功!");
MinioUploadDto minioUploadDto = new MinioUploadDto();
minioUploadDto.setName(filename);
minioUploadDto.setUrl(ENDPOINT + "/" + BUCKET_NAME + "/" + objectName);
return CommonResult.success(minioUploadDto);
} catch (Exception e) {
e.printStackTrace();
LOGGER.info("上传发生错误: {}", e.getMessage());
}
return CommonResult.failed();
}
/**
* 访
*/
private BucketPolicyConfigDto createBucketPolicyConfigDto(String bucketName) {
BucketPolicyConfigDto.Statement statement = BucketPolicyConfigDto.Statement.builder()
.Effect("Allow")
.Principal("*")
.Action("s3:GetObject")
.Resource("arn:aws:s3:::"+bucketName+"/*.**").build();
return BucketPolicyConfigDto.builder()
.Version("2012-10-17")
.Statement(CollUtil.toList(statement))
.build();
}
@ApiOperation("文件删除")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("objectName") String objectName) {
try {
MinioClient minioClient = MinioClient.builder()
.endpoint(ENDPOINT)
.credentials(ACCESS_KEY,SECRET_KEY)
.build();
minioClient.removeObject(RemoveObjectArgs.builder().bucket(BUCKET_NAME).object(objectName).build());
return CommonResult.success(null);
} catch (Exception e) {
e.printStackTrace();
}
return CommonResult.failed();
}
}

@ -0,0 +1,36 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.OmsCompanyAddress;
import com.macro.mall.service.OmsCompanyAddressService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* Controller
* Created by macro on 2018/10/18.
*/
@Controller
@Api(tags = "OmsCompanyAddressController")
@Tag(name = "OmsCompanyAddressController", description = "收货地址管理")
@RequestMapping("/companyAddress")
public class OmsCompanyAddressController {
@Autowired
private OmsCompanyAddressService companyAddressService;
@ApiOperation("获取所有收货地址")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<OmsCompanyAddress>> list() {
List<OmsCompanyAddress> companyAddressList = companyAddressService.list();
return CommonResult.success(companyAddressList);
}
}

@ -0,0 +1,114 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.*;
import com.macro.mall.model.OmsOrder;
import com.macro.mall.service.OmsOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/10/11.
*/
@Controller
@Api(tags = "OmsOrderController")
@Tag(name = "OmsOrderController", description = "订单管理")
@RequestMapping("/order")
public class OmsOrderController {
@Autowired
private OmsOrderService orderService;
@ApiOperation("查询订单")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<OmsOrder>> list(OmsOrderQueryParam queryParam,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<OmsOrder> orderList = orderService.list(queryParam, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(orderList));
}
@ApiOperation("批量发货")
@RequestMapping(value = "/update/delivery", method = RequestMethod.POST)
@ResponseBody
public CommonResult delivery(@RequestBody List<OmsOrderDeliveryParam> deliveryParamList) {
int count = orderService.delivery(deliveryParamList);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量关闭订单")
@RequestMapping(value = "/update/close", method = RequestMethod.POST)
@ResponseBody
public CommonResult close(@RequestParam("ids") List<Long> ids, @RequestParam String note) {
int count = orderService.close(ids, note);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量删除订单")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = orderService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取订单详情:订单信息、商品信息、操作记录")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OmsOrderDetail> detail(@PathVariable Long id) {
OmsOrderDetail orderDetailResult = orderService.detail(id);
return CommonResult.success(orderDetailResult);
}
@ApiOperation("修改收货人信息")
@RequestMapping(value = "/update/receiverInfo", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateReceiverInfo(@RequestBody OmsReceiverInfoParam receiverInfoParam) {
int count = orderService.updateReceiverInfo(receiverInfoParam);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改订单费用信息")
@RequestMapping(value = "/update/moneyInfo", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateReceiverInfo(@RequestBody OmsMoneyInfoParam moneyInfoParam) {
int count = orderService.updateMoneyInfo(moneyInfoParam);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("备注订单")
@RequestMapping(value = "/update/note", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateNote(@RequestParam("id") Long id,
@RequestParam("note") String note,
@RequestParam("status") Integer status) {
int count = orderService.updateNote(id, note, status);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
}

@ -0,0 +1,71 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.OmsOrderReturnApplyResult;
import com.macro.mall.dto.OmsReturnApplyQueryParam;
import com.macro.mall.dto.OmsUpdateStatusParam;
import com.macro.mall.model.OmsOrderReturnApply;
import com.macro.mall.service.OmsOrderReturnApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 退Controller
* Created by macro on 2018/10/18.
*/
@Controller
@Api(tags = "OmsOrderReturnApplyController")
@Tag(name = "OmsOrderReturnApplyController", description = "订单退货申请管理")
@RequestMapping("/returnApply")
public class OmsOrderReturnApplyController {
@Autowired
private OmsOrderReturnApplyService returnApplyService;
@ApiOperation("分页查询退货申请")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<OmsOrderReturnApply>> list(OmsReturnApplyQueryParam queryParam,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<OmsOrderReturnApply> returnApplyList = returnApplyService.list(queryParam, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(returnApplyList));
}
@ApiOperation("批量删除退货申请")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = returnApplyService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取退货申请详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult getItem(@PathVariable Long id) {
OmsOrderReturnApplyResult result = returnApplyService.getItem(id);
return CommonResult.success(result);
}
@ApiOperation("修改退货申请状态")
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, @RequestBody OmsUpdateStatusParam statusParam) {
int count = returnApplyService.updateStatus(id, statusParam);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
}

@ -0,0 +1,89 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.OmsOrderReturnReason;
import com.macro.mall.service.OmsOrderReturnReasonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 退Controller
* Created by macro on 2018/10/17.
*/
@Controller
@Api(tags = "OmsOrderReturnReasonController")
@Tag(name = "OmsOrderReturnReasonController", description = "退货原因管理")
@RequestMapping("/returnReason")
public class OmsOrderReturnReasonController {
@Autowired
private OmsOrderReturnReasonService orderReturnReasonService;
@ApiOperation("添加退货原因")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody OmsOrderReturnReason returnReason) {
int count = orderReturnReasonService.create(returnReason);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改退货原因")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody OmsOrderReturnReason returnReason) {
int count = orderReturnReasonService.update(id, returnReason);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量删除退货原因")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = orderReturnReasonService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("分页查询退货原因")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<OmsOrderReturnReason>> list(@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<OmsOrderReturnReason> reasonList = orderReturnReasonService.list(pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(reasonList));
}
@ApiOperation("获取单个退货原因详情信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OmsOrderReturnReason> getItem(@PathVariable Long id) {
OmsOrderReturnReason reason = orderReturnReasonService.getItem(id);
return CommonResult.success(reason);
}
@ApiOperation("修改退货原因启用状态")
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@RequestParam(value = "status") Integer status,
@RequestParam("ids") List<Long> ids) {
int count = orderReturnReasonService.updateStatus(ids, status);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
}

@ -0,0 +1,43 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.OmsOrderSetting;
import com.macro.mall.service.OmsOrderSettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
/**
* Controller
* Created by macro on 2018/10/16.
*/
@Controller
@Api(tags = "OmsOrderSettingController")
@Tag(name = "OmsOrderSettingController", description = "订单设置管理")
@RequestMapping("/orderSetting")
public class OmsOrderSettingController {
@Autowired
private OmsOrderSettingService orderSettingService;
@ApiOperation("获取指定订单设置")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OmsOrderSetting> getItem(@PathVariable Long id) {
OmsOrderSetting orderSetting = orderSettingService.getItem(id);
return CommonResult.success(orderSetting);
}
@ApiOperation("修改指定订单设置")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody OmsOrderSetting orderSetting) {
int count = orderSettingService.update(id,orderSetting);
if(count>0){
return CommonResult.success(count);
}
return CommonResult.failed();
}
}

@ -0,0 +1,47 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.OssCallbackResult;
import com.macro.mall.dto.OssPolicyResult;
import com.macro.mall.service.OssService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
/**
* OssController
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "OssController")
@Tag(name = "OssController", description = "Oss对象存储管理")
@RequestMapping("/aliyun/oss")
public class OssController {
@Autowired
private OssService ossService;
@ApiOperation(value = "Oss上传签名生成")
@RequestMapping(value = "/policy", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OssPolicyResult> policy() {
OssPolicyResult result = ossService.policy();
return CommonResult.success(result);
}
@ApiOperation(value = "Oss上传成功回调")
@RequestMapping(value = "callback", method = RequestMethod.POST)
@ResponseBody
public CommonResult<OssCallbackResult> callback(HttpServletRequest request) {
OssCallbackResult ossCallbackResult = ossService.callback(request);
return CommonResult.success(ossCallbackResult);
}
}

@ -0,0 +1,133 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.PmsBrandParam;
import com.macro.mall.model.PmsBrand;
import com.macro.mall.service.PmsBrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "PmsBrandController")
@Tag(name = "PmsBrandController", description = "商品品牌管理")
@RequestMapping("/brand")
public class PmsBrandController {
@Autowired
private PmsBrandService brandService;
@ApiOperation(value = "获取全部品牌列表")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsBrand>> getList() {
return CommonResult.success(brandService.listAllBrand());
}
@ApiOperation(value = "添加品牌")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@Validated @RequestBody PmsBrandParam pmsBrand) {
CommonResult commonResult;
int count = brandService.createBrand(pmsBrand);
if (count == 1) {
commonResult = CommonResult.success(count);
} else {
commonResult = CommonResult.failed();
}
return commonResult;
}
@ApiOperation(value = "更新品牌")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable("id") Long id,
@Validated @RequestBody PmsBrandParam pmsBrandParam) {
CommonResult commonResult;
int count = brandService.updateBrand(id, pmsBrandParam);
if (count == 1) {
commonResult = CommonResult.success(count);
} else {
commonResult = CommonResult.failed();
}
return commonResult;
}
@ApiOperation(value = "删除品牌")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult delete(@PathVariable("id") Long id) {
int count = brandService.deleteBrand(id);
if (count == 1) {
return CommonResult.success(null);
} else {
return CommonResult.failed();
}
}
@ApiOperation(value = "根据品牌名称分页获取品牌列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsBrand>> getList(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "showStatus",required = false) Integer showStatus,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
List<PmsBrand> brandList = brandService.listBrand(keyword,showStatus,pageNum, pageSize);
return CommonResult.success(CommonPage.restPage(brandList));
}
@ApiOperation(value = "根据编号查询品牌信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsBrand> getItem(@PathVariable("id") Long id) {
return CommonResult.success(brandService.getBrand(id));
}
@ApiOperation(value = "批量删除品牌")
@RequestMapping(value = "/delete/batch", method = RequestMethod.POST)
@ResponseBody
public CommonResult deleteBatch(@RequestParam("ids") List<Long> ids) {
int count = brandService.deleteBrand(ids);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation(value = "批量更新显示状态")
@RequestMapping(value = "/update/showStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateShowStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("showStatus") Integer showStatus) {
int count = brandService.updateShowStatus(ids, showStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation(value = "批量更新厂家制造商状态")
@RequestMapping(value = "/update/factoryStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateFactoryStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("factoryStatus") Integer factoryStatus) {
int count = brandService.updateFactoryStatus(ids, factoryStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
}

@ -0,0 +1,88 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.PmsProductAttributeCategoryItem;
import com.macro.mall.model.PmsProductAttributeCategory;
import com.macro.mall.service.PmsProductAttributeCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "PmsProductAttributeCategoryController")
@Tag(name = "PmsProductAttributeCategoryController", description = "商品属性分类管理")
@RequestMapping("/productAttribute/category")
public class PmsProductAttributeCategoryController {
@Autowired
private PmsProductAttributeCategoryService productAttributeCategoryService;
@ApiOperation("添加商品属性分类")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestParam String name) {
int count = productAttributeCategoryService.create(name);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改商品属性分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestParam String name) {
int count = productAttributeCategoryService.update(id, name);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("删除单个商品属性分类")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = productAttributeCategoryService.delete(id);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("获取单个商品属性分类信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductAttributeCategory> getItem(@PathVariable Long id) {
PmsProductAttributeCategory productAttributeCategory = productAttributeCategoryService.getItem(id);
return CommonResult.success(productAttributeCategory);
}
@ApiOperation("分页获取所有商品属性分类")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProductAttributeCategory>> getList(@RequestParam(defaultValue = "5") Integer pageSize, @RequestParam(defaultValue = "1") Integer pageNum) {
List<PmsProductAttributeCategory> productAttributeCategoryList = productAttributeCategoryService.getList(pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(productAttributeCategoryList));
}
@ApiOperation("获取所有商品属性分类及其下属性")
@RequestMapping(value = "/list/withAttr", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProductAttributeCategoryItem>> getListWithAttr() {
List<PmsProductAttributeCategoryItem> productAttributeCategoryResultList = productAttributeCategoryService.getListWithAttr();
return CommonResult.success(productAttributeCategoryResultList);
}
}

@ -0,0 +1,95 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.PmsProductAttributeParam;
import com.macro.mall.dto.ProductAttrInfo;
import com.macro.mall.model.PmsProductAttribute;
import com.macro.mall.service.PmsProductAttributeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "PmsProductAttributeController")
@Tag(name = "PmsProductAttributeController", description = "商品属性管理")
@RequestMapping("/productAttribute")
public class PmsProductAttributeController {
@Autowired
private PmsProductAttributeService productAttributeService;
@ApiOperation("根据分类查询属性列表或参数列表")
@ApiImplicitParams({@ApiImplicitParam(name = "type", value = "0表示属性1表示参数", required = true, paramType = "query", dataType = "integer")})
@RequestMapping(value = "/list/{cid}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProductAttribute>> getList(@PathVariable Long cid,
@RequestParam(value = "type") Integer type,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<PmsProductAttribute> productAttributeList = productAttributeService.getList(cid, type, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(productAttributeList));
}
@ApiOperation("添加商品属性信息")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody PmsProductAttributeParam productAttributeParam) {
int count = productAttributeService.create(productAttributeParam);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改商品属性信息")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody PmsProductAttributeParam productAttributeParam) {
int count = productAttributeService.update(id, productAttributeParam);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("查询单个商品属性")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductAttribute> getItem(@PathVariable Long id) {
PmsProductAttribute productAttribute = productAttributeService.getItem(id);
return CommonResult.success(productAttribute);
}
@ApiOperation("批量删除商品属性")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = productAttributeService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("根据商品分类的id获取商品属性及属性分类")
@RequestMapping(value = "/attrInfo/{productCategoryId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<ProductAttrInfo>> getAttrInfo(@PathVariable Long productCategoryId) {
List<ProductAttrInfo> productAttrInfoList = productAttributeService.getProductAttrInfo(productCategoryId);
return CommonResult.success(productAttrInfoList);
}
}

@ -0,0 +1,118 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.PmsProductCategoryParam;
import com.macro.mall.dto.PmsProductCategoryWithChildrenItem;
import com.macro.mall.model.PmsProductCategory;
import com.macro.mall.service.PmsProductCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "PmsProductCategoryController")
@Tag(name = "PmsProductCategoryController", description = "商品分类管理")
@RequestMapping("/productCategory")
public class PmsProductCategoryController {
@Autowired
private PmsProductCategoryService productCategoryService;
@ApiOperation("添加商品分类")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@Validated @RequestBody PmsProductCategoryParam productCategoryParam) {
int count = productCategoryService.create(productCategoryParam);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改商品分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@Validated
@RequestBody PmsProductCategoryParam productCategoryParam) {
int count = productCategoryService.update(id, productCategoryParam);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("分页查询商品分类")
@RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProductCategory>> getList(@PathVariable Long parentId,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<PmsProductCategory> productCategoryList = productCategoryService.getList(parentId, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(productCategoryList));
}
@ApiOperation("根据id获取商品分类")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductCategory> getItem(@PathVariable Long id) {
PmsProductCategory productCategory = productCategoryService.getItem(id);
return CommonResult.success(productCategory);
}
@ApiOperation("删除商品分类")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = productCategoryService.delete(id);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改导航栏显示状态")
@RequestMapping(value = "/update/navStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateNavStatus(@RequestParam("ids") List<Long> ids, @RequestParam("navStatus") Integer navStatus) {
int count = productCategoryService.updateNavStatus(ids, navStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改显示状态")
@RequestMapping(value = "/update/showStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateShowStatus(@RequestParam("ids") List<Long> ids, @RequestParam("showStatus") Integer showStatus) {
int count = productCategoryService.updateShowStatus(ids, showStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("查询所有一级分类及子分类")
@RequestMapping(value = "/list/withChildren", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProductCategoryWithChildrenItem>> listWithChildren() {
List<PmsProductCategoryWithChildrenItem> list = productCategoryService.listWithChildren();
return CommonResult.success(list);
}
}

@ -0,0 +1,146 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.PmsProductParam;
import com.macro.mall.dto.PmsProductQueryParam;
import com.macro.mall.dto.PmsProductResult;
import com.macro.mall.model.PmsProduct;
import com.macro.mall.service.PmsProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "PmsProductController")
@Tag(name = "PmsProductController", description = "商品管理")
@RequestMapping("/product")
public class PmsProductController {
@Autowired
private PmsProductService productService;
@ApiOperation("创建商品")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody PmsProductParam productParam) {
int count = productService.create(productParam);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("根据商品id获取商品编辑信息")
@RequestMapping(value = "/updateInfo/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsProductResult> getUpdateInfo(@PathVariable Long id) {
PmsProductResult productResult = productService.getUpdateInfo(id);
return CommonResult.success(productResult);
}
@ApiOperation("更新商品")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody PmsProductParam productParam) {
int count = productService.update(id, productParam);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("查询商品")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsProduct>> getList(PmsProductQueryParam productQueryParam,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<PmsProduct> productList = productService.list(productQueryParam, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(productList));
}
@ApiOperation("根据商品名称或货号模糊查询")
@RequestMapping(value = "/simpleList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> getList(String keyword) {
List<PmsProduct> productList = productService.list(keyword);
return CommonResult.success(productList);
}
@ApiOperation("批量修改审核状态")
@RequestMapping(value = "/update/verifyStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateVerifyStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("verifyStatus") Integer verifyStatus,
@RequestParam("detail") String detail) {
int count = productService.updateVerifyStatus(ids, verifyStatus, detail);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("批量上下架商品")
@RequestMapping(value = "/update/publishStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updatePublishStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("publishStatus") Integer publishStatus) {
int count = productService.updatePublishStatus(ids, publishStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("批量推荐商品")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("recommendStatus") Integer recommendStatus) {
int count = productService.updateRecommendStatus(ids, recommendStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("批量设为新品")
@RequestMapping(value = "/update/newStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateNewStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("newStatus") Integer newStatus) {
int count = productService.updateNewStatus(ids, newStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("批量修改删除状态")
@RequestMapping(value = "/update/deleteStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateDeleteStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("deleteStatus") Integer deleteStatus) {
int count = productService.updateDeleteStatus(ids, deleteStatus);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
}

@ -0,0 +1,45 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.PmsSkuStock;
import com.macro.mall.service.PmsSkuStockService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* SKUController
* Created by macro on 2018/4/27.
*/
@Controller
@Api(tags = "PmsSkuStockController")
@Tag(name = "PmsSkuStockController", description = "sku商品库存管理")
@RequestMapping("/sku")
public class PmsSkuStockController {
@Autowired
private PmsSkuStockService skuStockService;
@ApiOperation("根据商品ID及sku编码模糊搜索sku库存")
@RequestMapping(value = "/{pid}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsSkuStock>> getList(@PathVariable Long pid, @RequestParam(value = "keyword",required = false) String keyword) {
List<PmsSkuStock> skuStockList = skuStockService.getList(pid, keyword);
return CommonResult.success(skuStockList);
}
@ApiOperation("批量更新sku库存信息")
@RequestMapping(value ="/update/{pid}",method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long pid,@RequestBody List<PmsSkuStock> skuStockList){
int count = skuStockService.update(pid,skuStockList);
if(count>0){
return CommonResult.success(count);
}else{
return CommonResult.failed();
}
}
}

@ -0,0 +1,80 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.SmsCouponParam;
import com.macro.mall.model.SmsCoupon;
import com.macro.mall.service.SmsCouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/8/28.
*/
@Controller
@Api(tags = "SmsCouponController")
@Tag(name = "SmsCouponController", description = "优惠券管理")
@RequestMapping("/coupon")
public class SmsCouponController {
@Autowired
private SmsCouponService couponService;
@ApiOperation("添加优惠券")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult add(@RequestBody SmsCouponParam couponParam) {
int count = couponService.create(couponParam);
if(count>0){
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("删除优惠券")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = couponService.delete(id);
if(count>0){
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改优惠券")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,@RequestBody SmsCouponParam couponParam) {
int count = couponService.update(id,couponParam);
if(count>0){
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("根据优惠券名称和类型分页获取优惠券列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsCoupon>> list(
@RequestParam(value = "name",required = false) String name,
@RequestParam(value = "type",required = false) Integer type,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsCoupon> couponList = couponService.list(name,type,pageSize,pageNum);
return CommonResult.success(CommonPage.restPage(couponList));
}
@ApiOperation("获取单个优惠券的详细信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsCouponParam> getItem(@PathVariable Long id) {
SmsCouponParam couponParam = couponService.getItem(id);
return CommonResult.success(couponParam);
}
}

@ -0,0 +1,42 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsCouponHistory;
import com.macro.mall.service.SmsCouponHistoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* Controller
* Created by macro on 2018/11/6.
*/
@Controller
@Api(tags = "SmsCouponHistoryController")
@Tag(name = "SmsCouponHistoryController", description = "优惠券领取记录管理")
@RequestMapping("/couponHistory")
public class SmsCouponHistoryController {
@Autowired
private SmsCouponHistoryService historyService;
@ApiOperation("根据优惠券id使用状态订单编号分页获取领取记录")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsCouponHistory>> list(@RequestParam(value = "couponId", required = false) Long couponId,
@RequestParam(value = "useStatus", required = false) Integer useStatus,
@RequestParam(value = "orderSn", required = false) String orderSn,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsCouponHistory> historyList = historyService.list(couponId, useStatus, orderSn, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(historyList));
}
}

@ -0,0 +1,89 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsFlashPromotion;
import com.macro.mall.service.SmsFlashPromotionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/11/16.
*/
@Controller
@Api(tags = "SmsFlashPromotionController")
@Tag(name = "SmsFlashPromotionController", description = "限时购活动管理")
@RequestMapping("/flash")
public class SmsFlashPromotionController {
@Autowired
private SmsFlashPromotionService flashPromotionService;
@ApiOperation("添加活动")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody SmsFlashPromotion flashPromotion) {
int count = flashPromotionService.create(flashPromotion);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("编辑活动")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody SmsFlashPromotion flashPromotion) {
int count = flashPromotionService.update(id, flashPromotion);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("删除活动")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = flashPromotionService.delete(id);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改上下线状态")
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, Integer status) {
int count = flashPromotionService.updateStatus(id, status);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取活动详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsFlashPromotion> getItem(@PathVariable Long id) {
SmsFlashPromotion flashPromotion = flashPromotionService.getItem(id);
return CommonResult.success(flashPromotion);
}
@ApiOperation("根据活动名称分页查询")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsFlashPromotion>> getItem(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsFlashPromotion> flashPromotionList = flashPromotionService.list(keyword, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(flashPromotionList));
}
}

@ -0,0 +1,80 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.SmsFlashPromotionProduct;
import com.macro.mall.model.SmsFlashPromotionProductRelation;
import com.macro.mall.service.SmsFlashPromotionProductRelationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/11/16.
*/
@Controller
@Api(tags = "SmsFlashPromotionProductRelationController")
@Tag(name = "SmsFlashPromotionProductRelationController", description = "限时购和商品关系管理")
@RequestMapping("/flashProductRelation")
public class SmsFlashPromotionProductRelationController {
@Autowired
private SmsFlashPromotionProductRelationService relationService;
@ApiOperation("批量选择商品添加关联")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsFlashPromotionProductRelation> relationList) {
int count = relationService.create(relationList);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改关联信息")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody SmsFlashPromotionProductRelation relation) {
int count = relationService.update(id, relation);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("删除关联")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = relationService.delete(id);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取关联商品促销信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsFlashPromotionProductRelation> getItem(@PathVariable Long id) {
SmsFlashPromotionProductRelation relation = relationService.getItem(id);
return CommonResult.success(relation);
}
@ApiOperation("分页查询不同场次关联及商品信息")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsFlashPromotionProduct>> list(@RequestParam(value = "flashPromotionId") Long flashPromotionId,
@RequestParam(value = "flashPromotionSessionId") Long flashPromotionSessionId,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsFlashPromotionProduct> flashPromotionProductList = relationService.list(flashPromotionId, flashPromotionSessionId, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(flashPromotionProductList));
}
}

@ -0,0 +1,95 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.SmsFlashPromotionSessionDetail;
import com.macro.mall.model.SmsFlashPromotionSession;
import com.macro.mall.service.SmsFlashPromotionSessionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/11/16.
*/
@Controller
@Api(tags = "SmsFlashPromotionSessionController")
@Tag(name = "SmsFlashPromotionSessionController", description = "限时购场次管理")
@RequestMapping("/flashSession")
public class SmsFlashPromotionSessionController {
@Autowired
private SmsFlashPromotionSessionService flashPromotionSessionService;
@ApiOperation("添加场次")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody SmsFlashPromotionSession promotionSession) {
int count = flashPromotionSessionService.create(promotionSession);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改场次")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody SmsFlashPromotionSession promotionSession) {
int count = flashPromotionSessionService.update(id, promotionSession);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改启用状态")
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, Integer status) {
int count = flashPromotionSessionService.updateStatus(id, status);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("删除场次")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = flashPromotionSessionService.delete(id);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取场次详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsFlashPromotionSession> getItem(@PathVariable Long id) {
SmsFlashPromotionSession promotionSession = flashPromotionSessionService.getItem(id);
return CommonResult.success(promotionSession);
}
@ApiOperation("获取全部场次")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<SmsFlashPromotionSession>> list() {
List<SmsFlashPromotionSession> promotionSessionList = flashPromotionSessionService.list();
return CommonResult.success(promotionSessionList);
}
@ApiOperation("获取全部可选场次及其数量")
@RequestMapping(value = "/selectList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<SmsFlashPromotionSessionDetail>> selectList(Long flashPromotionId) {
List<SmsFlashPromotionSessionDetail> promotionSessionList = flashPromotionSessionService.selectList(flashPromotionId);
return CommonResult.success(promotionSessionList);
}
}

@ -0,0 +1,87 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsHomeAdvertise;
import com.macro.mall.service.SmsHomeAdvertiseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 广Controller
* Created by macro on 2018/11/7.
*/
@Controller
@Api(tags = "SmsHomeAdvertiseController")
@Tag(name = "SmsHomeAdvertiseController", description = "首页轮播广告管理")
@RequestMapping("/home/advertise")
public class SmsHomeAdvertiseController {
@Autowired
private SmsHomeAdvertiseService advertiseService;
@ApiOperation("添加广告")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody SmsHomeAdvertise advertise) {
int count = advertiseService.create(advertise);
if (count > 0)
return CommonResult.success(count);
return CommonResult.failed();
}
@ApiOperation("删除广告")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = advertiseService.delete(ids);
if (count > 0)
return CommonResult.success(count);
return CommonResult.failed();
}
@ApiOperation("修改上下线状态")
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, Integer status) {
int count = advertiseService.updateStatus(id, status);
if (count > 0)
return CommonResult.success(count);
return CommonResult.failed();
}
@ApiOperation("获取广告详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<SmsHomeAdvertise> getItem(@PathVariable Long id) {
SmsHomeAdvertise advertise = advertiseService.getItem(id);
return CommonResult.success(advertise);
}
@ApiOperation("修改广告")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody SmsHomeAdvertise advertise) {
int count = advertiseService.update(id, advertise);
if (count > 0)
return CommonResult.success(count);
return CommonResult.failed();
}
@ApiOperation("分页查询广告")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeAdvertise>> list(@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "type", required = false) Integer type,
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsHomeAdvertise> advertiseList = advertiseService.list(name, type, endTime, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(advertiseList));
}
}

@ -0,0 +1,82 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsHomeBrand;
import com.macro.mall.service.SmsHomeBrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/11/6.
*/
@Controller
@Api(tags = "SmsHomeBrandController")
@Tag(name = "SmsHomeBrandController", description = "首页品牌管理")
@RequestMapping("/home/brand")
public class SmsHomeBrandController {
@Autowired
private SmsHomeBrandService homeBrandService;
@ApiOperation("添加首页推荐品牌")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsHomeBrand> homeBrandList) {
int count = homeBrandService.create(homeBrandList);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改推荐品牌排序")
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
int count = homeBrandService.updateSort(id, sort);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量删除推荐品牌")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = homeBrandService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量修改推荐品牌状态")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
int count = homeBrandService.updateRecommendStatus(ids, recommendStatus);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("分页查询推荐品牌")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeBrand>> list(@RequestParam(value = "brandName", required = false) String brandName,
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsHomeBrand> homeBrandList = homeBrandService.list(brandName, recommendStatus, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(homeBrandList));
}
}

@ -0,0 +1,82 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsHomeNewProduct;
import com.macro.mall.service.SmsHomeNewProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/11/6.
*/
@Controller
@Api(tags = "SmsHomeNewProductController")
@Tag(name = "SmsHomeNewProductController", description = "首页新品管理")
@RequestMapping("/home/newProduct")
public class SmsHomeNewProductController {
@Autowired
private SmsHomeNewProductService homeNewProductService;
@ApiOperation("添加首页新品")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsHomeNewProduct> homeNewProductList) {
int count = homeNewProductService.create(homeNewProductList);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改首页新品排序")
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
int count = homeNewProductService.updateSort(id, sort);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量删除首页新品")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = homeNewProductService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量修改首页新品状态")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
int count = homeNewProductService.updateRecommendStatus(ids, recommendStatus);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("分页查询首页新品")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeNewProduct>> list(@RequestParam(value = "productName", required = false) String productName,
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsHomeNewProduct> homeNewProductList = homeNewProductService.list(productName, recommendStatus, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(homeNewProductList));
}
}

@ -0,0 +1,82 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsHomeRecommendProduct;
import com.macro.mall.service.SmsHomeRecommendProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/11/6.
*/
@Controller
@Api(tags = "SmsHomeRecommendProductController")
@Tag(name = "SmsHomeRecommendProductController", description = "首页人气推荐管理")
@RequestMapping("/home/recommendProduct")
public class SmsHomeRecommendProductController {
@Autowired
private SmsHomeRecommendProductService recommendProductService;
@ApiOperation("添加首页推荐")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsHomeRecommendProduct> homeRecommendProductList) {
int count = recommendProductService.create(homeRecommendProductList);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改推荐排序")
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
int count = recommendProductService.updateSort(id, sort);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量删除推荐")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = recommendProductService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量修改推荐状态")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
int count = recommendProductService.updateRecommendStatus(ids, recommendStatus);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("分页查询推荐")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeRecommendProduct>> list(@RequestParam(value = "productName", required = false) String productName,
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsHomeRecommendProduct> homeRecommendProductList = recommendProductService.list(productName, recommendStatus, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(homeRecommendProductList));
}
}

@ -0,0 +1,82 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsHomeRecommendSubject;
import com.macro.mall.service.SmsHomeRecommendSubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/11/6.
*/
@Controller
@Api(tags = "SmsHomeRecommendSubjectController")
@Tag(name = "SmsHomeRecommendSubjectController", description = "首页专题推荐管理")
@RequestMapping("/home/recommendSubject")
public class SmsHomeRecommendSubjectController {
@Autowired
private SmsHomeRecommendSubjectService recommendSubjectService;
@ApiOperation("添加首页专题推荐")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody List<SmsHomeRecommendSubject> homeRecommendSubjectList) {
int count = recommendSubjectService.create(homeRecommendSubjectList);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改专题推荐排序")
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateSort(@PathVariable Long id, Integer sort) {
int count = recommendSubjectService.updateSort(id, sort);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量删除专题推荐")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = recommendSubjectService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量修改专题推荐状态")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
int count = recommendSubjectService.updateRecommendStatus(ids, recommendStatus);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("分页查询专题推荐")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<SmsHomeRecommendSubject>> list(@RequestParam(value = "subjectName", required = false) String subjectName,
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<SmsHomeRecommendSubject> homeRecommendSubjectList = recommendSubjectService.list(subjectName, recommendStatus, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(homeRecommendSubjectList));
}
}

@ -0,0 +1,207 @@
package com.macro.mall.controller;
import cn.hutool.core.collection.CollUtil;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.UmsAdminLoginParam;
import com.macro.mall.dto.UmsAdminParam;
import com.macro.mall.dto.UpdateAdminPasswordParam;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.UmsRole;
import com.macro.mall.service.UmsAdminService;
import com.macro.mall.service.UmsRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.security.Principal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Controller
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "UmsAdminController")
@Tag(name = "UmsAdminController", description = "后台用户管理")
@RequestMapping("/admin")
public class UmsAdminController {
@Value("${jwt.tokenHeader}")
private String tokenHeader;
@Value("${jwt.tokenHead}")
private String tokenHead;
@Autowired
private UmsAdminService adminService;
@Autowired
private UmsRoleService roleService;
@ApiOperation(value = "用户注册")
@RequestMapping(value = "/register", method = RequestMethod.POST)
@ResponseBody
public CommonResult<UmsAdmin> register(@Validated @RequestBody UmsAdminParam umsAdminParam) {
UmsAdmin umsAdmin = adminService.register(umsAdminParam);
if (umsAdmin == null) {
return CommonResult.failed();
}
return CommonResult.success(umsAdmin);
}
@ApiOperation(value = "登录以后返回token")
@RequestMapping(value = "/login", method = RequestMethod.POST)
@ResponseBody
public CommonResult login(@Validated @RequestBody UmsAdminLoginParam umsAdminLoginParam) {
String token = adminService.login(umsAdminLoginParam.getUsername(), umsAdminLoginParam.getPassword());
if (token == null) {
return CommonResult.validateFailed("用户名或密码错误");
}
Map<String, String> tokenMap = new HashMap<>();
tokenMap.put("token", token);
tokenMap.put("tokenHead", tokenHead);
return CommonResult.success(tokenMap);
}
@ApiOperation(value = "刷新token")
@RequestMapping(value = "/refreshToken", method = RequestMethod.GET)
@ResponseBody
public CommonResult refreshToken(HttpServletRequest request) {
String token = request.getHeader(tokenHeader);
String refreshToken = adminService.refreshToken(token);
if (refreshToken == null) {
return CommonResult.failed("token已经过期");
}
Map<String, String> tokenMap = new HashMap<>();
tokenMap.put("token", refreshToken);
tokenMap.put("tokenHead", tokenHead);
return CommonResult.success(tokenMap);
}
@ApiOperation(value = "获取当前登录用户信息")
@RequestMapping(value = "/info", method = RequestMethod.GET)
@ResponseBody
public CommonResult getAdminInfo(Principal principal) {
if(principal==null){
return CommonResult.unauthorized(null);
}
String username = principal.getName();
UmsAdmin umsAdmin = adminService.getAdminByUsername(username);
Map<String, Object> data = new HashMap<>();
data.put("username", umsAdmin.getUsername());
data.put("menus", roleService.getMenuList(umsAdmin.getId()));
data.put("icon", umsAdmin.getIcon());
List<UmsRole> roleList = adminService.getRoleList(umsAdmin.getId());
if(CollUtil.isNotEmpty(roleList)){
List<String> roles = roleList.stream().map(UmsRole::getName).collect(Collectors.toList());
data.put("roles",roles);
}
return CommonResult.success(data);
}
@ApiOperation(value = "登出功能")
@RequestMapping(value = "/logout", method = RequestMethod.POST)
@ResponseBody
public CommonResult logout(Principal principal) {
adminService.logout(principal.getName());
return CommonResult.success(null);
}
@ApiOperation("根据用户名或姓名分页获取用户列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsAdmin>> list(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<UmsAdmin> adminList = adminService.list(keyword, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(adminList));
}
@ApiOperation("获取指定用户信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<UmsAdmin> getItem(@PathVariable Long id) {
UmsAdmin admin = adminService.getItem(id);
return CommonResult.success(admin);
}
@ApiOperation("修改指定用户信息")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody UmsAdmin admin) {
int count = adminService.update(id, admin);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改指定用户密码")
@RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
@ResponseBody
public CommonResult updatePassword(@Validated @RequestBody UpdateAdminPasswordParam updatePasswordParam) {
int status = adminService.updatePassword(updatePasswordParam);
if (status > 0) {
return CommonResult.success(status);
} else if (status == -1) {
return CommonResult.failed("提交参数不合法");
} else if (status == -2) {
return CommonResult.failed("找不到该用户");
} else if (status == -3) {
return CommonResult.failed("旧密码错误");
} else {
return CommonResult.failed();
}
}
@ApiOperation("删除指定用户信息")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = adminService.delete(id);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改帐号状态")
@RequestMapping(value = "/updateStatus/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id,@RequestParam(value = "status") Integer status) {
UmsAdmin umsAdmin = new UmsAdmin();
umsAdmin.setStatus(status);
int count = adminService.update(id,umsAdmin);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("给用户分配角色")
@RequestMapping(value = "/role/update", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateRole(@RequestParam("adminId") Long adminId,
@RequestParam("roleIds") List<Long> roleIds) {
int count = adminService.updateRole(adminId, roleIds);
if (count >= 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取指定用户的角色")
@RequestMapping(value = "/role/{adminId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsRole>> getRoleList(@PathVariable Long adminId) {
List<UmsRole> roleList = adminService.getRoleList(adminId);
return CommonResult.success(roleList);
}
}

@ -0,0 +1,37 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.UmsMemberLevel;
import com.macro.mall.service.UmsMemberLevelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* Controller
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "UmsMemberLevelController")
@Tag(name = "UmsMemberLevelController", description = "会员等级管理")
@RequestMapping("/memberLevel")
public class UmsMemberLevelController {
@Autowired
private UmsMemberLevelService memberLevelService;
@ApiOperation("查询所有会员等级")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsMemberLevel>> list(@RequestParam("defaultStatus") Integer defaultStatus) {
List<UmsMemberLevel> memberLevelList = memberLevelService.list(defaultStatus);
return CommonResult.success(memberLevelList);
}
}

@ -0,0 +1,104 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.UmsMenuNode;
import com.macro.mall.model.UmsMenu;
import com.macro.mall.service.UmsMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2020/2/4.
*/
@Controller
@Api(tags = "UmsMenuController")
@Tag(name = "UmsMenuController", description = "后台菜单管理")
@RequestMapping("/menu")
public class UmsMenuController {
@Autowired
private UmsMenuService menuService;
@ApiOperation("添加后台菜单")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsMenu umsMenu) {
int count = menuService.create(umsMenu);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改后台菜单")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@RequestBody UmsMenu umsMenu) {
int count = menuService.update(id, umsMenu);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("根据ID获取菜单详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<UmsMenu> getItem(@PathVariable Long id) {
UmsMenu umsMenu = menuService.getItem(id);
return CommonResult.success(umsMenu);
}
@ApiOperation("根据ID删除后台菜单")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = menuService.delete(id);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("分页查询后台菜单")
@RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsMenu>> list(@PathVariable Long parentId,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<UmsMenu> menuList = menuService.list(parentId, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(menuList));
}
@ApiOperation("树形结构返回所有菜单列表")
@RequestMapping(value = "/treeList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsMenuNode>> treeList() {
List<UmsMenuNode> list = menuService.treeList();
return CommonResult.success(list);
}
@ApiOperation("修改菜单显示状态")
@RequestMapping(value = "/updateHidden/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateHidden(@PathVariable Long id, @RequestParam("hidden") Integer hidden) {
int count = menuService.updateHidden(id, hidden);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
}

@ -0,0 +1,71 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.UmsResourceCategory;
import com.macro.mall.service.UmsResourceCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2020/2/5.
*/
@Controller
@Api(tags = "UmsResourceCategoryController")
@Tag(name = "UmsResourceCategoryController", description = "后台资源分类管理")
@RequestMapping("/resourceCategory")
public class UmsResourceCategoryController {
@Autowired
private UmsResourceCategoryService resourceCategoryService;
@ApiOperation("查询所有后台资源分类")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsResourceCategory>> listAll() {
List<UmsResourceCategory> resourceList = resourceCategoryService.listAll();
return CommonResult.success(resourceList);
}
@ApiOperation("添加后台资源分类")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsResourceCategory umsResourceCategory) {
int count = resourceCategoryService.create(umsResourceCategory);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改后台资源分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@RequestBody UmsResourceCategory umsResourceCategory) {
int count = resourceCategoryService.update(id, umsResourceCategory);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("根据ID删除后台资源分类")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = resourceCategoryService.delete(id);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
}

@ -0,0 +1,99 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.UmsResource;
import com.macro.mall.security.component.DynamicSecurityMetadataSource;
import com.macro.mall.service.UmsResourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2020/2/4.
*/
@Controller
@Api(tags = "UmsResourceController")
@Tag(name = "UmsResourceController", description = "后台资源管理")
@RequestMapping("/resource")
public class UmsResourceController {
@Autowired
private UmsResourceService resourceService;
@Autowired
private DynamicSecurityMetadataSource dynamicSecurityMetadataSource;
@ApiOperation("添加后台资源")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsResource umsResource) {
int count = resourceService.create(umsResource);
dynamicSecurityMetadataSource.clearDataSource();
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改后台资源")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@RequestBody UmsResource umsResource) {
int count = resourceService.update(id, umsResource);
dynamicSecurityMetadataSource.clearDataSource();
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("根据ID获取资源详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<UmsResource> getItem(@PathVariable Long id) {
UmsResource umsResource = resourceService.getItem(id);
return CommonResult.success(umsResource);
}
@ApiOperation("根据ID删除后台资源")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = resourceService.delete(id);
dynamicSecurityMetadataSource.clearDataSource();
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("分页模糊查询后台资源")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsResource>> list(@RequestParam(required = false) Long categoryId,
@RequestParam(required = false) String nameKeyword,
@RequestParam(required = false) String urlKeyword,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<UmsResource> resourceList = resourceService.list(categoryId,nameKeyword, urlKeyword, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(resourceList));
}
@ApiOperation("查询所有后台资源")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsResource>> listAll() {
List<UmsResource> resourceList = resourceService.listAll();
return CommonResult.success(resourceList);
}
}

@ -0,0 +1,124 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.*;
import com.macro.mall.service.UmsRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Controller
* Created by macro on 2018/9/30.
*/
@Controller
@Api(tags = "UmsRoleController")
@Tag(name = "UmsRoleController", description = "后台用户角色管理")
@RequestMapping("/role")
public class UmsRoleController {
@Autowired
private UmsRoleService roleService;
@ApiOperation("添加角色")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsRole role) {
int count = roleService.create(role);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("修改角色")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody UmsRole role) {
int count = roleService.update(id, role);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("批量删除角色")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = roleService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取所有角色")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsRole>> listAll() {
List<UmsRole> roleList = roleService.list();
return CommonResult.success(roleList);
}
@ApiOperation("根据角色名称分页获取角色列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsRole>> list(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<UmsRole> roleList = roleService.list(keyword, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(roleList));
}
@ApiOperation("修改角色状态")
@RequestMapping(value = "/updateStatus/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, @RequestParam(value = "status") Integer status) {
UmsRole umsRole = new UmsRole();
umsRole.setStatus(status);
int count = roleService.update(id, umsRole);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取角色相关菜单")
@RequestMapping(value = "/listMenu/{roleId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsMenu>> listMenu(@PathVariable Long roleId) {
List<UmsMenu> roleList = roleService.listMenu(roleId);
return CommonResult.success(roleList);
}
@ApiOperation("获取角色相关资源")
@RequestMapping(value = "/listResource/{roleId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsResource>> listResource(@PathVariable Long roleId) {
List<UmsResource> roleList = roleService.listResource(roleId);
return CommonResult.success(roleList);
}
@ApiOperation("给角色分配菜单")
@RequestMapping(value = "/allocMenu", method = RequestMethod.POST)
@ResponseBody
public CommonResult allocMenu(@RequestParam Long roleId, @RequestParam List<Long> menuIds) {
int count = roleService.allocMenu(roleId, menuIds);
return CommonResult.success(count);
}
@ApiOperation("给角色分配资源")
@RequestMapping(value = "/allocResource", method = RequestMethod.POST)
@ResponseBody
public CommonResult allocResource(@RequestParam Long roleId, @RequestParam List<Long> resourceIds) {
int count = roleService.allocResource(roleId, resourceIds);
return CommonResult.success(count);
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save