Compare commits
71 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eda1e841bb | ||
|
|
9de55088ea | ||
|
|
d4642d85dd | ||
|
|
a9c79eedd4 | ||
|
|
ac5d04ddc2 | ||
|
|
caacb9e201 | ||
|
|
844bff971f | ||
|
|
9ee5b4515a | ||
|
|
2246b498d9 | ||
|
|
93e4998b87 | ||
|
|
a360fd2eda | ||
|
|
e0ca366431 | ||
|
|
3d3be0b283 | ||
|
|
86f010b87e | ||
|
|
d29d166ce0 | ||
|
|
3c78a06008 | ||
|
|
b6a5630021 | ||
|
|
560ab5f102 | ||
|
|
da1b2c3aa8 | ||
|
|
7db5690a26 | ||
|
|
a1fcadf8b2 | ||
|
|
8302ca2e3a | ||
|
|
17b977ef94 | ||
|
|
512a298cc9 | ||
|
|
86625e9e9d | ||
|
|
a599fb9d01 | ||
|
|
89b057dfca | ||
|
|
18d2379a19 | ||
|
|
3e73257922 | ||
|
|
9e240f22b6 | ||
|
|
6aadd00e45 | ||
|
|
5fc962b29d | ||
|
|
00e93c91f5 | ||
|
|
a903160305 | ||
|
|
cd2942a96b | ||
|
|
6235faba96 | ||
|
|
6e7254e765 | ||
|
|
e338229902 | ||
|
|
9ff40291ee | ||
|
|
4c8375e861 | ||
|
|
acc40dc6fc | ||
|
|
177cd86366 | ||
|
|
d06b5ceb89 | ||
|
|
6926cd583d | ||
|
|
de2777e244 | ||
|
|
c10b698aed | ||
|
|
256d9e240e | ||
|
|
eedea676aa | ||
|
|
92c3c21e32 | ||
|
|
bd13a9b150 | ||
|
|
931276f72b | ||
|
|
e38f9aa2ff | ||
|
|
696e075fcd | ||
|
|
d25ba76094 | ||
|
|
cce14b4794 | ||
|
|
f6706d6394 | ||
|
|
7e3a9eb904 | ||
|
|
079437100d | ||
|
|
d7ce709ce6 | ||
|
|
cff2b95c48 | ||
|
|
1a77b3cec7 | ||
|
|
346465630c | ||
|
|
23388eff6b | ||
|
|
800437473d | ||
|
|
46f216c191 | ||
|
|
a60a535708 | ||
|
|
888b5e2558 | ||
|
|
1431d990f9 | ||
|
|
f509b8745d | ||
|
|
c1b9f287c7 | ||
|
|
3ee3e49d0b |
208
README.md
208
README.md
@@ -1,34 +1,37 @@
|
|||||||
## Lilishop B2B2C商城系统
|
## 🔥Lilishop B2B2C商城系统
|
||||||
|
|
||||||
|
##### 🌹官方公众号 & 开源不易,如有帮助请点Star
|
||||||
|
|
||||||
|
##### 官方qq群 961316482,官方公众号/小程序体验,扫描二维码
|
||||||
|
|
||||||
##### 官方公众号 & 开源不易,如有帮助请点Star
|
|
||||||

|

|
||||||
|
|
||||||
[](https://gitee.com/beijing_hongye_huicheng/lilishop/stargazers)
|
[](https://gitee.com/beijing_hongye_huicheng/lilishop/stargazers)
|
||||||
|

|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
### 介绍
|
### 🔥介绍
|
||||||
**官网**:https://pickmall.cn
|
**官网**:https://pickmall.cn
|
||||||
|
|
||||||
Lilishop 是一款Java开发,基于SpringBoot研发的B2B2C多用户商城,前端使用 Vue、uniapp开发 **系统全端全部代码开源**
|
Lilishop 基于SpringBoot研发的B2B2C多用户商城系统,前端使用 Vue、uniapp开发 **系统全端全部代码开源**
|
||||||
|
|
||||||
|
业务兼容O2O商城/B2B商城/B2B2C商城/F2B2C商城/S2B2C商城。支持小程序商城、H5商城、APP商城、 PC商城。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
产品前后端分离、支持分布式部署。
|
产品前后端分离、支持分布式部署。
|
||||||
|
|
||||||
商城展示端包含 PC、H5、微信小程序、APP。
|
|
||||||
|
|
||||||
商城包含 会员模块、**第三方登录模块**、**第三方支付模块**、**楼层装修模块**、订单模块、分销模块、文章模块、系统设置模块、流量分析模块
|
商城包含 会员模块、**第三方登录模块**、**第三方支付模块**、**楼层装修模块**、订单模块、分销模块、文章模块、系统设置模块、流量分析模块
|
||||||
|
|
||||||
系统包含各种中间件、搜索引擎、多级缓存、分布式事务、分布式任务调度等,支持Docker,支持k8s。是一款高性能,支持高并发等商城系统。
|
系统包含各种中间件、搜索引擎、多级缓存、分布式事务、分布式任务调度等,支持Docker,支持k8s。是一款高性能,支持高并发等商城系统。
|
||||||
|
|
||||||
开箱即用,简单配置即可部署一套属于您的系统。
|
|
||||||
|
|
||||||
### 文档
|
|
||||||
|
|
||||||
**产品文档**(需求、架构、使用、部署、开发):https://docs.pickmall.cn
|
### ☃️文档
|
||||||
**功能清单** 功能列表:https://docs.qq.com/sheet/DQ1Z2dWJKUnBRZEt5
|
|
||||||
|
|
||||||
### 项目链接(gitee)
|
**产品文档**:https://docs.pickmall.cn
|
||||||
|
|
||||||
|
### 💧项目链接(gitee)
|
||||||
|
|
||||||
**Java后台**:https://gitee.com/beijing_hongye_huicheng/lilishop.git
|
**Java后台**:https://gitee.com/beijing_hongye_huicheng/lilishop.git
|
||||||
|
|
||||||
@@ -38,7 +41,7 @@ Lilishop 是一款Java开发,基于SpringBoot研发的B2B2C多用户商城,
|
|||||||
|
|
||||||
**docker一键部署**:https://gitee.com/beijing_hongye_huicheng/docker.git
|
**docker一键部署**:https://gitee.com/beijing_hongye_huicheng/docker.git
|
||||||
|
|
||||||
### 项目链接(github)
|
### 💧项目链接(github)
|
||||||
|
|
||||||
**Java后台**:https://github.com/hongyehuicheng/lilishop.git
|
**Java后台**:https://github.com/hongyehuicheng/lilishop.git
|
||||||
|
|
||||||
@@ -48,42 +51,27 @@ Lilishop 是一款Java开发,基于SpringBoot研发的B2B2C多用户商城,
|
|||||||
|
|
||||||
**docker一键部署**:https://github.com/hongyehuicheng/docker.git
|
**docker一键部署**:https://github.com/hongyehuicheng/docker.git
|
||||||
|
|
||||||
### 演示地址
|
### 💧演示地址(手机验证码为 ‘111111’)
|
||||||
|
|
||||||
**运营后台**:https://admin-b2b2c.pickmall.cn 账号:admin/123456
|
**运营后台**:https://admin-b2b2c.pickmall.cn 账号:admin/123456
|
||||||
|
|
||||||
**店铺后台**:https://store-b2b2c.pickmall.cn 账号:13011111111/111111
|
**店铺后台**:https://store-b2b2c.pickmall.cn 账号:13011111111/111111
|
||||||
|
|
||||||
**用户前台**:https://pc-b2b2c.pickmall.cn
|
**PC**:https://pc-b2b2c.pickmall.cn
|
||||||
|
|
||||||
**移动端**:https://m-b2b2c.pickmall.cn
|
**WAP**:https://m-b2b2c.pickmall.cn
|
||||||
|
|
||||||
|
**小程序/公众号**:扫描二维码
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 3行命令搭建本地环境
|
### 🚙3行命令搭建本地环境
|
||||||
|
|
||||||
温馨提示:由于服务较多,如果笔记本环境启动内存没有32g可能无法启动成功(macbookpro 2020 16g内存启动无法成功),台式机在16g内存、AMD 3700x 的ubuntu系统成功运行。
|
温馨提示:由于服务中间件较多,如果笔记本环境启动内存没有32g可能无法启动成功(macbookpro 2020 16g内存启动无法成功),台式机在16g内存、AMD 3700x 的ubuntu系统成功运行。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### docker环境安装(已安装的用户可跳过)
|
##### docker环境安装 [点击跳转](https://docs.pickmall.cn/deploy/%E4%B8%80%E9%94%AE%E9%83%A8%E7%BD%B2.html)
|
||||||
```shell
|
|
||||||
#安装依赖
|
|
||||||
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
|
|
||||||
#设置源
|
|
||||||
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
|
|
||||||
sudo yum makecache fast
|
|
||||||
#安装docker
|
|
||||||
sudo yum install docker-ce
|
|
||||||
#启动服务
|
|
||||||
sudo systemctl start docker
|
|
||||||
#安装docker-compose
|
|
||||||
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
|
|
||||||
#授权
|
|
||||||
sudo chmod +x /usr/local/bin/docker-compose
|
|
||||||
#检测版本号
|
|
||||||
docker-compose -v
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -98,39 +86,39 @@ docker-compose -v
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_hongye_huicheng/docker/tree/master/init/mysql
|
PS:单独部署的话,商城数据库文件访问这里:https://gitee.com/beijing_hongye_huicheng/docker/tree/master/init/mysql
|
||||||
|
|
||||||
##### 各个地址
|
##### 商城部署后 API/UI 地址
|
||||||
|
|
||||||
| API | 地址 |
|
| API | 地址 |
|
||||||
| -------------- | --------------- |
|
| -------------- | --------------- |
|
||||||
| 买家API | http://127.0.0.1:8888 |
|
| 商城买家API | http://127.0.0.1:8888 |
|
||||||
| 商家API | http://127.0.0.1:8889 |
|
| 商城商家API | http://127.0.0.1:8889 |
|
||||||
| 管理端API | http://127.0.0.1:8887 |
|
| 商城管理端API | http://127.0.0.1:8887 |
|
||||||
| 通用API | http://127.0.0.1:8890 |
|
| 商城基础API | http://127.0.0.1:8890 |
|
||||||
|
|
||||||
| 前端演示 | 地址 |
|
| 前端演示 | 地址 |
|
||||||
| -------------- | --------------- |
|
| -------------- | --------------- |
|
||||||
| PC | http://127.0.0.1:10000 |
|
| 商城PC端 | http://127.0.0.1:10000 |
|
||||||
| WAP | http://127.0.0.1:10001 |
|
| 商城WAP端 | http://127.0.0.1:10001 |
|
||||||
| 商家 | http://127.0.0.1:10002 |
|
| 商城卖家端 | http://127.0.0.1:10002 |
|
||||||
| 管理端 | http://127.0.0.1:10003 |
|
| 商城管理端 | http://127.0.0.1:10003 |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 功能列表
|
### ⚾️功能列表
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### 平台功能
|
#### 🥎商城平台功能
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### 商家端功能
|
#### 🥎商城卖家功能
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -138,28 +126,28 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 功能展示
|
### 🧩商城前端功能展示
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### 移动端
|
#### ⚽️商城移动端
|
||||||
|
|
||||||
<img src="https://pickmall.cn/assets/imgs/other/app.gif" alt="移动端功能展示" style="zoom:50%;" />
|
<img src="https://pickmall.cn/assets/imgs/other/app.gif" alt="移动端功能展示" style="zoom:50%;" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### 管理端
|
#### ⚽️商城管理端
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
### 技术选型
|
### 商城技术选型
|
||||||
|
|
||||||
#### 架构图
|
#### 🥅架构图
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
##### Java后台
|
##### 🕹后台技术选型
|
||||||
|
|
||||||
| 说明 | 框架 | 说明 | |
|
| 说明 | 框架 | 说明 | |
|
||||||
| -------------- | --------------- | -------------- | ------------- |
|
| -------------- | --------------- | -------------- | ------------- |
|
||||||
@@ -173,7 +161,7 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_
|
|||||||
| 短信 | 阿里云短信 | 认证 | JWT |
|
| 短信 | 阿里云短信 | 认证 | JWT |
|
||||||
| 日志处理 | Log4j | 接口规范 | RESTful |
|
| 日志处理 | Log4j | 接口规范 | RESTful |
|
||||||
|
|
||||||
##### 前端-运营后台、店铺后台
|
##### 🖥前端-运营后台、店铺后台
|
||||||
|
|
||||||
| 说明 | 框架 | 说明 | 框架 |
|
| 说明 | 框架 | 说明 | 框架 |
|
||||||
| ---------- | ---------- | ---------- | ------- |
|
| ---------- | ---------- | ---------- | ------- |
|
||||||
@@ -183,115 +171,23 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_
|
|||||||
| 基础UI库 | iView | UI界面基于 | iView |
|
| 基础UI库 | iView | UI界面基于 | iView |
|
||||||
| 网络请求 | axios | | |
|
| 网络请求 | axios | | |
|
||||||
|
|
||||||
##### 前端-移动端
|
##### 📱前端-移动端
|
||||||
|
|
||||||
| 说明 | 架构 | 说明 | 架构 |
|
| 说明 | 架构 | 说明 | 架构 |
|
||||||
| --------- | ------- | -------- | ------- |
|
| --------- | ------- | -------- | ------- |
|
||||||
| 基础UI库 | uViewui | 基础框架 | uni-app |
|
| 基础UI库 | uViewui | 基础框架 | uni-app |
|
||||||
| CSS预处理 | scss | 地图引擎 | amap |
|
| CSS预处理 | scss | 地图引擎 | amap |
|
||||||
|
|
||||||
### 升级计划
|
### 🌟版本升级
|
||||||
|
|
||||||
#### 计划每个月发布一个版本,具体时间可能有出入
|
|
||||||
|
|
||||||
时间:2021年7月15日
|
|
||||||
|
|
||||||
```
|
```
|
||||||
新增功能:
|
商城后续会持续版本升级,修复bug,完善功能,覆盖更多业务场景 o2o/b2b/s2b2b2c/跨境电商
|
||||||
1.积分商城
|
|
||||||
2.店铺移动端
|
后续会考虑推出微服务商城系统/中台商城等
|
||||||
3.店铺支持发货单
|
|
||||||
4.供求单
|
|
||||||
5.店铺自提点
|
|
||||||
6.移动端展示附近店铺
|
|
||||||
7.开屏广告
|
|
||||||
8.会员站内消息
|
|
||||||
9.移动端店铺入驻
|
|
||||||
功能优化:
|
|
||||||
1.用户分享商城、关注店铺、邀请新用户可获取积分、经验值。
|
|
||||||
2.隐私管理功能
|
|
||||||
2.移动端店铺首页优化
|
|
||||||
```
|
```
|
||||||
|
|
||||||
时间:2021年8月16日
|
|
||||||
|
|
||||||
```
|
### ⚠️开源须知
|
||||||
新增功能:
|
|
||||||
1.微淘功能
|
|
||||||
2.相册管理功能
|
|
||||||
3.店铺申请品牌
|
|
||||||
4.第三方商品导入(淘宝、99api)
|
|
||||||
5.用户等级
|
|
||||||
6.用户升级会员
|
|
||||||
7.会员权益
|
|
||||||
8.促销活动:第二件*折
|
|
||||||
9.促销活动:商品打包价
|
|
||||||
10.促销活动:商品组合购
|
|
||||||
11.促销活动:进店赠券
|
|
||||||
12.代客退单
|
|
||||||
功能优化:
|
|
||||||
1.批量上传商品分类
|
|
||||||
2.店铺维护开票项目
|
|
||||||
3.店铺展示营销中心
|
|
||||||
```
|
|
||||||
|
|
||||||
时间:2021年9月15日
|
|
||||||
|
|
||||||
```
|
|
||||||
新增功能:
|
|
||||||
1.增加供应商功能
|
|
||||||
2.商品预售
|
|
||||||
3.商品预约
|
|
||||||
4.电子券码
|
|
||||||
5.企业会员
|
|
||||||
6.企业会员购
|
|
||||||
7.商品批发价
|
|
||||||
功能优化:
|
|
||||||
1.店铺运费模板支持按照体积计算
|
|
||||||
2.店铺支持自定义移动端首页
|
|
||||||
```
|
|
||||||
|
|
||||||
### 版本升级
|
|
||||||
|
|
||||||
```
|
|
||||||
后续会持续版本升级,修复bug,完善功能,覆盖更多业务场景 o2o/b2b/s2b2b2c/跨境电商
|
|
||||||
|
|
||||||
后续会考虑推出微服务/中台等 企业级版本
|
|
||||||
```
|
|
||||||
|
|
||||||
### 技术亮点
|
|
||||||
|
|
||||||
|
|
||||||
1.后端框架基于Springboot,构建基于maven,持久层使用MyBatisPlus。使用elasticsearch、redis、mongodb、rocketmq 等各种中间健。都是主流架构,轻松应对各种环境。
|
|
||||||
|
|
||||||
2.支持集群、分布式,支持docker 轻松部署,解决各种复杂场景!
|
|
||||||
|
|
||||||
3.代码模块清晰,主要分为三端api(买家、卖家、管理),各端API互相隔离,自己鉴权,自己操作业务。
|
|
||||||
|
|
||||||
4.使用阿里开源的RocketMQ,基于mq解决各种并发场景,解决事务一致性,解决搞并发延迟场景问题。
|
|
||||||
|
|
||||||
5.项目使用多级缓存,应用不同场景,redis缓存业务数据、mongodb缓存关系型多对多关系问题、nginx缓存高频访问低频修改的页面。
|
|
||||||
|
|
||||||
6.支持各种联合登陆,支持各种客户端的支付问题,灵活配置灵活开启。
|
|
||||||
|
|
||||||
7.内置完善的楼层装修机制,各种拖拉拽,维护跳转页面或外网,即便是一个什么都不懂的运营也可以轻松掌握。
|
|
||||||
|
|
||||||
8.内置阿里短信接口,可以在线申请短信模版。内置阿里oss系统,可以对文件执行各种操作。oss商家端资源相互隔离。
|
|
||||||
|
|
||||||
10.强大的统计报表,统计效果,可以实现各个场景,包含在线人数,历史在线人数,活跃人数等信息。
|
|
||||||
|
|
||||||
11.标准Api接口、提供swagger文档,快速二开。
|
|
||||||
|
|
||||||
12.分布式调度任务中心,解决分布式定时任务多次执行问题。
|
|
||||||
|
|
||||||
13.代码注释完善,快速上手。
|
|
||||||
|
|
||||||
14.非移动端采用IView框架,各种自定义插件、选择器实现。移动端采用uniapp,一次编写,全端使用
|
|
||||||
|
|
||||||
15.已经对接好各种第三方插件,支持各种复杂等联合登陆,联合支付等场景。
|
|
||||||
|
|
||||||
|
|
||||||
### 开源须知
|
|
||||||
1.仅允许用于个人学习研究使用.
|
1.仅允许用于个人学习研究使用.
|
||||||
|
|
||||||
2.禁止将本开源的代码和资源进行任何形式任何名义的出售.
|
2.禁止将本开源的代码和资源进行任何形式任何名义的出售.
|
||||||
@@ -301,7 +197,7 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_
|
|||||||
4.限制商用,如果需要商业使用请联系我们。QQ3409056806.
|
4.限制商用,如果需要商业使用请联系我们。QQ3409056806.
|
||||||
|
|
||||||
|
|
||||||
### 交流群
|
### 🐧交流群
|
||||||
|
|
||||||
**QQ群**:961316482
|
**QQ群**:961316482
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cn.lili</groupId>
|
<groupId>cn.lili</groupId>
|
||||||
<artifactId>lili-shop-parent</artifactId>
|
<artifactId>lili-shop-parent</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>${revision}</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>admin</artifactId>
|
<artifactId>admin</artifactId>
|
||||||
@@ -15,7 +16,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.codecentric</groupId>
|
<groupId>de.codecentric</groupId>
|
||||||
<artifactId>spring-boot-admin-starter-server</artifactId>
|
<artifactId>spring-boot-admin-starter-server</artifactId>
|
||||||
<version>2.3.1</version>
|
<version>${spring-boot-admin}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
@@ -3,21 +3,19 @@
|
|||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<properties>
|
|
||||||
<enjoy.version>4.3</enjoy.version>
|
|
||||||
</properties>
|
|
||||||
<artifactId>buyer-api</artifactId>
|
<artifactId>buyer-api</artifactId>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>cn.lili</groupId>
|
<groupId>cn.lili</groupId>
|
||||||
<artifactId>lili-shop-parent</artifactId>
|
<artifactId>lili-shop-parent</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>${revision}</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.lili</groupId>
|
<groupId>cn.lili</groupId>
|
||||||
<artifactId>framework</artifactId>
|
<artifactId>framework</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -36,11 +36,16 @@ public class MemberCollectionController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private StoreCollectionService storeCollectionService;
|
private StoreCollectionService storeCollectionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品收藏关键字
|
||||||
|
*/
|
||||||
|
private String goods="GOODS";
|
||||||
|
|
||||||
@ApiOperation(value = "查询会员收藏列表")
|
@ApiOperation(value = "查询会员收藏列表")
|
||||||
@ApiImplicitParam(name = "type", value = "类型", dataType = "String", paramType = "path", example = "GOODS:商品,STORE:店铺")
|
@ApiImplicitParam(name = "type", value = "类型", dataType = "String", paramType = "path", example = "GOODS:商品,STORE:店铺")
|
||||||
@GetMapping("/{type}")
|
@GetMapping("/{type}")
|
||||||
public ResultMessage<Object> goodsList(@PathVariable String type, PageVO page) {
|
public ResultMessage<Object> goodsList(@PathVariable String type, PageVO page) {
|
||||||
if (type.equals("GOODS")) {
|
if (goods.equals(type)) {
|
||||||
return ResultUtil.data(goodsCollectionService.goodsCollection(page));
|
return ResultUtil.data(goodsCollectionService.goodsCollection(page));
|
||||||
}
|
}
|
||||||
return ResultUtil.data(storeCollectionService.storeCollection(page));
|
return ResultUtil.data(storeCollectionService.storeCollection(page));
|
||||||
@@ -54,7 +59,7 @@ public class MemberCollectionController {
|
|||||||
@PostMapping("/add/{type}/{id}")
|
@PostMapping("/add/{type}/{id}")
|
||||||
public ResultMessage<Object> addGoodsCollection(@PathVariable String type,
|
public ResultMessage<Object> addGoodsCollection(@PathVariable String type,
|
||||||
@NotNull(message = "值不能为空") @PathVariable String id) {
|
@NotNull(message = "值不能为空") @PathVariable String id) {
|
||||||
if (type.equals("GOODS")) {
|
if (goods.equals(type)) {
|
||||||
return ResultUtil.data(goodsCollectionService.addGoodsCollection(id));
|
return ResultUtil.data(goodsCollectionService.addGoodsCollection(id));
|
||||||
}
|
}
|
||||||
return ResultUtil.data(storeCollectionService.addStoreCollection(id));
|
return ResultUtil.data(storeCollectionService.addStoreCollection(id));
|
||||||
@@ -69,7 +74,7 @@ public class MemberCollectionController {
|
|||||||
@DeleteMapping(value = "/delete/{type}/{id}")
|
@DeleteMapping(value = "/delete/{type}/{id}")
|
||||||
public ResultMessage<Object> deleteGoodsCollection(@PathVariable String type,
|
public ResultMessage<Object> deleteGoodsCollection(@PathVariable String type,
|
||||||
@NotNull(message = "值不能为空") @PathVariable String id) {
|
@NotNull(message = "值不能为空") @PathVariable String id) {
|
||||||
if (type.equals("GOODS")) {
|
if (goods.equals(type)) {
|
||||||
return ResultUtil.data(goodsCollectionService.deleteGoodsCollection(id));
|
return ResultUtil.data(goodsCollectionService.deleteGoodsCollection(id));
|
||||||
}
|
}
|
||||||
return ResultUtil.data(storeCollectionService.deleteStoreCollection(id));
|
return ResultUtil.data(storeCollectionService.deleteStoreCollection(id));
|
||||||
@@ -83,7 +88,7 @@ public class MemberCollectionController {
|
|||||||
@GetMapping(value = "/isCollection/{type}/{id}")
|
@GetMapping(value = "/isCollection/{type}/{id}")
|
||||||
public ResultMessage<Boolean> isCollection(@PathVariable String type,
|
public ResultMessage<Boolean> isCollection(@PathVariable String type,
|
||||||
@NotNull(message = "值不能为空") @PathVariable String id) {
|
@NotNull(message = "值不能为空") @PathVariable String id) {
|
||||||
if (type.equals("GOODS")) {
|
if (goods.equals(type)) {
|
||||||
return ResultUtil.data(this.goodsCollectionService.isCollection(id));
|
return ResultUtil.data(this.goodsCollectionService.isCollection(id));
|
||||||
}
|
}
|
||||||
return ResultUtil.data(this.storeCollectionService.isCollection(id));
|
return ResultUtil.data(this.storeCollectionService.isCollection(id));
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ public class MemberWithdrawApplyBuyerController {
|
|||||||
public ResultMessage<IPage<MemberWithdrawApply>> getByPage(PageVO page, MemberWithdrawApplyQueryVO memberWithdrawApplyQueryVO) {
|
public ResultMessage<IPage<MemberWithdrawApply>> getByPage(PageVO page, MemberWithdrawApplyQueryVO memberWithdrawApplyQueryVO) {
|
||||||
memberWithdrawApplyQueryVO.setMemberId(UserContext.getCurrentUser().getId());
|
memberWithdrawApplyQueryVO.setMemberId(UserContext.getCurrentUser().getId());
|
||||||
//构建查询 返回数据
|
//构建查询 返回数据
|
||||||
IPage<MemberWithdrawApply> memberWithdrawApplyIPage = memberWithdrawApplyService.getMemberWithdrawPage(page, memberWithdrawApplyQueryVO);
|
IPage<MemberWithdrawApply> memberWithdrawApplyPage = memberWithdrawApplyService.getMemberWithdrawPage(page, memberWithdrawApplyQueryVO);
|
||||||
return ResultUtil.data(memberWithdrawApplyIPage);
|
return ResultUtil.data(memberWithdrawApplyPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package cn.lili.controller.other.broadcast;
|
|||||||
import cn.lili.common.enums.ResultUtil;
|
import cn.lili.common.enums.ResultUtil;
|
||||||
import cn.lili.common.vo.PageVO;
|
import cn.lili.common.vo.PageVO;
|
||||||
import cn.lili.common.vo.ResultMessage;
|
import cn.lili.common.vo.ResultMessage;
|
||||||
import cn.lili.modules.broadcast.entity.dos.Studio;
|
import cn.lili.modules.goods.entity.dos.Studio;
|
||||||
import cn.lili.modules.broadcast.service.StudioService;
|
import cn.lili.modules.goods.service.StudioService;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.lili.common.security.context.UserContext;
|
|||||||
import cn.lili.common.vo.ResultMessage;
|
import cn.lili.common.vo.ResultMessage;
|
||||||
import cn.lili.modules.distribution.entity.dos.Distribution;
|
import cn.lili.modules.distribution.entity.dos.Distribution;
|
||||||
import cn.lili.modules.distribution.entity.dos.DistributionOrder;
|
import cn.lili.modules.distribution.entity.dos.DistributionOrder;
|
||||||
|
import cn.lili.modules.distribution.entity.dto.DistributionApplyDTO;
|
||||||
import cn.lili.modules.distribution.entity.vos.DistributionOrderSearchParams;
|
import cn.lili.modules.distribution.entity.vos.DistributionOrderSearchParams;
|
||||||
import cn.lili.modules.distribution.service.DistributionOrderService;
|
import cn.lili.modules.distribution.service.DistributionOrderService;
|
||||||
import cn.lili.modules.distribution.service.DistributionService;
|
import cn.lili.modules.distribution.service.DistributionService;
|
||||||
@@ -39,21 +40,16 @@ public class DistributionBuyerController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DistributionOrderService distributionOrderService;
|
private DistributionOrderService distributionOrderService;
|
||||||
|
|
||||||
//申请分销员
|
|
||||||
@ApiOperation(value = "申请分销员")
|
@ApiOperation(value = "申请分销员")
|
||||||
@ApiImplicitParams({
|
|
||||||
@ApiImplicitParam(name = "name", value = "姓名", required = true, paramType = "query", dataType = "String"),
|
|
||||||
@ApiImplicitParam(name = "idNumber", value = "身份证号", required = true, paramType = "query", dataType = "String")
|
|
||||||
})
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public ResultMessage<Object> applyDistribution(@RequestParam String name, @RequestParam String idNumber) {
|
public ResultMessage<Object> applyDistribution(DistributionApplyDTO distributionApplyDTO) {
|
||||||
return ResultUtil.data(distributionService.applyDistribution(name, idNumber));
|
return ResultUtil.data(distributionService.applyDistribution(distributionApplyDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "获取分销员分页订单列表")
|
@ApiOperation(value = "获取分销员分页订单列表")
|
||||||
@GetMapping("/distributionOrder")
|
@GetMapping("/distributionOrder")
|
||||||
public ResultMessage<IPage<DistributionOrder>> distributionOrderPage(DistributionOrderSearchParams distributionOrderSearchParams) {
|
public ResultMessage<IPage<DistributionOrder>> distributionOrderPage(DistributionOrderSearchParams distributionOrderSearchParams) {
|
||||||
distributionOrderSearchParams.setDistributionId(UserContext.getCurrentUser().getId());
|
distributionOrderSearchParams.setDistributionId(distributionService.getDistribution().getId());
|
||||||
return ResultUtil.data(distributionOrderService.getDistributionOrderPage(distributionOrderSearchParams));
|
return ResultUtil.data(distributionOrderService.getDistributionOrderPage(distributionOrderSearchParams));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +62,6 @@ public class DistributionBuyerController {
|
|||||||
return ResultUtil.data(distributionService.getDistribution());
|
return ResultUtil.data(distributionService.getDistribution());
|
||||||
}
|
}
|
||||||
|
|
||||||
//申请分销员
|
|
||||||
@ApiOperation(value = "绑定分销员")
|
@ApiOperation(value = "绑定分销员")
|
||||||
@ApiImplicitParam(name = "distributionId", value = "分销员ID", required = true, paramType = "path")
|
@ApiImplicitParam(name = "distributionId", value = "分销员ID", required = true, paramType = "path")
|
||||||
@GetMapping("/bindingDistribution/{distributionId}")
|
@GetMapping("/bindingDistribution/{distributionId}")
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import cn.lili.modules.distribution.service.DistributionSelectedGoodsService;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -50,13 +51,25 @@ public class DistributionGoodsBuyerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "选择分销商品")
|
@ApiOperation(value = "选择分销商品")
|
||||||
@ApiImplicitParam(name = "distributionGoodsId", value = "分销ID", required = true, dataType = "String", paramType = "path")
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "distributionGoodsId", value = "分销ID", required = true, dataType = "String", paramType = "path"),
|
||||||
|
@ApiImplicitParam(name = "checked", value = "是否选择", required = true, dataType = "boolean", paramType = "query")
|
||||||
|
})
|
||||||
@GetMapping(value = "/checked/{distributionGoodsId}")
|
@GetMapping(value = "/checked/{distributionGoodsId}")
|
||||||
public ResultMessage<Object> distributionCheckGoods(
|
public ResultMessage<Object> distributionCheckGoods(
|
||||||
@NotNull(message = "分销商品不能为空") @PathVariable("distributionGoodsId") String distributionGoodsId) {
|
@NotNull(message = "分销商品不能为空") @PathVariable("distributionGoodsId") String distributionGoodsId,Boolean checked) {
|
||||||
if(distributionSelectedGoodsService.add(distributionGoodsId)){
|
Boolean result=false;
|
||||||
return ResultUtil.success();
|
if(checked){
|
||||||
|
result=distributionSelectedGoodsService.add(distributionGoodsId);
|
||||||
|
}else {
|
||||||
|
result=distributionSelectedGoodsService.delete(distributionGoodsId);
|
||||||
}
|
}
|
||||||
throw new ServiceException(ResultCode.ERROR);
|
//判断操作结果
|
||||||
|
if(result){
|
||||||
|
return ResultUtil.success(ResultCode.SUCCESS);
|
||||||
|
}else{
|
||||||
|
throw new ServiceException(ResultCode.ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class MemberBuyerController {
|
|||||||
if (smsUtil.verifyCode(mobile, VerificationEnums.LOGIN, uuid, code)) {
|
if (smsUtil.verifyCode(mobile, VerificationEnums.LOGIN, uuid, code)) {
|
||||||
return ResultUtil.data(memberService.mobilePhoneLogin(mobile));
|
return ResultUtil.data(memberService.mobilePhoneLogin(mobile));
|
||||||
} else {
|
} else {
|
||||||
throw new ServiceException("验证码错误");
|
throw new ServiceException(ResultCode.VERIFICATION_SMS_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public class MiniProgramBuyerController {
|
|||||||
public ConnectService connectService;
|
public ConnectService connectService;
|
||||||
@Autowired
|
@Autowired
|
||||||
public WechatMpCodeUtil wechatMpCodeUtil;
|
public WechatMpCodeUtil wechatMpCodeUtil;
|
||||||
|
@SuppressWarnings("AlibabaLowerCamelCaseVariableNaming")
|
||||||
@Autowired
|
@Autowired
|
||||||
public WechatMPMessageService wechatMPMessageService;
|
public WechatMPMessageService wechatMPMessageService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
___ ___ ___ ___ ________ ________ _______ ________ _____ ______ ___ __ ________ ________ ___ __
|
|
||||||
|\ \ |\ \|\ \ |\ \ |\ _____\\ __ \|\ ___ \ |\ __ \|\ _ \ _ \|\ \ |\ \|\ __ \|\ __ \|\ \|\ \
|
|
||||||
\ \ \ \ \ \ \ \ \ \ \ ____________\ \ \__/\ \ \|\ \ \ __/|\ \ \|\ \ \ \\\__\ \ \ \ \ \ \ \ \ \|\ \ \ \|\ \ \ \/ /|_
|
|
||||||
\ \ \ \ \ \ \ \ \ \ \|\____________\ \ __\\ \ _ _\ \ \_|/_\ \ __ \ \ \\|__| \ \ \ \ __\ \ \ \ \\\ \ \ _ _\ \ ___ \
|
|
||||||
\ \ \____\ \ \ \ \____\ \ \|____________|\ \ \_| \ \ \\ \\ \ \_|\ \ \ \ \ \ \ \ \ \ \ \ \|\__\_\ \ \ \\\ \ \ \\ \\ \ \\ \ \
|
|
||||||
\ \_______\ \__\ \_______\ \__\ \ \__\ \ \__\\ _\\ \_______\ \__\ \__\ \__\ \ \__\ \____________\ \_______\ \__\\ _\\ \__\\ \__\
|
|
||||||
\|_______|\|__|\|_______|\|__| \|__| \|__|\|__|\|_______|\|__|\|__|\|__| \|__|\|____________|\|_______|\|__|\|__|\|__| \|__|
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
___ ___ ___ ___ ________ ___ ___ ________ ________
|
|
||||||
|\ \ |\ \|\ \ |\ \ |\ ____\|\ \|\ \|\ __ \|\ __ \
|
|
||||||
\ \ \ \ \ \ \ \ \ \ \ ____________\ \ \___|\ \ \\\ \ \ \|\ \ \ \|\ \
|
|
||||||
\ \ \ \ \ \ \ \ \ \ \|\____________\ \_____ \ \ __ \ \ \\\ \ \ ____\
|
|
||||||
\ \ \____\ \ \ \ \____\ \ \|____________|\|____|\ \ \ \ \ \ \ \\\ \ \ \___|
|
|
||||||
\ \_______\ \__\ \_______\ \__\ ____\_\ \ \__\ \__\ \_______\ \__\
|
|
||||||
\|_______|\|__|\|_______|\|__| |\_________\|__|\|__|\|_______|\|__|
|
|
||||||
\|_________|
|
|
||||||
|
|
||||||
@@ -7,17 +7,17 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cn.lili</groupId>
|
<groupId>cn.lili</groupId>
|
||||||
<artifactId>lili-shop-parent</artifactId>
|
<artifactId>lili-shop-parent</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>${revision}</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>cn.lili</groupId>
|
|
||||||
<artifactId>common-api</artifactId>
|
<artifactId>common-api</artifactId>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.lili</groupId>
|
<groupId>cn.lili</groupId>
|
||||||
<artifactId>framework</artifactId>
|
<artifactId>framework</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ public class FileController {
|
|||||||
if (file.getUserEnums().equals(authUser.getRole().name())) {
|
if (file.getUserEnums().equals(authUser.getRole().name())) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||||
}
|
}
|
||||||
fileService.updateById(file);
|
fileService.updateById(file);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package cn.lili.controller.common;
|
|||||||
|
|
||||||
import cn.lili.common.enums.ResultUtil;
|
import cn.lili.common.enums.ResultUtil;
|
||||||
import cn.lili.common.vo.ResultMessage;
|
import cn.lili.common.vo.ResultMessage;
|
||||||
import cn.lili.modules.base.service.RegionService;
|
import cn.lili.modules.system.service.RegionService;
|
||||||
import cn.lili.modules.system.entity.dos.Region;
|
import cn.lili.modules.system.entity.dos.Region;
|
||||||
import cn.lili.modules.system.entity.vo.RegionVO;
|
import cn.lili.modules.system.entity.vo.RegionVO;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|||||||
@@ -28,10 +28,9 @@ public class SliderImageController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private VerificationService verificationService;
|
private VerificationService verificationService;
|
||||||
|
|
||||||
//一分钟同一个ip请求10次
|
|
||||||
@LimitPoint(name = "slider_image", key = "verification")
|
@LimitPoint(name = "slider_image", key = "verification")
|
||||||
@GetMapping("/{verificationEnums}")
|
@GetMapping("/{verificationEnums}")
|
||||||
@ApiOperation(value = "获取校验接口")
|
@ApiOperation(value = "获取校验接口,一分钟同一个ip请求10次")
|
||||||
public ResultMessage getSliderImage(@RequestHeader String uuid, @PathVariable VerificationEnums verificationEnums) {
|
public ResultMessage getSliderImage(@RequestHeader String uuid, @PathVariable VerificationEnums verificationEnums) {
|
||||||
try {
|
try {
|
||||||
return ResultUtil.data(verificationService.createVerification(verificationEnums, uuid));
|
return ResultUtil.data(verificationService.createVerification(verificationEnums, uuid));
|
||||||
|
|||||||
@@ -31,14 +31,13 @@ public class SmsController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private VerificationService verificationService;
|
private VerificationService verificationService;
|
||||||
|
|
||||||
//一分钟同一个ip请求1次
|
|
||||||
@LimitPoint(name = "sms_send", key = "sms")
|
@LimitPoint(name = "sms_send", key = "sms")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(paramType = "path", dataType = "String", name = "mobile", value = "手机号"),
|
@ApiImplicitParam(paramType = "path", dataType = "String", name = "mobile", value = "手机号"),
|
||||||
@ApiImplicitParam(paramType = "header", dataType = "String", name = "uuid", value = "uuid"),
|
@ApiImplicitParam(paramType = "header", dataType = "String", name = "uuid", value = "uuid"),
|
||||||
})
|
})
|
||||||
@GetMapping("/{verificationEnums}/{mobile}")
|
@GetMapping("/{verificationEnums}/{mobile}")
|
||||||
@ApiOperation(value = "发送短信验证码")
|
@ApiOperation(value = "发送短信验证码,一分钟同一个ip请求1次")
|
||||||
public ResultMessage getSmsCode(
|
public ResultMessage getSmsCode(
|
||||||
@RequestHeader String uuid,
|
@RequestHeader String uuid,
|
||||||
@PathVariable String mobile,
|
@PathVariable String mobile,
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public class UploadController {
|
|||||||
fileService.save(newFile);
|
fileService.save(newFile);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("文件上传失败", e);
|
log.error("文件上传失败", e);
|
||||||
throw new ServiceException(ResultCode.OSS_EXCEPTION);
|
throw new ServiceException(ResultCode.OSS_EXCEPTION_ERROR);
|
||||||
}
|
}
|
||||||
return ResultUtil.data(result);
|
return ResultUtil.data(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ spring:
|
|||||||
default-datasource:
|
default-datasource:
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://192.168.0.116:3306/Bulbasaur?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://192.168.0.116:3306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||||
username: root
|
username: root
|
||||||
password: lilishop
|
password: lilishop
|
||||||
maxActive: 20
|
maxActive: 20
|
||||||
@@ -121,7 +121,7 @@ spring:
|
|||||||
props:
|
props:
|
||||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||||
sql:
|
sql:
|
||||||
show: false
|
show: true
|
||||||
|
|
||||||
# 忽略鉴权url
|
# 忽略鉴权url
|
||||||
ignored:
|
ignored:
|
||||||
@@ -144,6 +144,7 @@ ignored:
|
|||||||
- /buyer/promotion/pintuan/**
|
- /buyer/promotion/pintuan/**
|
||||||
- /buyer/promotion/seckill/**
|
- /buyer/promotion/seckill/**
|
||||||
- /buyer/promotion/pointsGoods/**
|
- /buyer/promotion/pointsGoods/**
|
||||||
|
- /buyer/promotion/coupon
|
||||||
- /buyer/memberEvaluation/**/goodsEvaluation
|
- /buyer/memberEvaluation/**/goodsEvaluation
|
||||||
- /buyer/memberEvaluation/**/evaluationNumber
|
- /buyer/memberEvaluation/**/evaluationNumber
|
||||||
- /buyer/appVersion/**
|
- /buyer/appVersion/**
|
||||||
@@ -163,6 +164,7 @@ ignored:
|
|||||||
- /v2/api-docs
|
- /v2/api-docs
|
||||||
- /configuration/ui
|
- /configuration/ui
|
||||||
- /boot-admin
|
- /boot-admin
|
||||||
|
- /manager/promotion/seckill/init
|
||||||
statics:
|
statics:
|
||||||
- /**/*.js
|
- /**/*.js
|
||||||
- /**/*.css
|
- /**/*.css
|
||||||
@@ -194,9 +196,9 @@ logging:
|
|||||||
# 输出级别
|
# 输出级别
|
||||||
level:
|
level:
|
||||||
cn.lili: info
|
cn.lili: info
|
||||||
# org.hibernate: debug
|
# org.hibernate: debug
|
||||||
# org.springframework: debug
|
# org.springframework: debug
|
||||||
# org.springframework.data.mongodb.core: debug
|
# org.springframework.data.mongodb.core: debug
|
||||||
file:
|
file:
|
||||||
# 指定路径
|
# 指定路径
|
||||||
path: lili-logs
|
path: lili-logs
|
||||||
@@ -295,6 +297,8 @@ lili:
|
|||||||
notice-send-group: lili_send_notice_group
|
notice-send-group: lili_send_notice_group
|
||||||
rocketmq:
|
rocketmq:
|
||||||
name-server: 192.168.0.116:9876
|
name-server: 192.168.0.116:9876
|
||||||
|
namesrvAddr: 192.168.0.116:9876
|
||||||
|
isVIPChannel: false
|
||||||
producer:
|
producer:
|
||||||
group: lili_group
|
group: lili_group
|
||||||
send-message-timeout: 30000
|
send-message-timeout: 30000
|
||||||
|
|||||||
@@ -8,20 +8,21 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cn.lili</groupId>
|
<groupId>cn.lili</groupId>
|
||||||
<artifactId>lili-shop-parent</artifactId>
|
<artifactId>lili-shop-parent</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>${revision}</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.lili</groupId>
|
<groupId>cn.lili</groupId>
|
||||||
<artifactId>framework</artifactId>
|
<artifactId>framework</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xuxueli</groupId>
|
<groupId>com.xuxueli</groupId>
|
||||||
<artifactId>xxl-job-core</artifactId>
|
<artifactId>xxl-job-core</artifactId>
|
||||||
<version>2.2.0</version>
|
<version>${xxl-job}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import cn.lili.modules.order.order.entity.dto.OrderMessage;
|
|||||||
import cn.lili.modules.order.trade.entity.enums.AfterSaleStatusEnum;
|
import cn.lili.modules.order.trade.entity.enums.AfterSaleStatusEnum;
|
||||||
import cn.lili.timetask.handler.EveryDayExecute;
|
import cn.lili.timetask.handler.EveryDayExecute;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -23,13 +24,18 @@ import javax.annotation.Resource;
|
|||||||
* @author Chopper
|
* @author Chopper
|
||||||
* @date 2020-07-03 11:20
|
* @date 2020-07-03 11:20
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class DistributionOrderExecute implements OrderStatusChangeEvent, EveryDayExecute, AfterSaleStatusChangeEvent {
|
public class DistributionOrderExecute implements OrderStatusChangeEvent, EveryDayExecute, AfterSaleStatusChangeEvent {
|
||||||
|
|
||||||
//分销订单
|
/**
|
||||||
|
* 分销订单
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private DistributionOrderService distributionOrderService;
|
private DistributionOrderService distributionOrderService;
|
||||||
//分销订单持久层
|
/**
|
||||||
|
* 分销订单持久层
|
||||||
|
*/
|
||||||
@Resource
|
@Resource
|
||||||
private DistributionOrderMapper distributionOrderMapper;
|
private DistributionOrderMapper distributionOrderMapper;
|
||||||
|
|
||||||
@@ -48,6 +54,9 @@ public class DistributionOrderExecute implements OrderStatusChangeEvent, EveryDa
|
|||||||
distributionOrderService.cancelOrder(orderMessage.getOrderSn());
|
distributionOrderService.cancelOrder(orderMessage.getOrderSn());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
log.error("分销订单执行异常:", orderMessage.getOrderSn());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ import org.springframework.stereotype.Service;
|
|||||||
* @date 2020-07-03 11:20
|
* @date 2020-07-03 11:20
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class GoodsSkuExecute implements GoodsCommentCompleteEvent {
|
public class GoodsSkuExecute implements GoodsCommentCompleteEvent {
|
||||||
|
|
||||||
//商品
|
/**
|
||||||
|
* 商品
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private GoodsSkuService goodsSkuService;
|
private GoodsSkuService goodsSkuService;
|
||||||
|
|
||||||
|
|||||||
@@ -29,18 +29,25 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class MemberExperienceExecute implements MemberRegisterEvent, GoodsCommentCompleteEvent, OrderStatusChangeEvent {
|
public class MemberExperienceExecute implements MemberRegisterEvent, GoodsCommentCompleteEvent, OrderStatusChangeEvent {
|
||||||
|
|
||||||
//配置
|
/**
|
||||||
|
* 配置
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private SettingService settingService;
|
private SettingService settingService;
|
||||||
//会员
|
/**
|
||||||
|
* 会员
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberService memberService;
|
private MemberService memberService;
|
||||||
//订单
|
/**
|
||||||
|
* 订单
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员注册赠送经验值
|
* 会员注册赠送经验值
|
||||||
|
*
|
||||||
* @param member 会员
|
* @param member 会员
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -53,6 +60,7 @@ public class MemberExperienceExecute implements MemberRegisterEvent, GoodsCommen
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品评价赠送经验值
|
* 商品评价赠送经验值
|
||||||
|
*
|
||||||
* @param memberEvaluation 会员评价
|
* @param memberEvaluation 会员评价
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -65,17 +73,18 @@ public class MemberExperienceExecute implements MemberRegisterEvent, GoodsCommen
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 完成订单赠送经验值
|
* 完成订单赠送经验值
|
||||||
|
*
|
||||||
* @param orderMessage 订单消息
|
* @param orderMessage 订单消息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void orderChange(OrderMessage orderMessage) {
|
public void orderChange(OrderMessage orderMessage) {
|
||||||
if(orderMessage.getNewStatus().equals(OrderStatusEnum.COMPLETED)){
|
if (orderMessage.getNewStatus().equals(OrderStatusEnum.COMPLETED)) {
|
||||||
//获取经验值设置
|
//获取经验值设置
|
||||||
ExperienceSetting experienceSetting = getExperienceSetting();
|
ExperienceSetting experienceSetting = getExperienceSetting();
|
||||||
//获取订单信息
|
//获取订单信息
|
||||||
Order order = orderService.getBySn(orderMessage.getOrderSn());
|
Order order = orderService.getBySn(orderMessage.getOrderSn());
|
||||||
//计算赠送经验值数量
|
//计算赠送经验值数量
|
||||||
Double point= CurrencyUtil.mul(experienceSetting.getMoney(),order.getFlowPrice(),0);
|
Double point = CurrencyUtil.mul(experienceSetting.getMoney(), order.getFlowPrice(), 0);
|
||||||
//赠送会员经验值
|
//赠送会员经验值
|
||||||
memberService.updateMemberExperience(point.longValue(), true, order.getMemberId(), "会员下单,赠送经验值" + point + "分");
|
memberService.updateMemberExperience(point.longValue(), true, order.getMemberId(), "会员下单,赠送经验值" + point + "分");
|
||||||
}
|
}
|
||||||
@@ -83,9 +92,10 @@ public class MemberExperienceExecute implements MemberRegisterEvent, GoodsCommen
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取经验值设置
|
* 获取经验值设置
|
||||||
|
*
|
||||||
* @return 经验值设置
|
* @return 经验值设置
|
||||||
*/
|
*/
|
||||||
private ExperienceSetting getExperienceSetting(){
|
private ExperienceSetting getExperienceSetting() {
|
||||||
Setting setting = settingService.get(SettingEnum.EXPERIENCE_SETTING.name());
|
Setting setting = settingService.get(SettingEnum.EXPERIENCE_SETTING.name());
|
||||||
return new Gson().fromJson(setting.getSettingValue(), ExperienceSetting.class);
|
return new Gson().fromJson(setting.getSettingValue(), ExperienceSetting.class);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,57 +33,66 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class MemberPointExecute implements MemberRegisterEvent, GoodsCommentCompleteEvent, OrderStatusChangeEvent, AfterSaleStatusChangeEvent {
|
public class MemberPointExecute implements MemberRegisterEvent, GoodsCommentCompleteEvent, OrderStatusChangeEvent, AfterSaleStatusChangeEvent {
|
||||||
|
|
||||||
//配置
|
/**
|
||||||
|
* 配置
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private SettingService settingService;
|
private SettingService settingService;
|
||||||
//会员
|
/**
|
||||||
|
* 会员
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberService memberService;
|
private MemberService memberService;
|
||||||
//订单
|
/**
|
||||||
|
* 订单
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员注册赠送积分
|
* 会员注册赠送积分
|
||||||
|
*
|
||||||
* @param member 会员
|
* @param member 会员
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void memberRegister(Member member) {
|
public void memberRegister(Member member) {
|
||||||
//获取积分设置
|
//获取积分设置
|
||||||
PointSetting pointSetting=getPointSetting();
|
PointSetting pointSetting = getPointSetting();
|
||||||
//赠送会员积分
|
//赠送会员积分
|
||||||
memberService.updateMemberPoint(Long.valueOf(pointSetting.getRegister().longValue()), true, member.getId(), "会员注册,赠送积分" + pointSetting.getRegister() + "分");
|
memberService.updateMemberPoint(Long.valueOf(pointSetting.getRegister().longValue()), true, member.getId(), "会员注册,赠送积分" + pointSetting.getRegister() + "分");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员评价赠送积分
|
* 会员评价赠送积分
|
||||||
|
*
|
||||||
* @param memberEvaluation 会员评价
|
* @param memberEvaluation 会员评价
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void goodsComment(MemberEvaluation memberEvaluation) {
|
public void goodsComment(MemberEvaluation memberEvaluation) {
|
||||||
//获取积分设置
|
//获取积分设置
|
||||||
PointSetting pointSetting=getPointSetting();
|
PointSetting pointSetting = getPointSetting();
|
||||||
//赠送会员积分
|
//赠送会员积分
|
||||||
memberService.updateMemberPoint(Long.valueOf(pointSetting.getComment().longValue()), true, memberEvaluation.getMemberId(), "会员评价,赠送积分" + pointSetting.getComment() + "分");
|
memberService.updateMemberPoint(Long.valueOf(pointSetting.getComment().longValue()), true, memberEvaluation.getMemberId(), "会员评价,赠送积分" + pointSetting.getComment() + "分");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 非积分订单订单完成后赠送积分
|
* 非积分订单订单完成后赠送积分
|
||||||
|
*
|
||||||
* @param orderMessage 订单消息
|
* @param orderMessage 订单消息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void orderChange(OrderMessage orderMessage) {
|
public void orderChange(OrderMessage orderMessage) {
|
||||||
|
|
||||||
if(orderMessage.getNewStatus().equals(OrderStatusEnum.COMPLETED)){
|
if (orderMessage.getNewStatus().equals(OrderStatusEnum.COMPLETED)) {
|
||||||
//根据订单编号获取订单数据,如果为积分订单则跳回
|
//根据订单编号获取订单数据,如果为积分订单则跳回
|
||||||
Order order = orderService.getBySn(orderMessage.getOrderSn());
|
Order order = orderService.getBySn(orderMessage.getOrderSn());
|
||||||
if(order.getOrderPromotionType().equals(OrderPromotionTypeEnum.POINT.name())){
|
if (order.getOrderPromotionType().equals(OrderPromotionTypeEnum.POINT.name())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//获取积分设置
|
//获取积分设置
|
||||||
PointSetting pointSetting=getPointSetting();
|
PointSetting pointSetting = getPointSetting();
|
||||||
//计算赠送积分数量
|
//计算赠送积分数量
|
||||||
Double point=CurrencyUtil.mul(pointSetting.getMoney(),order.getFlowPrice(),0);
|
Double point = CurrencyUtil.mul(pointSetting.getMoney(), order.getFlowPrice(), 0);
|
||||||
//赠送会员积分
|
//赠送会员积分
|
||||||
memberService.updateMemberPoint(point.longValue(), true, order.getMemberId(), "会员下单,赠送积分" + point + "分");
|
memberService.updateMemberPoint(point.longValue(), true, order.getMemberId(), "会员下单,赠送积分" + point + "分");
|
||||||
|
|
||||||
@@ -92,15 +101,16 @@ public class MemberPointExecute implements MemberRegisterEvent, GoodsCommentComp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交售后后扣除积分
|
* 提交售后后扣除积分
|
||||||
|
*
|
||||||
* @param afterSale 售后
|
* @param afterSale 售后
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void afterSaleStatusChange(AfterSale afterSale) {
|
public void afterSaleStatusChange(AfterSale afterSale) {
|
||||||
if (afterSale.getServiceStatus().equals(AfterSaleStatusEnum.COMPLETE.name())) {
|
if (afterSale.getServiceStatus().equals(AfterSaleStatusEnum.COMPLETE.name())) {
|
||||||
//获取积分设置
|
//获取积分设置
|
||||||
PointSetting pointSetting=getPointSetting();
|
PointSetting pointSetting = getPointSetting();
|
||||||
//计算扣除积分数量
|
//计算扣除积分数量
|
||||||
Double point=CurrencyUtil.mul(pointSetting.getMoney(), afterSale.getActualRefundPrice(),0);
|
Double point = CurrencyUtil.mul(pointSetting.getMoney(), afterSale.getActualRefundPrice(), 0);
|
||||||
//扣除会员积分
|
//扣除会员积分
|
||||||
memberService.updateMemberPoint(point.longValue(), false, afterSale.getMemberId(), "会员退款,扣除积分" + point + "分");
|
memberService.updateMemberPoint(point.longValue(), false, afterSale.getMemberId(), "会员退款,扣除积分" + point + "分");
|
||||||
|
|
||||||
@@ -109,9 +119,10 @@ public class MemberPointExecute implements MemberRegisterEvent, GoodsCommentComp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取积分设置
|
* 获取积分设置
|
||||||
|
*
|
||||||
* @return 积分设置
|
* @return 积分设置
|
||||||
*/
|
*/
|
||||||
private PointSetting getPointSetting(){
|
private PointSetting getPointSetting() {
|
||||||
Setting setting = settingService.get(SettingEnum.POINT_SETTING.name());
|
Setting setting = settingService.get(SettingEnum.POINT_SETTING.name());
|
||||||
return new Gson().fromJson(setting.getSettingValue(), PointSetting.class);
|
return new Gson().fromJson(setting.getSettingValue(), PointSetting.class);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
|
|||||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||||
noticeMessageDTO.setMemberId(tradeDTO.getMemberId());
|
noticeMessageDTO.setMemberId(tradeDTO.getMemberId());
|
||||||
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.ORDER_CREATE_SUCCESS);
|
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.ORDER_CREATE_SUCCESS);
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>(2);
|
||||||
params.put("goods", tradeDTO.getSkuList().get(0).getGoodsSku().getGoodsName());
|
params.put("goods", tradeDTO.getSkuList().get(0).getGoodsSku().getGoodsName());
|
||||||
noticeMessageDTO.setParameter(params);
|
noticeMessageDTO.setParameter(params);
|
||||||
//保存站内信
|
//保存站内信
|
||||||
@@ -58,7 +58,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
|
|||||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||||
//如果订单状态不为空
|
//如果订单状态不为空
|
||||||
if (orderDetailVO != null) {
|
if (orderDetailVO != null) {
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>(2);
|
||||||
switch (orderMessage.getNewStatus()) {
|
switch (orderMessage.getNewStatus()) {
|
||||||
//如果订单新的状态为已取消 则发送取消订单站内信
|
//如果订单新的状态为已取消 则发送取消订单站内信
|
||||||
case CANCELLED:
|
case CANCELLED:
|
||||||
@@ -103,7 +103,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
|
|||||||
public void afterSaleStatusChange(AfterSale afterSale) {
|
public void afterSaleStatusChange(AfterSale afterSale) {
|
||||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||||
noticeMessageDTO.setMemberId(afterSale.getMemberId());
|
noticeMessageDTO.setMemberId(afterSale.getMemberId());
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>(2);
|
||||||
params.put("goods", afterSale.getGoodsName());
|
params.put("goods", afterSale.getGoodsName());
|
||||||
params.put("refuse", afterSale.getAuditRemark());
|
params.put("refuse", afterSale.getAuditRemark());
|
||||||
noticeMessageDTO.setParameter(params);
|
noticeMessageDTO.setParameter(params);
|
||||||
@@ -154,7 +154,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
|
|||||||
//组织站内信参数
|
//组织站内信参数
|
||||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||||
noticeMessageDTO.setMemberId(memberPointMessage.getMemberId());
|
noticeMessageDTO.setMemberId(memberPointMessage.getMemberId());
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>(2);
|
||||||
if (memberPointMessage.getType()) {
|
if (memberPointMessage.getType()) {
|
||||||
params.put("expenditure_points", "0");
|
params.put("expenditure_points", "0");
|
||||||
params.put("income_points", memberPointMessage.getPoint().toString());
|
params.put("income_points", memberPointMessage.getPoint().toString());
|
||||||
@@ -178,7 +178,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
|
|||||||
//组织参数
|
//组织参数
|
||||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||||
noticeMessageDTO.setMemberId(memberWithdrawalMessage.getMemberId());
|
noticeMessageDTO.setMemberId(memberWithdrawalMessage.getMemberId());
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>(2);
|
||||||
params.put("income", memberWithdrawalMessage.getPrice().toString());
|
params.put("income", memberWithdrawalMessage.getPrice().toString());
|
||||||
noticeMessageDTO.setParameter(params);
|
noticeMessageDTO.setParameter(params);
|
||||||
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.WALLET_WITHDRAWAL_SUCCESS);
|
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.WALLET_WITHDRAWAL_SUCCESS);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import cn.lili.modules.order.order.service.OrderService;
|
|||||||
import cn.lili.modules.payment.entity.RefundLog;
|
import cn.lili.modules.payment.entity.RefundLog;
|
||||||
import cn.lili.modules.payment.kit.Payment;
|
import cn.lili.modules.payment.kit.Payment;
|
||||||
import cn.lili.modules.payment.kit.enums.PaymentMethodEnum;
|
import cn.lili.modules.payment.kit.enums.PaymentMethodEnum;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -19,10 +20,13 @@ import org.springframework.stereotype.Service;
|
|||||||
* @author Chopper
|
* @author Chopper
|
||||||
* @date 2021-03-13 16:58
|
* @date 2021-03-13 16:58
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class PaymentExecute implements OrderStatusChangeEvent {
|
public class PaymentExecute implements OrderStatusChangeEvent {
|
||||||
|
|
||||||
//订单
|
/**
|
||||||
|
* 订单
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
|
|
||||||
@@ -32,11 +36,11 @@ public class PaymentExecute implements OrderStatusChangeEvent {
|
|||||||
switch (orderMessage.getNewStatus()) {
|
switch (orderMessage.getNewStatus()) {
|
||||||
case CANCELLED:
|
case CANCELLED:
|
||||||
Order order = orderService.getBySn(orderMessage.getOrderSn());
|
Order order = orderService.getBySn(orderMessage.getOrderSn());
|
||||||
//未付款不做处理 直接返回
|
|
||||||
if (order.getPayStatus() == PayStatusEnum.UNPAID.name()) {
|
//如果未付款,则不去要退回相关代码执行
|
||||||
|
if (order.getPayStatus().equals(PayStatusEnum.UNPAID.name())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PaymentMethodEnum paymentMethodEnum = PaymentMethodEnum.valueOf(order.getPaymentMethod());
|
PaymentMethodEnum paymentMethodEnum = PaymentMethodEnum.valueOf(order.getPaymentMethod());
|
||||||
//进行退款操作
|
//进行退款操作
|
||||||
switch (paymentMethodEnum) {
|
switch (paymentMethodEnum) {
|
||||||
@@ -64,6 +68,9 @@ public class PaymentExecute implements OrderStatusChangeEvent {
|
|||||||
break;
|
break;
|
||||||
case BANK_TRANSFER:
|
case BANK_TRANSFER:
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
log.error("订单支付执行异常,订单编号:{}", orderMessage.getOrderSn());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.lili.event.impl;
|
package cn.lili.event.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.lili.common.cache.Cache;
|
import cn.lili.common.cache.Cache;
|
||||||
import cn.lili.event.OrderStatusChangeEvent;
|
import cn.lili.event.OrderStatusChangeEvent;
|
||||||
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
||||||
@@ -31,23 +32,35 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class StockUpdateExecute implements OrderStatusChangeEvent {
|
public class StockUpdateExecute implements OrderStatusChangeEvent {
|
||||||
|
|
||||||
//出库失败消息
|
/**
|
||||||
|
* 出库失败消息
|
||||||
|
*/
|
||||||
static String outOfStockMessage = "库存不足,出库失败";
|
static String outOfStockMessage = "库存不足,出库失败";
|
||||||
//Redis
|
/**
|
||||||
|
* Redis
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private StringRedisTemplate stringRedisTemplate;
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
@Autowired
|
@Autowired
|
||||||
private DefaultRedisScript<Boolean> quantityScript;
|
private DefaultRedisScript<Boolean> quantityScript;
|
||||||
//订单
|
/**
|
||||||
|
* 订单
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
//规格商品
|
/**
|
||||||
|
* 规格商品
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private GoodsSkuService goodsSkuService;
|
private GoodsSkuService goodsSkuService;
|
||||||
//促销商品
|
/**
|
||||||
|
* 促销商品
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private PromotionGoodsService promotionGoodsService;
|
private PromotionGoodsService promotionGoodsService;
|
||||||
//缓存
|
/**
|
||||||
|
* 缓存
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private Cache cache;
|
private Cache cache;
|
||||||
|
|
||||||
@@ -188,7 +201,7 @@ public class StockUpdateExecute implements OrderStatusChangeEvent {
|
|||||||
List skuStocks = cache.multiGet(skuKeys);
|
List skuStocks = cache.multiGet(skuKeys);
|
||||||
//循环写入商品库存
|
//循环写入商品库存
|
||||||
for (int i = 0; i < skuStocks.size(); i++) {
|
for (int i = 0; i < skuStocks.size(); i++) {
|
||||||
goodsSkus.get(i).setQuantity(Integer.parseInt(skuStocks.get(i).toString()));
|
goodsSkus.get(i).setQuantity(Convert.toInt(skuStocks.get(i).toString()));
|
||||||
}
|
}
|
||||||
//批量修改商品库存
|
//批量修改商品库存
|
||||||
goodsSkuService.updateBatchById(goodsSkus);
|
goodsSkuService.updateBatchById(goodsSkus);
|
||||||
@@ -197,7 +210,7 @@ public class StockUpdateExecute implements OrderStatusChangeEvent {
|
|||||||
if (!promotionKey.isEmpty()) {
|
if (!promotionKey.isEmpty()) {
|
||||||
List promotionStocks = cache.multiGet(promotionKey);
|
List promotionStocks = cache.multiGet(promotionKey);
|
||||||
for (int i = 0; i < promotionKey.size(); i++) {
|
for (int i = 0; i < promotionKey.size(); i++) {
|
||||||
promotionGoods.get(i).setQuantity(Integer.parseInt(promotionStocks.get(i).toString()));
|
promotionGoods.get(i).setQuantity(Convert.toInt(promotionStocks.get(i).toString()));
|
||||||
Integer num = promotionGoods.get(i).getNum();
|
Integer num = promotionGoods.get(i).getNum();
|
||||||
promotionGoods.get(i).setNum((num != null ? num : 0) + order.getOrder().getGoodsNum());
|
promotionGoods.get(i).setNum((num != null ? num : 0) + order.getOrder().getGoodsNum());
|
||||||
}
|
}
|
||||||
@@ -232,7 +245,7 @@ public class StockUpdateExecute implements OrderStatusChangeEvent {
|
|||||||
List skuStocks = cache.multiGet(skuKeys);
|
List skuStocks = cache.multiGet(skuKeys);
|
||||||
//循环写入商品SKU库存
|
//循环写入商品SKU库存
|
||||||
for (int i = 0; i < skuStocks.size(); i++) {
|
for (int i = 0; i < skuStocks.size(); i++) {
|
||||||
goodsSkus.get(i).setQuantity(Integer.parseInt(skuStocks.get(i).toString()));
|
goodsSkus.get(i).setQuantity(Convert.toInt(skuStocks.get(i).toString()));
|
||||||
}
|
}
|
||||||
log.info("订单取消,库存还原:{}", goodsSkus);
|
log.info("订单取消,库存还原:{}", goodsSkus);
|
||||||
//批量修改商品库存
|
//批量修改商品库存
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ import java.util.List;
|
|||||||
@RocketMQMessageListener(topic = "${lili.data.rocketmq.after-sale-topic}", consumerGroup = "${lili.data.rocketmq.after-sale-group}")
|
@RocketMQMessageListener(topic = "${lili.data.rocketmq.after-sale-topic}", consumerGroup = "${lili.data.rocketmq.after-sale-group}")
|
||||||
public class AfterSaleMessageListener implements RocketMQListener<MessageExt> {
|
public class AfterSaleMessageListener implements RocketMQListener<MessageExt> {
|
||||||
|
|
||||||
//售后订单状态
|
/**
|
||||||
|
* 售后订单状态
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private List<AfterSaleStatusChangeEvent> afterSaleStatusChangeEvents;
|
private List<AfterSaleStatusChangeEvent> afterSaleStatusChangeEvents;
|
||||||
|
|
||||||
@@ -43,6 +45,8 @@ public class AfterSaleMessageListener implements RocketMQListener<MessageExt> {
|
|||||||
e);
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
log.error("售后状态修改事件执行异常:", new String(messageExt.getBody()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ package cn.lili.listener;
|
|||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.lili.common.rocketmq.tags.GoodsTagsEnum;
|
import cn.lili.common.rocketmq.tags.GoodsTagsEnum;
|
||||||
import cn.lili.event.GoodsCommentCompleteEvent;
|
import cn.lili.event.GoodsCommentCompleteEvent;
|
||||||
|
import cn.lili.modules.distribution.entity.dos.DistributionGoods;
|
||||||
|
import cn.lili.modules.distribution.entity.dos.DistributionSelectedGoods;
|
||||||
|
import cn.lili.modules.distribution.service.DistributionGoodsService;
|
||||||
|
import cn.lili.modules.distribution.service.DistributionSelectedGoodsService;
|
||||||
import cn.lili.modules.goods.entity.dos.Goods;
|
import cn.lili.modules.goods.entity.dos.Goods;
|
||||||
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
||||||
import cn.lili.modules.goods.entity.dto.GoodsCompleteMessage;
|
import cn.lili.modules.goods.entity.dto.GoodsCompleteMessage;
|
||||||
@@ -15,6 +19,7 @@ import cn.lili.modules.member.service.GoodsCollectionService;
|
|||||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||||
import cn.lili.modules.search.service.EsGoodsIndexService;
|
import cn.lili.modules.search.service.EsGoodsIndexService;
|
||||||
import cn.lili.modules.store.service.StoreService;
|
import cn.lili.modules.store.service.StoreService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.rocketmq.common.message.MessageExt;
|
import org.apache.rocketmq.common.message.MessageExt;
|
||||||
@@ -36,27 +41,52 @@ import java.util.List;
|
|||||||
@RocketMQMessageListener(topic = "${lili.data.rocketmq.goods-topic}", consumerGroup = "${lili.data.rocketmq.goods-group}")
|
@RocketMQMessageListener(topic = "${lili.data.rocketmq.goods-topic}", consumerGroup = "${lili.data.rocketmq.goods-group}")
|
||||||
public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
||||||
|
|
||||||
//ES商品
|
/**
|
||||||
|
* ES商品
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private EsGoodsIndexService goodsIndexService;
|
private EsGoodsIndexService goodsIndexService;
|
||||||
//店铺
|
/**
|
||||||
|
* 店铺
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private StoreService storeService;
|
private StoreService storeService;
|
||||||
//商品
|
/**
|
||||||
|
* 商品
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private GoodsService goodsService;
|
private GoodsService goodsService;
|
||||||
//商品
|
/**
|
||||||
|
* 商品Sku
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private GoodsSkuService goodsSkuService;
|
private GoodsSkuService goodsSkuService;
|
||||||
//用户足迹
|
/**
|
||||||
|
* 用户足迹
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private FootprintService footprintService;
|
private FootprintService footprintService;
|
||||||
//商品收藏
|
/**
|
||||||
|
* 商品收藏
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private GoodsCollectionService goodsCollectionService;
|
private GoodsCollectionService goodsCollectionService;
|
||||||
//商品评价
|
/**
|
||||||
|
* 商品评价
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private List<GoodsCommentCompleteEvent> goodsCommentCompleteEvents;
|
private List<GoodsCommentCompleteEvent> goodsCommentCompleteEvents;
|
||||||
|
/**
|
||||||
|
* 分销商品
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private DistributionGoodsService distributionGoodsService;
|
||||||
|
/**
|
||||||
|
* 分销员-商品关联表
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private DistributionSelectedGoodsService distributionSelectedGoodsService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(MessageExt messageExt) {
|
public void onMessage(MessageExt messageExt) {
|
||||||
|
|
||||||
@@ -77,9 +107,10 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
|||||||
break;
|
break;
|
||||||
//审核商品
|
//审核商品
|
||||||
case GOODS_AUDIT:
|
case GOODS_AUDIT:
|
||||||
|
break;
|
||||||
//删除商品
|
//删除商品
|
||||||
case GOODS_DELETE:
|
case GOODS_DELETE:
|
||||||
storeService.updateStoreGoodsNum(new String(messageExt.getBody()));
|
deleteGoods(messageExt);
|
||||||
break;
|
break;
|
||||||
//规格删除
|
//规格删除
|
||||||
case SKU_DELETE:
|
case SKU_DELETE:
|
||||||
@@ -107,38 +138,77 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
|||||||
break;
|
break;
|
||||||
//购买商品完成
|
//购买商品完成
|
||||||
case BUY_GOODS_COMPLETE:
|
case BUY_GOODS_COMPLETE:
|
||||||
String goodsCompleteMessageStr = new String(messageExt.getBody());
|
this.goodsBuyComplete(messageExt);
|
||||||
List<GoodsCompleteMessage> goodsCompleteMessageList = JSONUtil.toList(JSONUtil.parseArray(goodsCompleteMessageStr), GoodsCompleteMessage.class);
|
break;
|
||||||
for (GoodsCompleteMessage goodsCompleteMessage : goodsCompleteMessageList) {
|
default:
|
||||||
Goods goods = goodsService.getById(goodsCompleteMessage.getGoodsId());
|
log.error("商品执行异常:", new String(messageExt.getBody()));
|
||||||
if (goods != null) {
|
|
||||||
//更新商品购买数量
|
|
||||||
if (goods.getBuyCount() == null) {
|
|
||||||
goods.setBuyCount(0);
|
|
||||||
}
|
|
||||||
int buyCount = goods.getBuyCount() + goodsCompleteMessage.getBuyNum();
|
|
||||||
LambdaUpdateWrapper<Goods> updateWrapper = new LambdaUpdateWrapper<>();
|
|
||||||
updateWrapper.eq(Goods::getId, goodsCompleteMessage.getGoodsId());
|
|
||||||
updateWrapper.set(Goods::getBuyCount, buyCount);
|
|
||||||
goodsService.update(updateWrapper);
|
|
||||||
} else {
|
|
||||||
log.error("商品Id为[" + goodsCompleteMessage.getGoodsId() + "的商品不存在,更新商品失败!");
|
|
||||||
}
|
|
||||||
GoodsSku goodsSku = goodsSkuService.getById(goodsCompleteMessage.getSkuId());
|
|
||||||
if (goodsSku != null) {
|
|
||||||
//更新商品购买数量
|
|
||||||
if (goodsSku.getBuyCount() == null) {
|
|
||||||
goodsSku.setBuyCount(0);
|
|
||||||
}
|
|
||||||
int buyCount = goodsSku.getBuyCount() + goodsCompleteMessage.getBuyNum();
|
|
||||||
goodsSku.setBuyCount(buyCount);
|
|
||||||
goodsSkuService.update(goodsSku);
|
|
||||||
goodsIndexService.updateIndexBuyNum(goodsCompleteMessage.getSkuId(), buyCount);
|
|
||||||
} else {
|
|
||||||
log.error("商品SkuId为[" + goodsCompleteMessage.getGoodsId() + "的商品不存在,更新商品失败!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商品
|
||||||
|
* 1.更新店铺的商品数量
|
||||||
|
* 2.删除分销员-分销商品绑定关系
|
||||||
|
* 3.删除分销商品
|
||||||
|
*
|
||||||
|
* @param messageExt 消息
|
||||||
|
*/
|
||||||
|
private void deleteGoods(MessageExt messageExt) {
|
||||||
|
Goods goods = JSONUtil.toBean(new String(messageExt.getBody()), Goods.class);
|
||||||
|
//更新店铺商品数量
|
||||||
|
storeService.updateStoreGoodsNum(goods.getStoreId());
|
||||||
|
|
||||||
|
//删除获取分销商品
|
||||||
|
DistributionGoods distributionGoods = distributionGoodsService.getOne(new LambdaQueryWrapper<DistributionGoods>()
|
||||||
|
.eq(DistributionGoods::getGoodsId, goods.getId()));
|
||||||
|
|
||||||
|
//删除分销商品绑定关系
|
||||||
|
distributionSelectedGoodsService.remove(new LambdaQueryWrapper<DistributionSelectedGoods>()
|
||||||
|
.eq(DistributionSelectedGoods::getDistributionGoodsId, distributionGoods.getId()));
|
||||||
|
|
||||||
|
//删除分销商品
|
||||||
|
distributionGoodsService.removeById(distributionGoods.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品购买完成
|
||||||
|
* 1.更新商品购买数量
|
||||||
|
* 2.更新SKU购买数量
|
||||||
|
* 3.更新索引购买数量
|
||||||
|
*
|
||||||
|
* @param messageExt
|
||||||
|
*/
|
||||||
|
private void goodsBuyComplete(MessageExt messageExt) {
|
||||||
|
String goodsCompleteMessageStr = new String(messageExt.getBody());
|
||||||
|
List<GoodsCompleteMessage> goodsCompleteMessageList = JSONUtil.toList(JSONUtil.parseArray(goodsCompleteMessageStr), GoodsCompleteMessage.class);
|
||||||
|
for (GoodsCompleteMessage goodsCompleteMessage : goodsCompleteMessageList) {
|
||||||
|
Goods goods = goodsService.getById(goodsCompleteMessage.getGoodsId());
|
||||||
|
if (goods != null) {
|
||||||
|
//更新商品购买数量
|
||||||
|
if (goods.getBuyCount() == null) {
|
||||||
|
goods.setBuyCount(0);
|
||||||
|
}
|
||||||
|
int buyCount = goods.getBuyCount() + goodsCompleteMessage.getBuyNum();
|
||||||
|
goodsService.update(new LambdaUpdateWrapper<Goods>()
|
||||||
|
.eq(Goods::getId, goodsCompleteMessage.getGoodsId())
|
||||||
|
.set(Goods::getBuyCount, buyCount));
|
||||||
|
} else {
|
||||||
|
log.error("商品Id为[" + goodsCompleteMessage.getGoodsId() + "的商品不存在,更新商品失败!");
|
||||||
|
}
|
||||||
|
GoodsSku goodsSku = goodsSkuService.getById(goodsCompleteMessage.getSkuId());
|
||||||
|
if (goodsSku != null) {
|
||||||
|
//更新商品购买数量
|
||||||
|
if (goodsSku.getBuyCount() == null) {
|
||||||
|
goodsSku.setBuyCount(0);
|
||||||
|
}
|
||||||
|
int buyCount = goodsSku.getBuyCount() + goodsCompleteMessage.getBuyNum();
|
||||||
|
goodsSku.setBuyCount(buyCount);
|
||||||
|
goodsSkuService.update(goodsSku);
|
||||||
|
goodsIndexService.updateIndexBuyNum(goodsCompleteMessage.getSkuId(), buyCount);
|
||||||
|
} else {
|
||||||
|
log.error("商品SkuId为[" + goodsCompleteMessage.getGoodsId() + "的商品不存在,更新商品失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,16 +30,24 @@ import java.util.List;
|
|||||||
@RocketMQMessageListener(topic = "${lili.data.rocketmq.member-topic}", consumerGroup = "${lili.data.rocketmq.member-group}")
|
@RocketMQMessageListener(topic = "${lili.data.rocketmq.member-topic}", consumerGroup = "${lili.data.rocketmq.member-group}")
|
||||||
public class MemberMessageListener implements RocketMQListener<MessageExt> {
|
public class MemberMessageListener implements RocketMQListener<MessageExt> {
|
||||||
|
|
||||||
//会员签到
|
/**
|
||||||
|
* 会员签到
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberSignService memberSignService;
|
private MemberSignService memberSignService;
|
||||||
//会员积分变化
|
/**
|
||||||
|
* 会员积分变化
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private List<MemberPointChangeEvent> memberPointChangeEvents;
|
private List<MemberPointChangeEvent> memberPointChangeEvents;
|
||||||
//会员提现
|
/**
|
||||||
|
* 会员提现
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private List<MemberWithdrawalEvent> memberWithdrawalEvents;
|
private List<MemberWithdrawalEvent> memberWithdrawalEvents;
|
||||||
//会员注册
|
/**
|
||||||
|
* 会员注册
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private List<MemberRegisterEvent> memberSignEvents;
|
private List<MemberRegisterEvent> memberSignEvents;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package cn.lili.listener;
|
|||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.lili.modules.message.entity.dto.NoticeMessageDTO;
|
import cn.lili.modules.message.entity.dto.NoticeMessageDTO;
|
||||||
import cn.lili.modules.message.service.NoticeMessageService;
|
import cn.lili.modules.message.service.NoticeMessageService;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.apache.rocketmq.common.message.MessageExt;
|
import org.apache.rocketmq.common.message.MessageExt;
|
||||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||||
@@ -20,7 +19,9 @@ import org.springframework.stereotype.Component;
|
|||||||
@RocketMQMessageListener(topic = "${lili.data.rocketmq.notice-topic}", consumerGroup = "${lili.data.rocketmq.notice-group}")
|
@RocketMQMessageListener(topic = "${lili.data.rocketmq.notice-topic}", consumerGroup = "${lili.data.rocketmq.notice-group}")
|
||||||
public class NoticeMessageListener implements RocketMQListener<MessageExt> {
|
public class NoticeMessageListener implements RocketMQListener<MessageExt> {
|
||||||
|
|
||||||
//站内信
|
/**
|
||||||
|
* 站内信
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private NoticeMessageService noticeMessageService;
|
private NoticeMessageService noticeMessageService;
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import org.apache.rocketmq.spring.core.RocketMQListener;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -41,22 +42,34 @@ import java.util.List;
|
|||||||
@RocketMQMessageListener(topic = "${lili.data.rocketmq.notice-send-topic}", consumerGroup = "${lili.data.rocketmq.notice-send-group}")
|
@RocketMQMessageListener(topic = "${lili.data.rocketmq.notice-send-topic}", consumerGroup = "${lili.data.rocketmq.notice-send-group}")
|
||||||
public class NoticeSendMessageListener implements RocketMQListener<MessageExt> {
|
public class NoticeSendMessageListener implements RocketMQListener<MessageExt> {
|
||||||
|
|
||||||
//会员
|
/**
|
||||||
@Autowired
|
* 会员
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
private MemberMapper memberMapper;
|
private MemberMapper memberMapper;
|
||||||
//短信
|
/**
|
||||||
|
* 短信
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private SmsUtil smsUtil;
|
private SmsUtil smsUtil;
|
||||||
//店铺消息
|
/**
|
||||||
|
* 店铺消息
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private StoreMessageService storeMessageService;
|
private StoreMessageService storeMessageService;
|
||||||
//会员消息
|
/**
|
||||||
|
* 会员消息
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberMessageService memberMessageService;
|
private MemberMessageService memberMessageService;
|
||||||
//店铺
|
/**
|
||||||
|
* 店铺
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private StoreService storeService;
|
private StoreService storeService;
|
||||||
//会员
|
/**
|
||||||
|
* 会员
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberService memberService;
|
private MemberService memberService;
|
||||||
|
|
||||||
@@ -100,7 +113,7 @@ public class NoticeSendMessageListener implements RocketMQListener<MessageExt> {
|
|||||||
private void saveStoreMessage(Message message) {
|
private void saveStoreMessage(Message message) {
|
||||||
List<StoreMessage> list = new ArrayList<>();
|
List<StoreMessage> list = new ArrayList<>();
|
||||||
//发送全部商家情况
|
//发送全部商家情况
|
||||||
if (message.getMessageRange().equals("ALL")) {
|
if ("ALL".equals(message.getMessageRange())) {
|
||||||
List<Store> storeList = storeService.list(new QueryWrapper<Store>().eq("store_disable", "OPEN"));
|
List<Store> storeList = storeService.list(new QueryWrapper<Store>().eq("store_disable", "OPEN"));
|
||||||
storeList.forEach(item -> {
|
storeList.forEach(item -> {
|
||||||
StoreMessage storeMessage = new StoreMessage();
|
StoreMessage storeMessage = new StoreMessage();
|
||||||
@@ -141,7 +154,7 @@ public class NoticeSendMessageListener implements RocketMQListener<MessageExt> {
|
|||||||
private void saveMemberMessage(Message message) {
|
private void saveMemberMessage(Message message) {
|
||||||
List<MemberMessage> list = new ArrayList<>();
|
List<MemberMessage> list = new ArrayList<>();
|
||||||
//如果是给所有会员发送消息
|
//如果是给所有会员发送消息
|
||||||
if (message.getMessageRange().equals("ALL")) {
|
if ("ALL".equals(message.getMessageRange())) {
|
||||||
//查询所有会员总数,因为会员总数比较大 如果一次性查出来会占用数据库资源,所以要分页查询
|
//查询所有会员总数,因为会员总数比较大 如果一次性查出来会占用数据库资源,所以要分页查询
|
||||||
MemberSearchVO memberSearchVO = new MemberSearchVO();
|
MemberSearchVO memberSearchVO = new MemberSearchVO();
|
||||||
memberSearchVO.setDisabled(SwitchEnum.OPEN.name());
|
memberSearchVO.setDisabled(SwitchEnum.OPEN.name());
|
||||||
|
|||||||
@@ -27,13 +27,19 @@ import java.util.List;
|
|||||||
@RocketMQMessageListener(topic = "${lili.data.rocketmq.order-topic}", consumerGroup = "${lili.data.rocketmq.order-group}")
|
@RocketMQMessageListener(topic = "${lili.data.rocketmq.order-topic}", consumerGroup = "${lili.data.rocketmq.order-group}")
|
||||||
public class OrderMessageListener implements RocketMQListener<MessageExt> {
|
public class OrderMessageListener implements RocketMQListener<MessageExt> {
|
||||||
|
|
||||||
//交易
|
/**
|
||||||
|
* 交易
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private List<TradeEvent> tradeEvent;
|
private List<TradeEvent> tradeEvent;
|
||||||
//订单状态
|
/**
|
||||||
|
* 订单状态
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private List<OrderStatusChangeEvent> orderStatusChangeEvents;
|
private List<OrderStatusChangeEvent> orderStatusChangeEvents;
|
||||||
//缓存
|
/**
|
||||||
|
* 缓存
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private Cache<Object> cache;
|
private Cache<Object> cache;
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,14 @@ import java.util.List;
|
|||||||
@Component
|
@Component
|
||||||
public class BillExecute implements EveryDayExecute {
|
public class BillExecute implements EveryDayExecute {
|
||||||
|
|
||||||
//结算单
|
/**
|
||||||
|
* 结算单
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private BillService billService;
|
private BillService billService;
|
||||||
//店铺详情
|
/**
|
||||||
|
* 店铺详情
|
||||||
|
*/
|
||||||
@Resource
|
@Resource
|
||||||
private StoreDetailMapper storeDetailMapper;
|
private StoreDetailMapper storeDetailMapper;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package cn.lili.timetask.handler.impl.broadcast;
|
package cn.lili.timetask.handler.impl.broadcast;
|
||||||
|
|
||||||
import cn.lili.modules.broadcast.service.CommodityService;
|
import cn.lili.modules.goods.service.CommodityService;
|
||||||
import cn.lili.timetask.handler.EveryHourExecute;
|
import cn.lili.timetask.handler.EveryHourExecute;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.lili.timetask.handler.impl.goods;
|
package cn.lili.timetask.handler.impl.goods;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.lili.modules.goods.mapper.GoodsMapper;
|
import cn.lili.modules.goods.mapper.GoodsMapper;
|
||||||
@@ -7,9 +8,9 @@ import cn.lili.modules.member.entity.dos.MemberEvaluation;
|
|||||||
import cn.lili.modules.member.mapper.MemberEvaluationMapper;
|
import cn.lili.modules.member.mapper.MemberEvaluationMapper;
|
||||||
import cn.lili.timetask.handler.EveryDayExecute;
|
import cn.lili.timetask.handler.EveryDayExecute;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -21,11 +22,15 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class GoodsExecute implements EveryDayExecute {
|
public class GoodsExecute implements EveryDayExecute {
|
||||||
//会员评价
|
/**
|
||||||
@Autowired
|
* 会员评价
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
private MemberEvaluationMapper memberEvaluationMapper;
|
private MemberEvaluationMapper memberEvaluationMapper;
|
||||||
//商品
|
/**
|
||||||
@Autowired
|
* 商品
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
private GoodsMapper goodsMapper;
|
private GoodsMapper goodsMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +45,7 @@ public class GoodsExecute implements EveryDayExecute {
|
|||||||
.between("create_time", DateUtil.yesterday(), new DateTime()));
|
.between("create_time", DateUtil.yesterday(), new DateTime()));
|
||||||
|
|
||||||
for (Map<String, Object> map : list) {
|
for (Map<String, Object> map : list) {
|
||||||
goodsMapper.addGoodsCommentNum(Integer.parseInt(map.get("num").toString()), map.get("goods_id").toString());
|
goodsMapper.addGoodsCommentNum(Convert.toInt(map.get("num").toString()), map.get("goods_id").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import cn.lili.modules.system.entity.enums.SettingEnum;
|
|||||||
import cn.lili.modules.system.service.SettingService;
|
import cn.lili.modules.system.service.SettingService;
|
||||||
import cn.lili.timetask.handler.EveryMinuteExecute;
|
import cn.lili.timetask.handler.EveryMinuteExecute;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -28,12 +27,15 @@ import java.util.stream.Collectors;
|
|||||||
**/
|
**/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
|
|
||||||
public class CancelOrderTaskExecute implements EveryMinuteExecute {
|
public class CancelOrderTaskExecute implements EveryMinuteExecute {
|
||||||
//订单
|
/**
|
||||||
|
* 订单
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
//设置
|
/**
|
||||||
|
* 设置
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private SettingService settingService;
|
private SettingService settingService;
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,19 @@ package cn.lili.timetask.handler.impl.order;
|
|||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import cn.lili.common.enums.ResultCode;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.modules.member.entity.dto.MemberEvaluationDTO;
|
import cn.lili.modules.member.entity.dto.MemberEvaluationDTO;
|
||||||
import cn.lili.modules.member.entity.enums.EvaluationGradeEnum;
|
import cn.lili.modules.member.entity.enums.EvaluationGradeEnum;
|
||||||
import cn.lili.modules.member.service.MemberEvaluationService;
|
import cn.lili.modules.member.service.MemberEvaluationService;
|
||||||
import cn.lili.modules.order.order.entity.dos.Order;
|
import cn.lili.modules.order.order.entity.dos.Order;
|
||||||
import cn.lili.modules.order.order.entity.dos.OrderItem;
|
import cn.lili.modules.order.order.entity.dos.OrderItem;
|
||||||
|
import cn.lili.modules.order.order.entity.enums.CommentStatusEnum;
|
||||||
|
import cn.lili.modules.order.order.entity.enums.OrderComplaintStatusEnum;
|
||||||
|
import cn.lili.modules.order.order.entity.enums.OrderItemAfterSaleStatusEnum;
|
||||||
import cn.lili.modules.order.order.entity.enums.OrderStatusEnum;
|
import cn.lili.modules.order.order.entity.enums.OrderStatusEnum;
|
||||||
|
import cn.lili.modules.order.order.mapper.OrderItemMapper;
|
||||||
|
import cn.lili.modules.order.order.service.AfterSaleService;
|
||||||
import cn.lili.modules.order.order.service.OrderItemService;
|
import cn.lili.modules.order.order.service.OrderItemService;
|
||||||
import cn.lili.modules.order.order.service.OrderService;
|
import cn.lili.modules.order.order.service.OrderService;
|
||||||
import cn.lili.modules.system.entity.dos.Setting;
|
import cn.lili.modules.system.entity.dos.Setting;
|
||||||
@@ -18,12 +24,13 @@ import cn.lili.modules.system.entity.enums.SettingEnum;
|
|||||||
import cn.lili.modules.system.service.SettingService;
|
import cn.lili.modules.system.service.SettingService;
|
||||||
import cn.lili.timetask.handler.EveryDayExecute;
|
import cn.lili.timetask.handler.EveryDayExecute;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Date;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -36,35 +43,53 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class OrderEveryDayTaskExecute implements EveryDayExecute {
|
public class OrderEveryDayTaskExecute implements EveryDayExecute {
|
||||||
|
|
||||||
//订单
|
/**
|
||||||
|
* 订单
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
//订单货物
|
/**
|
||||||
|
* 订单货物
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderItemService orderItemService;
|
private OrderItemService orderItemService;
|
||||||
//设置
|
@Resource
|
||||||
|
private OrderItemMapper orderItemMapper;
|
||||||
|
/**
|
||||||
|
* 设置
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private SettingService settingService;
|
private SettingService settingService;
|
||||||
//会员评价
|
/**
|
||||||
|
* 会员评价
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberEvaluationService memberEvaluationService;
|
private MemberEvaluationService memberEvaluationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AfterSaleService afterSaleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行每日任务
|
* 执行每日任务
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
|
||||||
Setting setting = settingService.get(SettingEnum.ORDER_SETTING.name());
|
Setting setting = settingService.get(SettingEnum.ORDER_SETTING.name());
|
||||||
//自动确认收货
|
//订单设置
|
||||||
OrderSetting orderSetting = JSONUtil.toBean(setting.getSettingValue(), OrderSetting.class);
|
OrderSetting orderSetting = JSONUtil.toBean(setting.getSettingValue(), OrderSetting.class);
|
||||||
if (orderSetting == null) {
|
if (orderSetting == null) {
|
||||||
throw new ServiceException("系统配置异常");
|
throw new ServiceException(ResultCode.ORDER_SETTING_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
//自动确认收货
|
//自动确认收货
|
||||||
completedOrder(orderSetting);
|
completedOrder(orderSetting);
|
||||||
//自动好评
|
//自动好评
|
||||||
memberEvaluation(orderSetting);
|
memberEvaluation(orderSetting);
|
||||||
|
//关闭允许售后申请
|
||||||
|
closeAfterSale(orderSetting);
|
||||||
|
//关闭允许投诉
|
||||||
|
closeComplaint(orderSetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,21 +98,21 @@ public class OrderEveryDayTaskExecute implements EveryDayExecute {
|
|||||||
* @param orderSetting 订单设置
|
* @param orderSetting 订单设置
|
||||||
*/
|
*/
|
||||||
private void completedOrder(OrderSetting orderSetting) {
|
private void completedOrder(OrderSetting orderSetting) {
|
||||||
|
|
||||||
//订单自动收货时间 = 当前时间 - 自动收货时间天数
|
//订单自动收货时间 = 当前时间 - 自动收货时间天数
|
||||||
DateTime receiveTime = DateUtil.offsetDay(DateUtil.date(), -orderSetting.getAutoEvaluation());
|
DateTime receiveTime = DateUtil.offsetDay(DateUtil.date(), -orderSetting.getAutoReceive());
|
||||||
LambdaQueryWrapper<Order> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Order> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(Order::getOrderStatus, OrderStatusEnum.DELIVERED.name());
|
queryWrapper.eq(Order::getOrderStatus, OrderStatusEnum.DELIVERED.name());
|
||||||
|
|
||||||
//订单发货时间 >= 订单自动收货时间
|
//订单发货时间 >= 订单自动收货时间
|
||||||
queryWrapper.ge(Order::getLogisticsTime, receiveTime);
|
queryWrapper.ge(Order::getLogisticsTime, receiveTime);
|
||||||
List<Order> list = orderService.list(queryWrapper);
|
List<Order> list = orderService.list(queryWrapper);
|
||||||
List<String> receiveSnList = list.stream().map(Order::getSn).collect(Collectors.toList());
|
|
||||||
if (!receiveSnList.isEmpty()) {
|
//判断是否有符合条件的订单,进行订单完成处理
|
||||||
LambdaUpdateWrapper<Order> updateWrapper = new LambdaUpdateWrapper<>();
|
if (!list.isEmpty()) {
|
||||||
updateWrapper.in(Order::getSn, receiveSnList);
|
List<String> receiveSnList = list.stream().map(Order::getSn).collect(Collectors.toList());
|
||||||
updateWrapper.set(Order::getOrderStatus, OrderStatusEnum.COMPLETED.name()).set(Order::getCompleteTime, new Date());
|
for (String orderSn : receiveSnList) {
|
||||||
boolean update = orderService.update(updateWrapper);
|
orderService.complete(orderSn);
|
||||||
if (Boolean.FALSE.equals(update)) {
|
|
||||||
log.error("自动收货订单失败!订单编号为[{}]", receiveSnList);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,26 +124,93 @@ public class OrderEveryDayTaskExecute implements EveryDayExecute {
|
|||||||
*/
|
*/
|
||||||
private void memberEvaluation(OrderSetting orderSetting) {
|
private void memberEvaluation(OrderSetting orderSetting) {
|
||||||
//订单自动收货时间 = 当前时间 - 自动收货时间天数
|
//订单自动收货时间 = 当前时间 - 自动收货时间天数
|
||||||
DateTime receiveTime = DateUtil.offsetDay(DateUtil.date(), -orderSetting.getAutoReceive());
|
DateTime receiveTime = DateUtil.offsetDay(DateUtil.date(), -orderSetting.getAutoEvaluation());
|
||||||
|
|
||||||
//订单完成时间 <= 订单自动好评时间
|
//订单完成时间 <= 订单自动好评时间
|
||||||
List<OrderItem> orderItems = orderItemService.waitEvaluate(receiveTime);
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
|
queryWrapper.ge("o.complete_time", receiveTime);
|
||||||
|
queryWrapper.eq("oi.comment_status", CommentStatusEnum.UNFINISHED.name());
|
||||||
|
List<OrderItem> orderItems = orderItemMapper.waitOperationOrderItem(queryWrapper);
|
||||||
|
|
||||||
for (OrderItem orderItem : orderItems) {
|
//判断是否有符合条件的订单,进行自动评价处理
|
||||||
|
if (!orderItems.isEmpty()) {
|
||||||
MemberEvaluationDTO memberEvaluationDTO = new MemberEvaluationDTO();
|
for (OrderItem orderItem : orderItems) {
|
||||||
memberEvaluationDTO.setOrderItemSn(orderItem.getSn());
|
MemberEvaluationDTO memberEvaluationDTO = new MemberEvaluationDTO();
|
||||||
memberEvaluationDTO.setContent("系统默认好评");
|
memberEvaluationDTO.setOrderItemSn(orderItem.getSn());
|
||||||
memberEvaluationDTO.setGoodsId(orderItem.getGoodsId());
|
memberEvaluationDTO.setContent("系统默认好评");
|
||||||
memberEvaluationDTO.setSkuId(orderItem.getSkuId());
|
memberEvaluationDTO.setGoodsId(orderItem.getGoodsId());
|
||||||
memberEvaluationDTO.setGrade(EvaluationGradeEnum.GOOD.name());
|
memberEvaluationDTO.setSkuId(orderItem.getSkuId());
|
||||||
memberEvaluationDTO.setDeliveryScore(5);
|
memberEvaluationDTO.setGrade(EvaluationGradeEnum.GOOD.name());
|
||||||
memberEvaluationDTO.setDescriptionScore(5);
|
memberEvaluationDTO.setDeliveryScore(5);
|
||||||
memberEvaluationDTO.setServiceScore(5);
|
memberEvaluationDTO.setDescriptionScore(5);
|
||||||
|
memberEvaluationDTO.setServiceScore(5);
|
||||||
memberEvaluationService.addMemberEvaluation(memberEvaluationDTO);
|
|
||||||
|
|
||||||
|
memberEvaluationService.addMemberEvaluation(memberEvaluationDTO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭允许售后申请
|
||||||
|
*
|
||||||
|
* @param orderSetting 订单设置
|
||||||
|
*/
|
||||||
|
private void closeAfterSale(OrderSetting orderSetting) {
|
||||||
|
|
||||||
|
//订单关闭售后申请时间 = 当前时间 - 自动关闭售后申请天数
|
||||||
|
DateTime receiveTime = DateUtil.offsetDay(DateUtil.date(), -orderSetting.getAutoEvaluation());
|
||||||
|
|
||||||
|
//关闭售后订单=未售后订单+小于订单关闭售后申请时间
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
|
queryWrapper.ge("o.complete_time", receiveTime);
|
||||||
|
queryWrapper.eq("oi.after_sale_status", OrderItemAfterSaleStatusEnum.NOT_APPLIED.name());
|
||||||
|
List<OrderItem> orderItems = orderItemMapper.waitOperationOrderItem(queryWrapper);
|
||||||
|
|
||||||
|
//判断是否有符合条件的订单,关闭允许售后申请处理
|
||||||
|
if (!orderItems.isEmpty()) {
|
||||||
|
|
||||||
|
//获取订单货物ID
|
||||||
|
List<String> orderItemIdList = orderItems.stream().map(OrderItem::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
//修改订单售后状态
|
||||||
|
LambdaUpdateWrapper<OrderItem> lambdaUpdateWrapper = new LambdaUpdateWrapper<OrderItem>()
|
||||||
|
.set(OrderItem::getAfterSaleStatus, OrderItemAfterSaleStatusEnum.EXPIRED.name())
|
||||||
|
.in(OrderItem::getId, orderItemIdList);
|
||||||
|
orderItemService.update(lambdaUpdateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭允许交易投诉
|
||||||
|
*
|
||||||
|
* @param orderSetting 订单设置
|
||||||
|
*/
|
||||||
|
private void closeComplaint(OrderSetting orderSetting) {
|
||||||
|
|
||||||
|
//订单关闭交易投诉申请时间 = 当前时间 - 自动关闭交易投诉申请天数
|
||||||
|
DateTime receiveTime = DateUtil.offsetDay(DateUtil.date(), -orderSetting.getCloseComplaint());
|
||||||
|
|
||||||
|
//关闭售后订单=未售后订单+小于订单关闭售后申请时间
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
|
queryWrapper.ge("o.complete_time", receiveTime);
|
||||||
|
queryWrapper.eq("oi.complain_status", OrderComplaintStatusEnum.NO_APPLY.name());
|
||||||
|
List<OrderItem> orderItems = orderItemMapper.waitOperationOrderItem(queryWrapper);
|
||||||
|
|
||||||
|
//判断是否有符合条件的订单,关闭允许售后申请处理
|
||||||
|
if (!orderItems.isEmpty()) {
|
||||||
|
|
||||||
|
//获取订单货物ID
|
||||||
|
List<String> orderItemIdList = orderItems.stream().map(OrderItem::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
//修改订单投诉状态
|
||||||
|
LambdaUpdateWrapper<OrderItem> lambdaUpdateWrapper = new LambdaUpdateWrapper<OrderItem>()
|
||||||
|
.set(OrderItem::getComplainStatus, OrderItemAfterSaleStatusEnum.EXPIRED.name())
|
||||||
|
.in(OrderItem::getId, orderItemIdList);
|
||||||
|
orderItemService.update(lambdaUpdateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,33 +39,49 @@ import java.util.List;
|
|||||||
@Component
|
@Component
|
||||||
public class PromotionEverydayExecute implements EveryDayExecute {
|
public class PromotionEverydayExecute implements EveryDayExecute {
|
||||||
|
|
||||||
//Mongo
|
/**
|
||||||
|
* Mongo
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private MongoTemplate mongoTemplate;
|
private MongoTemplate mongoTemplate;
|
||||||
//es
|
/**
|
||||||
|
* ES商品索引
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private EsGoodsIndexService esGoodsIndexService;
|
private EsGoodsIndexService esGoodsIndexService;
|
||||||
//满额活动
|
/**
|
||||||
|
* 满额活动
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private FullDiscountService fullDiscountService;
|
private FullDiscountService fullDiscountService;
|
||||||
//拼团
|
/**
|
||||||
|
* 拼团
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private PintuanService pintuanService;
|
private PintuanService pintuanService;
|
||||||
//优惠券
|
/**
|
||||||
|
* 优惠券
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private CouponService couponService;
|
private CouponService couponService;
|
||||||
//会员优惠券
|
/**
|
||||||
|
* 会员优惠券
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberCouponService memberCouponService;
|
private MemberCouponService memberCouponService;
|
||||||
//促销商品
|
/**
|
||||||
|
* 促销商品
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private PromotionGoodsService promotionGoodsService;
|
private PromotionGoodsService promotionGoodsService;
|
||||||
|
/**
|
||||||
//系统设置
|
* 系统设置
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private SettingService settingService;
|
private SettingService settingService;
|
||||||
|
/**
|
||||||
//秒杀活动
|
* 秒杀活动
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private SeckillService seckillService;
|
private SeckillService seckillService;
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ import java.util.Date;
|
|||||||
@Component
|
@Component
|
||||||
public class MemberStatisticsExecute implements EveryDayExecute {
|
public class MemberStatisticsExecute implements EveryDayExecute {
|
||||||
|
|
||||||
//会员统计
|
/**
|
||||||
|
* 会员统计
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberStatisticsDataService memberStatisticsDataService;
|
private MemberStatisticsDataService memberStatisticsDataService;
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,14 @@ import java.util.stream.Collectors;
|
|||||||
@Component
|
@Component
|
||||||
public class OnlineMemberStatistics implements EveryHourExecute {
|
public class OnlineMemberStatistics implements EveryHourExecute {
|
||||||
|
|
||||||
//缓存
|
/**
|
||||||
|
* 缓存
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private Cache cache;
|
private Cache cache;
|
||||||
//统计小时
|
/**
|
||||||
|
* 统计小时
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private StatisticsProperties statisticsProperties;
|
private StatisticsProperties statisticsProperties;
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import cn.lili.timetask.handler.EveryDayExecute;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,11 +25,15 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class StoreRatingExecute implements EveryDayExecute {
|
public class StoreRatingExecute implements EveryDayExecute {
|
||||||
//店铺
|
/**
|
||||||
|
* 店铺
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private StoreService storeService;
|
private StoreService storeService;
|
||||||
//会员评价
|
/**
|
||||||
@Autowired
|
* 会员评价
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
private MemberEvaluationMapper memberEvaluationMapper;
|
private MemberEvaluationMapper memberEvaluationMapper;
|
||||||
|
|
||||||
|
|
||||||
@@ -39,10 +43,10 @@ public class StoreRatingExecute implements EveryDayExecute {
|
|||||||
List<Store> storeList = storeService.list(new LambdaQueryWrapper<Store>().eq(Store::getStoreDisable, StoreStatusEnum.OPEN.name()));
|
List<Store> storeList = storeService.list(new LambdaQueryWrapper<Store>().eq(Store::getStoreDisable, StoreStatusEnum.OPEN.name()));
|
||||||
for (Store store : storeList) {
|
for (Store store : storeList) {
|
||||||
//店铺所有开启的评价
|
//店铺所有开启的评价
|
||||||
LambdaQueryWrapper<MemberEvaluation> QueryWrapper = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<MemberEvaluation> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
QueryWrapper.eq(MemberEvaluation::getStoreId, store.getId());
|
lambdaQueryWrapper.eq(MemberEvaluation::getStoreId, store.getId());
|
||||||
QueryWrapper.eq(MemberEvaluation::getStatus, SwitchEnum.OPEN.name());
|
lambdaQueryWrapper.eq(MemberEvaluation::getStatus, SwitchEnum.OPEN.name());
|
||||||
StoreRatingVO storeRatingVO = memberEvaluationMapper.getStoreRatingVO(QueryWrapper);
|
StoreRatingVO storeRatingVO = memberEvaluationMapper.getStoreRatingVO(lambdaQueryWrapper);
|
||||||
|
|
||||||
if (storeRatingVO != null) {
|
if (storeRatingVO != null) {
|
||||||
//保存评分
|
//保存评分
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package cn.lili.timetask.handler.impl.view;
|
package cn.lili.timetask.handler.impl.view;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.lili.common.cache.Cache;
|
import cn.lili.common.cache.Cache;
|
||||||
import cn.lili.common.cache.CachePrefix;
|
import cn.lili.common.cache.CachePrefix;
|
||||||
import cn.lili.common.utils.BeanUtil;
|
import cn.lili.common.utils.BeanUtil;
|
||||||
import cn.lili.common.utils.DateUtil;
|
|
||||||
import cn.lili.modules.statistics.model.dos.PlatformViewData;
|
import cn.lili.modules.statistics.model.dos.PlatformViewData;
|
||||||
import cn.lili.modules.statistics.service.PlatformViewDataService;
|
import cn.lili.modules.statistics.service.PlatformViewDataService;
|
||||||
import cn.lili.timetask.handler.EveryDayExecute;
|
import cn.lili.timetask.handler.EveryDayExecute;
|
||||||
@@ -28,10 +28,14 @@ import java.util.List;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class PageViewStatisticsExecute implements EveryDayExecute {
|
public class PageViewStatisticsExecute implements EveryDayExecute {
|
||||||
//缓存
|
/**
|
||||||
|
* 缓存
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private Cache cache;
|
private Cache cache;
|
||||||
//平台PV统计
|
/**
|
||||||
|
* 平台PV统计
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private PlatformViewDataService platformViewDataService;
|
private PlatformViewDataService platformViewDataService;
|
||||||
|
|
||||||
@@ -167,15 +171,15 @@ class PageViewStatistics {
|
|||||||
//将字符串解析成需要的对象
|
//将字符串解析成需要的对象
|
||||||
str = str.substring(str.indexOf("}") + 2);
|
str = str.substring(str.indexOf("}") + 2);
|
||||||
String[] dateStr = str.split("-");
|
String[] dateStr = str.split("-");
|
||||||
Integer year = Integer.parseInt(dateStr[0]);
|
Integer year = Convert.toInt(dateStr[0]);
|
||||||
Integer month = Integer.parseInt(dateStr[1]);
|
Integer month = Convert.toInt(dateStr[1]);
|
||||||
Integer day;
|
Integer day;
|
||||||
//是否有店铺id
|
//是否有店铺id
|
||||||
if (dateStr.length > 3) {
|
if (dateStr.length > 3) {
|
||||||
day = Integer.parseInt(dateStr[2]);
|
day = Convert.toInt(dateStr[2]);
|
||||||
this.storeId = dateStr[3];
|
this.storeId = dateStr[3];
|
||||||
} else {
|
} else {
|
||||||
day = Integer.parseInt(dateStr[2]);
|
day = Convert.toInt(dateStr[2]);
|
||||||
}
|
}
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.set(Calendar.YEAR, year);
|
calendar.set(Calendar.YEAR, year);
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public abstract class AbstractDelayQueueListen {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 要实现延时队列的名字
|
* 要实现延时队列的名字
|
||||||
|
* @return 促销延时队列名称
|
||||||
*/
|
*/
|
||||||
public abstract String setDelayQueueName();
|
public abstract String setDelayQueueName();
|
||||||
|
|
||||||
@@ -88,7 +89,7 @@ public abstract class AbstractDelayQueueListen {
|
|||||||
*/
|
*/
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
new Thread(this::startDelayQueueMachine).start();
|
ThreadPoolUtil.getPool().execute(this::startDelayQueueMachine);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package cn.lili.trigger.executor;
|
|||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.lili.common.delayqueue.BroadcastMessage;
|
import cn.lili.common.delayqueue.BroadcastMessage;
|
||||||
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
import cn.lili.common.trigger.model.TimeExecuteConstant;
|
||||||
import cn.lili.modules.broadcast.service.StudioService;
|
import cn.lili.modules.goods.service.StudioService;
|
||||||
import cn.lili.trigger.TimeTriggerExecutor;
|
import cn.lili.trigger.TimeTriggerExecutor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|||||||
@@ -25,16 +25,24 @@ import org.springframework.stereotype.Component;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Component(TimeExecuteConstant.PROMOTION_EXECUTOR)
|
@Component(TimeExecuteConstant.PROMOTION_EXECUTOR)
|
||||||
public class PromotionTimeTriggerExecutor implements TimeTriggerExecutor {
|
public class PromotionTimeTriggerExecutor implements TimeTriggerExecutor {
|
||||||
//促销
|
/**
|
||||||
|
* 促销
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private PromotionService promotionService;
|
private PromotionService promotionService;
|
||||||
//Rocketmq
|
/**
|
||||||
|
* RocketMQ
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private RocketmqCustomProperties rocketmqCustomProperties;
|
private RocketmqCustomProperties rocketmqCustomProperties;
|
||||||
//延时任务
|
/**
|
||||||
|
* 延时任务
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private TimeTrigger timeTrigger;
|
private TimeTrigger timeTrigger;
|
||||||
//订单
|
/**
|
||||||
|
* 订单
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
|
|
||||||
|
|||||||
@@ -7,53 +7,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cn.lili</groupId>
|
<groupId>cn.lili</groupId>
|
||||||
<artifactId>lili-shop-parent</artifactId>
|
<artifactId>lili-shop-parent</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>${revision}</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>framework</artifactId>
|
<artifactId>framework</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<swagger-bootstrap-ui-version>1.9.6</swagger-bootstrap-ui-version>
|
|
||||||
<alipay-sdk-version>4.13.40.ALL</alipay-sdk-version>
|
|
||||||
<mysql-connector-version>5.1.48</mysql-connector-version>
|
|
||||||
<mybatis-plus-version>3.3.1.tmp</mybatis-plus-version>
|
|
||||||
<Hutool-version>5.5.8</Hutool-version>
|
|
||||||
<TinyPinyin-verions>2.0.3.RELEASE</TinyPinyin-verions>
|
|
||||||
<jasypt-version>3.0.0</jasypt-version>
|
|
||||||
<neetl-version>2.9.10</neetl-version>
|
|
||||||
<lombok-version>1.18.10</lombok-version>
|
|
||||||
<minio-version>6.0.11</minio-version>
|
|
||||||
<aliyun-version>4.5.18</aliyun-version>
|
|
||||||
<aliyun-sdk-oss-version>3.11.1</aliyun-sdk-oss-version>
|
|
||||||
<aliyun-sdk-dysms-version>2.0.1</aliyun-sdk-dysms-version>
|
|
||||||
<rocketmq-version>2.1.1</rocketmq-version>
|
|
||||||
<jwt-version>0.10.7</jwt-version>
|
|
||||||
<antlr4-runtime-version>4.7.2</antlr4-runtime-version>
|
|
||||||
<sharding-jdbc-version>4.0.0</sharding-jdbc-version>
|
|
||||||
<druid-version>1.1.20</druid-version>
|
|
||||||
<simple-http-version>1.0.3</simple-http-version>
|
|
||||||
<antlr4-version>4.7.2</antlr4-version>
|
|
||||||
<okhttp-version>4.4.1</okhttp-version>
|
|
||||||
<httpclient-version>4.5.12</httpclient-version>
|
|
||||||
<beetl-version>2.9.10</beetl-version>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
|
||||||
<java.version>1.8</java.version>
|
|
||||||
<skipTests>true</skipTests>
|
|
||||||
<knife4j.version>2.0.8</knife4j.version>
|
|
||||||
<de.codecentric>2.3.1</de.codecentric>
|
|
||||||
<userAgentUtils>1.21</userAgentUtils>
|
|
||||||
<interceptor-api>1.2</interceptor-api>
|
|
||||||
<poi-version>4.1.2</poi-version>
|
|
||||||
<poi-ooxml-version>4.1.2</poi-ooxml-version>
|
|
||||||
<logstash-logback-encoder>6.6</logstash-logback-encoder>
|
|
||||||
<zxing>3.4.1</zxing>
|
|
||||||
<slf4j-api>1.7.28</slf4j-api>
|
|
||||||
<xk-time>2.2.0</xk-time>
|
|
||||||
<commons-text>1.4</commons-text>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cn.lili.common.aop.limiter;
|
package cn.lili.common.aop.limiter;
|
||||||
|
|
||||||
import cn.lili.common.aop.limiter.annotation.LimitPoint;
|
import cn.lili.common.aop.limiter.annotation.LimitPoint;
|
||||||
|
import cn.lili.common.enums.ResultCode;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -60,7 +61,7 @@ public class LimitInterceptor {
|
|||||||
log.info("限制请求{}, 当前请求{},缓存key{}", limitCount, count.intValue(), key);
|
log.info("限制请求{}, 当前请求{},缓存key{}", limitCount, count.intValue(), key);
|
||||||
//如果缓存里没有值,或者他的值小于限制频率
|
//如果缓存里没有值,或者他的值小于限制频率
|
||||||
if (count.intValue() >= limitCount) {
|
if (count.intValue() >= limitCount) {
|
||||||
throw new ServiceException("访问过于频繁,请稍后再试");
|
throw new ServiceException(ResultCode.LIMIT_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果从redis中执行都值判定为空,则这里跳过
|
//如果从redis中执行都值判定为空,则这里跳过
|
||||||
@@ -74,10 +75,15 @@ public class LimitInterceptor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//默认unknown常量值
|
/**
|
||||||
|
* 默认unknown常量值
|
||||||
|
*/
|
||||||
private static final String UNKNOWN = "unknown";
|
private static final String UNKNOWN = "unknown";
|
||||||
|
|
||||||
//获取ip
|
/**
|
||||||
|
* 获取ip
|
||||||
|
* @return ip
|
||||||
|
*/
|
||||||
public String getIpAddress() {
|
public String getIpAddress() {
|
||||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||||
String ip = request.getHeader("x-forwarded-for");
|
String ip = request.getHeader("x-forwarded-for");
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import cn.lili.common.security.enums.UserEnums;
|
|||||||
import cn.lili.common.utils.IpHelper;
|
import cn.lili.common.utils.IpHelper;
|
||||||
import cn.lili.common.utils.SpelUtil;
|
import cn.lili.common.utils.SpelUtil;
|
||||||
import cn.lili.common.utils.ThreadPoolUtil;
|
import cn.lili.common.utils.ThreadPoolUtil;
|
||||||
import cn.lili.modules.base.entity.systemlog.SystemLogVO;
|
import cn.lili.modules.permission.entity.vo.SystemLogVO;
|
||||||
import cn.lili.modules.connect.util.IpUtils;
|
import cn.lili.modules.connect.util.IpUtils;
|
||||||
import cn.lili.modules.permission.service.SystemLogService;
|
import cn.lili.modules.permission.service.SystemLogService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -39,7 +39,7 @@ public class SystemLogAspect {
|
|||||||
/**
|
/**
|
||||||
* 启动线程异步记录日志
|
* 启动线程异步记录日志
|
||||||
*/
|
*/
|
||||||
private static final ThreadLocal<Date> beginTimeThreadLocal = new NamedThreadLocal<>("SYSTEM-LOG");
|
private static final ThreadLocal<Date> BEGIN_TIME_THREAD_LOCAL = new NamedThreadLocal<>("SYSTEM-LOG");
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SystemLogService systemLogService;
|
private SystemLogService systemLogService;
|
||||||
@@ -61,7 +61,7 @@ public class SystemLogAspect {
|
|||||||
*/
|
*/
|
||||||
@Before("controllerAspect()")
|
@Before("controllerAspect()")
|
||||||
public void doBefore() {
|
public void doBefore() {
|
||||||
beginTimeThreadLocal.set(new Date());
|
BEGIN_TIME_THREAD_LOCAL.set(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ public class SystemLogAspect {
|
|||||||
//写入自定义日志内容
|
//写入自定义日志内容
|
||||||
systemLogVO.setCustomerLog(customerLog);
|
systemLogVO.setCustomerLog(customerLog);
|
||||||
//请求开始时间
|
//请求开始时间
|
||||||
long beginTime = beginTimeThreadLocal.get().getTime();
|
long beginTime = BEGIN_TIME_THREAD_LOCAL.get().getTime();
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
//请求耗时
|
//请求耗时
|
||||||
Long usedTime = endTime - beginTime;
|
Long usedTime = endTime - beginTime;
|
||||||
@@ -157,7 +157,7 @@ public class SystemLogAspect {
|
|||||||
*/
|
*/
|
||||||
private static Map<String, String> spelFormat(JoinPoint joinPoint, Object rvt) {
|
private static Map<String, String> spelFormat(JoinPoint joinPoint, Object rvt) {
|
||||||
|
|
||||||
Map<String, String> result = new HashMap<>();
|
Map<String, String> result = new HashMap<>(2);
|
||||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||||
SystemLogPoint systemLogPoint = signature.getMethod().getAnnotation(SystemLogPoint.class);
|
SystemLogPoint systemLogPoint = signature.getMethod().getAnnotation(SystemLogPoint.class);
|
||||||
String description = systemLogPoint.description();
|
String description = systemLogPoint.description();
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ public interface Cache<T> {
|
|||||||
* 如需清零,按照普通key 移除即可
|
* 如需清零,按照普通key 移除即可
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
|
* @param value
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Long cumulative(Object key, Object value);
|
Long cumulative(Object key, Object value);
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ public enum CachePrefix {
|
|||||||
/**
|
/**
|
||||||
* 店铺管理员角色权限对照表
|
* 店铺管理员角色权限对照表
|
||||||
*/
|
*/
|
||||||
SHOP_URL_ROLE,
|
STORE_URL_ROLE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机验证标识
|
* 手机验证标识
|
||||||
@@ -449,25 +449,44 @@ public enum CachePrefix {
|
|||||||
/**
|
/**
|
||||||
* 文章
|
* 文章
|
||||||
*/
|
*/
|
||||||
ARTICLE_CACHE
|
ARTICLE_CACHE,
|
||||||
;
|
|
||||||
|
/**
|
||||||
|
* 店铺分类
|
||||||
|
*/
|
||||||
|
STORE_CATEGORY;
|
||||||
|
|
||||||
|
|
||||||
public static String removePrefix(String str) {
|
public static String removePrefix(String str) {
|
||||||
return str.substring(str.lastIndexOf("}_") + 2);
|
return str.substring(str.lastIndexOf("}_") + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//通用获取缓存key值
|
/**
|
||||||
|
* 通用获取缓存key值
|
||||||
|
*
|
||||||
|
* @return 缓存key值
|
||||||
|
*/
|
||||||
public String getPrefix() {
|
public String getPrefix() {
|
||||||
return "{" + this.name() + "}_";
|
return "{" + this.name() + "}_";
|
||||||
}
|
}
|
||||||
|
|
||||||
//通用获取缓存key值
|
/**
|
||||||
|
* 通用获取缓存key值
|
||||||
|
*
|
||||||
|
* @param typeEnum 促销枚举
|
||||||
|
* @return 缓存key值
|
||||||
|
*/
|
||||||
public String getPrefix(PromotionTypeEnum typeEnum) {
|
public String getPrefix(PromotionTypeEnum typeEnum) {
|
||||||
return "{" + this.name() + "_" + typeEnum.name() + "}_";
|
return "{" + this.name() + "_" + typeEnum.name() + "}_";
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取缓存key值 + 用户端,例如:三端都有用户体系,需要分别登录,如果用户名一致,则redis中的权限可能会冲突出错
|
/**
|
||||||
|
* 获取缓存key值 + 用户端
|
||||||
|
* 例如:三端都有用户体系,需要分别登录,如果用户名一致,则redis中的权限可能会冲突出错
|
||||||
|
*
|
||||||
|
* @param user 角色
|
||||||
|
* @return 缓存key值 + 用户端
|
||||||
|
*/
|
||||||
public String getPrefix(UserEnums user) {
|
public String getPrefix(UserEnums user) {
|
||||||
return "{" + this.name() + "_" + user.name() + "}_";
|
return "{" + this.name() + "_" + user.name() + "}_";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public class RedisCache implements Cache {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("scan错误",e);
|
log.error("scan错误", e);
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -206,8 +206,8 @@ public class RedisCache implements Cache {
|
|||||||
public Long incr(String key, long liveTime) {
|
public Long incr(String key, long liveTime) {
|
||||||
RedisAtomicLong entityIdCounter = new RedisAtomicLong(key, redisTemplate.getConnectionFactory());
|
RedisAtomicLong entityIdCounter = new RedisAtomicLong(key, redisTemplate.getConnectionFactory());
|
||||||
Long increment = entityIdCounter.getAndIncrement();
|
Long increment = entityIdCounter.getAndIncrement();
|
||||||
|
//初始设置过期时间
|
||||||
if ((null == increment || increment.longValue() == 0) && liveTime > 0) {//初始设置过期时间
|
if ((null == increment || increment.longValue() == 0) && liveTime > 0) {
|
||||||
entityIdCounter.expire(liveTime, TimeUnit.SECONDS);
|
entityIdCounter.expire(liveTime, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,8 +254,7 @@ public class RedisCache implements Cache {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean zAdd(String key, long score, String value) {
|
public boolean zAdd(String key, long score, String value) {
|
||||||
Boolean result = redisTemplate.opsForZSet().add(key, value, score);
|
return redisTemplate.opsForZSet().add(key, value, score);
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -308,13 +308,6 @@ public abstract class BaseElasticsearchService {
|
|||||||
|
|
||||||
PutMappingRequest request = new PutMappingRequest(index)
|
PutMappingRequest request = new PutMappingRequest(index)
|
||||||
.source(source, XContentType.JSON);
|
.source(source, XContentType.JSON);
|
||||||
// AcknowledgedResponse putMappingResponse = client.indices().putMapping(request,
|
|
||||||
// RequestOptions.DEFAULT);
|
|
||||||
//
|
|
||||||
// boolean acknowledged = putMappingResponse.isAcknowledged();
|
|
||||||
// if (acknowledged) {
|
|
||||||
// log.error("Succeed to put mapping");
|
|
||||||
// }
|
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
AtomicReference response = new AtomicReference<AcknowledgedResponse>();
|
AtomicReference response = new AtomicReference<AcknowledgedResponse>();
|
||||||
client.indices().putMappingAsync(
|
client.indices().putMappingAsync(
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package cn.lili.modules.base.entity.enums;
|
package cn.lili.common.enums;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -10,10 +10,25 @@ package cn.lili.modules.base.entity.enums;
|
|||||||
|
|
||||||
public enum ClientTypeEnum {
|
public enum ClientTypeEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "移动端"
|
||||||
|
*/
|
||||||
H5("移动端"),
|
H5("移动端"),
|
||||||
|
/**
|
||||||
|
* "PC端"
|
||||||
|
*/
|
||||||
PC("PC端"),
|
PC("PC端"),
|
||||||
|
/**
|
||||||
|
* "小程序端"
|
||||||
|
*/
|
||||||
WECHAT_MP("小程序端"),
|
WECHAT_MP("小程序端"),
|
||||||
|
/**
|
||||||
|
* "移动应用端"
|
||||||
|
*/
|
||||||
APP("移动应用端"),
|
APP("移动应用端"),
|
||||||
|
/**
|
||||||
|
* "未知"
|
||||||
|
*/
|
||||||
UNKNOWN("未知");
|
UNKNOWN("未知");
|
||||||
|
|
||||||
private final String clientName;
|
private final String clientName;
|
||||||
@@ -32,9 +32,11 @@ public enum ResultCode {
|
|||||||
/**
|
/**
|
||||||
* 系统异常
|
* 系统异常
|
||||||
*/
|
*/
|
||||||
|
|
||||||
WECHAT_CONNECT_NOT_EXIST(1001, "微信联合登录未配置"),
|
WECHAT_CONNECT_NOT_EXIST(1001, "微信联合登录未配置"),
|
||||||
VERIFICATION_EXIST(1002, "验证码服务异常"),
|
VERIFICATION_EXIST(1002, "验证码服务异常"),
|
||||||
|
LIMIT_ERROR(1003, "访问过于频繁,请稍后再试"),
|
||||||
|
ILLEGAL_REQUEST_ERROR(1004, "非法请求,请重新刷新页面操作"),
|
||||||
|
IMAGE_FILE_EXT_ERROR(1005, "不支持图片格式"),
|
||||||
/**
|
/**
|
||||||
* 分类
|
* 分类
|
||||||
*/
|
*/
|
||||||
@@ -47,6 +49,8 @@ public enum ResultCode {
|
|||||||
CATEGORY_SAVE_ERROR(10007, "此类别下存在商品不能删除"),
|
CATEGORY_SAVE_ERROR(10007, "此类别下存在商品不能删除"),
|
||||||
CATEGORY_PARAMETER_SAVE_ERROR(10008, "分类绑定参数组添加失败"),
|
CATEGORY_PARAMETER_SAVE_ERROR(10008, "分类绑定参数组添加失败"),
|
||||||
CATEGORY_PARAMETER_UPDATE_ERROR(10009, "分类绑定参数组添加失败"),
|
CATEGORY_PARAMETER_UPDATE_ERROR(10009, "分类绑定参数组添加失败"),
|
||||||
|
CATEGORY_DELETE_FLAG_ERROR(10010, "子类状态不能与父类不一致!"),
|
||||||
|
CATEGORY_COMMISSION_RATE_ERROR(10011, "分类的佣金不正确!"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品
|
* 商品
|
||||||
@@ -64,209 +68,159 @@ public enum ResultCode {
|
|||||||
GOODS_SKU_WEIGHT_ERROR(11010, "商品重量不能为负数"),
|
GOODS_SKU_WEIGHT_ERROR(11010, "商品重量不能为负数"),
|
||||||
GOODS_SKU_QUANTITY_ERROR(11011, "商品库存数量不能为负数"),
|
GOODS_SKU_QUANTITY_ERROR(11011, "商品库存数量不能为负数"),
|
||||||
GOODS_SKU_QUANTITY_NOT_ENOUGH(11011, "商品库存不足"),
|
GOODS_SKU_QUANTITY_NOT_ENOUGH(11011, "商品库存不足"),
|
||||||
|
MUST_HAVE_GOODS_SKU(11012, "规格必须要有一个!"),
|
||||||
|
GOODS_PARAMS_ERROR(11013, "商品参数错误,刷新后重试"),
|
||||||
|
PHYSICAL_GOODS_NEED_TEMP(11014, "实物商品需选择配送模板"),
|
||||||
|
VIRTUAL_GOODS_NOT_NEED_TEMP(11015, "实物商品需选择配送模板"),
|
||||||
|
GOODS_TYPE_ERROR(11016, "需选择商品类型"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数
|
* 参数
|
||||||
*/
|
*/
|
||||||
PARAMETER_SAVE_ERROR(12001, "参数添加失败"),
|
PARAMETER_SAVE_ERROR(12001, "参数添加失败"),
|
||||||
|
|
||||||
PARAMETER_UPDATE_ERROR(12002, "参数编辑失败"),
|
PARAMETER_UPDATE_ERROR(12002, "参数编辑失败"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规格
|
* 规格
|
||||||
*/
|
*/
|
||||||
SPEC_SAVE_ERROR(13001, "规格修改失败"),
|
SPEC_SAVE_ERROR(13001, "规格修改失败"),
|
||||||
|
|
||||||
SPEC_UPDATE_ERROR(13002, "规格修改失败"),
|
SPEC_UPDATE_ERROR(13002, "规格修改失败"),
|
||||||
|
|
||||||
SPEC_DELETE_ERROR(13003, "此规格已绑定分类不允许删除"),
|
SPEC_DELETE_ERROR(13003, "此规格已绑定分类不允许删除"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品牌
|
* 品牌
|
||||||
*/
|
*/
|
||||||
BRAND_SAVE_ERROR(14001, "品牌添加失败"),
|
BRAND_SAVE_ERROR(14001, "品牌添加失败"),
|
||||||
|
|
||||||
BRAND_UPDATE_ERROR(14002, "品牌修改失败"),
|
BRAND_UPDATE_ERROR(14002, "品牌修改失败"),
|
||||||
|
|
||||||
BRAND_DISABLE_ERROR(14003, "品牌禁用失败"),
|
BRAND_DISABLE_ERROR(14003, "品牌禁用失败"),
|
||||||
|
|
||||||
BRAND_DELETE_ERROR(14004, "品牌删除失败"),
|
BRAND_DELETE_ERROR(14004, "品牌删除失败"),
|
||||||
|
BRAND_NAME_EXIST_ERROR(20002, "品牌名称重复!"),
|
||||||
|
BRAND_USE_DISABLE_ERROR(20003, "当前品牌下存在分类不可禁用"),
|
||||||
|
BRAND_NOT_EXIST(20004, "品牌不存在"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户
|
* 用户
|
||||||
*/
|
*/
|
||||||
USER_EDIT_SUCCESS(20001, "用户修改成功"),
|
USER_EDIT_SUCCESS(20001, "用户修改成功"),
|
||||||
|
|
||||||
USER_NOT_EXIST(20002, "用户不存在"),
|
USER_NOT_EXIST(20002, "用户不存在"),
|
||||||
|
|
||||||
USER_NOT_LOGIN(20003, "用户未登录"),
|
USER_NOT_LOGIN(20003, "用户未登录"),
|
||||||
|
|
||||||
USER_AUTH_EXPIRED(20004, "用户已退出,请重新登录"),
|
USER_AUTH_EXPIRED(20004, "用户已退出,请重新登录"),
|
||||||
|
|
||||||
USER_AUTHORITY_ERROR(20005, "权限不足"),
|
USER_AUTHORITY_ERROR(20005, "权限不足"),
|
||||||
|
|
||||||
USER_CONNECT_LOGIN_ERROR(20006, "未找到登录信息"),
|
USER_CONNECT_LOGIN_ERROR(20006, "未找到登录信息"),
|
||||||
|
|
||||||
USER_NAME_EXIST(20007, "该用户名已被注册"),
|
USER_NAME_EXIST(20007, "该用户名已被注册"),
|
||||||
|
|
||||||
USER_PHONE_EXIST(20008, "该手机号已被注册"),
|
USER_PHONE_EXIST(20008, "该手机号已被注册"),
|
||||||
|
|
||||||
USER_PHONE_NOT_EXIST(20009, "手机号不存在"),
|
USER_PHONE_NOT_EXIST(20009, "手机号不存在"),
|
||||||
|
|
||||||
USER_PASSWORD_ERROR(20010, "密码不正确"),
|
USER_PASSWORD_ERROR(20010, "密码不正确"),
|
||||||
|
|
||||||
USER_NOT_PHONE(20011, "非当前用户的手机号"),
|
USER_NOT_PHONE(20011, "非当前用户的手机号"),
|
||||||
|
|
||||||
USER_CONNECT_ERROR(20012, "联合第三方登录,授权信息错误"),
|
USER_CONNECT_ERROR(20012, "联合第三方登录,授权信息错误"),
|
||||||
|
|
||||||
USER_RECEIPT_REPEAT_ERROR(20013, "会员发票信息重复"),
|
USER_RECEIPT_REPEAT_ERROR(20013, "会员发票信息重复"),
|
||||||
|
|
||||||
USER_RECEIPT_NOT_EXIST(20014, "会员发票信息不存在"),
|
USER_RECEIPT_NOT_EXIST(20014, "会员发票信息不存在"),
|
||||||
|
|
||||||
USER_EDIT_ERROR(20015, "用户修改失败"),
|
USER_EDIT_ERROR(20015, "用户修改失败"),
|
||||||
|
|
||||||
USER_OLD_PASSWORD_ERROR(20016, "旧密码不正确"),
|
USER_OLD_PASSWORD_ERROR(20016, "旧密码不正确"),
|
||||||
|
|
||||||
USER_COLLECTION_EXIST(20017, "无法重复收藏"),
|
USER_COLLECTION_EXIST(20017, "无法重复收藏"),
|
||||||
|
|
||||||
USER_GRADE_IS_DEFAULT(20018, "会员等级为默认会员等级"),
|
USER_GRADE_IS_DEFAULT(20018, "会员等级为默认会员等级"),
|
||||||
|
DELETE_EXIST(20019, "无法重复收藏"),
|
||||||
DELETE_EXIST(2001, "无法重复收藏"),
|
USER_NOT_BINDING(20020, "未绑定用户"),
|
||||||
|
USER_AUTO_REGISTER_ERROR(20021, "自动注册失败,请稍后重试"),
|
||||||
|
USER_OVERDUE_CONNECT_ERROR(20022, "授权信息已过期,请重新授权/登录"),
|
||||||
|
USER_CONNECT_BANDING_ERROR(20023, "当前联合登陆方式,已绑定其他账号,需进行解绑操作"),
|
||||||
|
USER_CONNECT_NOT_EXIST_ERROR(20024, "暂无联合登陆信息,无法实现一键注册功能,请点击第三方登录进行授权"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限
|
* 权限
|
||||||
*/
|
*/
|
||||||
PERMISSION_DEPARTMENT_ROLE_ERROR(21001, "角色已绑定部门,请逐个删除"),
|
PERMISSION_DEPARTMENT_ROLE_ERROR(21001, "角色已绑定部门,请逐个删除"),
|
||||||
|
|
||||||
PERMISSION_USER_ROLE_ERROR(21002, "角色已绑定管理员,请逐个删除"),
|
PERMISSION_USER_ROLE_ERROR(21002, "角色已绑定管理员,请逐个删除"),
|
||||||
|
|
||||||
PERMISSION_MENU_ROLE_ERROR(21003, "菜单已绑定角色,请先删除或编辑角色"),
|
PERMISSION_MENU_ROLE_ERROR(21003, "菜单已绑定角色,请先删除或编辑角色"),
|
||||||
|
|
||||||
PERMISSION_DEPARTMENT_DELETE_ERROR(21004, "部门已经绑定管理员,请先删除或编辑管理员"),
|
PERMISSION_DEPARTMENT_DELETE_ERROR(21004, "部门已经绑定管理员,请先删除或编辑管理员"),
|
||||||
|
|
||||||
PERMISSION_BEYOND_TEN(21005, "最多可以设置10个角色"),
|
PERMISSION_BEYOND_TEN(21005, "最多可以设置10个角色"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销
|
* 分销
|
||||||
*/
|
*/
|
||||||
DISTRIBUTION_CLOSE(22000, "分销功能关闭"),
|
DISTRIBUTION_CLOSE(22000, "分销功能关闭"),
|
||||||
|
|
||||||
DISTRIBUTION_NOT_EXIST(22001, "分销员不存在"),
|
DISTRIBUTION_NOT_EXIST(22001, "分销员不存在"),
|
||||||
|
|
||||||
DISTRIBUTION_IS_APPLY(22002, "分销员已申请,无需重复提交"),
|
DISTRIBUTION_IS_APPLY(22002, "分销员已申请,无需重复提交"),
|
||||||
|
|
||||||
DISTRIBUTION_AUDIT_ERROR(22003, "审核分销员失败"),
|
DISTRIBUTION_AUDIT_ERROR(22003, "审核分销员失败"),
|
||||||
|
|
||||||
DISTRIBUTION_RETREAT_ERROR(22004, "分销员清退失败"),
|
DISTRIBUTION_RETREAT_ERROR(22004, "分销员清退失败"),
|
||||||
|
|
||||||
DISTRIBUTION_CASH_NOT_EXIST(22005, "分销员提现记录不存在"),
|
DISTRIBUTION_CASH_NOT_EXIST(22005, "分销员提现记录不存在"),
|
||||||
|
|
||||||
DISTRIBUTION_GOODS_DOUBLE(22006, "不能重复添加分销商品"),
|
DISTRIBUTION_GOODS_DOUBLE(22006, "不能重复添加分销商品"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 购物车
|
* 购物车
|
||||||
*/
|
*/
|
||||||
CART_ERROR(30001, "读取结算页的购物车异常"),
|
CART_ERROR(30001, "读取结算页的购物车异常"),
|
||||||
|
|
||||||
CART_PINTUAN_NOT_EXIST_ERROR(30002, "拼团活动不存在错误"),
|
CART_PINTUAN_NOT_EXIST_ERROR(30002, "拼团活动不存在错误"),
|
||||||
|
|
||||||
CART_PINTUAN_LIMIT_ERROR(30003, "购买数量超过拼团活动限制数量"),
|
CART_PINTUAN_LIMIT_ERROR(30003, "购买数量超过拼团活动限制数量"),
|
||||||
|
|
||||||
SHIPPING_NOT_APPLY(30005, "购物商品不支持当前收货地址配送"),
|
SHIPPING_NOT_APPLY(30005, "购物商品不支持当前收货地址配送"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单
|
* 订单
|
||||||
*/
|
*/
|
||||||
ORDER_ERROR(31001, "创建订单异常,请稍后重试"),
|
ORDER_ERROR(31001, "创建订单异常,请稍后重试"),
|
||||||
|
|
||||||
ORDER_NOT_EXIST(31002, "订单不存在"),
|
ORDER_NOT_EXIST(31002, "订单不存在"),
|
||||||
|
|
||||||
ORDER_DELIVERED_ERROR(31003, "订单状态错误,无法进行确认收货"),
|
ORDER_DELIVERED_ERROR(31003, "订单状态错误,无法进行确认收货"),
|
||||||
|
|
||||||
ORDER_UPDATE_PRICE_ERROR(31004, "已支付的订单不能修改金额"),
|
ORDER_UPDATE_PRICE_ERROR(31004, "已支付的订单不能修改金额"),
|
||||||
|
|
||||||
ORDER_LOGISTICS_ERROR(31005, "物流错误"),
|
ORDER_LOGISTICS_ERROR(31005, "物流错误"),
|
||||||
|
|
||||||
ORDER_DELIVER_ERROR(31006, "物流错误"),
|
ORDER_DELIVER_ERROR(31006, "物流错误"),
|
||||||
|
|
||||||
ORDER_NOT_USER(31007, "非当前会员的订单"),
|
ORDER_NOT_USER(31007, "非当前会员的订单"),
|
||||||
|
|
||||||
ORDER_TAKE_ERROR(31008, "当前订单无法核销"),
|
ORDER_TAKE_ERROR(31008, "当前订单无法核销"),
|
||||||
|
|
||||||
MEMBER_ADDRESS_NOT_EXIST(31009, "订单无收货地址,请先配置收货地址"),
|
MEMBER_ADDRESS_NOT_EXIST(31009, "订单无收货地址,请先配置收货地址"),
|
||||||
|
|
||||||
ORDER_DELIVER_NUM_ERROR(31010, "没有待发货的订单"),
|
ORDER_DELIVER_NUM_ERROR(31010, "没有待发货的订单"),
|
||||||
|
|
||||||
ORDER_NOT_SUPPORT_DISTRIBUTION(31011, "购物车中包含不支持配送的商品,请重新选择收货地址,或者重新选择商品"),
|
ORDER_NOT_SUPPORT_DISTRIBUTION(31011, "购物车中包含不支持配送的商品,请重新选择收货地址,或者重新选择商品"),
|
||||||
|
|
||||||
ORDER_CAN_NOT_CANCEL(31012, "当前订单状态不可取消"),
|
ORDER_CAN_NOT_CANCEL(31012, "当前订单状态不可取消"),
|
||||||
|
ORDER_BATCH_DELIVER_ERROR(31013, "批量发货,文件读取失败"),
|
||||||
|
ORDER_ITEM_NOT_EXIST(31014, "当前订单项不存在!"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付
|
* 支付
|
||||||
*/
|
*/
|
||||||
PAY_UN_WANTED(32000, "当前订单不需要付款,返回订单列表等待系统订单出库即可"),
|
PAY_UN_WANTED(32000, "当前订单不需要付款,返回订单列表等待系统订单出库即可"),
|
||||||
|
|
||||||
PAY_SUCCESS(32001, "支付成功"),
|
PAY_SUCCESS(32001, "支付成功"),
|
||||||
|
|
||||||
PAY_INCONSISTENT_ERROR(32002, "付款金额和应付金额不一致"),
|
PAY_INCONSISTENT_ERROR(32002, "付款金额和应付金额不一致"),
|
||||||
|
|
||||||
PAY_DOUBLE_ERROR(32003, "订单已支付,不能再次进行支付"),
|
PAY_DOUBLE_ERROR(32003, "订单已支付,不能再次进行支付"),
|
||||||
|
|
||||||
PAY_CASHIER_ERROR(32004, "收银台信息获取错误"),
|
PAY_CASHIER_ERROR(32004, "收银台信息获取错误"),
|
||||||
|
|
||||||
PAY_ERROR(32005, "支付业务异常,请稍后重试"),
|
PAY_ERROR(32005, "支付业务异常,请稍后重试"),
|
||||||
|
|
||||||
PAY_BAN(32006, "当前订单不需要付款,请返回订单列表重新操作"),
|
PAY_BAN(32006, "当前订单不需要付款,请返回订单列表重新操作"),
|
||||||
|
|
||||||
PAY_PARTIAL_ERROR(32007, "该订单已部分支付,请前往订单中心进行支付"),
|
PAY_PARTIAL_ERROR(32007, "该订单已部分支付,请前往订单中心进行支付"),
|
||||||
|
|
||||||
PAY_NOT_SUPPORT(32008, "支付暂不支持"),
|
PAY_NOT_SUPPORT(32008, "支付暂不支持"),
|
||||||
|
|
||||||
PAY_CLIENT_TYPE_ERROR(32009, "错误的客户端"),
|
PAY_CLIENT_TYPE_ERROR(32009, "错误的客户端"),
|
||||||
|
|
||||||
PAY_POINT_ENOUGH(32010, "积分不足,不能兑换"),
|
PAY_POINT_ENOUGH(32010, "积分不足,不能兑换"),
|
||||||
|
|
||||||
PAY_NOT_EXIST_ORDER(32011, "支付订单不存在"),
|
PAY_NOT_EXIST_ORDER(32011, "支付订单不存在"),
|
||||||
|
|
||||||
CAN_NOT_RECHARGE_WALLET(32012, "不能使用余额进行充值"),
|
CAN_NOT_RECHARGE_WALLET(32012, "不能使用余额进行充值"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 售后
|
* 售后
|
||||||
*/
|
*/
|
||||||
AFTER_SALES_NOT_PAY_ERROR(33001, "当前订单未支付,不能申请售后"),
|
AFTER_SALES_NOT_PAY_ERROR(33001, "当前订单未支付,不能申请售后"),
|
||||||
|
|
||||||
AFTER_SALES_CANCEL_ERROR(33002, "当前售后单无法取消"),
|
AFTER_SALES_CANCEL_ERROR(33002, "当前售后单无法取消"),
|
||||||
|
|
||||||
AFTER_SALES_BAN(33003, "订单状态不允许申请售后,请联系平台或商家"),
|
AFTER_SALES_BAN(33003, "订单状态不允许申请售后,请联系平台或商家"),
|
||||||
|
|
||||||
AFTER_SALES_DOUBLE_ERROR(33004, "售后已审核,无法重复操作"),
|
AFTER_SALES_DOUBLE_ERROR(33004, "售后已审核,无法重复操作"),
|
||||||
|
|
||||||
AFTER_SALES_LOGISTICS_ERROR(33005, "物流公司错误,请重新选择"),
|
AFTER_SALES_LOGISTICS_ERROR(33005, "物流公司错误,请重新选择"),
|
||||||
|
|
||||||
AFTER_STATUS_ERROR(33006, "售后状态错误,请刷新页面"),
|
AFTER_STATUS_ERROR(33006, "售后状态错误,请刷新页面"),
|
||||||
|
RETURN_MONEY_OFFLINE_BANK_ERROR(33007, "当账号类型为银行转账时,银行信息不能为空"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 投诉
|
* 投诉
|
||||||
*/
|
*/
|
||||||
COMPLAINT_ORDER_ITEM_EMPTY_ERROR(33100, "订单不存在"),
|
COMPLAINT_ORDER_ITEM_EMPTY_ERROR(33100, "订单不存在"),
|
||||||
|
|
||||||
COMPLAINT_SKU_EMPTY_ERROR(33101, "商品已下架,如需投诉请联系平台客服"),
|
COMPLAINT_SKU_EMPTY_ERROR(33101, "商品已下架,如需投诉请联系平台客服"),
|
||||||
|
|
||||||
COMPLAINT_ERROR(33102, "投诉异常,请稍后重试"),
|
COMPLAINT_ERROR(33102, "投诉异常,请稍后重试"),
|
||||||
|
COMPLAINT_NOT_EXIT(33103, "当前投诉记录不存在"),
|
||||||
|
COMPLAINT_ARBITRATION_RESULT_ERROR(33104, "结束订单投诉时,仲裁结果不能为空"),
|
||||||
|
COMPLAINT_APPEAL_CONTENT_ERROR(33105, "商家申诉时,申诉内容不能为空"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 余额
|
* 余额
|
||||||
*/
|
*/
|
||||||
WALLET_NOT_EXIT_ERROR(34000, "钱包不存在,请联系管理员"),
|
WALLET_NOT_EXIT_ERROR(34000, "钱包不存在,请联系管理员"),
|
||||||
|
|
||||||
WALLET_INSUFFICIENT(34001, "余额不足以支付订单,请充值!"),
|
WALLET_INSUFFICIENT(34001, "余额不足以支付订单,请充值!"),
|
||||||
|
|
||||||
WALLET_WITHDRAWAL_INSUFFICIENT(34002, "可提现金额不足!"),
|
WALLET_WITHDRAWAL_INSUFFICIENT(34002, "可提现金额不足!"),
|
||||||
|
|
||||||
WALLET_ERROR_INSUFFICIENT(34003, "零钱提现失败!"),
|
WALLET_ERROR_INSUFFICIENT(34003, "零钱提现失败!"),
|
||||||
|
|
||||||
WALLET_REMARK_ERROR(34004, "请填写审核备注!"),
|
WALLET_REMARK_ERROR(34004, "请填写审核备注!"),
|
||||||
|
|
||||||
WALLET_APPLY_ERROR(34005, "提现申请异常!"),
|
WALLET_APPLY_ERROR(34005, "提现申请异常!"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -275,87 +229,126 @@ public enum ResultCode {
|
|||||||
EVALUATION_DOUBLE_ERROR(35001, "无法重复提交评价"),
|
EVALUATION_DOUBLE_ERROR(35001, "无法重复提交评价"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 签到
|
* 活动
|
||||||
*/
|
*/
|
||||||
MEMBER_SIGN_REPEAT(40001, "请勿重复签到"),
|
PROMOTION_GOODS_NOT_EXIT(40001, "当前促销商品不存在!"),
|
||||||
|
PROMOTION_SAME_ACTIVE_EXIST(40002, "当前时间内已存在同类活动"),
|
||||||
|
PROMOTION_START_TIME_ERROR(40003, "活动起始时间不能大于活动结束时间"),
|
||||||
|
PROMOTION_TIME_ERROR(40004, "活动起始时间必须大于当前时间"),
|
||||||
|
PROMOTION_SAME_ERROR(40005, "当前时间段已存在相同活动!"),
|
||||||
|
PROMOTION_GOODS_ERROR(40006, "请选择要参与活动的商品"),
|
||||||
|
PROMOTION_STATUS_END(40007, "当前活动已停止"),
|
||||||
|
PROMOTION_UPDATE_ERROR(40008, "当前活动已开始/结束,无法编辑!"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠券
|
* 优惠券
|
||||||
*/
|
*/
|
||||||
COUPON_EDIT_STATUS_SUCCESS(41001, "修改状态成功!"),
|
COUPON_EDIT_STATUS_SUCCESS(41001, "修改状态成功!"),
|
||||||
|
|
||||||
COUPON_CANCELLATION_SUCCESS(41002, "会员优惠券作废成功"),
|
COUPON_CANCELLATION_SUCCESS(41002, "会员优惠券作废成功"),
|
||||||
|
|
||||||
COUPON_EXPIRED(41003, "优惠券已使用/已过期,不能使用"),
|
COUPON_EXPIRED(41003, "优惠券已使用/已过期,不能使用"),
|
||||||
|
|
||||||
COUPON_EDIT_STATUS_ERROR(41004, "优惠券修改状态失败!"),
|
COUPON_EDIT_STATUS_ERROR(41004, "优惠券修改状态失败!"),
|
||||||
|
COUPON_RECEIVE_ERROR(41005, "当前优惠券状态不可领取"),
|
||||||
|
COUPON_NUM_INSUFFICIENT_ERROR(41006, "优惠券剩余领取数量不足"),
|
||||||
|
COUPON_NOT_EXIST(41007, "当前优惠券不存在"),
|
||||||
|
COUPON_LIMIT_NUM_LESS_THAN_0(41008, "领取限制数量不能为负数"),
|
||||||
|
COUPON_LIMIT_GREATER_THAN_PUBLISH(41009, "领取限制数量超出发行数量"),
|
||||||
|
COUPON_DISCOUNT_ERROR(41010, "优惠券折扣必须小于10且大于0"),
|
||||||
|
COUPON_SCOPE_TYPE_GOODS_ERROR(41011, "当前关联范围类型为指定商品时,商品列表不能为空"),
|
||||||
|
COUPON_SCOPE_TYPE_CATEGORY_ERROR(41012, "当前关联范围类型为部分商品分类时,范围关联的id不能为空"),
|
||||||
|
COUPON_SCOPE_TYPE_STORE_ERROR(41013, "当前关联范围类型为部分店铺分类时,范围关联的id不能为空"),
|
||||||
|
COUPON_SCOPE_ERROR(41014, "指定商品范围关联id无效!"),
|
||||||
|
COUPON_MEMBER_NOT_EXIST(41015, "没有当前会员优惠券"),
|
||||||
|
COUPON_MEMBER_STATUS_ERROR(41016, "当前会员优惠券已过期/作废无法变更状态!"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼团
|
* 拼团
|
||||||
*/
|
*/
|
||||||
PINTUAN_MANUAL_OPEN_SUCCESS(42001, "手动开启拼团活动成功"),
|
PINTUAN_MANUAL_OPEN_SUCCESS(42001, "手动开启拼团活动成功"),
|
||||||
|
|
||||||
PINTUAN_MANUAL_CLOSE_SUCCESS(42002, "手动关闭拼团活动成功"),
|
PINTUAN_MANUAL_CLOSE_SUCCESS(42002, "手动关闭拼团活动成功"),
|
||||||
|
|
||||||
PINTUAN_ADD_SUCCESS(42003, "添加拼团活动成功"),
|
PINTUAN_ADD_SUCCESS(42003, "添加拼团活动成功"),
|
||||||
|
|
||||||
PINTUAN_EDIT_SUCCESS(42004, "修改拼团活动成功"),
|
PINTUAN_EDIT_SUCCESS(42004, "修改拼团活动成功"),
|
||||||
|
|
||||||
PINTUAN_DELETE_SUCCESS(42005, "删除拼团活动成功"),
|
PINTUAN_DELETE_SUCCESS(42005, "删除拼团活动成功"),
|
||||||
|
|
||||||
PINTUAN_MANUAL_OPEN_ERROR(42006, "手动开启拼团活动失败"),
|
PINTUAN_MANUAL_OPEN_ERROR(42006, "手动开启拼团活动失败"),
|
||||||
|
|
||||||
PINTUAN_MANUAL_CLOSE_ERROR(42007, "手动关闭拼团活动失败"),
|
PINTUAN_MANUAL_CLOSE_ERROR(42007, "手动关闭拼团活动失败"),
|
||||||
|
|
||||||
PINTUAN_ADD_ERROR(42008, "添加拼团活动失败"),
|
PINTUAN_ADD_ERROR(42008, "添加拼团活动失败"),
|
||||||
|
|
||||||
PINTUAN_EDIT_ERROR(42009, "修改拼团活动失败"),
|
PINTUAN_EDIT_ERROR(42009, "修改拼团活动失败"),
|
||||||
|
|
||||||
PINTUAN_DELETE_ERROR(42010, "删除拼团活动失败"),
|
PINTUAN_DELETE_ERROR(42010, "删除拼团活动失败"),
|
||||||
|
PINTUAN_JOIN_ERROR(42011, "不能参与自己发起的拼团活动!"),
|
||||||
|
PINTUAN_LIMIT_NUM_ERROR(42012, "购买数量超过拼团活动限制数量!"),
|
||||||
|
PINTUAN_NOT_EXIST_ERROR(42013, "当前拼团商品不存在!"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 满额活动
|
* 满额活动
|
||||||
*/
|
*/
|
||||||
FULL_DISCOUNT_EDIT_SUCCESS(43001, "修改满优惠活动成功"),
|
FULL_DISCOUNT_EDIT_SUCCESS(43001, "修改满优惠活动成功"),
|
||||||
|
|
||||||
FULL_DISCOUNT_EDIT_DELETE(43002, "删除满优惠活动成功"),
|
FULL_DISCOUNT_EDIT_DELETE(43002, "删除满优惠活动成功"),
|
||||||
|
FULL_DISCOUNT_MODIFY_ERROR(43003, "当前编辑的满优惠活动已经开始或者已经结束,无法修改"),
|
||||||
|
FULL_DISCOUNT_NOT_EXIST_ERROR(43004, "当前要操作的满优惠活动不存在!"),
|
||||||
|
FULL_DISCOUNT_WAY_ERROR(43005, "请选择一种优惠方式!"),
|
||||||
|
FULL_DISCOUNT_GIFT_ERROR(43006, "请选择赠品!"),
|
||||||
|
FULL_DISCOUNT_COUPON_TIME_ERROR(43007, "赠送的优惠券有效时间必须大于活动时间"),
|
||||||
|
FULL_DISCOUNT_MONEY_ERROR(43008, "请填写满减金额"),
|
||||||
|
FULL_DISCOUNT_MONEY_GREATER_THAN_MINUS(43009, "满减金额不能大于优惠门槛"),
|
||||||
|
FULL_RATE_NUM_ERROR(43010, "请填写打折数值"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 直播
|
* 直播
|
||||||
*/
|
*/
|
||||||
STODIO_GOODS_EXIST_ERROR(44001,"直播商品已存在"),
|
STODIO_GOODS_EXIST_ERROR(44001, "直播商品已存在"),
|
||||||
|
COMMODITY_ERROR(44002, "添加直播商品失败"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 秒杀
|
||||||
|
*/
|
||||||
|
SECKILL_NOT_EXIST_ERROR(45001, "当前参与的秒杀活动不存在!"),
|
||||||
|
SECKILL_UPDATE_ERROR(45002, "当前秒杀活动活动已经开始,无法修改!"),
|
||||||
|
SECKILL_PRICE_ERROR(45003, "活动价格不能大于商品原价"),
|
||||||
|
SECKILL_TIME_ERROR(45004, "时刻参数异常"),
|
||||||
|
SECKILL_DELETE_ERROR(45005, "该秒杀活动活动的状态不能删除"),
|
||||||
|
SECKILL_CLOSE_ERROR(45006, "该秒杀活动活动的状态不能关闭"),
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券活动
|
||||||
|
*/
|
||||||
|
COUPON_ACTIVITY_START_TIME_ERROR(46001, "活动时间小于当前时间,不能进行编辑删除操作"),
|
||||||
|
COUPON_ACTIVITY_MEMBER_ERROR(46002, "指定精准发券则必须指定会员,会员不可以为空"),
|
||||||
|
COUPON_ACTIVITY_ITEM_ERROR(46003, "优惠券活动必须指定优惠券,不能为空"),
|
||||||
|
COUPON_ACTIVITY_ITEM_MUST_NUM_ERROR(46004, "优惠券活动最多指定10个优惠券"),
|
||||||
|
COUPON_ACTIVITY_ITEM_NUM_ERROR(46005, "赠券数量必须大于0"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他促销
|
||||||
|
*/
|
||||||
|
MEMBER_SIGN_REPEAT(47001, "请勿重复签到"),
|
||||||
|
POINT_GOODS_ACTIVE_STOCK_ERROR(47002, "活动库存数量不能高于商品库存"),
|
||||||
/**
|
/**
|
||||||
* 店铺
|
* 店铺
|
||||||
*/
|
*/
|
||||||
|
|
||||||
STORE_NOT_EXIST(50001, "此店铺不存在"),
|
STORE_NOT_EXIST(50001, "此店铺不存在"),
|
||||||
|
|
||||||
STORE_NAME_EXIST_ERROR(50002, "店铺名称已存在!"),
|
STORE_NAME_EXIST_ERROR(50002, "店铺名称已存在!"),
|
||||||
|
|
||||||
STORE_APPLY_DOUBLE_ERROR(50003, "已有店铺,无需重复申请!"),
|
STORE_APPLY_DOUBLE_ERROR(50003, "已有店铺,无需重复申请!"),
|
||||||
|
STORE_NOT_OPEN(50004, "该会员未开通店铺"),
|
||||||
|
STORE_NOT_LOGIN_ERROR(50005, "未登录店铺"),
|
||||||
|
STORE_CLOSE_ERROR(50006, "店铺关闭,请联系管理员"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结算单
|
* 结算单
|
||||||
*/
|
*/
|
||||||
BILL_CHECK_ERROR(51001, "只有已出账结算单可以核对"),
|
BILL_CHECK_ERROR(51001, "只有已出账结算单可以核对"),
|
||||||
|
|
||||||
BILL_COMPLETE_ERROR(51002, "只有已审核结算单可以支付"),
|
BILL_COMPLETE_ERROR(51002, "只有已审核结算单可以支付"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文章
|
* 文章
|
||||||
*/
|
*/
|
||||||
ARTICLE_CATEGORY_NAME_EXIST(60001, "文章分类名称已存在"),
|
ARTICLE_CATEGORY_NAME_EXIST(60001, "文章分类名称已存在"),
|
||||||
|
|
||||||
ARTICLE_CATEGORY_PARENT_NOT_EXIST(60002, "文章分类父分类不存在"),
|
ARTICLE_CATEGORY_PARENT_NOT_EXIST(60002, "文章分类父分类不存在"),
|
||||||
|
|
||||||
ARTICLE_CATEGORY_BEYOND_TWO(60003, "最多为二级分类,操作失败"),
|
ARTICLE_CATEGORY_BEYOND_TWO(60003, "最多为二级分类,操作失败"),
|
||||||
|
|
||||||
ARTICLE_CATEGORY_DELETE_ERROR(60004, "该文章分类下存在子分类,不能删除"),
|
ARTICLE_CATEGORY_DELETE_ERROR(60004, "该文章分类下存在子分类,不能删除"),
|
||||||
|
|
||||||
ARTICLE_CATEGORY_HAS_ARTICLE(60005, "该文章分类下存在文章,不能删除"),
|
ARTICLE_CATEGORY_HAS_ARTICLE(60005, "该文章分类下存在文章,不能删除"),
|
||||||
|
|
||||||
ARTICLE_CATEGORY_NO_DELETION(60007, "默认文章分类不能进行删除"),
|
ARTICLE_CATEGORY_NO_DELETION(60007, "默认文章分类不能进行删除"),
|
||||||
|
|
||||||
ARTICLE_NO_DELETION(60008, "默认文章不能进行删除"),
|
ARTICLE_NO_DELETION(60008, "默认文章不能进行删除"),
|
||||||
|
|
||||||
|
|
||||||
@@ -363,69 +356,67 @@ public enum ResultCode {
|
|||||||
* 页面
|
* 页面
|
||||||
*/
|
*/
|
||||||
PAGE_NOT_EXIST(61001, "页面不存在"),
|
PAGE_NOT_EXIST(61001, "页面不存在"),
|
||||||
|
|
||||||
PAGE_OPEN_DELETE_ERROR(61002, "当前页面为开启状态,无法删除"),
|
PAGE_OPEN_DELETE_ERROR(61002, "当前页面为开启状态,无法删除"),
|
||||||
|
|
||||||
PAGE_DELETE_ERROR(61003, "当前页面为唯一页面,无法删除"),
|
PAGE_DELETE_ERROR(61003, "当前页面为唯一页面,无法删除"),
|
||||||
|
|
||||||
PAGE_RELEASE_ERROR(61004, "页面已发布,无需重复提交"),
|
PAGE_RELEASE_ERROR(61004, "页面已发布,无需重复提交"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置
|
* 设置
|
||||||
*/
|
*/
|
||||||
SETTING_NOT_TO_SET(70001, "该参数不需要设置"),
|
SETTING_NOT_TO_SET(70001, "该参数不需要设置"),
|
||||||
|
ALIPAY_NOT_SETTING(70002, "支付宝支付未配置"),
|
||||||
/**
|
ALIPAY_EXCEPTION(70003, "支付宝支付错误,请稍后重试"),
|
||||||
* 短信
|
ALIPAY_PARAMS_EXCEPTION(70004, "支付宝参数异常"),
|
||||||
*/
|
LOGISTICS_NOT_SETTING(70005, "您还未配置快递查询"),
|
||||||
SMS_SIGN_EXIST_ERROR(80001, "短信签名已存在"),
|
ORDER_SETTING_ERROR(70006, "系统订单配置异常"),
|
||||||
|
ALI_SMS_SETTING_ERROR(70007, "您还未配置阿里云短信"),
|
||||||
|
SMS_SIGN_EXIST_ERROR(70008, "短信签名已存在"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 站内信
|
* 站内信
|
||||||
*/
|
*/
|
||||||
NOTICE_NOT_EXIST(80101, "当前消息模板不存在"),
|
NOTICE_NOT_EXIST(80001, "当前消息模板不存在"),
|
||||||
|
NOTICE_ERROR(80002, "修改站内信异常,请稍后重试"),
|
||||||
|
NOTICE_SEND_ERROR(80003, "发送站内信异常,请检查系统日志"),
|
||||||
|
|
||||||
NOTICE_ERROR(80102, "修改站内信异常,请稍后重试"),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OSS
|
* OSS
|
||||||
*/
|
*/
|
||||||
OSS_NOT_EXIST(80201, "OSS未配置"),
|
OSS_NOT_EXIST(80101, "OSS未配置"),
|
||||||
|
OSS_EXCEPTION_ERROR(80102, "文件上传失败,请稍后重试"),
|
||||||
OSS_EXCEPTION(80202, "文件上传失败,请稍后重试"),
|
OSS_DELETE_ERROR(80102, "图片删除失败"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证码
|
* 验证码
|
||||||
*/
|
*/
|
||||||
VERIFICATION_SEND_SUCCESS(80301, "短信验证码,发送成功"),
|
VERIFICATION_SEND_SUCCESS(80201, "短信验证码,发送成功"),
|
||||||
|
VERIFICATION_ERROR(80202, "验证失败"),
|
||||||
VERIFICATION_ERROR(80302, "验证失败"),
|
VERIFICATION_SMS_ERROR(80203, "短信验证码错误,请重新校验"),
|
||||||
|
VERIFICATION_SMS_EXPIRED_ERROR(80204, "验证码已失效,请重新校验"),
|
||||||
VERIFICATION_SMS_ERROR(80303, "短信验证码错误,请重新校验"),
|
|
||||||
|
|
||||||
VERIFICATION_SMS_EXPIRED_ERROR(80304, "验证码已失效,请重新校验"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置错误
|
|
||||||
*/
|
|
||||||
ALIPAY_NOT_SETTING(80401, "支付宝支付未配置"),
|
|
||||||
|
|
||||||
ALIPAY_EXCEPTION(80402, "支付宝支付错误,请稍后重试"),
|
|
||||||
|
|
||||||
ALIPAY_PARAMS_EXCEPTION(80403, "支付宝参数异常"),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信相关异常
|
* 微信相关异常
|
||||||
*/
|
*/
|
||||||
WECHAT_CONNECT_NOT_SETTING(80500, "微信联合登陆信息未配置"),
|
WECHAT_CONNECT_NOT_SETTING(80300, "微信联合登陆信息未配置"),
|
||||||
|
WECHAT_PAYMENT_NOT_SETTING(80301, "微信支付信息未配置"),
|
||||||
|
WECHAT_QRCODE_ERROR(80302, "微信二维码生成异常"),
|
||||||
|
WECHAT_MP_MESSAGE_ERROR(80303, "微信小程序小消息订阅异常"),
|
||||||
|
WECHAT_JSAPI_SIGN_ERROR(80304, "微信JsApi签名异常"),
|
||||||
|
WECHAT_CERT_ERROR(80305, "证书获取失败"),
|
||||||
|
WECHAT_MP_MESSAGE_TMPL_ERROR(80306, "未能获取到微信模版消息id"),
|
||||||
|
WECHAT_ERROR(80307, "微信接口异常"),
|
||||||
|
APP_VERSION_EXIST(80307, "APP版本已存在"),
|
||||||
|
|
||||||
WECHAT_PAYMENT_NOT_SETTING(80501, "微信支付信息未配置"),
|
/**
|
||||||
|
* 其他
|
||||||
|
*/
|
||||||
|
CUSTOM_WORDS_EXIST_ERROR(90000, "当前自定义分词已存在!"),
|
||||||
|
CUSTOM_WORDS_NOT_EXIST_ERROR(90001, "当前自定义分词不存在!"),
|
||||||
|
CUSTOM_WORDS_SECRET_KEY_ERROR(90002, "秘钥验证失败!"),
|
||||||
|
CONNECT_NOT_EXIST(90000, "登录方式不存在"),
|
||||||
|
|
||||||
WECHAT_QRCODE_ERROR(80502, "微信二维码生成异常"),
|
;
|
||||||
|
|
||||||
WECHAT_MP_MESSAGE_ERROR(80503, "微信小程序小消息订阅异常"),
|
|
||||||
|
|
||||||
APP_VERSION_EXIST(80600, "APP版本已存在");
|
|
||||||
|
|
||||||
private final Integer code;
|
private final Integer code;
|
||||||
private final String message;
|
private final String message;
|
||||||
|
|||||||
@@ -56,7 +56,12 @@ public class ResultUtil<T> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//抽象静态方法,返回结果集
|
/**
|
||||||
|
* 抽象静态方法,返回结果集
|
||||||
|
* @param t
|
||||||
|
* @param <T>
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static <T> ResultMessage<T> data(T t) {
|
public static <T> ResultMessage<T> data(T t) {
|
||||||
return new ResultUtil<T>().setData(t);
|
return new ResultUtil<T>().setData(t);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,14 @@ public class ServiceException extends RuntimeException {
|
|||||||
|
|
||||||
public static String DEFAULT_MESSAGE = "网络错误,请稍后重试!";
|
public static String DEFAULT_MESSAGE = "网络错误,请稍后重试!";
|
||||||
|
|
||||||
//异常消息
|
/**
|
||||||
|
* 异常消息
|
||||||
|
*/
|
||||||
private String msg = DEFAULT_MESSAGE;
|
private String msg = DEFAULT_MESSAGE;
|
||||||
|
|
||||||
//错误码
|
/**
|
||||||
|
* 错误码
|
||||||
|
*/
|
||||||
private ResultCode resultCode;
|
private ResultCode resultCode;
|
||||||
|
|
||||||
public ServiceException(String msg) {
|
public ServiceException(String msg) {
|
||||||
|
|||||||
@@ -1,12 +1,20 @@
|
|||||||
package cn.lili.common.rocketmq.tags;
|
package cn.lili.common.rocketmq.tags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 售后标签枚举
|
||||||
|
*
|
||||||
* @author paulG
|
* @author paulG
|
||||||
* @since 2020/12/9
|
* @since 2020/12/9
|
||||||
**/
|
**/
|
||||||
public enum AfterSaleTagsEnum {
|
public enum AfterSaleTagsEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "售后退款"
|
||||||
|
*/
|
||||||
REFUND("售后退款"),
|
REFUND("售后退款"),
|
||||||
|
/**
|
||||||
|
* "售后单状态改变"
|
||||||
|
*/
|
||||||
AFTER_SALE_STATUS_CHANGE("售后单状态改变");
|
AFTER_SALE_STATUS_CHANGE("售后单状态改变");
|
||||||
|
|
||||||
private final String description;
|
private final String description;
|
||||||
|
|||||||
@@ -6,13 +6,37 @@ package cn.lili.common.rocketmq.tags;
|
|||||||
**/
|
**/
|
||||||
public enum GoodsTagsEnum {
|
public enum GoodsTagsEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "生成商品索引"
|
||||||
|
*/
|
||||||
GENERATOR_GOODS_INDEX("生成商品索引"),
|
GENERATOR_GOODS_INDEX("生成商品索引"),
|
||||||
|
/**
|
||||||
|
* "删除商品"
|
||||||
|
*/
|
||||||
GOODS_DELETE("删除商品"),
|
GOODS_DELETE("删除商品"),
|
||||||
|
/**
|
||||||
|
* "审核商品"
|
||||||
|
*/
|
||||||
GOODS_AUDIT("审核商品"),
|
GOODS_AUDIT("审核商品"),
|
||||||
|
/**
|
||||||
|
* "收藏商品"
|
||||||
|
*/
|
||||||
GOODS_COLLECTION("收藏商品"),
|
GOODS_COLLECTION("收藏商品"),
|
||||||
|
/**
|
||||||
|
* "购买商品完成"
|
||||||
|
*/
|
||||||
BUY_GOODS_COMPLETE("购买商品完成"),
|
BUY_GOODS_COMPLETE("购买商品完成"),
|
||||||
|
/**
|
||||||
|
* "删除商品SKU"
|
||||||
|
*/
|
||||||
SKU_DELETE("删除商品SKU"),
|
SKU_DELETE("删除商品SKU"),
|
||||||
|
/**
|
||||||
|
* "查看商品"
|
||||||
|
*/
|
||||||
VIEW_GOODS("查看商品"),
|
VIEW_GOODS("查看商品"),
|
||||||
|
/**
|
||||||
|
* "商品评价"
|
||||||
|
*/
|
||||||
GOODS_COMMENT_COMPLETE("商品评价");
|
GOODS_COMMENT_COMPLETE("商品评价");
|
||||||
|
|
||||||
private final String description;
|
private final String description;
|
||||||
|
|||||||
@@ -1,14 +1,27 @@
|
|||||||
package cn.lili.common.rocketmq.tags;
|
package cn.lili.common.rocketmq.tags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 会员操作枚举
|
||||||
|
*
|
||||||
* @author paulG
|
* @author paulG
|
||||||
* @since 2020/12/9
|
* @since 2020/12/9
|
||||||
**/
|
**/
|
||||||
public enum MemberTagsEnum {
|
public enum MemberTagsEnum {
|
||||||
|
/**
|
||||||
|
* 会员注册
|
||||||
|
*/
|
||||||
MEMBER_REGISTER("会员注册"),
|
MEMBER_REGISTER("会员注册"),
|
||||||
|
/**
|
||||||
|
* 会员签到
|
||||||
|
*/
|
||||||
MEMBER_SING("会员签到"),
|
MEMBER_SING("会员签到"),
|
||||||
|
/**
|
||||||
|
* 会员提现
|
||||||
|
*/
|
||||||
MEMBER_WITHDRAWAL("会员提现"),
|
MEMBER_WITHDRAWAL("会员提现"),
|
||||||
|
/**
|
||||||
|
* 会员积分变动
|
||||||
|
*/
|
||||||
MEMBER_POINT_CHANGE("会员积分变动");
|
MEMBER_POINT_CHANGE("会员积分变动");
|
||||||
|
|
||||||
private final String description;
|
private final String description;
|
||||||
|
|||||||
@@ -1,18 +1,23 @@
|
|||||||
package cn.lili.common.rocketmq.tags;
|
package cn.lili.common.rocketmq.tags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 订单操作枚举
|
||||||
|
*
|
||||||
* @author paulG
|
* @author paulG
|
||||||
* @since 2020/12/9
|
* @since 2020/12/9
|
||||||
**/
|
**/
|
||||||
public enum MqOrderTagsEnum {
|
public enum MqOrderTagsEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单创建
|
||||||
|
*/
|
||||||
ORDER_CREATE("订单创建"),
|
ORDER_CREATE("订单创建"),
|
||||||
|
/**
|
||||||
|
* 订单状态改变
|
||||||
|
*/
|
||||||
STATUS_CHANGE("订单状态改变");
|
STATUS_CHANGE("订单状态改变");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private final String description;
|
private final String description;
|
||||||
|
|
||||||
MqOrderTagsEnum(String description) {
|
MqOrderTagsEnum(String description) {
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
package cn.lili.common.rocketmq.tags;
|
package cn.lili.common.rocketmq.tags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 其他操作枚举
|
||||||
|
*
|
||||||
* @author paulG
|
* @author paulG
|
||||||
* @since 2020/12/9
|
* @since 2020/12/9
|
||||||
**/
|
**/
|
||||||
public enum OtherTagsEnum {
|
public enum OtherTagsEnum {
|
||||||
|
/**
|
||||||
|
* 站内消息提醒
|
||||||
|
*/
|
||||||
MESSAGE("站内消息提醒"),
|
MESSAGE("站内消息提醒"),
|
||||||
|
/**
|
||||||
|
* 短信消息提醒
|
||||||
|
*/
|
||||||
SMS("短信消息提醒");
|
SMS("短信消息提醒");
|
||||||
|
|
||||||
private final String description;
|
private final String description;
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ import cn.lili.common.token.SecretKeyUtil;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import io.jsonwebtoken.Claims;
|
import io.jsonwebtoken.Claims;
|
||||||
import io.jsonwebtoken.Jwts;
|
import io.jsonwebtoken.Jwts;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户上下文
|
* 用户上下文
|
||||||
@@ -20,15 +24,18 @@ import io.jsonwebtoken.Jwts;
|
|||||||
*/
|
*/
|
||||||
public class UserContext {
|
public class UserContext {
|
||||||
|
|
||||||
private static AuthenticationHandler authenticationHandler;
|
/**
|
||||||
|
* 根据request获取用户信息
|
||||||
public static void setHolder(AuthenticationHandler authenticationHandler) {
|
*
|
||||||
UserContext.authenticationHandler = authenticationHandler;
|
* @return
|
||||||
}
|
*/
|
||||||
|
|
||||||
|
|
||||||
public static AuthUser getCurrentUser() {
|
public static AuthUser getCurrentUser() {
|
||||||
return authenticationHandler.getAuthUser();
|
if (RequestContextHolder.getRequestAttributes() != null) {
|
||||||
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||||
|
String accessToken = request.getHeader(SecurityEnum.HEADER_TOKEN.getValue());
|
||||||
|
return getAuthUser(accessToken);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -44,6 +51,20 @@ public class UserContext {
|
|||||||
if (cache.keys("*" + accessToken).size() == 0) {
|
if (cache.keys("*" + accessToken).size() == 0) {
|
||||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||||
}
|
}
|
||||||
|
return getAuthUser(accessToken);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据jwt获取token重的用户信息
|
||||||
|
*
|
||||||
|
* @param accessToken token
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static AuthUser getAuthUser(String accessToken) {
|
||||||
|
try {
|
||||||
//获取token的信息
|
//获取token的信息
|
||||||
Claims claims
|
Claims claims
|
||||||
= Jwts.parser()
|
= Jwts.parser()
|
||||||
|
|||||||
@@ -31,6 +31,6 @@ public class UserContextInit implements ApplicationRunner {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) {
|
public void run(ApplicationArguments args) {
|
||||||
UserContext.setHolder(authenticationHandler);
|
//UserContext.setHolder(authenticationHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ import java.util.regex.Pattern;
|
|||||||
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||||
private HttpServletRequest request;
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public XssHttpServletRequestWrapper(HttpServletRequest request) {
|
public XssHttpServletRequestWrapper(HttpServletRequest request) {
|
||||||
super(request);
|
super(request);
|
||||||
this.request = request;
|
this.request = request;
|
||||||
@@ -90,46 +94,38 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static final Pattern SCRIPT_PATTERN1 = Pattern.compile("<script>(.*?)</script>", Pattern.CASE_INSENSITIVE);
|
||||||
|
private static final Pattern SCRIPT_PATTERN2 = Pattern.compile("</script>", Pattern.CASE_INSENSITIVE);
|
||||||
|
private static final Pattern SCRIPT_PATTERN3 = Pattern.compile("<script(.*?)>", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||||
|
private static final Pattern SCRIPT_PATTERN4 = Pattern.compile("javascript:", Pattern.CASE_INSENSITIVE);
|
||||||
|
private static final Pattern SRC_PATTERN = Pattern.compile("src[\r\n]*=[\r\n]*\\\'(.*?)\\\'", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||||
|
private static final Pattern EVAL_PATTERN = Pattern.compile("eval\\((.*?)\\)", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||||
|
private static final Pattern E__XPRESSION_PATTERN = Pattern.compile("expression\\((.*?)\\)", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||||
|
private static final Pattern VB_SCRIPT_PATTERN = Pattern.compile("vbscript:", Pattern.CASE_INSENSITIVE);
|
||||||
|
private static final Pattern ONLOAD_PATTERN = Pattern.compile("onload(.*?)=", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||||
|
|
||||||
private String cleanXSS(String value) {
|
private String cleanXSS(String value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
//推荐使用ESAPI库来避免脚本攻击,value = ESAPI.encoder().canonicalize(value);
|
//推荐使用ESAPI库来避免脚本攻击,value = ESAPI.encoder().canonicalize(value);
|
||||||
// //避免空字符串
|
|
||||||
// value = value.replaceAll(" ", "");
|
|
||||||
//避免script 标签
|
//避免script 标签
|
||||||
Pattern scriptPattern = Pattern.compile("<script>(.*?)</script>", Pattern.CASE_INSENSITIVE);
|
value = SCRIPT_PATTERN1.matcher(value).replaceAll("");
|
||||||
value = scriptPattern.matcher(value).replaceAll("");
|
|
||||||
//避免src形式的表达式
|
|
||||||
scriptPattern = Pattern.compile("src[\r\n]*=[\r\n]*\\\'(.*?)\\\'",
|
|
||||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
|
||||||
value = scriptPattern.matcher(value).replaceAll("");
|
|
||||||
scriptPattern = Pattern.compile("src[\r\n]*=[\r\n]*\\\"(.*?)\\\"",
|
|
||||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
|
||||||
value = scriptPattern.matcher(value).replaceAll("");
|
|
||||||
//删除单个的 </script> 标签
|
//删除单个的 </script> 标签
|
||||||
scriptPattern = Pattern.compile("</script>", Pattern.CASE_INSENSITIVE);
|
value = SCRIPT_PATTERN2.matcher(value).replaceAll("");
|
||||||
value = scriptPattern.matcher(value).replaceAll("");
|
|
||||||
//删除单个的<script ...> 标签
|
//删除单个的<script ...> 标签
|
||||||
scriptPattern = Pattern.compile("<script(.*?)>",
|
value = SCRIPT_PATTERN3.matcher(value).replaceAll("");
|
||||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
|
||||||
value = scriptPattern.matcher(value).replaceAll("");
|
|
||||||
//避免 eval(...) 形式表达式
|
|
||||||
scriptPattern = Pattern.compile("eval\\((.*?)\\)",
|
|
||||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
|
||||||
value = scriptPattern.matcher(value).replaceAll("");
|
|
||||||
//避免 expression(...) 表达式
|
|
||||||
scriptPattern = Pattern.compile("expression\\((.*?)\\)",
|
|
||||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
|
||||||
value = scriptPattern.matcher(value).replaceAll("");
|
|
||||||
//避免 javascript: 表达式
|
//避免 javascript: 表达式
|
||||||
scriptPattern = Pattern.compile("javascript:", Pattern.CASE_INSENSITIVE);
|
value = SCRIPT_PATTERN4.matcher(value).replaceAll("");
|
||||||
value = scriptPattern.matcher(value).replaceAll("");
|
//避免src形式的表达式
|
||||||
|
value = SRC_PATTERN.matcher(value).replaceAll("");
|
||||||
|
//避免 eval(...) 形式表达式
|
||||||
|
value = EVAL_PATTERN.matcher(value).replaceAll("");
|
||||||
|
//避免 expression(...) 表达式
|
||||||
|
value = E__XPRESSION_PATTERN.matcher(value).replaceAll("");
|
||||||
//避免 vbscript:表达式
|
//避免 vbscript:表达式
|
||||||
scriptPattern = Pattern.compile("vbscript:", Pattern.CASE_INSENSITIVE);
|
value = VB_SCRIPT_PATTERN.matcher(value).replaceAll("");
|
||||||
value = scriptPattern.matcher(value).replaceAll("");
|
|
||||||
//避免 onload= 表达式
|
//避免 onload= 表达式
|
||||||
scriptPattern = Pattern.compile("onload(.*?)=",
|
value = ONLOAD_PATTERN.matcher(value).replaceAll("");
|
||||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
|
||||||
value = scriptPattern.matcher(value).replaceAll("");
|
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public interface AliSmsUtil {
|
|||||||
* 申请短信签名
|
* 申请短信签名
|
||||||
*
|
*
|
||||||
* @param smsSign 短信签名
|
* @param smsSign 短信签名
|
||||||
|
* @throws Exception 阿里短信签名错误
|
||||||
*/
|
*/
|
||||||
void addSmsSign(SmsSign smsSign) throws Exception;
|
void addSmsSign(SmsSign smsSign) throws Exception;
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ public interface AliSmsUtil {
|
|||||||
* 删除短信签名
|
* 删除短信签名
|
||||||
*
|
*
|
||||||
* @param signName 签名名称
|
* @param signName 签名名称
|
||||||
|
* @throws Exception 阿里短信签名错误
|
||||||
*/
|
*/
|
||||||
void deleteSmsSign(String signName) throws Exception;
|
void deleteSmsSign(String signName) throws Exception;
|
||||||
|
|
||||||
@@ -31,6 +33,8 @@ public interface AliSmsUtil {
|
|||||||
* 查询短信签名申请状态
|
* 查询短信签名申请状态
|
||||||
*
|
*
|
||||||
* @param signName 签名名称
|
* @param signName 签名名称
|
||||||
|
* @return 短信签名申请状态
|
||||||
|
* @throws Exception 阿里短信签名错误
|
||||||
*/
|
*/
|
||||||
Map<String, Object> querySmsSign(String signName) throws Exception;
|
Map<String, Object> querySmsSign(String signName) throws Exception;
|
||||||
|
|
||||||
@@ -38,6 +42,7 @@ public interface AliSmsUtil {
|
|||||||
* 修改未审核通过的短信签名,并重新提交审核。
|
* 修改未审核通过的短信签名,并重新提交审核。
|
||||||
*
|
*
|
||||||
* @param smsSign 短信签名
|
* @param smsSign 短信签名
|
||||||
|
* @throws Exception 阿里短信签名错误
|
||||||
*/
|
*/
|
||||||
void modifySmsSign(SmsSign smsSign) throws Exception;
|
void modifySmsSign(SmsSign smsSign) throws Exception;
|
||||||
|
|
||||||
@@ -45,7 +50,7 @@ public interface AliSmsUtil {
|
|||||||
* 修改未审核通过的短信模板,并重新提交审核。
|
* 修改未审核通过的短信模板,并重新提交审核。
|
||||||
*
|
*
|
||||||
* @param smsTemplate 短信模板
|
* @param smsTemplate 短信模板
|
||||||
* @throws Exception
|
* @throws Exception 阿里短信签名错误
|
||||||
*/
|
*/
|
||||||
void modifySmsTemplate(SmsTemplate smsTemplate) throws Exception;
|
void modifySmsTemplate(SmsTemplate smsTemplate) throws Exception;
|
||||||
|
|
||||||
@@ -53,7 +58,8 @@ public interface AliSmsUtil {
|
|||||||
* 查看短信模板
|
* 查看短信模板
|
||||||
*
|
*
|
||||||
* @param templateCode 短信模板CODE
|
* @param templateCode 短信模板CODE
|
||||||
* @throws Exception
|
* @return 短信模板
|
||||||
|
* @throws Exception 阿里短信签名错误
|
||||||
*/
|
*/
|
||||||
Map<String, Object> querySmsTemplate(String templateCode) throws Exception;
|
Map<String, Object> querySmsTemplate(String templateCode) throws Exception;
|
||||||
|
|
||||||
@@ -61,8 +67,8 @@ public interface AliSmsUtil {
|
|||||||
* 申请短信模板
|
* 申请短信模板
|
||||||
*
|
*
|
||||||
* @param smsTemplate 短信模板
|
* @param smsTemplate 短信模板
|
||||||
* @return
|
* @return 短信模板
|
||||||
* @throws Exception
|
* @throws Exception 阿里短信签名错误
|
||||||
*/
|
*/
|
||||||
String addSmsTemplate(SmsTemplate smsTemplate) throws Exception;
|
String addSmsTemplate(SmsTemplate smsTemplate) throws Exception;
|
||||||
|
|
||||||
@@ -70,7 +76,7 @@ public interface AliSmsUtil {
|
|||||||
* 删除短信模板
|
* 删除短信模板
|
||||||
*
|
*
|
||||||
* @param templateCode 短信模板CODE
|
* @param templateCode 短信模板CODE
|
||||||
* @throws Exception
|
* @throws Exception 阿里短信签名错误
|
||||||
*/
|
*/
|
||||||
void deleteSmsTemplate(String templateCode) throws Exception;
|
void deleteSmsTemplate(String templateCode) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public interface SmsUtil {
|
|||||||
* @param verificationEnums 验证码场景
|
* @param verificationEnums 验证码场景
|
||||||
* @param uuid 用户标识uuid
|
* @param uuid 用户标识uuid
|
||||||
* @param code 待验证code
|
* @param code 待验证code
|
||||||
|
* @return 操作状态
|
||||||
*/
|
*/
|
||||||
boolean verifyCode(String mobile, VerificationEnums verificationEnums, String uuid, String code);
|
boolean verifyCode(String mobile, VerificationEnums verificationEnums, String uuid, String code);
|
||||||
|
|
||||||
@@ -41,6 +42,7 @@ public interface SmsUtil {
|
|||||||
* @param mobile 接收手机号
|
* @param mobile 接收手机号
|
||||||
* @param param 参数
|
* @param param 参数
|
||||||
* @param templateCode 模版code
|
* @param templateCode 模版code
|
||||||
|
* @param signName 签名名称
|
||||||
*/
|
*/
|
||||||
void sendSmsCode(String signName, String mobile, Map<String, String> param, String templateCode);
|
void sendSmsCode(String signName, String mobile, Map<String, String> param, String templateCode);
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.lili.common.cache.Cache;
|
import cn.lili.common.cache.Cache;
|
||||||
import cn.lili.common.cache.CachePrefix;
|
import cn.lili.common.cache.CachePrefix;
|
||||||
|
import cn.lili.common.enums.ResultCode;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.security.context.UserContext;
|
import cn.lili.common.security.context.UserContext;
|
||||||
import cn.lili.common.sms.AliSmsUtil;
|
import cn.lili.common.sms.AliSmsUtil;
|
||||||
@@ -64,7 +65,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
//获取短信配置
|
//获取短信配置
|
||||||
Setting setting = settingService.get(SettingEnum.SMS_SETTING.name());
|
Setting setting = settingService.get(SettingEnum.SMS_SETTING.name());
|
||||||
if (StrUtil.isBlank(setting.getSettingValue())) {
|
if (StrUtil.isBlank(setting.getSettingValue())) {
|
||||||
throw new ServiceException("您还未配置阿里云短信");
|
throw new ServiceException(ResultCode.ALI_SMS_SETTING_ERROR);
|
||||||
}
|
}
|
||||||
SmsSetting smsSetting = new Gson().fromJson(setting.getSettingValue(), SmsSetting.class);
|
SmsSetting smsSetting = new Gson().fromJson(setting.getSettingValue(), SmsSetting.class);
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
String code = CommonUtil.getRandomNum();
|
String code = CommonUtil.getRandomNum();
|
||||||
|
|
||||||
//准备发送短信参数
|
//准备发送短信参数
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>(2);
|
||||||
//验证码内容
|
//验证码内容
|
||||||
params.put("code", code);
|
params.put("code", code);
|
||||||
|
|
||||||
@@ -220,7 +221,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
signFileList1
|
signFileList1
|
||||||
));
|
));
|
||||||
AddSmsSignResponse response = client.addSmsSign(addSmsSignRequest);
|
AddSmsSignResponse response = client.addSmsSign(addSmsSignRequest);
|
||||||
if (!response.getBody().getCode().equals("OK")) {
|
if (!("OK").equals(response.getBody().getCode())) {
|
||||||
throw new ServiceException(response.getBody().getMessage());
|
throw new ServiceException(response.getBody().getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,7 +233,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
.setSignName(signName);
|
.setSignName(signName);
|
||||||
|
|
||||||
DeleteSmsSignResponse response = client.deleteSmsSign(deleteSmsSignRequest);
|
DeleteSmsSignResponse response = client.deleteSmsSign(deleteSmsSignRequest);
|
||||||
if (!response.getBody().getCode().equals("OK")) {
|
if (!("OK").equals(response.getBody().getCode())) {
|
||||||
throw new ServiceException(response.getBody().getMessage());
|
throw new ServiceException(response.getBody().getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,10 +246,10 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
QuerySmsSignRequest querySmsSignRequest = new QuerySmsSignRequest().setSignName(signName);
|
QuerySmsSignRequest querySmsSignRequest = new QuerySmsSignRequest().setSignName(signName);
|
||||||
|
|
||||||
QuerySmsSignResponse response = client.querySmsSign(querySmsSignRequest);
|
QuerySmsSignResponse response = client.querySmsSign(querySmsSignRequest);
|
||||||
if (!response.getBody().getCode().equals("OK")) {
|
if (!("OK").equals(response.getBody().getCode())) {
|
||||||
throw new ServiceException(response.getBody().getMessage());
|
throw new ServiceException(response.getBody().getMessage());
|
||||||
}
|
}
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>(2);
|
||||||
map.put("SignStatus", response.getBody().getSignStatus());
|
map.put("SignStatus", response.getBody().getSignStatus());
|
||||||
map.put("Reason", response.getBody().getReason());
|
map.put("Reason", response.getBody().getReason());
|
||||||
return map;
|
return map;
|
||||||
@@ -274,7 +275,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
signFileList1
|
signFileList1
|
||||||
));
|
));
|
||||||
ModifySmsSignResponse response = client.modifySmsSign(modifySmsSign);
|
ModifySmsSignResponse response = client.modifySmsSign(modifySmsSign);
|
||||||
if (!response.getBody().getCode().equals("OK")) {
|
if (!("OK").equals(response.getBody().getCode())) {
|
||||||
throw new ServiceException(response.getBody().getMessage());
|
throw new ServiceException(response.getBody().getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -290,7 +291,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
.setTemplateCode(smsTemplate.getTemplateCode());
|
.setTemplateCode(smsTemplate.getTemplateCode());
|
||||||
|
|
||||||
ModifySmsTemplateResponse response = client.modifySmsTemplate(modifySmsTemplateRequest);
|
ModifySmsTemplateResponse response = client.modifySmsTemplate(modifySmsTemplateRequest);
|
||||||
if (!response.getBody().getCode().equals("OK")) {
|
if (!("OK").equals(response.getBody().getCode())) {
|
||||||
throw new ServiceException(response.getBody().getMessage());
|
throw new ServiceException(response.getBody().getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -302,10 +303,10 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
.setTemplateCode(templateCode);
|
.setTemplateCode(templateCode);
|
||||||
QuerySmsTemplateResponse response = client.querySmsTemplate(querySmsTemplateRequest);
|
QuerySmsTemplateResponse response = client.querySmsTemplate(querySmsTemplateRequest);
|
||||||
|
|
||||||
if (!response.getBody().getCode().equals("OK")) {
|
if (!("OK").equals(response.getBody().getCode())) {
|
||||||
throw new ServiceException(response.getBody().getMessage());
|
throw new ServiceException(response.getBody().getMessage());
|
||||||
}
|
}
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>(4);
|
||||||
map.put("TemplateStatus", response.getBody().getTemplateStatus());
|
map.put("TemplateStatus", response.getBody().getTemplateStatus());
|
||||||
map.put("Reason", response.getBody().getReason());
|
map.put("Reason", response.getBody().getReason());
|
||||||
map.put("TemplateCode", response.getBody().getTemplateCode());
|
map.put("TemplateCode", response.getBody().getTemplateCode());
|
||||||
@@ -322,7 +323,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
.setRemark(smsTemplate.getRemark());
|
.setRemark(smsTemplate.getRemark());
|
||||||
|
|
||||||
AddSmsTemplateResponse response = client.addSmsTemplate(addSmsTemplateRequest);
|
AddSmsTemplateResponse response = client.addSmsTemplate(addSmsTemplateRequest);
|
||||||
if (!response.getBody().getCode().equals("OK")) {
|
if (!("OK").equals(response.getBody().getCode())) {
|
||||||
throw new ServiceException(response.getBody().getMessage());
|
throw new ServiceException(response.getBody().getMessage());
|
||||||
}
|
}
|
||||||
return response.getBody().getTemplateCode();
|
return response.getBody().getTemplateCode();
|
||||||
@@ -335,7 +336,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
.setTemplateCode(templateCode);
|
.setTemplateCode(templateCode);
|
||||||
|
|
||||||
DeleteSmsTemplateResponse response = client.deleteSmsTemplate(deleteSmsTemplateRequest);
|
DeleteSmsTemplateResponse response = client.deleteSmsTemplate(deleteSmsTemplateRequest);
|
||||||
if (!response.getBody().getCode().equals("OK")) {
|
if (!("OK").equals(response.getBody().getCode())) {
|
||||||
throw new ServiceException(response.getBody().getMessage());
|
throw new ServiceException(response.getBody().getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -351,7 +352,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
try {
|
try {
|
||||||
Setting setting = settingService.get(SettingEnum.SMS_SETTING.name());
|
Setting setting = settingService.get(SettingEnum.SMS_SETTING.name());
|
||||||
if (StrUtil.isBlank(setting.getSettingValue())) {
|
if (StrUtil.isBlank(setting.getSettingValue())) {
|
||||||
throw new ServiceException("您还未配置阿里云短信");
|
throw new ServiceException(ResultCode.ALI_SMS_SETTING_ERROR);
|
||||||
}
|
}
|
||||||
SmsSetting smsSetting = new Gson().fromJson(setting.getSettingValue(), SmsSetting.class);
|
SmsSetting smsSetting = new Gson().fromJson(setting.getSettingValue(), SmsSetting.class);
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ import javax.crypto.SecretKey;
|
|||||||
*/
|
*/
|
||||||
public class SecretKeyUtil {
|
public class SecretKeyUtil {
|
||||||
public static SecretKey generalKey() {
|
public static SecretKey generalKey() {
|
||||||
byte[] encodedKey = Base64.decodeBase64("cuAihCz53DZRjZwbsGcZJ2Ai6At+T142uphtJMsk7iQ=");//自定义
|
//自定义
|
||||||
|
byte[] encodedKey = Base64.decodeBase64("cuAihCz53DZRjZwbsGcZJ2Ai6At+T142uphtJMsk7iQ=");
|
||||||
javax.crypto.SecretKey key = Keys.hmacShaKeyFor(encodedKey);
|
javax.crypto.SecretKey key = Keys.hmacShaKeyFor(encodedKey);
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class ManagerTokenGenerate extends AbstractTokenGenerate {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String, List<String>> permissionList(List<UserMenuVO> userMenuVOList) {
|
private Map<String, List<String>> permissionList(List<UserMenuVO> userMenuVOList) {
|
||||||
Map<String, List<String>> permission = new HashMap<>();
|
Map<String, List<String>> permission = new HashMap<>(2);
|
||||||
if (userMenuVOList == null || userMenuVOList.size() == 0) {
|
if (userMenuVOList == null || userMenuVOList.size() == 0) {
|
||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ public class ManagerTokenGenerate extends AbstractTokenGenerate {
|
|||||||
//for循环路径集合
|
//for循环路径集合
|
||||||
for (String path : paths) {
|
for (String path : paths) {
|
||||||
//如果是超级权限 则计入超级权限
|
//如果是超级权限 则计入超级权限
|
||||||
if (menu.getIsSupper()) {
|
if (menu.getIsSupper() != null && menu.getIsSupper()) {
|
||||||
//如果已有超级权限,则这里就不做权限的累加
|
//如果已有超级权限,则这里就不做权限的累加
|
||||||
if (!superPermissions.contains(path)) {
|
if (!superPermissions.contains(path)) {
|
||||||
superPermissions.add(path);
|
superPermissions.add(path);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import cn.lili.common.token.Token;
|
|||||||
import cn.lili.common.token.TokenUtil;
|
import cn.lili.common.token.TokenUtil;
|
||||||
import cn.lili.common.token.base.AbstractTokenGenerate;
|
import cn.lili.common.token.base.AbstractTokenGenerate;
|
||||||
import cn.lili.config.context.ThreadContextHolder;
|
import cn.lili.config.context.ThreadContextHolder;
|
||||||
import cn.lili.modules.base.entity.enums.ClientTypeEnum;
|
import cn.lili.common.enums.ClientTypeEnum;
|
||||||
import cn.lili.modules.member.entity.dos.Member;
|
import cn.lili.modules.member.entity.dos.Member;
|
||||||
import cn.lili.modules.member.service.MemberService;
|
import cn.lili.modules.member.service.MemberService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.lili.common.token.base.generate;
|
package cn.lili.common.token.base.generate;
|
||||||
|
|
||||||
|
import cn.lili.common.enums.ResultCode;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.security.AuthUser;
|
import cn.lili.common.security.AuthUser;
|
||||||
import cn.lili.common.security.enums.UserEnums;
|
import cn.lili.common.security.enums.UserEnums;
|
||||||
@@ -19,7 +20,6 @@ import org.springframework.stereotype.Component;
|
|||||||
*
|
*
|
||||||
* @author Chopper
|
* @author Chopper
|
||||||
* @version v4.0
|
* @version v4.0
|
||||||
* @Description:
|
|
||||||
* @since 2020/11/16 10:51
|
* @since 2020/11/16 10:51
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@@ -36,7 +36,7 @@ public class StoreTokenGenerate extends AbstractTokenGenerate {
|
|||||||
//生成token
|
//生成token
|
||||||
Member member = memberService.findByUsername(username);
|
Member member = memberService.findByUsername(username);
|
||||||
if (!member.getHaveStore()) {
|
if (!member.getHaveStore()) {
|
||||||
throw new ServiceException("该会员未开通店铺");
|
throw new ServiceException(ResultCode.STORE_NOT_OPEN);
|
||||||
}
|
}
|
||||||
AuthUser user = new AuthUser(member.getUsername(), member.getId(), member.getNickName(), UserEnums.STORE);
|
AuthUser user = new AuthUser(member.getUsername(), member.getId(), member.getNickName(), UserEnums.STORE);
|
||||||
LambdaQueryWrapper<Store> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Store> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public abstract class AbstractDelayQueueMachineFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 要实现延时队列的名字
|
* 要实现延时队列的名字
|
||||||
|
* @return 延时队列的名字
|
||||||
*/
|
*/
|
||||||
public abstract String setDelayQueueName();
|
public abstract String setDelayQueueName();
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package cn.lili.common.trigger.enums;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 队列枚举
|
* 队列枚举
|
||||||
|
*
|
||||||
|
* @author Bulbasaur
|
||||||
|
* @date: 2021/7/9 1:40 上午
|
||||||
*/
|
*/
|
||||||
public enum DelayQueueEnums {
|
public enum DelayQueueEnums {
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package cn.lili.common.trigger.message;
|
package cn.lili.common.trigger.message;
|
||||||
|
|
||||||
import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -43,10 +41,4 @@ public class PromotionMessage {
|
|||||||
*/
|
*/
|
||||||
private Date endTime;
|
private Date endTime;
|
||||||
|
|
||||||
public <T> UpdateWrapper<T> updateWrapper() {
|
|
||||||
UpdateWrapper<T> updateWrapper = new UpdateWrapper<>();
|
|
||||||
updateWrapper.eq("id", promotionId);
|
|
||||||
updateWrapper.set("promotion_status", PromotionStatusEnum.valueOf(promotionStatus));
|
|
||||||
return updateWrapper;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package cn.lili.common.utils;
|
package cn.lili.common.utils;
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import cn.lili.modules.payment.kit.dto.PayParam;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@@ -9,16 +7,18 @@ import java.lang.reflect.Method;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 对象属性复制
|
* 对象属性复制
|
||||||
|
*
|
||||||
* @author Chopper
|
* @author Chopper
|
||||||
*/
|
*/
|
||||||
public class BeanUtil {
|
public class BeanUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 复制属性
|
* 复制属性
|
||||||
|
*
|
||||||
* @param objectFrom
|
* @param objectFrom
|
||||||
* @param objectTo
|
* @param objectTo
|
||||||
*/
|
*/
|
||||||
public static void copyProperties(Object objectFrom,Object objectTo){
|
public static void copyProperties(Object objectFrom, Object objectTo) {
|
||||||
BeanUtils.copyProperties(objectFrom, objectTo);
|
BeanUtils.copyProperties(objectFrom, objectTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ public class BeanUtil {
|
|||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < superFields.length; i++) {
|
for (int i = 0; i < superFields.length; i++) {
|
||||||
if (superFields[i].getName().equals("id")) {
|
if ("id".equals(superFields[i].getName())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fieldNames[index] = superFields[i].getName();
|
fieldNames[index] = superFields[i].getName();
|
||||||
@@ -45,8 +45,12 @@ public class BeanUtil {
|
|||||||
return fieldNames;
|
return fieldNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 根据属性名获取属性值
|
/**
|
||||||
* */
|
* 根据属性名获取属性值
|
||||||
|
* @param fieldName 属性名
|
||||||
|
* @param o 对象
|
||||||
|
* @return 属性值
|
||||||
|
*/
|
||||||
public static Object getFieldValueByName(String fieldName, Object o) {
|
public static Object getFieldValueByName(String fieldName, Object o) {
|
||||||
try {
|
try {
|
||||||
String firstLetter = fieldName.substring(0, 1).toUpperCase();
|
String firstLetter = fieldName.substring(0, 1).toUpperCase();
|
||||||
@@ -117,16 +121,4 @@ public class BeanUtil {
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IllegalAccessException {
|
|
||||||
PayParam payParam = new PayParam();
|
|
||||||
payParam.setClientType("client");
|
|
||||||
payParam.setOrderType("");
|
|
||||||
payParam.setSn("sn");
|
|
||||||
String val = formatKeyValuePair(payParam);
|
|
||||||
System.out.println(val);
|
|
||||||
|
|
||||||
PayParam param = formatKeyValuePair(val, new PayParam());
|
|
||||||
System.out.println(JSONUtil.toJsonStr(param));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
package cn.lili.common.utils;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CheckMobileUtil
|
|
||||||
*
|
|
||||||
* @author Chopper
|
|
||||||
* @version v1.0
|
|
||||||
* 2021-02-04 14:56
|
|
||||||
*/
|
|
||||||
public class CheckMobileUtil {
|
|
||||||
|
|
||||||
|
|
||||||
//\b 是单词边界(连着的两个(字母字符 与 非字母字符) 之间的逻辑上的间隔),
|
|
||||||
//字符串在编译时会被转码一次,所以是 "\\b"
|
|
||||||
//\B 是单词内部逻辑间隔(连着的两个字母字符之间的逻辑上的间隔)
|
|
||||||
static String phoneReg = "\\b(ip(hone|od)|android|opera m(ob|in)i"
|
|
||||||
+ "|windows (phone|ce)|blackberry"
|
|
||||||
+ "|s(ymbian|eries60|amsung)|p(laybook|alm|rofile/midp"
|
|
||||||
+ "|laystation portable)|nokia|fennec|htc[-_]"
|
|
||||||
+ "|mobile|up.browser|[1-4][0-9]{2}x[1-4][0-9]{2})\\b";
|
|
||||||
static String tableReg = "\\b(ipad|tablet|(Nexus 7)|up.browser"
|
|
||||||
+ "|[1-4][0-9]{2}x[1-4][0-9]{2})\\b";
|
|
||||||
|
|
||||||
//移动设备正则匹配:手机端、平板
|
|
||||||
static Pattern phonePat = Pattern.compile(phoneReg, Pattern.CASE_INSENSITIVE);
|
|
||||||
static Pattern tablePat = Pattern.compile(tableReg, Pattern.CASE_INSENSITIVE);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检测是否是移动设备访问
|
|
||||||
*
|
|
||||||
* @param request 浏览器标识 获取方式:
|
|
||||||
* @return true:移动设备接入,false:pc端接入
|
|
||||||
* @Title: check
|
|
||||||
*/
|
|
||||||
public static boolean check(HttpServletRequest request) {
|
|
||||||
String userAgent = request.getHeader("USER-AGENT").toLowerCase();
|
|
||||||
if (null == userAgent) {
|
|
||||||
userAgent = "";
|
|
||||||
}
|
|
||||||
//匹配
|
|
||||||
Matcher matcherPhone = phonePat.matcher(userAgent);
|
|
||||||
Matcher matcherTable = tablePat.matcher(userAgent);
|
|
||||||
if (matcherPhone.find() || matcherTable.find()) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,9 @@ import java.math.BigDecimal;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 金额计算工具
|
* 金额计算工具
|
||||||
|
*
|
||||||
|
* @author Bulbasaur
|
||||||
|
* @date: 2021/7/9 1:40 上午
|
||||||
*/
|
*/
|
||||||
public final class CurrencyUtil {
|
public final class CurrencyUtil {
|
||||||
/**
|
/**
|
||||||
@@ -25,8 +28,8 @@ public final class CurrencyUtil {
|
|||||||
* @return 两个参数的和
|
* @return 两个参数的和
|
||||||
*/
|
*/
|
||||||
public static Double add(double v1, double v2) {
|
public static Double add(double v1, double v2) {
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
BigDecimal b1 = new BigDecimal(v1);
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
BigDecimal b2 = new BigDecimal(v2);
|
||||||
return b1.add(b2).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
return b1.add(b2).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,8 +41,8 @@ public final class CurrencyUtil {
|
|||||||
* @return 两个参数的差
|
* @return 两个参数的差
|
||||||
*/
|
*/
|
||||||
public static double sub(double v1, double v2) {
|
public static double sub(double v1, double v2) {
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
BigDecimal b1 = new BigDecimal(v1);
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
BigDecimal b2 = new BigDecimal(v2);
|
||||||
return b1.subtract(b2).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
return b1.subtract(b2).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,16 +54,16 @@ public final class CurrencyUtil {
|
|||||||
* @return 两个参数的积
|
* @return 两个参数的积
|
||||||
*/
|
*/
|
||||||
public static Double mul(double v1, double v2) {
|
public static Double mul(double v1, double v2) {
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
BigDecimal b1 = new BigDecimal(v1);
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
BigDecimal b2 = new BigDecimal(v2);
|
||||||
return b1.multiply(b2).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
return b1.multiply(b2).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提供精确的乘法运算。
|
* 提供精确的乘法运算。
|
||||||
*
|
*
|
||||||
* @param v1 被乘数
|
* @param v1 被乘数
|
||||||
* @param v2 乘数
|
* @param v2 乘数
|
||||||
* @param scale 表示表示需要精确到小数点以后几位。
|
* @param scale 表示表示需要精确到小数点以后几位。
|
||||||
* @return 两个参数的积
|
* @return 两个参数的积
|
||||||
*/
|
*/
|
||||||
@@ -69,8 +72,8 @@ public final class CurrencyUtil {
|
|||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"The scale must be a positive integer or zero");
|
"The scale must be a positive integer or zero");
|
||||||
}
|
}
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
BigDecimal b1 = new BigDecimal(v1);
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
BigDecimal b2 = new BigDecimal(v2);
|
||||||
return b1.multiply(b2).setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
return b1.multiply(b2).setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,8 +105,8 @@ public final class CurrencyUtil {
|
|||||||
if (v2 == 0) {
|
if (v2 == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
BigDecimal b1 = new BigDecimal(v1);
|
||||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
BigDecimal b2 = new BigDecimal(v2);
|
||||||
return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +122,7 @@ public final class CurrencyUtil {
|
|||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"The scale must be a positive integer or zero");
|
"The scale must be a positive integer or zero");
|
||||||
}
|
}
|
||||||
BigDecimal b = new BigDecimal(Double.toString(v));
|
BigDecimal b = new BigDecimal(v);
|
||||||
BigDecimal one = new BigDecimal("1");
|
BigDecimal one = new BigDecimal("1");
|
||||||
return b.divide(one, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
return b.divide(one, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,12 +174,12 @@ public class DateUtil {
|
|||||||
year--;
|
year--;
|
||||||
month = 12;
|
month = 12;
|
||||||
}
|
}
|
||||||
if (!(String.valueOf(month).length() > 1)) {
|
if (String.valueOf(month).length() <= 1) {
|
||||||
months = "0" + month;
|
months = "0" + month;
|
||||||
} else {
|
} else {
|
||||||
months = String.valueOf(month);
|
months = String.valueOf(month);
|
||||||
}
|
}
|
||||||
if (!(String.valueOf(day).length() > 1)) {
|
if (String.valueOf(day).length() <= 1) {
|
||||||
days = "0" + day;
|
days = "0" + day;
|
||||||
} else {
|
} else {
|
||||||
days = String.valueOf(day);
|
days = String.valueOf(day);
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import org.apache.http.client.HttpRequestRetryHandler;
|
|||||||
import org.apache.http.client.config.RequestConfig;
|
import org.apache.http.client.config.RequestConfig;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.client.methods.HttpPost;
|
|
||||||
import org.apache.http.client.protocol.HttpClientContext;
|
import org.apache.http.client.protocol.HttpClientContext;
|
||||||
import org.apache.http.client.utils.URIBuilder;
|
import org.apache.http.client.utils.URIBuilder;
|
||||||
import org.apache.http.config.Registry;
|
import org.apache.http.config.Registry;
|
||||||
@@ -19,8 +18,6 @@ import org.apache.http.conn.socket.ConnectionSocketFactory;
|
|||||||
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
|
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
|
||||||
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
|
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
|
||||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||||
import org.apache.http.entity.ContentType;
|
|
||||||
import org.apache.http.entity.StringEntity;
|
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||||
@@ -34,29 +31,60 @@ import java.net.URI;
|
|||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HttpClientUtils
|
||||||
|
*
|
||||||
|
* @author Bulbasaur
|
||||||
|
* @date: 2021/7/9 1:40 上午
|
||||||
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class HttpClientUtils {
|
public class HttpClientUtils {
|
||||||
|
|
||||||
//org.apache.http.impl.client.CloseableHttpClient
|
/**
|
||||||
|
* org.apache.http.impl.client.CloseableHttpClient
|
||||||
|
*/
|
||||||
private static CloseableHttpClient httpClient = null;
|
private static CloseableHttpClient httpClient = null;
|
||||||
|
|
||||||
//这里就直接默认固定了,因为以下三个参数在新建的method中仍然可以重新配置并被覆盖.
|
//这里就直接默认固定了,因为以下三个参数在新建的method中仍然可以重新配置并被覆盖.
|
||||||
static final int connectionRequestTimeout = 30000;//ms毫秒,从池中获取链接超时时间
|
/**
|
||||||
static final int connectTimeout = 60000;//ms毫秒,建立链接超时时间
|
* ms毫秒,从池中获取链接超时时间
|
||||||
static final int socketTimeout = 60000;//ms毫秒,读取超时时间
|
*/
|
||||||
|
static final int CONNECTION_REQUEST_TIMEOUT = 30000;
|
||||||
|
/**
|
||||||
|
* ms毫秒,建立链接超时时间
|
||||||
|
*/
|
||||||
|
static final int CONNECT_TIMEOUT = 60000;
|
||||||
|
/**
|
||||||
|
* ms毫秒,读取超时时间
|
||||||
|
*/
|
||||||
|
static final int SOCKET_TIMEOUT = 60000;
|
||||||
|
|
||||||
//总配置,主要涉及是以下两个参数,如果要作调整没有用到properties会比较后麻烦,但鉴于一经粘贴,随处可用的特点,就不再做依赖性配置化处理了.
|
/**
|
||||||
//而且这个参数同一家公司基本不会变动.
|
* 总配置,主要涉及是以下两个参数,如果要作调整没有用到properties会比较后麻烦,但鉴于一经粘贴,随处可用的特点,就不再做依赖性配置化处理了.
|
||||||
static final int maxTotal = 500;//最大总并发,很重要的参数
|
* 而且这个参数同一家公司基本不会变动.
|
||||||
static final int maxPerRoute = 100;//每路并发,很重要的参数
|
* 最大总并发,很重要的参数
|
||||||
|
*/
|
||||||
|
static final int MAX_TOTAL = 500;
|
||||||
|
/**
|
||||||
|
* 每路并发,很重要的参数
|
||||||
|
*/
|
||||||
|
static final int MAX_PER_ROUTE = 100;
|
||||||
|
|
||||||
//正常情况这里应该配成MAP或LIST
|
/**
|
||||||
//细化配置参数,用来对每路参数做精细化处理,可以管控各ip的流量,比如默认配置请求baidu:80端口最大100个并发链接,
|
* 正常情况这里应该配成MAP或LIST
|
||||||
static final String detailHostName = "http://www.baidu.com";//每个细化配置之ip(不重要,在特殊场景很有用)
|
* 细化配置参数,用来对每路参数做精细化处理,可以管控各ip的流量,比如默认配置请求baidu:80端口最大100个并发链接,
|
||||||
//每个细化配置之port(不重要,在特殊场景很有用)
|
* 每个细化配置之ip(不重要,在特殊场景很有用)
|
||||||
static final int detailPort = 80;
|
*/
|
||||||
//每个细化配置之最大并发数(不重要,在特殊场景很有用)
|
static final String DETAIL_HOST_NAME = "http://www.baidu.com";
|
||||||
static final int detailMaxPerRoute = 100;
|
|
||||||
|
/**
|
||||||
|
* 每个细化配置之port(不重要,在特殊场景很有用)
|
||||||
|
*/
|
||||||
|
static final int DETAIL_PORT = 80;
|
||||||
|
/**
|
||||||
|
* 每个细化配置之最大并发数(不重要,在特殊场景很有用)
|
||||||
|
*/
|
||||||
|
static final int DETAIL_MAX_PER_ROUTE = 100;
|
||||||
|
|
||||||
private synchronized static CloseableHttpClient getHttpClient() {
|
private synchronized static CloseableHttpClient getHttpClient() {
|
||||||
if (null == httpClient) {
|
if (null == httpClient) {
|
||||||
@@ -78,15 +106,15 @@ public class HttpClientUtils {
|
|||||||
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create().register("http", plainsf).register("https", sslsf).build();
|
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create().register("http", plainsf).register("https", sslsf).build();
|
||||||
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(registry);
|
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(registry);
|
||||||
//将最大连接数增加
|
//将最大连接数增加
|
||||||
cm.setMaxTotal(maxTotal);
|
cm.setMaxTotal(MAX_TOTAL);
|
||||||
//将每个路由基础的连接增加
|
//将每个路由基础的连接增加
|
||||||
cm.setDefaultMaxPerRoute(maxPerRoute);
|
cm.setDefaultMaxPerRoute(MAX_PER_ROUTE);
|
||||||
|
|
||||||
//细化配置开始,其实这里用Map或List的for循环来配置每个链接,在特殊场景很有用.
|
//细化配置开始,其实这里用Map或List的for循环来配置每个链接,在特殊场景很有用.
|
||||||
//将每个路由基础的连接做特殊化配置,一般用不着
|
//将每个路由基础的连接做特殊化配置,一般用不着
|
||||||
HttpHost httpHost = new HttpHost(detailHostName, detailPort);
|
HttpHost httpHost = new HttpHost(DETAIL_HOST_NAME, DETAIL_PORT);
|
||||||
//将目标主机的最大连接数增加
|
//将目标主机的最大连接数增加
|
||||||
cm.setMaxPerRoute(new HttpRoute(httpHost), detailMaxPerRoute);
|
cm.setMaxPerRoute(new HttpRoute(httpHost), DETAIL_MAX_PER_ROUTE);
|
||||||
//细化配置结束
|
//细化配置结束
|
||||||
|
|
||||||
//请求重试处理
|
//请求重试处理
|
||||||
@@ -117,7 +145,7 @@ public class HttpClientUtils {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//配置请求的超时设置
|
//配置请求的超时设置
|
||||||
RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(connectionRequestTimeout).setConnectTimeout(connectTimeout).setSocketTimeout(socketTimeout).build();
|
RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(CONNECTION_REQUEST_TIMEOUT).setConnectTimeout(CONNECT_TIMEOUT).setSocketTimeout(SOCKET_TIMEOUT).build();
|
||||||
newHotpoint = HttpClients.custom().setConnectionManager(cm).setDefaultRequestConfig(requestConfig).setRetryHandler(httpRequestRetryHandler).build();
|
newHotpoint = HttpClients.custom().setConnectionManager(cm).setDefaultRequestConfig(requestConfig).setRetryHandler(httpRequestRetryHandler).build();
|
||||||
return newHotpoint;
|
return newHotpoint;
|
||||||
}
|
}
|
||||||
@@ -149,7 +177,7 @@ public class HttpClientUtils {
|
|||||||
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
|
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("get请求错误",e);
|
log.error("get请求错误", e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
@@ -157,7 +185,7 @@ public class HttpClientUtils {
|
|||||||
}
|
}
|
||||||
httpClient.close();
|
httpClient.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Get错误",e);
|
log.error("Get错误", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resultString;
|
return resultString;
|
||||||
|
|||||||
@@ -23,14 +23,18 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
@Component
|
@Component
|
||||||
public class IpHelper {
|
public class IpHelper {
|
||||||
|
|
||||||
//qq lbs 地区查询key
|
/**
|
||||||
|
* qq lbs 地区查询key
|
||||||
|
*/
|
||||||
@Value("${lili.lbs.key}")
|
@Value("${lili.lbs.key}")
|
||||||
private String key;
|
private String key;
|
||||||
//qq lbs 地区查询key
|
/**
|
||||||
|
* qq lbs 地区查询key
|
||||||
|
*/
|
||||||
@Value("${lili.lbs.sk}")
|
@Value("${lili.lbs.sk}")
|
||||||
private String sk;
|
private String sk;
|
||||||
|
|
||||||
private static final String api = "https://apis.map.qq.com";
|
private static final String API = "https://apis.map.qq.com";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,7 +47,7 @@ public class IpHelper {
|
|||||||
|
|
||||||
String url = "/ws/location/v1/ip?key=" + key + "&ip=" + IpUtils.getIpAddress(request);
|
String url = "/ws/location/v1/ip?key=" + key + "&ip=" + IpUtils.getIpAddress(request);
|
||||||
String sign = SecureUtil.md5(url + sk);
|
String sign = SecureUtil.md5(url + sk);
|
||||||
url = api + url + "&sign=" + sign;
|
url = API + url + "&sign=" + sign;
|
||||||
String result = "未知";
|
String result = "未知";
|
||||||
try {
|
try {
|
||||||
String json = HttpUtil.get(url, 3000);
|
String json = HttpUtil.get(url, 3000);
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ public class OperationalJudgment<t> {
|
|||||||
} else {
|
} else {
|
||||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||||
}
|
}
|
||||||
return object;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,157 +0,0 @@
|
|||||||
package cn.lili.common.utils;
|
|
||||||
|
|
||||||
import java.security.Key;
|
|
||||||
import java.security.SecureRandom;
|
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
|
||||||
import javax.crypto.SecretKey;
|
|
||||||
import javax.crypto.SecretKeyFactory;
|
|
||||||
import javax.crypto.spec.PBEKeySpec;
|
|
||||||
import javax.crypto.spec.PBEParameterSpec;
|
|
||||||
|
|
||||||
public class PasswordUtil {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* JAVA6支持以下任意一种算法
|
|
||||||
* PBEWITHMD5ANDDES
|
|
||||||
* PBEWITHMD5ANDTRIPLEDES
|
|
||||||
* PBEWITHSHAANDDESEDE
|
|
||||||
* PBEWITHSHA1ANDRC2_40
|
|
||||||
* PBKDF2WITHHMACSHA1
|
|
||||||
* */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定义使用的算法为:PBEWITHMD5andDES算法
|
|
||||||
*/
|
|
||||||
public static final String ALGORITHM = "PBEWithMD5AndDES";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定义迭代次数为1000次
|
|
||||||
*/
|
|
||||||
private static final int ITERATIONCOUNT = 1000;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取加密算法中使用的盐值,解密中使用的盐值必须与加密中使用的相同才能完成操作.
|
|
||||||
* 盐长度必须为8字节
|
|
||||||
*
|
|
||||||
* @return byte[] 盐值
|
|
||||||
*/
|
|
||||||
public static byte[] getSalt() throws Exception {
|
|
||||||
//实例化安全随机数
|
|
||||||
SecureRandom random = new SecureRandom();
|
|
||||||
//产出盐
|
|
||||||
return random.generateSeed(8);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据PBE密码生成一把密钥
|
|
||||||
*
|
|
||||||
* @param password 生成密钥时所使用的密码
|
|
||||||
* @return Key PBE算法密钥
|
|
||||||
*/
|
|
||||||
private static Key getPBEKey(String password) throws Exception {
|
|
||||||
//实例化使用的算法
|
|
||||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
|
|
||||||
//设置PBE密钥参数
|
|
||||||
PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
|
|
||||||
//生成密钥
|
|
||||||
SecretKey secretKey = keyFactory.generateSecret(keySpec);
|
|
||||||
|
|
||||||
return secretKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加密明文字符串
|
|
||||||
*
|
|
||||||
* @param plaintext 待加密的明文字符串
|
|
||||||
* @param password 生成密钥时所使用的密码
|
|
||||||
* @param salt 盐值
|
|
||||||
* @return 加密后的密文字符串
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static String encrypt(String plaintext, String password, byte[] salt) throws Exception {
|
|
||||||
|
|
||||||
Key key = getPBEKey(password);
|
|
||||||
|
|
||||||
PBEParameterSpec parameterSpec = new PBEParameterSpec(salt, ITERATIONCOUNT);
|
|
||||||
|
|
||||||
Cipher cipher = Cipher.getInstance(ALGORITHM);
|
|
||||||
|
|
||||||
cipher.init(Cipher.ENCRYPT_MODE, key, parameterSpec);
|
|
||||||
|
|
||||||
byte encipheredData[] = cipher.doFinal(plaintext.getBytes());
|
|
||||||
|
|
||||||
return bytesToHexString(encipheredData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解密密文字符串
|
|
||||||
*
|
|
||||||
* @param ciphertext 待解密的密文字符串
|
|
||||||
* @param password 生成密钥时所使用的密码(如需解密,该参数需要与加密时使用的一致)
|
|
||||||
* @param salt 盐值(如需解密,该参数需要与加密时使用的一致)
|
|
||||||
* @return 解密后的明文字符串
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static String decrypt(String ciphertext, String password, byte[] salt) throws Exception {
|
|
||||||
|
|
||||||
Key key = getPBEKey(password);
|
|
||||||
|
|
||||||
PBEParameterSpec parameterSpec = new PBEParameterSpec(salt, ITERATIONCOUNT);
|
|
||||||
|
|
||||||
Cipher cipher = Cipher.getInstance(ALGORITHM);
|
|
||||||
|
|
||||||
cipher.init(Cipher.DECRYPT_MODE, key, parameterSpec);
|
|
||||||
|
|
||||||
byte[] passDec = cipher.doFinal(hexStringToBytes(ciphertext));
|
|
||||||
|
|
||||||
return new String(passDec);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将字节数组转换为十六进制字符串
|
|
||||||
*
|
|
||||||
* @param src 字节数组
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String bytesToHexString(byte[] src) {
|
|
||||||
StringBuilder stringBuilder = new StringBuilder("");
|
|
||||||
if (src == null || src.length <= 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < src.length; i++) {
|
|
||||||
int v = src[i] & 0xFF;
|
|
||||||
String hv = Integer.toHexString(v);
|
|
||||||
if (hv.length() < 2) {
|
|
||||||
stringBuilder.append(0);
|
|
||||||
}
|
|
||||||
stringBuilder.append(hv);
|
|
||||||
}
|
|
||||||
return stringBuilder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将十六进制字符串转换为字节数组
|
|
||||||
*
|
|
||||||
* @param hexString 十六进制字符串
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static byte[] hexStringToBytes(String hexString) {
|
|
||||||
if (hexString == null || hexString.equals("")) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
hexString = hexString.toUpperCase();
|
|
||||||
int length = hexString.length() / 2;
|
|
||||||
char[] hexChars = hexString.toCharArray();
|
|
||||||
byte[] d = new byte[length];
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
int pos = i * 2;
|
|
||||||
d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
|
|
||||||
}
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static byte charToByte(char c) {
|
|
||||||
return (byte) "0123456789ABCDEF".indexOf(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -217,8 +217,7 @@ public class RedisUtil {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean zadd(String key, long score, String value) {
|
public boolean zadd(String key, long score, String value) {
|
||||||
Boolean result = redisTemplate.opsForZSet().add(key, value, score);
|
return redisTemplate.opsForZSet().add(key, value, score);
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package cn.lili.common.utils;
|
package cn.lili.common.utils;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@@ -15,25 +13,25 @@ public class RegularUtil {
|
|||||||
/**
|
/**
|
||||||
* 手机号
|
* 手机号
|
||||||
*/
|
*/
|
||||||
private static final Pattern mobile = Pattern.compile("^1[3|4|5|8][0-9]\\d{8}$");
|
private static final Pattern MOBILE = Pattern.compile("^1[3|4|5|8][0-9]\\d{8}$");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 邮箱
|
* 邮箱
|
||||||
*/
|
*/
|
||||||
private static final Pattern email = Pattern.compile("^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z0-9]{2,6}$");
|
private static final Pattern EMAIL = Pattern.compile("^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z0-9]{2,6}$");
|
||||||
|
|
||||||
public static boolean Mobile(String v){
|
public static boolean mobile(String v){
|
||||||
|
|
||||||
Matcher m = mobile.matcher(v);
|
Matcher m = MOBILE.matcher(v);
|
||||||
if(m.matches()){
|
if(m.matches()){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean Email(String v){
|
public static boolean email(String v){
|
||||||
|
|
||||||
Matcher m = email.matcher(v);
|
Matcher m = EMAIL.matcher(v);
|
||||||
if(m.matches()){
|
if(m.matches()){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,13 @@ import org.springframework.expression.spel.support.StandardEvaluationContext;
|
|||||||
public class SpelUtil {
|
public class SpelUtil {
|
||||||
|
|
||||||
|
|
||||||
//spel表达式解析器
|
/**
|
||||||
|
* spel表达式解析器
|
||||||
|
*/
|
||||||
private static SpelExpressionParser spelExpressionParser = new SpelExpressionParser();
|
private static SpelExpressionParser spelExpressionParser = new SpelExpressionParser();
|
||||||
|
/**
|
||||||
//参数名发现器
|
* 参数名发现器
|
||||||
|
*/
|
||||||
private static DefaultParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
|
private static DefaultParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,7 +44,8 @@ public class SpelUtil {
|
|||||||
//获取方法参数值
|
//获取方法参数值
|
||||||
Object[] args = joinPoint.getArgs();
|
Object[] args = joinPoint.getArgs();
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
context.setVariable(parameterNames[i], args[i]); //替换spel里的变量值为实际值, 比如 #user --> user对象
|
//替换spel里的变量值为实际值, 比如 #user --> user对象
|
||||||
|
context.setVariable(parameterNames[i], args[i]);
|
||||||
}
|
}
|
||||||
return spelExpressionParser.parseExpression(spel).getValue(context).toString();
|
return spelExpressionParser.parseExpression(spel).getValue(context).toString();
|
||||||
}
|
}
|
||||||
@@ -66,7 +70,8 @@ public class SpelUtil {
|
|||||||
//获取方法参数值
|
//获取方法参数值
|
||||||
Object[] args = joinPoint.getArgs();
|
Object[] args = joinPoint.getArgs();
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
context.setVariable(parameterNames[i], args[i]); //替换spel里的变量值为实际值, 比如 #user --> user对象
|
//替换spel里的变量值为实际值, 比如 #user --> user对象
|
||||||
|
context.setVariable(parameterNames[i], args[i]);
|
||||||
}
|
}
|
||||||
context.setVariable("rvt", rvt);
|
context.setVariable("rvt", rvt);
|
||||||
return spelExpressionParser.parseExpression(spel).getValue(context).toString();
|
return spelExpressionParser.parseExpression(spel).getValue(context).toString();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.lili.common.utils;
|
package cn.lili.common.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
import java.beans.BeanInfo;
|
import java.beans.BeanInfo;
|
||||||
@@ -61,7 +62,7 @@ public class StringUtils extends StrUtil {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
value = Integer.parseInt(obj.toString());
|
value = Convert.toInt(obj.toString());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
throw new RuntimeException("整型数字格式不正确");
|
throw new RuntimeException("整型数字格式不正确");
|
||||||
@@ -194,7 +195,7 @@ public class StringUtils extends StrUtil {
|
|||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>(16);
|
||||||
|
|
||||||
BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
|
BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
|
||||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ public class ThreadPoolUtil {
|
|||||||
/**
|
/**
|
||||||
* 线程缓冲队列
|
* 线程缓冲队列
|
||||||
*/
|
*/
|
||||||
private static final BlockingQueue<Runnable> bqueue = new ArrayBlockingQueue<Runnable>(100);
|
private static final BlockingQueue<Runnable> BQUEUE = new ArrayBlockingQueue<Runnable>(100);
|
||||||
private static final ThreadPoolExecutor pool = new ThreadPoolExecutor(SIZE_CORE_POOL, SIZE_MAX_POOL, ALIVE_TIME, TimeUnit.MILLISECONDS, bqueue, new ThreadPoolExecutor.CallerRunsPolicy());
|
private static final ThreadPoolExecutor POOL = new ThreadPoolExecutor(SIZE_CORE_POOL, SIZE_MAX_POOL, ALIVE_TIME, TimeUnit.MILLISECONDS, BQUEUE, new ThreadPoolExecutor.CallerRunsPolicy());
|
||||||
public static ThreadPoolExecutor threadPool;
|
public static ThreadPoolExecutor threadPool;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
pool.prestartAllCoreThreads();
|
POOL.prestartAllCoreThreads();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,10 +68,10 @@ public class ThreadPoolUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ThreadPoolExecutor getPool() {
|
public static ThreadPoolExecutor getPool() {
|
||||||
return pool;
|
return POOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println(pool.getPoolSize());
|
System.out.println(POOL.getPoolSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,43 @@
|
|||||||
package cn.lili.common.validation.impl;
|
package cn.lili.common.validation.impl;
|
||||||
|
|
||||||
import cn.lili.common.validation.Mobile;
|
import cn.lili.common.validation.Mobile;
|
||||||
import cn.lili.common.validation.Phone;
|
|
||||||
|
|
||||||
import javax.validation.ConstraintValidator;
|
import javax.validation.ConstraintValidator;
|
||||||
import javax.validation.ConstraintValidatorContext;
|
import javax.validation.ConstraintValidatorContext;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电话校验
|
||||||
|
* 支持手机号+电话同时校验
|
||||||
|
*
|
||||||
|
* @author Bulbasaur
|
||||||
|
* @date: 2021/7/9 1:41 上午
|
||||||
|
*/
|
||||||
public class MobileValidator implements ConstraintValidator<Mobile, String> {
|
public class MobileValidator implements ConstraintValidator<Mobile, String> {
|
||||||
|
|
||||||
|
private static final Pattern PHONE = Pattern.compile("^0?(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$");
|
||||||
|
private static final Pattern AREA_MOBILE = Pattern.compile("0\\d{2,3}[-]?\\d{7,8}|0\\d{2,3}\\s?\\d{7,8}|13[0-9]\\d{8}|15[1089]\\d{8}");
|
||||||
|
private static final Pattern MOBILE = Pattern.compile("^[1-9]{1}[0-9]{5,8}$");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
|
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
|
||||||
Pattern p1 = null,p2 = null;
|
|
||||||
Matcher m = null;
|
Matcher m = null;
|
||||||
boolean b = false;
|
Pattern pattern = null;
|
||||||
p1 = Pattern.compile("^[0][1-9]{2,3}-[0-9]{5,10}$"); // 验证带区号的
|
// 验证手机号
|
||||||
p2 = Pattern.compile("^[1-9]{1}[0-9]{5,8}$"); // 验证没有区号的
|
if (value.length() == 11) {
|
||||||
if(value.length() >9)
|
m = PHONE.matcher(value);
|
||||||
{ m = p1.matcher(value);
|
// 验证带区号的电话
|
||||||
b = m.matches();
|
} else if (value.length() > 9) {
|
||||||
}else{
|
m = AREA_MOBILE.matcher(value);
|
||||||
m = p2.matcher(value);
|
//验证没有区号的电话
|
||||||
b = m.matches();
|
} else {
|
||||||
|
m = MOBILE.matcher(value);
|
||||||
}
|
}
|
||||||
return b;
|
return m.matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(Mobile constraintAnnotation) {
|
public void initialize(Mobile constraintAnnotation) {
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,12 @@ import javax.validation.ConstraintValidatorContext;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号校验
|
||||||
|
*
|
||||||
|
* @author Bulbasaur
|
||||||
|
* @date: 2021/7/9 1:42 上午
|
||||||
|
*/
|
||||||
public class PhoneValidator implements ConstraintValidator<Phone, String> {
|
public class PhoneValidator implements ConstraintValidator<Phone, String> {
|
||||||
|
|
||||||
private static Pattern pattern = Pattern.compile("^0?(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$");
|
private static Pattern pattern = Pattern.compile("^0?(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$");
|
||||||
|
|||||||
@@ -72,12 +72,13 @@ public class ImageUtil {
|
|||||||
int rightRgb = templateImage.getRGB(i + 1, j);
|
int rightRgb = templateImage.getRGB(i + 1, j);
|
||||||
int downRgb = templateImage.getRGB(i, j + 1);
|
int downRgb = templateImage.getRGB(i, j + 1);
|
||||||
//描边处理,,取带像素和无像素的界点,判断该点是不是临界轮廓点,如果是设置该坐标像素是白色
|
//描边处理,,取带像素和无像素的界点,判断该点是不是临界轮廓点,如果是设置该坐标像素是白色
|
||||||
if ((rgb >= 0 && rightRgb < 0) || (rgb < 0 && rightRgb >= 0) || (rgb >= 0 && downRgb < 0)
|
boolean rgbImage = ((rgb >= 0 && rightRgb < 0)
|
||||||
|| (rgb < 0 && downRgb >= 0)) {
|
|| (rgb < 0 && rightRgb >= 0)
|
||||||
|
|| (rgb >= 0 && downRgb < 0)
|
||||||
|
|| (rgb < 0 && downRgb >= 0));
|
||||||
|
|
||||||
|
if (rgbImage) {
|
||||||
newImage.setRGB(i, j, Color.GRAY.getRGB());
|
newImage.setRGB(i, j, Color.GRAY.getRGB());
|
||||||
|
|
||||||
// oriImage.setRGB(x + i, y + j, Color.white.getRGB());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,7 +88,7 @@ public class ImageUtil {
|
|||||||
int xStart = x - 1;
|
int xStart = x - 1;
|
||||||
int yStart = y - 1;
|
int yStart = y - 1;
|
||||||
int current = 0;
|
int current = 0;
|
||||||
for (int i = xStart; i < 3 + xStart; i++)
|
for (int i = xStart; i < 3 + xStart; i++) {
|
||||||
for (int j = yStart; j < 3 + yStart; j++) {
|
for (int j = yStart; j < 3 + yStart; j++) {
|
||||||
int tx = i;
|
int tx = i;
|
||||||
if (tx < 0) {
|
if (tx < 0) {
|
||||||
@@ -105,6 +106,7 @@ public class ImageUtil {
|
|||||||
pixels[current++] = img.getRGB(tx, ty);
|
pixels[current++] = img.getRGB(tx, ty);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void fillMatrix(int[][] matrix, int[] values) {
|
public static void fillMatrix(int[][] matrix, int[] values) {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class SliderImageUtil {
|
|||||||
public static Map<String, Object> pictureTemplatesCut(SerializableStream sliderFile, SerializableStream originalFile) throws Exception {
|
public static Map<String, Object> pictureTemplatesCut(SerializableStream sliderFile, SerializableStream originalFile) throws Exception {
|
||||||
|
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
Map<String, Object> pictureMap = new HashMap<>();
|
Map<String, Object> pictureMap = new HashMap<>(16);
|
||||||
//拼图
|
//拼图
|
||||||
BufferedImage sliderImage = ImageIO.read(Base64DecodeMultipartFile.base64ToInputStream(sliderFile.getBase64()));
|
BufferedImage sliderImage = ImageIO.read(Base64DecodeMultipartFile.base64ToInputStream(sliderFile.getBase64()));
|
||||||
int sliderWidth = sliderImage.getWidth();
|
int sliderWidth = sliderImage.getWidth();
|
||||||
@@ -79,12 +79,15 @@ public class SliderImageUtil {
|
|||||||
|
|
||||||
//添加水印
|
//添加水印
|
||||||
ImageUtil.addWatermark(originalImage, "LILI-SHOP");
|
ImageUtil.addWatermark(originalImage, "LILI-SHOP");
|
||||||
ByteArrayOutputStream newImageOs = new ByteArrayOutputStream();//新建流。
|
//新建流
|
||||||
ImageIO.write(newImage, TEMP_IMG_FILE_TYPE, newImageOs);//利用ImageIO类提供的write方法,将bi以png图片的数据模式写入流。
|
ByteArrayOutputStream newImageOs = new ByteArrayOutputStream();
|
||||||
|
//利用ImageIO类提供的write方法,将bi以png图片的数据模式写入流。
|
||||||
|
ImageIO.write(newImage, TEMP_IMG_FILE_TYPE, newImageOs);
|
||||||
byte[] newImagery = newImageOs.toByteArray();
|
byte[] newImagery = newImageOs.toByteArray();
|
||||||
|
//新建流
|
||||||
ByteArrayOutputStream oriImagesOs = new ByteArrayOutputStream();//新建流。
|
ByteArrayOutputStream oriImagesOs = new ByteArrayOutputStream();
|
||||||
ImageIO.write(originalImage, IMG_FILE_TYPE, oriImagesOs);//利用ImageIO类提供的write方法,将bi以jpg图片的数据模式写入流。
|
//利用ImageIO类提供的write方法,将bi以jpg图片的数据模式写入流
|
||||||
|
ImageIO.write(originalImage, IMG_FILE_TYPE, oriImagesOs);
|
||||||
byte[] oriImageByte = oriImagesOs.toByteArray();
|
byte[] oriImageByte = oriImagesOs.toByteArray();
|
||||||
|
|
||||||
pictureMap.put("slidingImage", "data:image/png;base64," + Base64Utils.encodeToString(newImagery));
|
pictureMap.put("slidingImage", "data:image/png;base64," + Base64Utils.encodeToString(newImagery));
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证码模块
|
* 验证码模块
|
||||||
|
*
|
||||||
|
* @author Bulbasaur
|
||||||
|
* @date: 2021/7/9 1:42 上午
|
||||||
*/
|
*/
|
||||||
public interface VerificationService {
|
public interface VerificationService {
|
||||||
/**
|
/**
|
||||||
@@ -15,6 +18,7 @@ public interface VerificationService {
|
|||||||
* @param verificationEnums 校验枚举
|
* @param verificationEnums 校验枚举
|
||||||
* @param uuid uuid
|
* @param uuid uuid
|
||||||
* @return 校验对象
|
* @return 校验对象
|
||||||
|
* @throws IOException 校验错误
|
||||||
*/
|
*/
|
||||||
Map<String, Object> createVerification(VerificationEnums verificationEnums, String uuid) throws IOException;
|
Map<String, Object> createVerification(VerificationEnums verificationEnums, String uuid) throws IOException;
|
||||||
|
|
||||||
@@ -29,9 +33,11 @@ public interface VerificationService {
|
|||||||
boolean preCheck(Integer xPos, String uuid, VerificationEnums verificationEnums);
|
boolean preCheck(Integer xPos, String uuid, VerificationEnums verificationEnums);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 验证码校验
|
||||||
|
*
|
||||||
* @param uuid 用户唯一表示
|
* @param uuid 用户唯一表示
|
||||||
* @param verificationEnums 校验枚举
|
* @param verificationEnums 校验枚举
|
||||||
* @return
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
boolean check(String uuid, VerificationEnums verificationEnums);
|
boolean check(String uuid, VerificationEnums verificationEnums);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,16 @@ package cn.lili.common.verification.service.impl;
|
|||||||
|
|
||||||
import cn.lili.common.cache.Cache;
|
import cn.lili.common.cache.Cache;
|
||||||
import cn.lili.common.cache.CachePrefix;
|
import cn.lili.common.cache.CachePrefix;
|
||||||
|
import cn.lili.common.enums.ResultCode;
|
||||||
import cn.lili.common.exception.ServiceException;
|
import cn.lili.common.exception.ServiceException;
|
||||||
import cn.lili.common.utils.StringUtils;
|
import cn.lili.common.utils.StringUtils;
|
||||||
import cn.lili.common.verification.SliderImageUtil;
|
import cn.lili.common.verification.SliderImageUtil;
|
||||||
import cn.lili.common.verification.enums.VerificationEnums;
|
import cn.lili.common.verification.enums.VerificationEnums;
|
||||||
import cn.lili.common.verification.service.VerificationService;
|
import cn.lili.common.verification.service.VerificationService;
|
||||||
import cn.lili.common.vo.SerializableStream;
|
import cn.lili.common.vo.SerializableStream;
|
||||||
import cn.lili.modules.base.entity.dos.VerificationSource;
|
import cn.lili.modules.system.entity.dos.VerificationSource;
|
||||||
import cn.lili.modules.base.entity.vo.VerificationVO;
|
import cn.lili.modules.system.entity.vo.VerificationVO;
|
||||||
import cn.lili.modules.base.service.VerificationSourceService;
|
import cn.lili.modules.system.service.VerificationSourceService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -47,7 +48,7 @@ public class VerificationServiceImpl implements VerificationService {
|
|||||||
public Map<String, Object> createVerification(VerificationEnums verificationEnums, String uuid) throws IOException {
|
public Map<String, Object> createVerification(VerificationEnums verificationEnums, String uuid) throws IOException {
|
||||||
|
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
throw new ServiceException("非法请求,请重新刷新页面操作");
|
throw new ServiceException(ResultCode.ILLEGAL_REQUEST_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取验证码配置
|
//获取验证码配置
|
||||||
|
|||||||
@@ -7,8 +7,11 @@ import org.springframework.data.redis.serializer.SerializationException;
|
|||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
*要实现对象的缓存,定义自己的序列化和反序列化器。使用阿里的fastjson来实现的比较多。
|
* 要实现对象的缓存,定义自己的序列化和反序列化器。使用阿里的fastjson来实现的比较多
|
||||||
|
*
|
||||||
|
* @author Bulbasaur
|
||||||
|
* @date: 2021/7/9 12:25 上午
|
||||||
*/
|
*/
|
||||||
public class FastJsonRedisSerializer<T> implements RedisSerializer<T> {
|
public class FastJsonRedisSerializer<T> implements RedisSerializer<T> {
|
||||||
private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
||||||
|
|||||||
@@ -51,8 +51,14 @@ public class RedisConfig extends CachingConfigurerSupport {
|
|||||||
private Integer timeout;
|
private Integer timeout;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当有多个管理器的时候,必须使用该注解在一个管理器上注释:表示该管理器为默认的管理器
|
||||||
|
*
|
||||||
|
* @param connectionFactory
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
@Primary//当有多个管理器的时候,必须使用该注解在一个管理器上注释:表示该管理器为默认的管理器
|
@Primary
|
||||||
public CacheManager cacheManager(RedisConnectionFactory connectionFactory) {
|
public CacheManager cacheManager(RedisConnectionFactory connectionFactory) {
|
||||||
//初始化一个RedisCacheWriter
|
//初始化一个RedisCacheWriter
|
||||||
RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory);
|
RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.lili.config.elasticsearch;
|
package cn.lili.config.elasticsearch;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.http.HttpHost;
|
import org.apache.http.HttpHost;
|
||||||
@@ -75,7 +76,7 @@ public class ElasticsearchConfig extends AbstractElasticsearchConfiguration {
|
|||||||
HttpHost[] httpHosts = new HttpHost[clusterNodes.size()];
|
HttpHost[] httpHosts = new HttpHost[clusterNodes.size()];
|
||||||
for (int i = 0; i < clusterNodes.size(); i++) {
|
for (int i = 0; i < clusterNodes.size(); i++) {
|
||||||
String[] node = clusterNodes.get(i).split(":");
|
String[] node = clusterNodes.get(i).split(":");
|
||||||
httpHosts[i] = new HttpHost(node[0], Integer.parseInt(node[1]), elasticsearchProperties.getSchema());
|
httpHosts[i] = new HttpHost(node[0], Convert.toInt(node[1]), elasticsearchProperties.getSchema());
|
||||||
}
|
}
|
||||||
return httpHosts;
|
return httpHosts;
|
||||||
}
|
}
|
||||||
@@ -84,11 +85,9 @@ public class ElasticsearchConfig extends AbstractElasticsearchConfiguration {
|
|||||||
return (response, context) -> 2 * 60 * 1000;
|
return (response, context) -> 2 * 60 * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* it gets called when bean instance is getting removed from the context if
|
* it gets called when bean instance is getting removed from the context if
|
||||||
* scope is not a prototype
|
* scope is not a prototype
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* If there is a method named shutdown or close then spring container will try
|
* If there is a method named shutdown or close then spring container will try
|
||||||
* to automatically configure them as callback methods when bean is being
|
* to automatically configure them as callback methods when bean is being
|
||||||
* destroyed
|
* destroyed
|
||||||
@@ -98,7 +97,7 @@ public class ElasticsearchConfig extends AbstractElasticsearchConfiguration {
|
|||||||
try {
|
try {
|
||||||
this.client.close();
|
this.client.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("es clientClose错误",e);
|
log.error("es clientClose错误", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package cn.lili.config.interceptor;
|
package cn.lili.config.interceptor;
|
||||||
|
|
||||||
import cn.lili.config.properties.IgnoredUrlsProperties;
|
import cn.lili.config.properties.IgnoredUrlsProperties;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
||||||
@@ -31,7 +30,10 @@ public class UrlConfiguration implements WebMvcConfigurer {
|
|||||||
ir.excludePathPatterns(ignoredUrlsProperties.getUrls());
|
ir.excludePathPatterns(ignoredUrlsProperties.getUrls());
|
||||||
}
|
}
|
||||||
|
|
||||||
//开放资源 这里配置swagger可以在前端访问
|
/**
|
||||||
|
* 开放资源 这里配置swagger可以在前端访问
|
||||||
|
* @param registry
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
registry.addResourceHandler("/statics/**").addResourceLocations("classpath:/statics/");
|
registry.addResourceHandler("/statics/**").addResourceLocations("classpath:/statics/");
|
||||||
|
|||||||
@@ -13,14 +13,24 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@ConfigurationProperties(prefix = "lili.sms")
|
@ConfigurationProperties(prefix = "lili.sms")
|
||||||
public class SmsTemplateSetting {
|
public class SmsTemplateSetting {
|
||||||
//登录
|
/**
|
||||||
private String LOGIN = "SMS_205755300";
|
* 登录
|
||||||
//注册
|
*/
|
||||||
|
private String lOGIN = "SMS_205755300";
|
||||||
|
/**
|
||||||
|
* 注册
|
||||||
|
*/
|
||||||
private String REGISTER = "SMS_205755298";
|
private String REGISTER = "SMS_205755298";
|
||||||
//找回密码
|
/**
|
||||||
|
* 找回密码
|
||||||
|
*/
|
||||||
private String FIND_USER = "SMS_205755301";
|
private String FIND_USER = "SMS_205755301";
|
||||||
//设置密码
|
/**
|
||||||
|
* 设置密码
|
||||||
|
*/
|
||||||
private String UPDATE_PASSWORD = "SMS_205755297";
|
private String UPDATE_PASSWORD = "SMS_205755297";
|
||||||
//设置支付密码
|
/**
|
||||||
|
* 设置支付密码
|
||||||
|
*/
|
||||||
private String WALLET_PASSWORD = "SMS_205755297";
|
private String WALLET_PASSWORD = "SMS_205755297";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class ThreadProperties {
|
|||||||
/**
|
/**
|
||||||
* 保持存活时间
|
* 保持存活时间
|
||||||
*/
|
*/
|
||||||
private Integer KeepAliveSeconds = 60;
|
private Integer keepAliveSeconds = 60;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ public class CreateTimeShardingDatabaseAlgorithm implements PreciseShardingAlgor
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String doSharding(Collection<String> collection, PreciseShardingValue<Long> preciseShardingValue) {
|
public String doSharding(Collection<String> collection, PreciseShardingValue<Long> preciseShardingValue) {
|
||||||
Long create_time = preciseShardingValue.getValue();
|
Long createTime = preciseShardingValue.getValue();
|
||||||
String value = DateUtil.toString(create_time, "yyyy");
|
String value = DateUtil.toString(createTime, "yyyy");
|
||||||
//data2019,data2020
|
//data2019,data2020
|
||||||
return "data" + value;
|
return "data" + value;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user