Compare commits
184 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74abc4b360 | ||
|
|
f1c0207a3d | ||
|
|
f61f98d288 | ||
|
|
3727b67a23 | ||
|
|
dae52cd68f | ||
|
|
805197c127 | ||
|
|
aca627e137 | ||
|
|
1b6a650ba4 | ||
|
|
7d43279b49 | ||
|
|
a843081663 | ||
|
|
2765dd8fd9 | ||
|
|
0e7c703dfd | ||
|
|
f9112c4b39 | ||
|
|
1707563118 | ||
|
|
803bd32f4b | ||
|
|
31728300e1 | ||
|
|
1d317998af | ||
|
|
078af06b63 | ||
|
|
155d98e8b9 | ||
|
|
3c6d6e67bd | ||
|
|
4dc5950191 | ||
|
|
4b3935339e | ||
|
|
e218738fda | ||
|
|
dc4c529c2c | ||
|
|
617cf98bc0 | ||
|
|
7aa2c05d92 | ||
|
|
505f3fcf96 | ||
|
|
920d095fda | ||
|
|
2369b61243 | ||
|
|
89420f5c1e | ||
|
|
6f13218564 | ||
|
|
5cd0c9a205 | ||
|
|
2fbdfb293a | ||
|
|
9fd75c65e1 | ||
|
|
9fda721bd4 | ||
|
|
8854a97547 | ||
|
|
c1d84a7130 | ||
|
|
0ff0f266d4 | ||
|
|
93d9b217ca | ||
|
|
725e65cffb | ||
|
|
3dd61f47fc | ||
|
|
05eee7fca5 | ||
|
|
0ae97b71dd | ||
|
|
3dbc340e6d | ||
|
|
d877a24dec | ||
|
|
c4feaa1546 | ||
|
|
5eded10d19 | ||
|
|
65f6cf3b54 | ||
|
|
f216957cb4 | ||
|
|
8ba0212f37 | ||
|
|
8982db255d | ||
|
|
f0f343aa23 | ||
|
|
5fe7459e6e | ||
|
|
b98e01b261 | ||
|
|
27efe772ab | ||
|
|
a44f06b3e8 | ||
|
|
8ddd39d6e5 | ||
|
|
c5f5128b1b | ||
|
|
10c3e90f54 | ||
|
|
14ce522539 | ||
|
|
6770f058d5 | ||
|
|
c85caab197 | ||
|
|
58ce721674 | ||
|
|
ec020535e2 | ||
|
|
af9ffd1cbf | ||
|
|
956a6e465a | ||
|
|
af37386821 | ||
|
|
9baafd55be | ||
|
|
394ee27525 | ||
|
|
7e58b98e74 | ||
|
|
a2fd6dd8d1 | ||
|
|
afd5eba986 | ||
|
|
585e2c4ccc | ||
|
|
44e36f0bcd | ||
|
|
a535b5c54c | ||
|
|
adf353790b | ||
|
|
57594f3f07 | ||
|
|
036ad56093 | ||
|
|
bc8885c5b8 | ||
|
|
dd1bf2eec0 | ||
|
|
ab0b7f1591 | ||
|
|
5872049391 | ||
|
|
676c432ded | ||
|
|
234f355661 | ||
|
|
61914d04f0 | ||
|
|
f42f7c7ba1 | ||
|
|
c61bcfa5c1 | ||
|
|
18f6e279d2 | ||
|
|
fe9a5fb71d | ||
|
|
961703a3b2 | ||
|
|
8382101520 | ||
|
|
8de80d2e8e | ||
|
|
cc3bd71610 | ||
|
|
db90d83951 | ||
|
|
64e9e1bfeb | ||
|
|
7da2d6a16b | ||
|
|
744d882831 | ||
|
|
2bf232b5fd | ||
|
|
6e653519d8 | ||
|
|
6e58b1e1e6 | ||
|
|
ebe4a01448 | ||
|
|
123626dbba | ||
|
|
6c95a784f8 | ||
|
|
15c6b74829 | ||
|
|
e630420910 | ||
|
|
3cc4fbb377 | ||
|
|
7907f16359 | ||
|
|
d838f7f3f0 | ||
|
|
ead6a72dec | ||
|
|
55c9a63301 | ||
|
|
099708390d | ||
|
|
dea2881aa8 | ||
|
|
76c253041a | ||
|
|
7cf180fda0 | ||
|
|
b03fdd3bbe | ||
|
|
0d5be1372c | ||
|
|
5cee705d63 | ||
|
|
ec132009ef | ||
|
|
7cd07a8503 | ||
|
|
9ec208fd9e | ||
|
|
cf5ce47f32 | ||
|
|
b90ee161b5 | ||
|
|
e28d26556a | ||
|
|
eb6e29fb33 | ||
|
|
c8ac7159cf | ||
|
|
b91927bfde | ||
|
|
5d6ea5b48d | ||
|
|
cbacab6bdf | ||
|
|
d041e7b5b4 | ||
|
|
0440ecea23 | ||
|
|
cdeebc7afb | ||
|
|
5181a19f29 | ||
|
|
e2f5b6031a | ||
|
|
acf2e56ffc | ||
|
|
95095f35c0 | ||
|
|
50c08c0e01 | ||
|
|
f4cd51120b | ||
|
|
a550e4051d | ||
|
|
d432b0a183 | ||
|
|
444b617c63 | ||
|
|
87c82ce4d3 | ||
|
|
bdf0f65963 | ||
|
|
794a932340 | ||
|
|
504941eafb | ||
|
|
7fafdc087e | ||
|
|
c8b2e87570 | ||
|
|
81ce0f4682 | ||
|
|
87e5404aa8 | ||
|
|
2f31946a17 | ||
|
|
a23b8ac642 | ||
|
|
071f8c9d56 | ||
|
|
76fcf84043 | ||
|
|
d9b1d78c61 | ||
|
|
c8de423e7c | ||
|
|
a4648ac40f | ||
|
|
af5c0a4641 | ||
|
|
ff24c95d02 | ||
|
|
ac936caf17 | ||
|
|
be1c9772ad | ||
|
|
50b52f07c6 | ||
|
|
57a5c5a0f1 | ||
|
|
4f4704ab50 | ||
|
|
505366d9bc | ||
|
|
c5e8afd841 | ||
|
|
1de4dea1fb | ||
|
|
6fb9afd411 | ||
|
|
a2d896c9b2 | ||
|
|
e5e809ed72 | ||
|
|
d4c9b0f147 | ||
|
|
ac60f27814 | ||
|
|
42ce0814ae | ||
|
|
f3f3d3f936 | ||
|
|
8c3bc6e06e | ||
|
|
6dfde467b4 | ||
|
|
e0e5106eed | ||
|
|
9cee1093f4 | ||
|
|
a3d73bf7ad | ||
|
|
1f7dff38fc | ||
|
|
f7fc9a1299 | ||
|
|
6ef7a98d81 | ||
|
|
31a16b77df | ||
|
|
3459169885 | ||
|
|
8ae04e7ee6 | ||
|
|
a3564c746c |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -11,7 +11,6 @@ target
|
||||
|
||||
log/
|
||||
*.factorypath
|
||||
*.log
|
||||
lili-shop/src/main/java/cn/lili/generator/CodeGenerator.java
|
||||
lili-logs
|
||||
|
||||
@@ -19,7 +18,6 @@ lili-logs
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
@@ -28,7 +26,6 @@ lili-logs
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
|
||||
2
DB/version4.2.2to4.2.3.sql
Normal file
2
DB/version4.2.2to4.2.3.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
/** 新增店铺客服字段 **/
|
||||
ALTER TABLE li_store ADD merchant_euid varchar(255) COMMENT '客服标识';
|
||||
108
README.md
108
README.md
@@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
|
||||
#### 欢迎交流需求,交流业务,交流技术
|
||||
#### 欢迎交流需求,交流业务,交流技术(基础问题自行解决,进群先看文档后提问)
|
||||
|
||||
##### 交流 qq 1群 961316482(已满)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
|
||||
|
||||
##### 商城 公众号/小程序体验,扫描二维码
|
||||
##### 体验 公众号/小程序/APP 体验,扫描二维码
|
||||
|
||||

|
||||
|
||||
@@ -23,98 +23,98 @@
|
||||
### 🔥 商城介绍
|
||||
**官网**:https://pickmall.cn
|
||||
|
||||
Lilishop 商城系统 基于SpringBoot 研发,B2B2C多用户商城系统,前端使用 Vue、uniapp开发 **系统全端全部代码开源**
|
||||
Lilishop商城系统支持商家入驻,后端基于SpringBoot 研发,前端使用 Vue、uniapp开发, **系统全端全部代码开源**
|
||||
|
||||
业务兼容O2O商城/B2B商城/B2B2C商城/F2B2C商城/S2B2C商城。支持小程序商城、H5商城、APP商城、 PC商城。
|
||||
商城前后端分离,支持分布式部署,各个API独立,并且有独立的消费者。
|
||||
|
||||
商城包含 会员模块、**第三方登录模块**、**第三方支付模块**、**楼层装修模块**、订单模块、商品模块、促销模块、分销模块、文章模块、系统设置模块、流量分析模块和平台运营模块
|
||||
|
||||
商城包含各种中间件、搜索引擎、多级缓存、分布式事务、分布式任务调度等,支持Docker,支持k8s。是一款高性能、支持分布式、支持扩展的商城系统。
|
||||
|
||||
商城前后端分离、支持分布式部署。
|
||||
### 商城 API/消费者 聚合版
|
||||
api不需要单独部署,只需启动一个jar包就可以正常运转 如有需要,可以点击跳转
|
||||
https://gitee.com/beijing_hongye_huicheng/lilishop-simplify
|
||||
|
||||
商城包含 会员模块、**第三方登录模块**、**第三方支付模块**、**楼层装修模块**、订单模块、分销模块、文章模块、系统设置模块、流量分析模块
|
||||
|
||||
商城包含各种中间件、搜索引擎、多级缓存、分布式事务、分布式任务调度等,支持Docker,支持k8s。是一款高性能,支持高并发的商城系统。
|
||||
|
||||
|
||||
|
||||
### ☃️ 帮助文档
|
||||
### ☃️ 商城 开发/使用/常见问题 帮助文档
|
||||
|
||||
https://docs.pickmall.cn
|
||||
|
||||
### 💧 项目链接(gitee)
|
||||
### 💧 开源商城项目地址(gitee)
|
||||
|
||||
**Java后台**:https://gitee.com/beijing_hongye_huicheng/lilishop.git
|
||||
**API(商城所有API)**:https://gitee.com/beijing_hongye_huicheng/lilishop.git
|
||||
|
||||
**Vue后台前端**: https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
|
||||
**UI(平台管理端/商家端/买家PC端)**: https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
|
||||
|
||||
**Uni-app**:https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
|
||||
**uniapp(商城移动端,支持小程序/APP/H5)**:https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
|
||||
|
||||
**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
|
||||
**API(商城所有API)**:https://github.com/hongyehuicheng/lilishop.git
|
||||
|
||||
**Vue后台前端**: https://github.com/hongyehuicheng/lilishop-ui.git
|
||||
**UI(平台管理端/商家端/买家PC端)**: https://github.com/hongyehuicheng/lilishop-ui.git
|
||||
|
||||
**Uni-app**:https://github.com/hongyehuicheng/lilishop-uniapp.git
|
||||
**uniapp(商城移动端,支持小程序/APP/H5)**:https://github.com/hongyehuicheng/lilishop-uniapp.git
|
||||
|
||||
**docker一键部署(商城部署脚本)**:https://github.com/hongyehuicheng/docker.git
|
||||
|
||||
|
||||
|
||||
☃️ UI 项目下3个文件夹 buyer:买家PC端,seller:商家端,manager:后台管理端
|
||||
|
||||
**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
|
||||
|
||||
**PC**:https://pc-b2b2c.pickmall.cn
|
||||
**商城PC页面**:https://pc-b2b2c.pickmall.cn
|
||||
|
||||
**WAP**:https://m-b2b2c.pickmall.cn
|
||||
**商城移动端(请使浏览器手机模式,或者用手机浏览器打开)**:https://m-b2b2c.pickmall.cn
|
||||
|
||||
**小程序/公众号**:扫描二维码
|
||||
**商城 小程序/公众号/APP(支持ios、android)**:扫描二维码
|
||||
|
||||

|
||||
|
||||
### 🚙 3行命令搭建本地运行环境
|
||||
### 🚙 3行命令搭建本地商城(注:只能本机访问,前端镜像固定访问 127.0.0.1,如果是非本机体验,请自行下载源码操作镜像)
|
||||
|
||||
温馨提示:由于服务中间件较多,如果笔记本环境启动内存没有32g可能无法启动成功(macbookpro 2020 16g内存启动无法成功),台式机在16g内存、AMD 3700x 的ubuntu系统成功运行。
|
||||
|
||||
|
||||
|
||||
##### docker环境安装 [点击跳转](https://docs.pickmall.cn/deploy/%E4%B8%80%E9%94%AE%E9%83%A8%E7%BD%B2.html)
|
||||
|
||||
|
||||
##### docker环境安装 [点击跳转](https://docs.pickmall.cn/deploy/%E8%BF%90%E8%A1%8C%E7%8E%AF%E5%A2%83%E5%87%86%E5%A4%87.html)
|
||||
|
||||
##### 下载docker-compose脚本
|
||||
`git clone https://gitee.com/beijing_hongye_huicheng/docker.git `
|
||||
|
||||
##### 部署基础环境
|
||||
##### 部署商城所需中间件
|
||||
`docker-compose up -d`
|
||||
|
||||
##### 部署应用
|
||||
##### 部署商城应用
|
||||
`docker-compose -f docker-compose-application.yml up -d`
|
||||
|
||||
PS:商城数据库非docker部署
|
||||
https://gitee.com/beijing_hongye_huicheng/docker/tree/master/init/mysql
|
||||
|
||||
|
||||
PS:单独部署的话,点击跳转 https://gitee.com/beijing_hongye_huicheng/docker/tree/master/init/mysql 这里有与tag版本一致的sql,根据tag获取sql,如果使用master代码,则需要在lilishop项目根目录的update-sql目录中,获取对应的升级sql。
|
||||
这里有与tag版本一致的sql,根据tag获取sql,如果使用master代码
|
||||
|
||||
##### 商城 API/UI 地址
|
||||
|
||||
| API | 地址 |
|
||||
| -------------- | --------------- |
|
||||
| 商城买家API | http://127.0.0.1:8888 |
|
||||
| 商城商家API | http://127.0.0.1:8889 |
|
||||
| 商城管理端API | http://127.0.0.1:8887 |
|
||||
| 商城基础API | http://127.0.0.1:8890 |
|
||||
| 买家API | http://127.0.0.1:8888 |
|
||||
| 商家API | http://127.0.0.1:8889 |
|
||||
| 管理端API | http://127.0.0.1:8887 |
|
||||
| 通用API | http://127.0.0.1:8890 |
|
||||
|
||||
| 前端演示 | 地址 |
|
||||
| -------------- | --------------- |
|
||||
| 商城PC端 | http://127.0.0.1:10000 |
|
||||
| 商城WAP端 | http://127.0.0.1:10001 |
|
||||
| 商城卖家端 | http://127.0.0.1:10002 |
|
||||
| 商城管理端 | http://127.0.0.1:10003 |
|
||||
|
||||
| 商城H5端 | http://127.0.0.1:10001 |
|
||||
| 卖家端 | http://127.0.0.1:10002 |
|
||||
| 平台管理端 | http://127.0.0.1:10003 |
|
||||
|
||||
其他小程序/app等需自行打包。
|
||||
|
||||
|
||||
|
||||
@@ -122,13 +122,13 @@ PS:单独部署的话,点击跳转 https://gitee.com/beijing_hongye_huicheng/d
|
||||
|
||||
|
||||
|
||||
#### 🥎 商城平台功能
|
||||
#### 🥎 平台管理端功能
|
||||
|
||||

|
||||

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

|
||||
|
||||
@@ -138,24 +138,20 @@ PS:单独部署的话,点击跳转 https://gitee.com/beijing_hongye_huicheng/d
|
||||
|
||||
### 🧩 商城前端功能展示
|
||||
|
||||
|
||||
|
||||
#### ⚽️ 商城移动端
|
||||
|
||||
<img src="https://pickmall.cn/assets/imgs/other/app.gif" alt="移动端功能展示" style="zoom:50%;" />
|
||||
|
||||
|
||||
|
||||
#### ⚽️ 商城管理端
|
||||
#### ⚽️ 平台管理端
|
||||
|
||||

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

|
||||

|
||||
|
||||
##### 🕹 后台技术选型
|
||||
|
||||
@@ -193,7 +189,7 @@ PS:单独部署的话,点击跳转 https://gitee.com/beijing_hongye_huicheng/d
|
||||
```
|
||||
商城后续会持续版本升级,修复bug,完善功能,覆盖更多业务场景 o2o/b2b/s2b2b2c/跨境电商
|
||||
|
||||
后续会考虑推出微服务商城系统/中台商城等
|
||||
后续会考虑推出微服务商城系统/商城中台等
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.logstash.logback</groupId>
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
<version>${logstash-logback-encoder}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-mail</artifactId>-->
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<!--应用名称-->
|
||||
<property name="APP_NAME" value="common-api"/>
|
||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
||||
<!--日志文件保存路径-->
|
||||
<property name="LOG_FILE_PATH" value="lili-logs"/>
|
||||
<springProperty scope="context" name="LOG_FILE_PATH" source="logging.file.path"/>
|
||||
<springProperty scope="context" name="LOGSTASH_SERVER" source="lili.data.logstash.server"/>
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
@@ -22,7 +23,7 @@
|
||||
<!--输出到elk的LOGSTASH-->
|
||||
<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<!-- 配置elk日志收集 配饰的是 LOGSTASH 的地址-->
|
||||
<destination>127.0.0.1:4560</destination>
|
||||
<destination>${LOGSTASH_SERVER}</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
|
||||
<providers>
|
||||
<timestamp>
|
||||
@@ -1,8 +1,8 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.promotion.entity.dos.MemberCoupon;
|
||||
@@ -10,6 +10,7 @@ import cn.lili.modules.promotion.entity.vos.CouponSearchParams;
|
||||
import cn.lili.modules.promotion.entity.vos.CouponVO;
|
||||
import cn.lili.modules.promotion.service.CouponService;
|
||||
import cn.lili.modules.promotion.service.MemberCouponService;
|
||||
import cn.lili.modules.system.utils.OperationalJudgment;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -22,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 买家端,买家优惠券接口
|
||||
@@ -56,14 +58,16 @@ public class CouponBuyerController {
|
||||
@ApiOperation(value = "获取当前会员的优惠券列表")
|
||||
@GetMapping("/getCoupons")
|
||||
public ResultMessage<IPage<MemberCoupon>> getCoupons(CouponSearchParams param, PageVO pageVo) {
|
||||
param.setMemberId(UserContext.getCurrentUser().getId());
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
param.setMemberId(currentUser.getId());
|
||||
return ResultUtil.data(memberCouponService.getMemberCoupons(param, pageVo));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取当前会员的对于当前商品可使用的优惠券列表")
|
||||
@GetMapping("/canUse")
|
||||
public ResultMessage<IPage<MemberCoupon>> getCouponsByCanUse(CouponSearchParams param, Double totalPrice, PageVO pageVo) {
|
||||
param.setMemberId(UserContext.getCurrentUser().getId());
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
param.setMemberId(currentUser.getId());
|
||||
return ResultUtil.data(memberCouponService.getMemberCouponsByCanUse(param, totalPrice, pageVo));
|
||||
}
|
||||
|
||||
@@ -79,8 +83,9 @@ public class CouponBuyerController {
|
||||
})
|
||||
@GetMapping("/receive/{couponId}")
|
||||
public ResultMessage<Object> receiveCoupon(@NotNull(message = "优惠券ID不能为空") @PathVariable("couponId") String couponId) {
|
||||
memberCouponService.checkCouponLimit(couponId, UserContext.getCurrentUser().getId());
|
||||
memberCouponService.receiveCoupon(couponId, UserContext.getCurrentUser().getId(), UserContext.getCurrentUser().getNickName());
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
memberCouponService.checkCouponLimit(couponId, currentUser.getId());
|
||||
memberCouponService.receiveCoupon(couponId, currentUser.getId(), currentUser.getNickName());
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@@ -90,7 +95,7 @@ public class CouponBuyerController {
|
||||
})
|
||||
@GetMapping(value = "/get/{id}")
|
||||
public ResultMessage<MemberCoupon> get(@NotNull(message = "优惠券ID不能为空") @PathVariable("id") String id) {
|
||||
MemberCoupon memberCoupon = memberCouponService.getById(id);
|
||||
MemberCoupon memberCoupon = OperationalJudgment.judgment(memberCouponService.getById(id));
|
||||
return ResultUtil.data(memberCoupon);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.MemberAddress;
|
||||
import cn.lili.modules.promotion.service.MemberAddressService;
|
||||
import cn.lili.modules.member.service.MemberAddressService;
|
||||
import cn.lili.modules.system.utils.OperationalJudgment;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -14,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
@@ -56,7 +58,7 @@ public class MemberAddressBuyerController {
|
||||
@PostMapping
|
||||
public ResultMessage<MemberAddress> addShippingAddress(@Valid MemberAddress shippingAddress) {
|
||||
//添加会员地址
|
||||
shippingAddress.setMemberId(UserContext.getCurrentUser().getId());
|
||||
shippingAddress.setMemberId(Objects.requireNonNull(UserContext.getCurrentUser()).getId());
|
||||
if(shippingAddress.getIsDefault()==null){
|
||||
shippingAddress.setIsDefault(false);
|
||||
}
|
||||
@@ -66,11 +68,6 @@ public class MemberAddressBuyerController {
|
||||
@ApiOperation(value = "修改会员收件地址")
|
||||
@PutMapping
|
||||
public ResultMessage<MemberAddress> editShippingAddress(@Valid MemberAddress shippingAddress) {
|
||||
//修改会员地址
|
||||
shippingAddress.setMemberId(UserContext.getCurrentUser().getId());
|
||||
if(shippingAddress.getIsDefault()==null){
|
||||
shippingAddress.setIsDefault(false);
|
||||
}
|
||||
return ResultUtil.data(memberAddressService.updateMemberAddress(shippingAddress));
|
||||
}
|
||||
|
||||
@@ -78,6 +75,7 @@ public class MemberAddressBuyerController {
|
||||
@ApiImplicitParam(name = "id", value = "会员地址ID", dataType = "String", paramType = "path")
|
||||
@DeleteMapping(value = "/delById/{id}")
|
||||
public ResultMessage<Object> delShippingAddressById(@PathVariable String id) {
|
||||
OperationalJudgment.judgment(memberAddressService.getById(id));
|
||||
memberAddressService.removeMemberAddress(id);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 买家端,意见反馈接口
|
||||
*
|
||||
@@ -31,7 +33,7 @@ public class FeedbackBuyerController {
|
||||
|
||||
@ApiOperation(value = "添加意见反馈")
|
||||
@PostMapping()
|
||||
public ResultMessage<Object> save(Feedback feedback) {
|
||||
public ResultMessage<Object> save(@Valid Feedback feedback) {
|
||||
feedback.setUserName(UserContext.getCurrentUser().getNickName());
|
||||
feedbackService.save(feedback);
|
||||
return ResultUtil.success();
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package cn.lili.controller.purchase;
|
||||
package cn.lili.controller.other.purchase;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.GoodsUnit;
|
||||
import cn.lili.modules.goods.service.GoodsUnitService;
|
||||
import cn.lili.modules.purchase.entity.dos.PurchaseOrder;
|
||||
import cn.lili.modules.purchase.entity.params.PurchaseOrderSearchParams;
|
||||
import cn.lili.modules.purchase.entity.vos.PurchaseOrderVO;
|
||||
import cn.lili.modules.purchase.service.PurchaseOrderService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -33,9 +38,19 @@ public class PurchaseBuyerController {
|
||||
@Autowired
|
||||
private PurchaseOrderService purchaseOrderService;
|
||||
|
||||
@Autowired
|
||||
private GoodsUnitService goodsUnitService;
|
||||
|
||||
|
||||
@ApiOperation(value = "分页获取商品计量单位")
|
||||
@GetMapping("/goodsUnit")
|
||||
public ResultMessage<IPage<GoodsUnit>> goodsUnitPage(PageVO pageVO) {
|
||||
return ResultUtil.data(goodsUnitService.page(PageUtil.initPage(pageVO)));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加采购单")
|
||||
@PostMapping
|
||||
public ResultMessage<PurchaseOrderVO> addPurchaseOrderVO(PurchaseOrderVO purchaseOrderVO) {
|
||||
public ResultMessage<PurchaseOrderVO> addPurchaseOrderVO(@RequestBody PurchaseOrderVO purchaseOrderVO) {
|
||||
return ResultUtil.data(purchaseOrderService.addPurchaseOrder(purchaseOrderVO));
|
||||
}
|
||||
|
||||
@@ -64,7 +79,7 @@ public class PurchaseBuyerController {
|
||||
@PutMapping("/{id}")
|
||||
public ResultMessage<Object> close(@NotNull @PathVariable String id) {
|
||||
purchaseOrderService.close(id);
|
||||
return ResultUtil.success();
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,14 @@
|
||||
package cn.lili.controller.purchase;
|
||||
package cn.lili.controller.other.purchase;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.purchase.entity.dos.PurchaseOrder;
|
||||
import cn.lili.modules.purchase.entity.dos.PurchaseQuoted;
|
||||
import cn.lili.modules.purchase.entity.vos.PurchaseQuotedVO;
|
||||
import cn.lili.modules.purchase.service.PurchaseOrderService;
|
||||
import cn.lili.modules.purchase.service.PurchaseQuotedService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -30,10 +35,19 @@ public class PurchaseQuotedController {
|
||||
*/
|
||||
@Autowired
|
||||
private PurchaseQuotedService purchaseQuotedService;
|
||||
/**
|
||||
* 采购单
|
||||
*/
|
||||
@Autowired
|
||||
private PurchaseOrderService purchaseOrderService;
|
||||
|
||||
@ApiOperation(value = "添加采购单报价")
|
||||
@PostMapping
|
||||
public ResultMessage<PurchaseQuoted> addPurchaseOrderVO(PurchaseQuotedVO purchaseQuotedVO) {
|
||||
public ResultMessage<PurchaseQuoted> addPurchaseOrderVO(@RequestBody PurchaseQuotedVO purchaseQuotedVO) {
|
||||
PurchaseOrder purchaseOrder=purchaseOrderService.getById(purchaseQuotedVO.getPurchaseOrderId());
|
||||
if(DateUtil.compare(purchaseOrder.getDeadline(),new DateTime())< 0){
|
||||
ResultUtil.error(ResultCode.PURCHASE_ORDER_DEADLINE_ERROR);
|
||||
}
|
||||
return ResultUtil.data(purchaseQuotedService.addPurchaseQuoted(purchaseQuotedVO));
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package cn.lili.controller.passport;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.entity.dto.MemberEditDTO;
|
||||
@@ -47,11 +46,15 @@ public class MemberBuyerController {
|
||||
public ResultMessage<Object> userLogin(@NotNull(message = "用户名不能为空") @RequestParam String username,
|
||||
@NotNull(message = "密码不能为空") @RequestParam String password,
|
||||
@RequestHeader String uuid) {
|
||||
if (verificationService.check(uuid, VerificationEnums.LOGIN)) {
|
||||
return ResultUtil.data(this.memberService.usernameLogin(username, password));
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
||||
}
|
||||
verificationService.check(uuid, VerificationEnums.LOGIN);
|
||||
return ResultUtil.data(this.memberService.usernameLogin(username, password));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "注销接口")
|
||||
@PostMapping("/logout")
|
||||
public ResultMessage<Object> logout() {
|
||||
this.memberService.logout(UserEnums.MEMBER);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "短信登录接口")
|
||||
@@ -63,11 +66,8 @@ public class MemberBuyerController {
|
||||
public ResultMessage<Object> smsLogin(@NotNull(message = "手机号为空") @RequestParam String mobile,
|
||||
@NotNull(message = "验证码为空") @RequestParam String code,
|
||||
@RequestHeader String uuid) {
|
||||
if (smsUtil.verifyCode(mobile, VerificationEnums.LOGIN, uuid, code)) {
|
||||
return ResultUtil.data(memberService.mobilePhoneLogin(mobile));
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.VERIFICATION_SMS_ERROR);
|
||||
}
|
||||
smsUtil.verifyCode(mobile, VerificationEnums.LOGIN, uuid, code);
|
||||
return ResultUtil.data(memberService.mobilePhoneLogin(mobile));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "注册用户")
|
||||
@@ -84,12 +84,9 @@ public class MemberBuyerController {
|
||||
@RequestHeader String uuid,
|
||||
@NotNull(message = "验证码不能为空") @RequestParam String code) {
|
||||
|
||||
boolean result = smsUtil.verifyCode(mobilePhone, VerificationEnums.REGISTER, uuid, code);
|
||||
if (result) {
|
||||
return ResultUtil.data(memberService.register(username, password, mobilePhone));
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.VERIFICATION_SMS_ERROR);
|
||||
}
|
||||
smsUtil.verifyCode(mobilePhone, VerificationEnums.REGISTER, uuid, code);
|
||||
return ResultUtil.data(memberService.register(username, password, mobilePhone));
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取当前登录用户接口")
|
||||
@@ -109,13 +106,11 @@ public class MemberBuyerController {
|
||||
@NotNull(message = "验证码为空") @RequestParam String code,
|
||||
@RequestHeader String uuid) {
|
||||
//校验短信验证码是否正确
|
||||
if (smsUtil.verifyCode(mobile, VerificationEnums.FIND_USER, uuid, code)) {
|
||||
//校验是否通过手机号可获取会员,存在则将会员信息存入缓存,有效时间3分钟
|
||||
if (memberService.findByMobile(uuid, mobile)) {
|
||||
return ResultUtil.success();
|
||||
}
|
||||
}
|
||||
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
||||
smsUtil.verifyCode(mobile, VerificationEnums.FIND_USER, uuid, code);
|
||||
//校验是否通过手机号可获取会员,存在则将会员信息存入缓存,有效时间3分钟
|
||||
memberService.findByMobile(uuid, mobile);
|
||||
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改密码")
|
||||
|
||||
@@ -6,8 +6,8 @@ import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.payment.kit.CashierSupport;
|
||||
import cn.lili.modules.payment.kit.dto.PayParam;
|
||||
import cn.lili.modules.payment.kit.enums.PaymentClientEnum;
|
||||
import cn.lili.modules.payment.kit.enums.PaymentMethodEnum;
|
||||
import cn.lili.modules.payment.entity.enums.PaymentClientEnum;
|
||||
import cn.lili.modules.payment.entity.enums.PaymentMethodEnum;
|
||||
import cn.lili.modules.payment.kit.params.dto.CashierParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package cn.lili.controller.payment;
|
||||
|
||||
import cn.lili.modules.payment.kit.RefundSupport;
|
||||
import cn.lili.modules.payment.kit.enums.PaymentMethodEnum;
|
||||
import cn.lili.modules.payment.entity.enums.PaymentMethodEnum;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@@ -13,6 +13,7 @@ import cn.lili.modules.order.order.service.AfterSaleReasonService;
|
||||
import cn.lili.modules.order.order.service.AfterSaleService;
|
||||
import cn.lili.modules.order.trade.entity.dos.AfterSaleLog;
|
||||
import cn.lili.modules.store.entity.dto.StoreAfterSaleAddressDTO;
|
||||
import cn.lili.modules.system.utils.OperationalJudgment;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -57,7 +58,8 @@ public class AfterSaleBuyerController {
|
||||
@ApiImplicitParam(name = "sn", value = "售后单号", required = true, paramType = "path")
|
||||
@GetMapping(value = "/get/{sn}")
|
||||
public ResultMessage<AfterSaleVO> get(@NotNull(message = "售后单号") @PathVariable("sn") String sn) {
|
||||
return ResultUtil.data(afterSaleService.getAfterSale(sn));
|
||||
AfterSaleVO afterSale = OperationalJudgment.judgment(afterSaleService.getAfterSale(sn));
|
||||
return ResultUtil.data(afterSale);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取售后服务")
|
||||
@@ -95,7 +97,7 @@ public class AfterSaleBuyerController {
|
||||
public ResultMessage<AfterSale> delivery(@NotNull(message = "售后编号不能为空") @PathVariable("afterSaleSn") String afterSaleSn,
|
||||
@NotNull(message = "发货单号不能为空") @RequestParam String logisticsNo,
|
||||
@NotNull(message = "请选择物流公司") @RequestParam String logisticsId,
|
||||
@NotNull(message = "请选择发货时间") @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date mDeliverTime) {
|
||||
@NotNull(message = "请选择发货时间") @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date mDeliverTime) {
|
||||
return ResultUtil.data(afterSaleService.buyerDelivery(afterSaleSn, logisticsNo, logisticsId, mDeliverTime));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.order.order.entity.dos.Order;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderSearchParams;
|
||||
@@ -12,6 +12,7 @@ import cn.lili.modules.order.order.entity.enums.OrderStatusEnum;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
|
||||
import cn.lili.modules.order.order.service.OrderService;
|
||||
import cn.lili.modules.system.utils.OperationalJudgment;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -23,6 +24,7 @@ import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 买家端,订单接口
|
||||
@@ -44,7 +46,7 @@ public class OrderBuyerController {
|
||||
@ApiOperation(value = "查询会员订单列表")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<OrderSimpleVO>> queryMineOrder(OrderSearchParams orderSearchParams) {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
orderSearchParams.setMemberId(currentUser.getId());
|
||||
return ResultUtil.data(orderService.queryByParams(orderSearchParams));
|
||||
}
|
||||
@@ -55,7 +57,9 @@ public class OrderBuyerController {
|
||||
})
|
||||
@GetMapping(value = "/{orderSn}")
|
||||
public ResultMessage<OrderDetailVO> detail(@NotNull(message = "订单编号不能为空") @PathVariable("orderSn") String orderSn) {
|
||||
return ResultUtil.data(orderService.queryDetail(orderSn));
|
||||
OrderDetailVO orderDetailVO = orderService.queryDetail(orderSn);
|
||||
OperationalJudgment.judgment(orderDetailVO.getOrder());
|
||||
return ResultUtil.data(orderDetailVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "确认收货")
|
||||
@@ -93,6 +97,7 @@ public class OrderBuyerController {
|
||||
})
|
||||
@DeleteMapping(value = "/{orderSn}")
|
||||
public ResultMessage<Object> deleteOrder(@PathVariable String orderSn) {
|
||||
OperationalJudgment.judgment(orderService.getBySn(orderSn));
|
||||
orderService.deleteOrder(orderSn);
|
||||
return ResultUtil.success();
|
||||
}
|
||||
@@ -103,6 +108,7 @@ public class OrderBuyerController {
|
||||
})
|
||||
@PostMapping(value = "/getTraces/{orderSn}")
|
||||
public ResultMessage<Object> getTraces(@NotBlank(message = "订单编号不能为空") @PathVariable String orderSn) {
|
||||
OperationalJudgment.judgment(orderService.getBySn(orderSn));
|
||||
return ResultUtil.data(orderService.getTraces(orderSn));
|
||||
}
|
||||
|
||||
@@ -113,6 +119,7 @@ public class OrderBuyerController {
|
||||
})
|
||||
@PostMapping(value = "/receipt/{orderSn}")
|
||||
public ResultMessage<Object> invoice(@NotBlank(message = "订单编号不能为空") @PathVariable String orderSn) {
|
||||
OperationalJudgment.judgment(orderService.getBySn(orderSn));
|
||||
return ResultUtil.data(orderService.invoice(orderSn));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import cn.lili.modules.order.order.entity.vo.OrderComplaintSearchParams;
|
||||
import cn.lili.modules.order.order.entity.vo.OrderComplaintVO;
|
||||
import cn.lili.modules.order.order.service.OrderComplaintCommunicationService;
|
||||
import cn.lili.modules.order.order.service.OrderComplaintService;
|
||||
import cn.lili.modules.system.utils.OperationalJudgment;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -22,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 买家端,交易投诉接口
|
||||
@@ -51,13 +53,15 @@ public class OrderComplaintBuyerController {
|
||||
@ApiImplicitParam(name = "id", value = "投诉单ID", required = true, paramType = "path")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultMessage<OrderComplaintVO> get(@PathVariable String id) {
|
||||
return ResultUtil.data(orderComplaintService.getOrderComplainById(id));
|
||||
OrderComplaintVO orderComplaintVO = OperationalJudgment.judgment(orderComplaintService.getOrderComplainById(id));
|
||||
return ResultUtil.data(orderComplaintVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@GetMapping
|
||||
public ResultMessage<IPage<OrderComplaint>> get(OrderComplaintSearchParams searchParams, PageVO pageVO) {
|
||||
searchParams.setMemberId(UserContext.getCurrentUser().getId());
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
searchParams.setMemberId(currentUser.getId());
|
||||
return ResultUtil.data(orderComplaintService.getOrderComplainByPage(searchParams, pageVO));
|
||||
|
||||
}
|
||||
@@ -75,7 +79,7 @@ public class OrderComplaintBuyerController {
|
||||
})
|
||||
@PostMapping("/communication")
|
||||
public ResultMessage<OrderComplaintCommunicationVO> addCommunication(@RequestParam String complainId, @RequestParam String content) {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
OrderComplaintCommunicationVO communicationVO = new OrderComplaintCommunicationVO(complainId, content, CommunicationOwnerEnum.BUYER.name(), currentUser.getId(), currentUser.getNickName());
|
||||
orderComplaintCommunicationService.addCommunication(communicationVO);
|
||||
return ResultUtil.data(communicationVO);
|
||||
|
||||
@@ -22,6 +22,8 @@ management:
|
||||
exposure:
|
||||
include: '*'
|
||||
spring:
|
||||
application:
|
||||
name: buyer-api
|
||||
# 要在其中注册的Spring Boot Admin Server的URL。
|
||||
boot:
|
||||
admin:
|
||||
@@ -44,8 +46,7 @@ spring:
|
||||
# mongodb
|
||||
data:
|
||||
mongodb:
|
||||
host: 127.0.0.1
|
||||
port: 27017
|
||||
uri: 127.0.0.1:27017
|
||||
database: lilishop
|
||||
username: root
|
||||
password: lilishop
|
||||
@@ -119,7 +120,7 @@ spring:
|
||||
props:
|
||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||
sql:
|
||||
show: false
|
||||
show: true
|
||||
|
||||
# 忽略TOKEN 鉴权 的url
|
||||
ignored:
|
||||
@@ -136,9 +137,7 @@ ignored:
|
||||
- /buyer/article/**
|
||||
- /buyer/goods/**
|
||||
- /buyer/category/**
|
||||
- /buyer/store
|
||||
- /buyer/store/get**
|
||||
- /buyer/store/label/get**
|
||||
- /buyer/store/**
|
||||
- /buyer/connect/**
|
||||
- /buyer/members/**
|
||||
- /buyer/promotion/pintuan/**
|
||||
@@ -184,6 +183,7 @@ mybatis-plus:
|
||||
|
||||
# 日志
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: debug
|
||||
@@ -193,10 +193,12 @@ logging:
|
||||
file:
|
||||
# 指定路径
|
||||
path: lili-logs
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-size: 5MB
|
||||
logback:
|
||||
rollingpolicy:
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-file-size: 5MB
|
||||
#加密参数
|
||||
jasypt:
|
||||
encryptor:
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<!--应用名称-->
|
||||
<property name="APP_NAME" value="seller-api"/>
|
||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
||||
<!--日志文件保存路径-->
|
||||
<property name="LOG_FILE_PATH" value="lili-logs"/>
|
||||
<springProperty scope="context" name="LOG_FILE_PATH" source="logging.file.path"/>
|
||||
<springProperty scope="context" name="LOGSTASH_SERVER" source="lili.data.logstash.server"/>
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
@@ -22,7 +23,7 @@
|
||||
<!--输出到elk的LOGSTASH-->
|
||||
<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<!-- 配置elk日志收集 配饰的是 LOGSTASH 的地址-->
|
||||
<destination>127.0.0.1:4560</destination>
|
||||
<destination>${LOGSTASH_SERVER}</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
|
||||
<providers>
|
||||
<timestamp>
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE configuration>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<!--应用名称-->
|
||||
<property name="APP_NAME" value="buyer-api"/>
|
||||
<!--日志文件保存路径-->
|
||||
<property name="LOG_FILE_PATH" value="lili-logs"/>
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_FILE_PATH}/${APP_NAME}-%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${FILE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--输出到elk的LOGSTASH-->
|
||||
<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<destination>127.0.0.1:4560</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
|
||||
<providers>
|
||||
<timestamp>
|
||||
<timeZone>UTC</timeZone>
|
||||
</timestamp>
|
||||
</providers>
|
||||
<!--自定义字段 区分项目-->
|
||||
<customFields>{"appName":"${APP_NAME}"}</customFields>
|
||||
</encoder>
|
||||
</appender>
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
<appender-ref ref="LOGSTASH"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -250,7 +250,8 @@ lili:
|
||||
# account:
|
||||
# username: elastic
|
||||
# password: LiLiShopES
|
||||
|
||||
logstash:
|
||||
server: 127.0.0.1:4560
|
||||
rocketmq:
|
||||
promotion-topic: lili_promotion_topic
|
||||
promotion-group: lili_promotion_group
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package cn.lili.controller.common;
|
||||
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.entity.dto.ImSetting;
|
||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* IM控制器
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* 2021-09-16 15:32
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common/IM")
|
||||
@Api(tags = "IM 中心")
|
||||
public class IMController {
|
||||
|
||||
@Autowired
|
||||
private SettingService settingService;
|
||||
|
||||
@ApiOperation(value = "获取IM接口前缀")
|
||||
@GetMapping
|
||||
public ResultMessage<String> getUrl() {
|
||||
String imUrl;
|
||||
try {
|
||||
Setting imSettingVal = settingService.get(SettingEnum.IM_SETTING.name());
|
||||
ImSetting imSetting = JSONUtil.toBean(imSettingVal.getSettingValue(), ImSetting.class);
|
||||
imUrl = imSetting.getHttpUrl() + "?tenant_id=" + imSetting.getTenantId()+"&merchant_euid=";
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(ResultCode.PLATFORM_NOT_SUPPORTED_IM);
|
||||
}
|
||||
return ResultUtil.data(imUrl);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
package cn.lili.controller.common;
|
||||
|
||||
import cn.lili.cache.limit.annotation.LimitPoint;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.verification.enums.VerificationEnums;
|
||||
import cn.lili.modules.verification.service.VerificationService;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -32,14 +30,8 @@ public class SliderImageController {
|
||||
@GetMapping("/{verificationEnums}")
|
||||
@ApiOperation(value = "获取校验接口,一分钟同一个ip请求10次")
|
||||
public ResultMessage getSliderImage(@RequestHeader String uuid, @PathVariable VerificationEnums verificationEnums) {
|
||||
try {
|
||||
return ResultUtil.data(verificationService.createVerification(verificationEnums, uuid));
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("获取校验接口错误", e);
|
||||
throw new ServiceException(ResultCode.VERIFICATION_EXIST);
|
||||
}
|
||||
return ResultUtil.data(verificationService.createVerification(verificationEnums, uuid));
|
||||
|
||||
}
|
||||
|
||||
@LimitPoint(name = "slider_image", key = "verification_pre_check", limit = 600)
|
||||
|
||||
@@ -2,12 +2,11 @@ package cn.lili.controller.common;
|
||||
|
||||
import cn.lili.cache.limit.annotation.LimitPoint;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.modules.system.sms.SmsUtil;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.system.sms.SmsUtil;
|
||||
import cn.lili.modules.verification.enums.VerificationEnums;
|
||||
import cn.lili.modules.verification.service.VerificationService;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -42,11 +41,8 @@ public class SmsController {
|
||||
@RequestHeader String uuid,
|
||||
@PathVariable String mobile,
|
||||
@PathVariable VerificationEnums verificationEnums) {
|
||||
if (verificationService.check(uuid, verificationEnums)) {
|
||||
smsUtil.sendSmsCode(mobile, verificationEnums, uuid);
|
||||
return ResultUtil.success(ResultCode.VERIFICATION_SEND_SUCCESS);
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.VERIFICATION_SMS_EXPIRED_ERROR);
|
||||
}
|
||||
verificationService.check(uuid, verificationEnums);
|
||||
smsUtil.sendSmsCode(mobile, verificationEnums, uuid);
|
||||
return ResultUtil.success(ResultCode.VERIFICATION_SEND_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package cn.lili.controller.common;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.properties.SystemSettingProperties;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.utils.Base64DecodeMultipartFile;
|
||||
import cn.lili.common.utils.CommonUtil;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.common.properties.SystemSettingProperties;
|
||||
import cn.lili.modules.file.entity.File;
|
||||
import cn.lili.modules.file.plugin.FileManagerPlugin;
|
||||
import cn.lili.modules.file.service.FileService;
|
||||
@@ -30,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 文件上传接口
|
||||
@@ -68,16 +68,24 @@ public class UploadController {
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
Setting setting = settingService.get(SettingEnum.OSS_SETTING.name());
|
||||
if (setting == null || StrUtil.isBlank(setting.getSettingValue())) {
|
||||
if (setting == null || CharSequenceUtil.isBlank(setting.getSettingValue())) {
|
||||
throw new ServiceException(ResultCode.OSS_NOT_EXIST);
|
||||
}
|
||||
if (file == null || CharSequenceUtil.isEmpty(file.getContentType())) {
|
||||
throw new ServiceException(ResultCode.IMAGE_FILE_EXT_ERROR);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(base64)) {
|
||||
|
||||
if (!CharSequenceUtil.containsAny(file.getContentType().toLowerCase(), "image")) {
|
||||
throw new ServiceException(ResultCode.FILE_TYPE_NOT_SUPPORT);
|
||||
}
|
||||
|
||||
if (CharSequenceUtil.isNotBlank(base64)) {
|
||||
//base64上传
|
||||
file = Base64DecodeMultipartFile.base64Convert(base64);
|
||||
}
|
||||
String result = "";
|
||||
String fileKey = CommonUtil.rename(file.getOriginalFilename());
|
||||
String result;
|
||||
String fileKey = CommonUtil.rename(Objects.requireNonNull(file.getOriginalFilename()));
|
||||
File newFile = new File();
|
||||
try {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
|
||||
@@ -22,6 +22,8 @@ management:
|
||||
exposure:
|
||||
include: '*'
|
||||
spring:
|
||||
application:
|
||||
name: common-api
|
||||
# 要在其中注册的Spring Boot Admin Server的URL。
|
||||
boot:
|
||||
admin:
|
||||
@@ -30,8 +32,7 @@ spring:
|
||||
# mongodb
|
||||
data:
|
||||
mongodb:
|
||||
host: 127.0.0.1
|
||||
port: 27017
|
||||
uri: 127.0.0.1:27017
|
||||
database: lilishop
|
||||
username: root
|
||||
password: lilishop
|
||||
@@ -116,7 +117,7 @@ spring:
|
||||
props:
|
||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||
sql:
|
||||
show: false
|
||||
show: true
|
||||
|
||||
# 忽略鉴权url
|
||||
ignored:
|
||||
@@ -181,6 +182,7 @@ mybatis-plus:
|
||||
|
||||
# 日志
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: info
|
||||
@@ -190,10 +192,12 @@ logging:
|
||||
file:
|
||||
# 指定路径
|
||||
path: lili-logs
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-size: 5MB
|
||||
logback:
|
||||
rollingpolicy:
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-file-size: 5MB
|
||||
#加密参数
|
||||
jasypt:
|
||||
encryptor:
|
||||
@@ -272,7 +276,8 @@ lili:
|
||||
# account:
|
||||
# username: elastic
|
||||
# password: LiLiShopES
|
||||
|
||||
logstash:
|
||||
server: 127.0.0.1:4560
|
||||
rocketmq:
|
||||
promotion-topic: lili_promotion_topic
|
||||
promotion-group: lili_promotion_group
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<!--应用名称-->
|
||||
<property name="APP_NAME" value="common-api"/>
|
||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
||||
<!--日志文件保存路径-->
|
||||
<property name="LOG_FILE_PATH" value="lili-logs"/>
|
||||
<springProperty scope="context" name="LOG_FILE_PATH" source="logging.file.path"/>
|
||||
<springProperty scope="context" name="LOGSTASH_SERVER" source="lili.data.logstash.server"/>
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
@@ -22,7 +23,7 @@
|
||||
<!--输出到elk的LOGSTASH-->
|
||||
<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<!-- 配置elk日志收集 配饰的是 LOGSTASH 的地址-->
|
||||
<destination>127.0.0.1:4560</destination>
|
||||
<destination>${LOGSTASH_SERVER}</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
|
||||
<providers>
|
||||
<timestamp>
|
||||
@@ -28,8 +28,7 @@ spring:
|
||||
# mongodb
|
||||
data:
|
||||
mongodb:
|
||||
host: 192.168.0.116
|
||||
port: 27017
|
||||
uri: 192.168.0.116:27017
|
||||
database: lilishop
|
||||
username: root
|
||||
password: lilishop
|
||||
@@ -151,7 +150,7 @@ ignored:
|
||||
- /swagger-resources/**
|
||||
- /swagger/**
|
||||
- /webjars/**
|
||||
- /v2/api-docs
|
||||
- /v2/api-docs**
|
||||
- /configuration/ui
|
||||
- /boot-admin
|
||||
- /manager/promotion/seckill/init
|
||||
@@ -162,9 +161,9 @@ ignored:
|
||||
|
||||
# Swagger界面内容配置
|
||||
swagger:
|
||||
title: lili API接口文档
|
||||
description: lili Api Documentation
|
||||
version: 1.0.0
|
||||
title: lilishop API接口文档
|
||||
description: lilishop Api Documentation
|
||||
version: 4.2.2
|
||||
termsOfServiceUrl: https://pickmall.cn
|
||||
contact:
|
||||
name: lili
|
||||
@@ -190,11 +189,13 @@ logging:
|
||||
# org.springframework.data.mongodb.core: debug
|
||||
file:
|
||||
# 指定路径
|
||||
path: lili-logs
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-size: 5MB
|
||||
path: logs
|
||||
logback:
|
||||
rollingpolicy:
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-file-size: 5MB
|
||||
#加密参数
|
||||
jasypt:
|
||||
encryptor:
|
||||
@@ -227,11 +228,11 @@ lili:
|
||||
system:
|
||||
isDemoSite: false
|
||||
isTestModel: true
|
||||
# 脱敏级别:
|
||||
# 0:不做脱敏处理
|
||||
# 1:管理端用户手机号等信息脱敏
|
||||
# 2:商家端信息脱敏(为2时,表示管理端,商家端同时脱敏)
|
||||
# sensitiveLevel: 2
|
||||
# 脱敏级别:
|
||||
# 0:不做脱敏处理
|
||||
# 1:管理端用户手机号等信息脱敏
|
||||
# 2:商家端信息脱敏(为2时,表示管理端,商家端同时脱敏)
|
||||
# sensitiveLevel: 2
|
||||
|
||||
statistics:
|
||||
# 在线人数统计 X 小时。这里设置48,即统计过去48小时每小时在线人数
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
|
||||
#Thu Dec 24 11:13:34 CST 2020
|
||||
xxl-job-admin-2.3.0-SNAPSHOT.pom>=
|
||||
xxl-job-admin-2.3.0-SNAPSHOT.jar>=
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata modelVersion="1.1.0">
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-admin</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
<versioning>
|
||||
<snapshot>
|
||||
<localCopy>true</localCopy>
|
||||
</snapshot>
|
||||
<lastUpdated>20201224031334</lastUpdated>
|
||||
<snapshotVersions>
|
||||
<snapshotVersion>
|
||||
<extension>jar</extension>
|
||||
<value>2.3.0-SNAPSHOT</value>
|
||||
<updated>20201224031334</updated>
|
||||
</snapshotVersion>
|
||||
<snapshotVersion>
|
||||
<extension>pom</extension>
|
||||
<value>2.3.0-SNAPSHOT</value>
|
||||
<updated>20201224031334</updated>
|
||||
</snapshotVersion>
|
||||
</snapshotVersions>
|
||||
</versioning>
|
||||
</metadata>
|
||||
Binary file not shown.
@@ -1,113 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>xxl-job-admin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- starter-web:spring-webmvc + autoconfigure + logback + yaml + tomcat -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- starter-test:junit + spring-test + mockito -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- freemarker-starter -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mail-starter -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- starter-actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis-starter:mybatis + mybatis-spring + hikari(default) -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>${mybatis-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
<!-- mysql -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql-connector-java.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- xxl-job-core -->
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- docker -->
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>0.4.13</version>
|
||||
<configuration>
|
||||
<!-- made of '[a-z0-9-_.]' -->
|
||||
<imageName>${project.artifactId}:${project.version}</imageName>
|
||||
<dockerDirectory>${project.basedir}</dockerDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>/</targetPath>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<include>${project.build.finalName}.jar</include>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-admin</artifactId>
|
||||
<versioning>
|
||||
<versions>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</versions>
|
||||
<lastUpdated>20201224031334</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
||||
@@ -1,4 +0,0 @@
|
||||
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
|
||||
#Thu Dec 24 11:13:30 CST 2020
|
||||
xxl-job-core-2.3.0-SNAPSHOT.pom>=
|
||||
xxl-job-core-2.3.0-SNAPSHOT.jar>=
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata modelVersion="1.1.0">
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
<versioning>
|
||||
<snapshot>
|
||||
<localCopy>true</localCopy>
|
||||
</snapshot>
|
||||
<lastUpdated>20201224031330</lastUpdated>
|
||||
<snapshotVersions>
|
||||
<snapshotVersion>
|
||||
<extension>jar</extension>
|
||||
<value>2.3.0-SNAPSHOT</value>
|
||||
<updated>20201224031330</updated>
|
||||
</snapshotVersion>
|
||||
<snapshotVersion>
|
||||
<extension>pom</extension>
|
||||
<value>2.3.0-SNAPSHOT</value>
|
||||
<updated>20201224031330</updated>
|
||||
</snapshotVersion>
|
||||
</snapshotVersions>
|
||||
</versioning>
|
||||
</metadata>
|
||||
@@ -1,6 +0,0 @@
|
||||
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
|
||||
#Thu Dec 24 20:01:24 CST 2020
|
||||
maven-metadata-maven-central.xml/@default-maven-central-http\://central.maven.org/maven2/.lastUpdated=1608811283852
|
||||
maven-metadata-aliyun.xml.error=
|
||||
maven-metadata-maven-central.xml.error=Could not transfer metadata com.xuxueli\:xxl-job-core\:2.3.0-SNAPSHOT/maven-metadata.xml from/to maven-central (http\://central.maven.org/maven2/)\: Transfer failed for http\://central.maven.org/maven2/com/xuxueli/xxl-job-core/2.3.0-SNAPSHOT/maven-metadata.xml
|
||||
maven-metadata-aliyun.xml.lastUpdated=1608811284126
|
||||
Binary file not shown.
@@ -1,64 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>A distributed task scheduling framework.</description>
|
||||
<url>https://www.xuxueli.com/</url>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- ********************** embed server: netty + gson ********************** -->
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
<version>${netty-all.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>${gson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- ********************** plugin ********************** -->
|
||||
<!-- groovy-all -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
<version>${groovy.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- spring-context -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- ********************** base ********************** -->
|
||||
<!-- slf4j -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- javax.annotation-api -->
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>${javax.annotation-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<versioning>
|
||||
<versions>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</versions>
|
||||
<lastUpdated>20201224031330</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
||||
@@ -1,3 +0,0 @@
|
||||
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
|
||||
#Thu Dec 24 11:13:27 CST 2020
|
||||
xxl-job-2.3.0-SNAPSHOT.pom>=
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata modelVersion="1.1.0">
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
<versioning>
|
||||
<snapshot>
|
||||
<localCopy>true</localCopy>
|
||||
</snapshot>
|
||||
<lastUpdated>20201224031327</lastUpdated>
|
||||
<snapshotVersions>
|
||||
<snapshotVersion>
|
||||
<extension>pom</extension>
|
||||
<value>2.3.0-SNAPSHOT</value>
|
||||
<updated>20201224031327</updated>
|
||||
</snapshotVersion>
|
||||
</snapshotVersions>
|
||||
</versioning>
|
||||
</metadata>
|
||||
@@ -1,6 +0,0 @@
|
||||
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
|
||||
#Thu Dec 24 20:01:24 CST 2020
|
||||
maven-metadata-maven-central.xml/@default-maven-central-http\://central.maven.org/maven2/.lastUpdated=1608811284134
|
||||
maven-metadata-aliyun.xml.error=
|
||||
maven-metadata-maven-central.xml.error=Could not transfer metadata com.xuxueli\:xxl-job\:2.3.0-SNAPSHOT/maven-metadata.xml from/to maven-central (http\://central.maven.org/maven2/)\: Transfer failed for http\://central.maven.org/maven2/com/xuxueli/xxl-job/2.3.0-SNAPSHOT/maven-metadata.xml
|
||||
maven-metadata-aliyun.xml.lastUpdated=1608811284273
|
||||
@@ -1,145 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>A distributed task scheduling framework.</description>
|
||||
<url>https://www.xuxueli.com/</url>
|
||||
|
||||
<modules>
|
||||
<module>xxl-job-core</module>
|
||||
<module>xxl-job-admin</module>
|
||||
<module>xxl-job-executor-samples</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
|
||||
<netty-all.version>4.1.54.Final</netty-all.version>
|
||||
<gson.version>2.8.6</gson.version>
|
||||
|
||||
<spring.version>5.3.1</spring.version>
|
||||
<spring-boot.version>2.4.0</spring-boot.version>
|
||||
|
||||
<mybatis-spring-boot-starter.version>2.1.4</mybatis-spring-boot-starter.version>
|
||||
<mysql-connector-java.version>8.0.22</mysql-connector-java.version>
|
||||
|
||||
<slf4j-api.version>1.7.30</slf4j-api.version>
|
||||
<junit.version>5.7.0</junit.version>
|
||||
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
|
||||
|
||||
<groovy.version>3.0.7</groovy.version>
|
||||
|
||||
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
|
||||
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
|
||||
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
|
||||
<maven-war-plugin.version>3.3.1</maven-war-plugin.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>GNU General Public License version 3</name>
|
||||
<url>https://opensource.org/licenses/GPL-3.0</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<scm>
|
||||
<tag>master</tag>
|
||||
<url>https://github.com/xuxueli/xxl-job.git</url>
|
||||
<connection>scm:git:https://github.com/xuxueli/xxl-job.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:xuxueli/xxl-job.git</developerConnection>
|
||||
</scm>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>XXL</id>
|
||||
<name>xuxueli</name>
|
||||
<email>931591021@qq.com</email>
|
||||
<url>https://github.com/xuxueli</url>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<profiles>
|
||||
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Source -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>${maven-source-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Javadoc -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>${maven-javadoc-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<doclint>none</doclint>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- GPG -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>${maven-gpg-plugin.version}</version>
|
||||
<configuration>
|
||||
<useAgent>false</useAgent>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>oss</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>oss</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job</artifactId>
|
||||
<versioning>
|
||||
<versions>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</versions>
|
||||
<lastUpdated>20201224031327</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
||||
@@ -1,5 +0,0 @@
|
||||
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
|
||||
#Sat Apr 04 19:56:05 CST 2020
|
||||
xxl-rpc-core-1.2.1.pom>aliyun=
|
||||
xxl-rpc-core-1.2.1-sources.jar>aliyun=
|
||||
xxl-rpc-core-1.2.1.jar>aliyun=
|
||||
Binary file not shown.
@@ -1,5 +0,0 @@
|
||||
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
|
||||
#Sat Apr 04 19:56:05 CST 2020
|
||||
http\://central.maven.org/maven2/.error=Could not transfer artifact com.xuxueli\:xxl-rpc-core\:jar\:sources\:1.2.1 from/to maven-central (http\://central.maven.org/maven2/)\: central.maven.org
|
||||
@default-maven-central-http\://central.maven.org/maven2/.lastUpdated=1586001364931
|
||||
http\://maven.aliyun.com/nexus/content/groups/public/.lastUpdated=1586001365245
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
33b53883ecf6e77b8b4eafe3506e213e83b2c80a
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
27f8d667b1ede36b219f36af75b493b0e6143288
|
||||
@@ -1,143 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-rpc</artifactId>
|
||||
<version>1.2.1</version>
|
||||
</parent>
|
||||
<artifactId>xxl-rpc-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>A high performance, distributed RPC framework.</description>
|
||||
<url>http://www.xuxueli.com/</url>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- ********************** base ********************** -->
|
||||
|
||||
<!-- slf4j -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j-api.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- ********************** serialize (hessian default) ********************** -->
|
||||
|
||||
<!-- hessian -->
|
||||
<dependency>
|
||||
<groupId>com.caucho</groupId>
|
||||
<artifactId>hessian</artifactId>
|
||||
<version>${hessian.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- protostuff + objenesis (provided) -->
|
||||
<dependency>
|
||||
<groupId>io.protostuff</groupId>
|
||||
<artifactId>protostuff-core</artifactId>
|
||||
<version>${protostuff.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.protostuff</groupId>
|
||||
<artifactId>protostuff-runtime</artifactId>
|
||||
<version>${protostuff.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.objenesis</groupId>
|
||||
<artifactId>objenesis</artifactId>
|
||||
<version>${objenesis.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- jackson (provided) -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- ********************** registry (local default) ********************** -->
|
||||
|
||||
<!-- zookeeper (provided) -->
|
||||
<dependency>
|
||||
<groupId>org.apache.zookeeper</groupId>
|
||||
<artifactId>zookeeper</artifactId>
|
||||
<version>${zookeeper.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- ********************** net (jetty default) ********************** -->
|
||||
|
||||
<!-- jetty (javax.servlet-api:3.1.0;) -->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>${jetty-server.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-client</artifactId>
|
||||
<version>${jetty-server.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- netty (commons-pool2) -->
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
<version>${netty.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- mina (commons-pool2) -->
|
||||
<dependency>
|
||||
<groupId>org.apache.mina</groupId>
|
||||
<artifactId>mina-core</artifactId>
|
||||
<version>2.0.19</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- commons-pool2 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
<version>${commons-pool2.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- ********************** other ********************** -->
|
||||
|
||||
<!-- spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
bed5b85e402f8fccf7109a3d5944f45dd5cae342
|
||||
@@ -1,3 +0,0 @@
|
||||
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
|
||||
#Mon Mar 02 16:06:40 CST 2020
|
||||
xxl-rpc-1.2.1.pom>aliyun=
|
||||
@@ -1,151 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-rpc</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>A high performance, distributed RPC framework.</description>
|
||||
<url>http://www.xuxueli.com/</url>
|
||||
|
||||
<modules>
|
||||
<module>xxl-rpc-core</module>
|
||||
<!--<module>xxl-rpc-samples</module>-->
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
|
||||
|
||||
<javax.servlet-api.version>3.1.0</javax.servlet-api.version>
|
||||
<javax.servlet.jsp-api.version>2.3.3</javax.servlet.jsp-api.version>
|
||||
|
||||
<slf4j-api.version>1.7.25</slf4j-api.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
|
||||
|
||||
<netty.version>4.1.29.Final</netty.version>
|
||||
<mina.version>2.0.19</mina.version>
|
||||
<jetty-server.version>9.2.26.v20180806</jetty-server.version>
|
||||
|
||||
<commons-pool2.version>2.6.0</commons-pool2.version>
|
||||
|
||||
|
||||
<hessian.version>4.0.51</hessian.version>
|
||||
|
||||
<protostuff.version>1.6.0</protostuff.version>
|
||||
<objenesis.version>2.6</objenesis.version>
|
||||
|
||||
<jackson.version>2.9.6</jackson.version>
|
||||
|
||||
|
||||
<zookeeper.version>3.4.13</zookeeper.version>
|
||||
|
||||
|
||||
<spring.version>4.3.19.RELEASE</spring.version>
|
||||
<spring-boot.version>1.5.16.RELEASE</spring-boot.version>
|
||||
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>GNU General Public License version 3</name>
|
||||
<url>https://opensource.org/licenses/GPL-3.0</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<scm>
|
||||
<tag>master</tag>
|
||||
<url>https://github.com/xuxueli/xxl-rpc.git</url>
|
||||
<connection>scm:git:https://github.com/xuxueli/xxl-rpc.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:xuxueli/xxl-rpc.git</developerConnection>
|
||||
</scm>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>XXL</id>
|
||||
<name>xuxueli</name>
|
||||
<email>931591021@qq.com</email>
|
||||
<url>https://github.com/xuxueli</url>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Source -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Javadoc -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- GPG -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<configuration>
|
||||
<useAgent>false</useAgent>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>oss</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>oss</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
@@ -1 +0,0 @@
|
||||
370f4c4f20b218942fba34d939cbc625025e1e30
|
||||
@@ -44,9 +44,11 @@ public class DistributionOrderExecute implements OrderStatusChangeEvent, EveryDa
|
||||
public void orderChange(OrderMessage orderMessage) {
|
||||
|
||||
switch (orderMessage.getNewStatus()) {
|
||||
case PAID: {
|
||||
//订单带校验/订单代发货,则记录分销信息
|
||||
case TAKE:
|
||||
case UNDELIVERED: {
|
||||
//记录分销订单
|
||||
distributionOrderService.payOrder(orderMessage.getOrderSn());
|
||||
distributionOrderService.calculationDistribution(orderMessage.getOrderSn());
|
||||
break;
|
||||
}
|
||||
case CANCELLED: {
|
||||
|
||||
@@ -79,9 +79,9 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent {
|
||||
tradeDTO.getCartList().forEach(
|
||||
cartVO -> {
|
||||
//有满减优惠,则记录信息
|
||||
if (cartVO.getGiftList() != null && cartVO.getGiftList().size() > 0
|
||||
&& cartVO.getGiftPoint() != null && cartVO.getGiftPoint() > 0
|
||||
&& cartVO.getGiftCouponList() != null && cartVO.getGiftCouponList().size() > 0) {
|
||||
if ((cartVO.getGiftList() != null && !cartVO.getGiftList().isEmpty())
|
||||
|| (cartVO.getGiftPoint() != null && cartVO.getGiftPoint() > 0)
|
||||
|| (cartVO.getGiftCouponList() != null && !cartVO.getGiftCouponList().isEmpty())) {
|
||||
cache.put(CachePrefix.ORDER.getPrefix() + cartVO.getSn(), cartVO);
|
||||
}
|
||||
}
|
||||
@@ -90,8 +90,8 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent {
|
||||
|
||||
@Override
|
||||
public void orderChange(OrderMessage orderMessage) {
|
||||
System.out.println(CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn());
|
||||
if (orderMessage.getNewStatus().equals(OrderStatusEnum.PAID)) {
|
||||
log.debug("满减活动,订单状态操作 {}", CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn());
|
||||
renderGift((CartVO) cache.get(CachePrefix.ORDER.getPrefix() + orderMessage.getOrderSn()), orderMessage);
|
||||
}
|
||||
}
|
||||
@@ -118,10 +118,8 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent {
|
||||
|
||||
try {
|
||||
//优惠券判定
|
||||
if (cartVO.getGiftCouponList() != null && cartVO.getGiftCouponList().size() > 0) {
|
||||
cartVO.getGiftCouponList().forEach(couponId -> {
|
||||
memberCouponService.receiveCoupon(couponId, order.getMemberId(), order.getMemberName());
|
||||
});
|
||||
if (cartVO.getGiftCouponList() != null && !cartVO.getGiftCouponList().isEmpty()) {
|
||||
cartVO.getGiftCouponList().forEach(couponId -> memberCouponService.receiveCoupon(couponId, order.getMemberId(), order.getMemberName()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("订单赠送优惠券异常", e);
|
||||
@@ -129,7 +127,7 @@ public class FullDiscountExecute implements TradeEvent, OrderStatusChangeEvent {
|
||||
|
||||
try {
|
||||
//赠品潘迪ing
|
||||
if (cartVO.getGiftList() != null && cartVO.getGiftList().size() > 0) {
|
||||
if (cartVO.getGiftList() != null && !cartVO.getGiftList().isEmpty()) {
|
||||
generatorGiftOrder(cartVO.getGiftList(), order);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -17,6 +17,7 @@ import cn.lili.modules.order.order.entity.dos.Order;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderMessage;
|
||||
import cn.lili.modules.order.order.entity.enums.OrderPromotionTypeEnum;
|
||||
import cn.lili.modules.order.order.entity.enums.OrderStatusEnum;
|
||||
import cn.lili.modules.order.order.entity.enums.PayStatusEnum;
|
||||
import cn.lili.modules.order.order.service.OrderService;
|
||||
import cn.lili.modules.order.trade.entity.enums.AfterSaleStatusEnum;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
@@ -62,7 +63,7 @@ public class MemberPointExecute implements MemberRegisterEvent, GoodsCommentComp
|
||||
//获取积分设置
|
||||
PointSetting pointSetting = getPointSetting();
|
||||
//赠送会员积分
|
||||
memberService.updateMemberPoint(Long.valueOf(pointSetting.getRegister().longValue()), PointTypeEnum.INCREASE.name(), member.getId(), "会员注册,赠送积分" + pointSetting.getRegister() + "分");
|
||||
memberService.updateMemberPoint(pointSetting.getRegister().longValue(), PointTypeEnum.INCREASE.name(), member.getId(), "会员注册,赠送积分" + pointSetting.getRegister() + "分");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,7 +76,7 @@ public class MemberPointExecute implements MemberRegisterEvent, GoodsCommentComp
|
||||
//获取积分设置
|
||||
PointSetting pointSetting = getPointSetting();
|
||||
//赠送会员积分
|
||||
memberService.updateMemberPoint(Long.valueOf(pointSetting.getComment().longValue()), PointTypeEnum.INCREASE.name(), memberEvaluation.getMemberId(), "会员评价,赠送积分" + pointSetting.getComment() + "分");
|
||||
memberService.updateMemberPoint(pointSetting.getComment().longValue(), PointTypeEnum.INCREASE.name(), memberEvaluation.getMemberId(), "会员评价,赠送积分" + pointSetting.getComment() + "分");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,30 +87,43 @@ public class MemberPointExecute implements MemberRegisterEvent, GoodsCommentComp
|
||||
@Override
|
||||
public void orderChange(OrderMessage orderMessage) {
|
||||
|
||||
if (orderMessage.getNewStatus().equals(OrderStatusEnum.COMPLETED)) {
|
||||
Order order = orderService.getBySn(orderMessage.getOrderSn());
|
||||
//根据订单编号获取订单数据,如果订单促销类型不为空,并且订单促销类型为积分订单 则直接返回
|
||||
if (StringUtils.isNotEmpty(order.getOrderPromotionType()) && order.getOrderPromotionType().equals(OrderPromotionTypeEnum.POINTS.name())) {
|
||||
return;
|
||||
switch (orderMessage.getNewStatus()) {
|
||||
case CANCELLED: {
|
||||
Order order = orderService.getBySn(orderMessage.getOrderSn());
|
||||
Long point = order.getPriceDetailDTO().getPayPoint();
|
||||
if (point <= 0) {
|
||||
return;
|
||||
}
|
||||
//如果未付款,则不去要退回相关代码执行
|
||||
if (order.getPayStatus().equals(PayStatusEnum.UNPAID.name())) {
|
||||
return;
|
||||
}
|
||||
String content = "订单取消,积分返还:" + point + "分";
|
||||
//赠送会员积分
|
||||
memberService.updateMemberPoint(point, PointTypeEnum.INCREASE.name(), order.getMemberId(), content);
|
||||
break;
|
||||
}
|
||||
//获取积分设置
|
||||
PointSetting pointSetting = getPointSetting();
|
||||
//计算赠送积分数量
|
||||
Double point = CurrencyUtil.mul(pointSetting.getMoney(), order.getFlowPrice(), 0);
|
||||
//赠送会员积分
|
||||
memberService.updateMemberPoint(point.longValue(), PointTypeEnum.INCREASE.name(), order.getMemberId(), "会员下单,赠送积分" + point + "分");
|
||||
//取消订单恢复积分
|
||||
} else if (orderMessage.getNewStatus().equals(OrderStatusEnum.CANCELLED)) {
|
||||
//根据订单编号获取订单数据,如果为积分订单则跳回
|
||||
Order order = orderService.getBySn(orderMessage.getOrderSn());
|
||||
//增加对积分订单的判定,如果积分支付,取消订单则退还用户积分
|
||||
if (StringUtils.isNotEmpty(order.getOrderPromotionType()) &&
|
||||
order.getOrderPromotionType().equals(OrderPromotionTypeEnum.POINTS.name()) && order.getPriceDetailDTO().getPayPoint() != null) {
|
||||
memberService.updateMemberPoint(Convert.toLong(order.getPriceDetailDTO().getPayPoint()), PointTypeEnum.INCREASE.name(), order.getMemberId(), "订单取消,恢复积分:" + order.getPriceDetailDTO().getPayPoint() + "分");
|
||||
case COMPLETED: {
|
||||
Order order = orderService.getBySn(orderMessage.getOrderSn());
|
||||
//根据订单编号获取订单数据,如果订单促销类型不为空,并且订单促销类型为积分订单 则直接返回
|
||||
if (StringUtils.isNotEmpty(order.getOrderPromotionType()) && order.getOrderPromotionType().equals(OrderPromotionTypeEnum.POINTS.name())) {
|
||||
return;
|
||||
}
|
||||
//获取积分设置
|
||||
PointSetting pointSetting = getPointSetting();
|
||||
//计算赠送积分数量
|
||||
Double point = CurrencyUtil.mul(pointSetting.getMoney(), order.getFlowPrice(), 0);
|
||||
//赠送会员积分
|
||||
memberService.updateMemberPoint(point.longValue(), PointTypeEnum.INCREASE.name(), order.getMemberId(), "会员下单,赠送积分" + point + "分");
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 提交售后后扣除积分
|
||||
*
|
||||
|
||||
@@ -3,7 +3,7 @@ package cn.lili.event.impl;
|
||||
import cn.lili.event.TradeEvent;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.order.service.TradeService;
|
||||
import cn.lili.modules.payment.kit.enums.PaymentMethodEnum;
|
||||
import cn.lili.modules.payment.entity.enums.PaymentMethodEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import cn.lili.modules.order.order.entity.enums.PayStatusEnum;
|
||||
import cn.lili.modules.order.order.service.OrderService;
|
||||
import cn.lili.modules.payment.entity.RefundLog;
|
||||
import cn.lili.modules.payment.kit.Payment;
|
||||
import cn.lili.modules.payment.kit.enums.PaymentMethodEnum;
|
||||
import cn.lili.modules.payment.entity.enums.PaymentMethodEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
package cn.lili.event.impl;
|
||||
|
||||
import cn.lili.event.OrderStatusChangeEvent;
|
||||
import cn.lili.modules.member.entity.enums.PointTypeEnum;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.modules.order.order.entity.dos.Order;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderMessage;
|
||||
import cn.lili.modules.order.order.entity.enums.PayStatusEnum;
|
||||
import cn.lili.modules.order.order.service.OrderService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 积分
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2021-03-13 16:58
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PointExecute implements OrderStatusChangeEvent {
|
||||
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
@Override
|
||||
public void orderChange(OrderMessage orderMessage) {
|
||||
|
||||
switch (orderMessage.getNewStatus()) {
|
||||
case CANCELLED:
|
||||
Order order = orderService.getBySn(orderMessage.getOrderSn());
|
||||
Long point = order.getPriceDetailDTO().getPayPoint();
|
||||
if (point <= 0) {
|
||||
return;
|
||||
}
|
||||
//如果未付款,则不去要退回相关代码执行
|
||||
if (order.getPayStatus().equals(PayStatusEnum.UNPAID.name())) {
|
||||
return;
|
||||
}
|
||||
//如果他不处于连续赠送阶段,则只赠送签到积分数
|
||||
String content = "订单取消,积分返还:" + point + "分";
|
||||
//赠送会员积分
|
||||
memberService.updateMemberPoint(point, PointTypeEnum.INCREASE.name(), order.getMemberId(), content);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -123,7 +123,8 @@ public class StockUpdateExecute implements OrderStatusChangeEvent {
|
||||
//获取订单详情
|
||||
OrderDetailVO order = orderService.queryDetail(orderMessage.getOrderSn());
|
||||
//判定是否已支付 并且 非库存不足导致库存回滚 则需要考虑订单库存返还业务
|
||||
if (order.getOrder().getPayStatus().equals(PayStatusEnum.PAID.name()) && order.getOrder().getCancelReason().equals(outOfStockMessage)) {
|
||||
if (order.getOrder().getPayStatus().equals(PayStatusEnum.PAID.name())
|
||||
&& !order.getOrder().getCancelReason().equals(outOfStockMessage)) {
|
||||
//库存key 和 还原数量
|
||||
List<String> keys = new ArrayList<>();
|
||||
List<String> values = new ArrayList<>();
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package cn.lili.listener;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.properties.RocketmqCustomProperties;
|
||||
import cn.lili.event.GoodsCommentCompleteEvent;
|
||||
import cn.lili.modules.distribution.entity.dos.DistributionGoods;
|
||||
import cn.lili.modules.distribution.entity.dos.DistributionSelectedGoods;
|
||||
@@ -26,9 +29,11 @@ import cn.lili.modules.member.service.FootprintService;
|
||||
import cn.lili.modules.member.service.GoodsCollectionService;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||
import cn.lili.modules.search.service.EsGoodsIndexService;
|
||||
import cn.lili.modules.search.utils.EsIndexUtil;
|
||||
import cn.lili.modules.store.entity.dos.StoreGoodsLabel;
|
||||
import cn.lili.modules.store.service.StoreGoodsLabelService;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
|
||||
import cn.lili.rocketmq.tags.GoodsTagsEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@@ -36,12 +41,14 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.rocketmq.common.message.MessageExt;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 商品消息
|
||||
@@ -115,6 +122,17 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
||||
@Autowired
|
||||
private StoreGoodsLabelService storeGoodsLabelService;
|
||||
|
||||
/**
|
||||
* rocketMq
|
||||
*/
|
||||
@Autowired
|
||||
private RocketMQTemplate rocketMQTemplate;
|
||||
/**
|
||||
* rocketMq配置
|
||||
*/
|
||||
@Autowired
|
||||
private RocketmqCustomProperties rocketmqCustomProperties;
|
||||
|
||||
@Override
|
||||
public void onMessage(MessageExt messageExt) {
|
||||
|
||||
@@ -137,16 +155,25 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
||||
case UPDATE_GOODS_INDEX:
|
||||
try {
|
||||
String goodsIdsJsonStr = new String(messageExt.getBody());
|
||||
List<Goods> goodsList = new ArrayList<>();
|
||||
for (String goodsId : JSONUtil.toList(goodsIdsJsonStr, String.class)) {
|
||||
Goods goods = goodsService.getById(goodsId);
|
||||
goodsList.add(goods);
|
||||
}
|
||||
List<Goods> goodsList = goodsService.list(new LambdaQueryWrapper<Goods>().in(Goods::getId, JSONUtil.toList(goodsIdsJsonStr, String.class)));
|
||||
this.updateGoodsIndex(goodsList);
|
||||
} catch (Exception e) {
|
||||
log.error("更新商品索引事件执行异常,商品信息 {}", new String(messageExt.getBody()));
|
||||
}
|
||||
break;
|
||||
case UPDATE_GOODS_INDEX_FIELD:
|
||||
try {
|
||||
String updateIndexFieldsJsonStr = new String(messageExt.getBody());
|
||||
JSONObject updateIndexFields = JSONUtil.parseObj(updateIndexFieldsJsonStr);
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> queryFields = updateIndexFields.get("queryFields", Map.class);
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> updateFields = updateIndexFields.get("updateFields", Map.class);
|
||||
goodsIndexService.updateIndex(queryFields, updateFields);
|
||||
} catch (Exception e) {
|
||||
log.error("更新商品索引事件执行异常,商品信息 {}", new String(messageExt.getBody()));
|
||||
}
|
||||
break;
|
||||
case RESET_GOODS_INDEX:
|
||||
try {
|
||||
String goodsIdsJsonStr = new String(messageExt.getBody());
|
||||
@@ -261,9 +288,11 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
||||
* @param goodsSkuList 商品sku信息
|
||||
*/
|
||||
private void generatorGoodsIndex(Goods goods, List<GoodsSku> goodsSkuList) {
|
||||
int skuSource = 100;
|
||||
for (GoodsSku goodsSku : goodsSkuList) {
|
||||
EsGoodsIndex esGoodsOld = goodsIndexService.findById(goodsSku.getId());
|
||||
EsGoodsIndex goodsIndex = this.settingUpGoodsIndexData(goods, goodsSku);
|
||||
goodsIndex.setSkuSource(skuSource--);
|
||||
//如果商品库存不为0,并且es中有数据
|
||||
if (goodsSku.getQuantity() > 0 && esGoodsOld == null) {
|
||||
log.info("生成商品索引 {}", goodsIndex);
|
||||
@@ -385,6 +414,13 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
||||
int buyCount = goodsSku.getBuyCount() + goodsCompleteMessage.getBuyNum();
|
||||
goodsSku.setBuyCount(buyCount);
|
||||
goodsSkuService.update(goodsSku);
|
||||
|
||||
//修改规格索引,发送mq消息
|
||||
Map<String, Object> updateIndexFieldsMap = EsIndexUtil.getUpdateIndexFieldsMap(
|
||||
MapUtil.builder().put("id", goodsCompleteMessage.getSkuId()).build(),
|
||||
MapUtil.builder().put("buyCount", buyCount).build());
|
||||
String destination = rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.UPDATE_GOODS_INDEX_FIELD.name();
|
||||
rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(updateIndexFieldsMap), RocketmqSendCallbackBuilder.commonCallback());
|
||||
goodsIndexService.updateIndex(goodsCompleteMessage.getSkuId(), new EsGoodsIndex().setBuyCount(buyCount));
|
||||
} else {
|
||||
log.error("商品SkuId为[" + goodsCompleteMessage.getGoodsId() + "的商品不存在,更新商品失败!");
|
||||
|
||||
@@ -2,11 +2,9 @@ package cn.lili.listener;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.enums.SwitchEnum;
|
||||
import cn.lili.rocketmq.tags.OtherTagsEnum;
|
||||
import cn.lili.modules.system.sms.SmsUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.entity.vo.MemberSearchVO;
|
||||
import cn.lili.modules.member.entity.vo.MemberVO;
|
||||
import cn.lili.modules.member.mapper.MemberMapper;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.modules.message.entity.dos.MemberMessage;
|
||||
@@ -20,6 +18,8 @@ import cn.lili.modules.message.service.MemberMessageService;
|
||||
import cn.lili.modules.message.service.StoreMessageService;
|
||||
import cn.lili.modules.store.entity.dos.Store;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
import cn.lili.modules.system.sms.SmsUtil;
|
||||
import cn.lili.rocketmq.tags.OtherTagsEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.rocketmq.common.message.MessageExt;
|
||||
@@ -169,7 +169,7 @@ public class NoticeSendMessageListener implements RocketMQListener<MessageExt> {
|
||||
PageVO pageVO = new PageVO();
|
||||
pageVO.setPageSize(pageSize);
|
||||
pageVO.setPageNumber(i);
|
||||
IPage<Member> page = memberService.getMemberPage(memberSearchVO, pageVO);
|
||||
IPage<MemberVO> page = memberService.getMemberPage(memberSearchVO, pageVO);
|
||||
//循环要保存的信息
|
||||
page.getRecords().forEach(item -> {
|
||||
MemberMessage memberMessage = new MemberMessage();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.lili.timetask.handler.impl.coupon;
|
||||
|
||||
import cn.lili.common.utils.DateUtil;
|
||||
import cn.lili.modules.promotion.entity.dos.MemberCoupon;
|
||||
import cn.lili.modules.promotion.entity.enums.MemberCouponStatusEnum;
|
||||
import cn.lili.modules.promotion.service.MemberCouponService;
|
||||
@@ -8,6 +9,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 优惠券状态监测
|
||||
*
|
||||
@@ -20,7 +24,7 @@ public class CouponExecute implements EveryDayExecute {
|
||||
/**
|
||||
* 过期常量,过期后或者使用后一定时间内,删除无效的优惠券,物理删除
|
||||
*/
|
||||
static final int EXPIRATION_DAY = 7;
|
||||
static final int EXPIRATION_DAY = 3;
|
||||
|
||||
@Autowired
|
||||
private MemberCouponService memberCouponService;
|
||||
@@ -34,16 +38,20 @@ public class CouponExecute implements EveryDayExecute {
|
||||
//将过期优惠券变更为过期状体
|
||||
LambdaUpdateWrapper<MemberCoupon> updateWrapper = new LambdaUpdateWrapper<MemberCoupon>()
|
||||
.eq(MemberCoupon::getMemberCouponStatus, MemberCouponStatusEnum.NEW.name())
|
||||
.le(MemberCoupon::getEndTime, System.currentTimeMillis())
|
||||
.le(MemberCoupon::getEndTime, new Date())
|
||||
.set(MemberCoupon::getMemberCouponStatus, MemberCouponStatusEnum.EXPIRE.name());
|
||||
this.memberCouponService.update(updateWrapper);
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + EXPIRATION_DAY);
|
||||
Date removeTime = calendar.getTime();
|
||||
//删除过期/已使用的优惠券
|
||||
LambdaUpdateWrapper<MemberCoupon> deleteWrapper = new LambdaUpdateWrapper<MemberCoupon>()
|
||||
//如果结束时间小于 当前时间增加指定删除日期,则删除
|
||||
.le(MemberCoupon::getEndTime, System.currentTimeMillis() + 24 * 60 * 60 * 1000 * EXPIRATION_DAY);
|
||||
.le(MemberCoupon::getEndTime, removeTime);
|
||||
this.memberCouponService.remove(deleteWrapper);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -99,20 +99,21 @@ public class OrderEveryDayTaskExecute implements EveryDayExecute {
|
||||
*/
|
||||
private void completedOrder(OrderSetting orderSetting) {
|
||||
|
||||
|
||||
//订单自动收货时间 = 当前时间 - 自动收货时间天数
|
||||
DateTime receiveTime = DateUtil.offsetDay(DateUtil.date(), -orderSetting.getAutoReceive());
|
||||
LambdaQueryWrapper<Order> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Order::getOrderStatus, OrderStatusEnum.DELIVERED.name());
|
||||
|
||||
//订单发货时间 >= 订单自动收货时间
|
||||
queryWrapper.ge(Order::getLogisticsTime, receiveTime);
|
||||
queryWrapper.le(Order::getLogisticsTime, receiveTime);
|
||||
List<Order> list = orderService.list(queryWrapper);
|
||||
|
||||
//判断是否有符合条件的订单,进行订单完成处理
|
||||
if (!list.isEmpty()) {
|
||||
List<String> receiveSnList = list.stream().map(Order::getSn).collect(Collectors.toList());
|
||||
for (String orderSn : receiveSnList) {
|
||||
orderService.complete(orderSn);
|
||||
orderService.systemComplete(orderSn);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,7 +129,7 @@ public class OrderEveryDayTaskExecute implements EveryDayExecute {
|
||||
|
||||
//订单完成时间 <= 订单自动好评时间
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.ge("o.complete_time", receiveTime);
|
||||
queryWrapper.le("o.complete_time", receiveTime);
|
||||
queryWrapper.eq("oi.comment_status", CommentStatusEnum.UNFINISHED.name());
|
||||
List<OrderItem> orderItems = orderItemMapper.waitOperationOrderItem(queryWrapper);
|
||||
|
||||
@@ -163,7 +164,7 @@ public class OrderEveryDayTaskExecute implements EveryDayExecute {
|
||||
|
||||
//关闭售后订单=未售后订单+小于订单关闭售后申请时间
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.ge("o.complete_time", receiveTime);
|
||||
queryWrapper.le("o.complete_time", receiveTime);
|
||||
queryWrapper.eq("oi.after_sale_status", OrderItemAfterSaleStatusEnum.NOT_APPLIED.name());
|
||||
List<OrderItem> orderItems = orderItemMapper.waitOperationOrderItem(queryWrapper);
|
||||
|
||||
@@ -194,7 +195,7 @@ public class OrderEveryDayTaskExecute implements EveryDayExecute {
|
||||
|
||||
//关闭售后订单=未售后订单+小于订单关闭售后申请时间
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.ge("o.complete_time", receiveTime);
|
||||
queryWrapper.le("o.complete_time", receiveTime);
|
||||
queryWrapper.eq("oi.complain_status", OrderComplaintStatusEnum.NO_APPLY.name());
|
||||
List<OrderItem> orderItems = orderItemMapper.waitOperationOrderItem(queryWrapper);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package cn.lili.timetask.handler.impl.statistics;
|
||||
|
||||
import cn.lili.modules.statistics.model.dos.MemberStatisticsData;
|
||||
import cn.lili.modules.statistics.entity.dos.MemberStatisticsData;
|
||||
import cn.lili.modules.statistics.service.MemberStatisticsDataService;
|
||||
import cn.lili.timetask.handler.EveryDayExecute;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -4,7 +4,7 @@ import cn.lili.cache.Cache;
|
||||
import cn.lili.cache.CachePrefix;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.properties.StatisticsProperties;
|
||||
import cn.lili.modules.statistics.model.vo.OnlineMemberVO;
|
||||
import cn.lili.modules.statistics.entity.vo.OnlineMemberVO;
|
||||
import cn.lili.timetask.handler.EveryHourExecute;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -28,7 +28,7 @@ public class OnlineMemberStatistics implements EveryHourExecute {
|
||||
* 缓存
|
||||
*/
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
private Cache<List<OnlineMemberVO>> cache;
|
||||
/**
|
||||
* 统计小时
|
||||
*/
|
||||
@@ -41,12 +41,10 @@ public class OnlineMemberStatistics implements EveryHourExecute {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
Object object = cache.get(CachePrefix.ONLINE_MEMBER.getPrefix());
|
||||
List<OnlineMemberVO> onlineMemberVOS;
|
||||
if (object == null) {
|
||||
List<OnlineMemberVO> onlineMemberVOS = cache.get(CachePrefix.ONLINE_MEMBER.getPrefix());
|
||||
|
||||
if (onlineMemberVOS == null) {
|
||||
onlineMemberVOS = new ArrayList<>();
|
||||
} else {
|
||||
onlineMemberVOS = (List<OnlineMemberVO>) object;
|
||||
}
|
||||
|
||||
//过滤 有效统计时间
|
||||
@@ -80,12 +78,10 @@ public class OnlineMemberStatistics implements EveryHourExecute {
|
||||
*/
|
||||
public void execute(Date time, Integer num) {
|
||||
|
||||
Object object = cache.get(CachePrefix.ONLINE_MEMBER.getPrefix());
|
||||
List<OnlineMemberVO> onlineMemberVOS;
|
||||
if (object == null) {
|
||||
List<OnlineMemberVO> onlineMemberVOS = cache.get(CachePrefix.ONLINE_MEMBER.getPrefix());
|
||||
|
||||
if (onlineMemberVOS == null) {
|
||||
onlineMemberVOS = new ArrayList<>();
|
||||
} else {
|
||||
onlineMemberVOS = (List<OnlineMemberVO>) object;
|
||||
}
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
@@ -96,9 +92,8 @@ public class OnlineMemberStatistics implements EveryHourExecute {
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - 48);
|
||||
|
||||
Calendar finalCalendar = calendar;
|
||||
onlineMemberVOS = onlineMemberVOS.stream()
|
||||
.filter(onlineMemberVO -> onlineMemberVO.getDate().after(finalCalendar.getTime()))
|
||||
.filter(onlineMemberVO -> onlineMemberVO.getDate().after(calendar.getTime()))
|
||||
.collect(Collectors.toList());
|
||||
onlineMemberVOS.add(new OnlineMemberVO(time, num));
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import cn.hutool.core.convert.Convert;
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.cache.CachePrefix;
|
||||
import cn.lili.common.utils.BeanUtil;
|
||||
import cn.lili.modules.statistics.model.dos.PlatformViewData;
|
||||
import cn.lili.modules.statistics.entity.dos.PlatformViewData;
|
||||
import cn.lili.modules.statistics.service.PlatformViewDataService;
|
||||
import cn.lili.timetask.handler.EveryDayExecute;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -25,6 +25,8 @@ management:
|
||||
exposure:
|
||||
include: '*'
|
||||
spring:
|
||||
application:
|
||||
name: consumer
|
||||
# 要在其中注册的Spring Boot Admin Server的URL。
|
||||
boot:
|
||||
admin:
|
||||
@@ -33,8 +35,7 @@ spring:
|
||||
# mongodb
|
||||
data:
|
||||
mongodb:
|
||||
host: 127.0.0.1
|
||||
port: 27017
|
||||
uri: 127.0.0.1:27017
|
||||
database: lilishop
|
||||
username: root
|
||||
password: lilishop
|
||||
@@ -119,7 +120,7 @@ spring:
|
||||
props:
|
||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||
sql:
|
||||
show: false
|
||||
show: true
|
||||
|
||||
# 忽略鉴权url
|
||||
ignored:
|
||||
@@ -184,6 +185,7 @@ mybatis-plus:
|
||||
|
||||
# 日志
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: info
|
||||
@@ -193,10 +195,12 @@ logging:
|
||||
file:
|
||||
# 指定路径
|
||||
path: lili-logs
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-size: 5MB
|
||||
logback:
|
||||
rollingpolicy:
|
||||
# 最大保存天数
|
||||
max-history: 7
|
||||
# 每个文件最大大小
|
||||
max-file-size: 5MB
|
||||
#加密参数
|
||||
jasypt:
|
||||
encryptor:
|
||||
@@ -253,7 +257,8 @@ lili:
|
||||
# account:
|
||||
# username: elastic
|
||||
# password: LiLiShopES
|
||||
|
||||
logstash:
|
||||
server: 127.0.0.1:4560
|
||||
rocketmq:
|
||||
promotion-topic: lili_promotion_topic
|
||||
promotion-group: lili_promotion_group
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
|
||||
<!--应用名称-->
|
||||
<property name="APP_NAME" value="consumer"/>
|
||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name"/>
|
||||
<!--日志文件保存路径-->
|
||||
<property name="LOG_FILE_PATH" value="lili-logs"/>
|
||||
<springProperty scope="context" name="LOG_FILE_PATH" source="logging.file.path"/>
|
||||
<springProperty scope="context" name="LOGSTASH_SERVER" source="lili.data.logstash.server"/>
|
||||
<contextName>${APP_NAME}</contextName>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
@@ -22,7 +23,7 @@
|
||||
<!--输出到elk的LOGSTASH-->
|
||||
<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<!-- 配置elk日志收集 配饰的是 LOGSTASH 的地址-->
|
||||
<destination>192.168.0.116:4560</destination>
|
||||
<destination>${LOGSTASH_SERVER}</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
|
||||
<providers>
|
||||
<timestamp>
|
||||
@@ -3,7 +3,7 @@ package cn.lili.buyer.test.cart;
|
||||
import cn.lili.event.impl.StockUpdateExecute;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderMessage;
|
||||
import cn.lili.modules.order.order.entity.enums.OrderStatusEnum;
|
||||
import cn.lili.modules.payment.kit.enums.PaymentMethodEnum;
|
||||
import cn.lili.modules.payment.entity.enums.PaymentMethodEnum;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
1
docker-image.sh
Normal file
1
docker-image.sh
Normal file
@@ -0,0 +1 @@
|
||||
mvn clean package docker:build -DskipTests -DpushImage
|
||||
@@ -108,11 +108,6 @@
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>swagger-bootstrap-ui</artifactId>
|
||||
<version>${swagger-bootstrap-ui-version}</version>
|
||||
</dependency>
|
||||
<!-- Hutool工具包 -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
@@ -136,12 +131,6 @@
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>${jasypt-version}</version>
|
||||
</dependency>
|
||||
<!-- 模板引擎 -->
|
||||
<dependency>
|
||||
<groupId>com.ibeetl</groupId>
|
||||
<artifactId>beetl</artifactId>
|
||||
<version>${beetl-version}</version>
|
||||
</dependency>
|
||||
<!-- 阿里云核心包-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
@@ -276,11 +265,11 @@
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
<version>${logstash-logback-encoder}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.interceptor</groupId>
|
||||
<artifactId>javax.interceptor-api</artifactId>
|
||||
<version>${interceptor-api}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>javax.interceptor</groupId>-->
|
||||
<!-- <artifactId>javax.interceptor-api</artifactId>-->
|
||||
<!-- <version>${interceptor-api}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
@@ -313,6 +302,13 @@
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>${commons-text}</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer -->
|
||||
<dependency>
|
||||
<groupId>com.googlecode.owasp-java-html-sanitizer</groupId>
|
||||
<artifactId>owasp-java-html-sanitizer</artifactId>
|
||||
<version>${owasp-java-html-sanitizer}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ public interface Cache<T> {
|
||||
*
|
||||
* @param key 缓存key
|
||||
*/
|
||||
void remove(Object key);
|
||||
Boolean remove(Object key);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cn.lili.cache;
|
||||
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.enums.PromotionTypeEnum;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
|
||||
/**
|
||||
* 缓存前缀
|
||||
@@ -469,6 +469,14 @@ public enum CachePrefix {
|
||||
* 店铺分类
|
||||
*/
|
||||
STORE_CATEGORY,
|
||||
/**
|
||||
* 用户菜单
|
||||
*/
|
||||
MENU_USER_ID,
|
||||
/**
|
||||
* 用户菜单
|
||||
*/
|
||||
USER_MENU,
|
||||
/**
|
||||
* 订单暂时缓存
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.mongodb.config.AbstractMongoClientConfiguration;
|
||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
@@ -21,11 +22,8 @@ public class MongoConfig extends AbstractMongoClientConfiguration {
|
||||
@Value("${spring.data.mongodb.database}")
|
||||
private String databaseName;
|
||||
|
||||
@Value("${spring.data.mongodb.host}")
|
||||
private String host;
|
||||
|
||||
@Value("${spring.data.mongodb.port}")
|
||||
private Integer port;
|
||||
@Value("${spring.data.mongodb.uri}")
|
||||
private List<String> uri = new ArrayList<>();
|
||||
|
||||
@Value("${spring.data.mongodb.username}")
|
||||
private String username;
|
||||
@@ -44,7 +42,14 @@ public class MongoConfig extends AbstractMongoClientConfiguration {
|
||||
@Override
|
||||
protected void configureClientSettings(MongoClientSettings.Builder builder) {
|
||||
builder.credential(MongoCredential.createCredential(username, authenticationDatabase, password.toCharArray()))
|
||||
.applyToClusterSettings(settings -> settings.hosts(Collections.singletonList(new ServerAddress(host, port))));
|
||||
.applyToClusterSettings(settings -> {
|
||||
List<ServerAddress> serverAddresses = new ArrayList<>();
|
||||
for (String s : uri) {
|
||||
String[] node = s.split(":");
|
||||
serverAddresses.add(new ServerAddress(node[0], Integer.parseInt(node[1])));
|
||||
}
|
||||
settings.hosts(serverAddresses);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,9 +78,9 @@ public class RedisCache implements Cache {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Object key) {
|
||||
public Boolean remove(Object key) {
|
||||
|
||||
redisTemplate.delete(key);
|
||||
return redisTemplate.delete(key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package cn.lili.common.context;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* 过滤路径
|
||||
* @author Chopper
|
||||
*/
|
||||
@Configuration
|
||||
public class ContextConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(new ThreadContextHolderInterceptorAdapter()).addPathPatterns("/**");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +1,29 @@
|
||||
package cn.lili.common.context;
|
||||
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 用户上下文
|
||||
* request / response 获取工具
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/10/16
|
||||
**/
|
||||
public class ThreadContextHolder {
|
||||
|
||||
private static final ThreadLocal<HttpServletRequest> REQUEST_THREAD_LOCAL_HOLDER = new ThreadLocal<>();
|
||||
private static final ThreadLocal<HttpServletResponse> RESPONSE_THREAD_LOCAL_HOLDER = new ThreadLocal<>();
|
||||
|
||||
public static void remove() {
|
||||
REQUEST_THREAD_LOCAL_HOLDER.remove();
|
||||
RESPONSE_THREAD_LOCAL_HOLDER.remove();
|
||||
}
|
||||
|
||||
public static HttpServletResponse getHttpResponse() {
|
||||
|
||||
return RESPONSE_THREAD_LOCAL_HOLDER.get();
|
||||
}
|
||||
|
||||
public static void setHttpResponse(HttpServletResponse response) {
|
||||
RESPONSE_THREAD_LOCAL_HOLDER.set(response);
|
||||
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
assert servletRequestAttributes != null;
|
||||
return servletRequestAttributes.getResponse();
|
||||
}
|
||||
|
||||
public static HttpServletRequest getHttpRequest() {
|
||||
return REQUEST_THREAD_LOCAL_HOLDER.get();
|
||||
}
|
||||
|
||||
public static void setHttpRequest(HttpServletRequest request) {
|
||||
|
||||
REQUEST_THREAD_LOCAL_HOLDER.set(request);
|
||||
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
assert servletRequestAttributes != null;
|
||||
return servletRequestAttributes.getRequest();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
package cn.lili.common.context;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
/**
|
||||
* request response 填充
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v4.0
|
||||
* @since 2020/12/9 10:44
|
||||
*/
|
||||
public class ThreadContextHolderInterceptorAdapter extends HandlerInterceptorAdapter {
|
||||
|
||||
|
||||
/**
|
||||
* 拦截request和response并放到上下文中
|
||||
*
|
||||
* @param request 请求
|
||||
* @param response 响应
|
||||
* @param handler 处理程序
|
||||
* @return 处理结果
|
||||
* @throws Exception 未知异常
|
||||
*/
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request,
|
||||
HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
ThreadContextHolder.setHttpResponse(response);
|
||||
ThreadContextHolder.setHttpRequest(request);
|
||||
|
||||
return super.preHandle(request, response, handler);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从上下文中移除 request 和response
|
||||
*
|
||||
* @param request 请求
|
||||
* @param response 响应
|
||||
* @param handler 处理程序
|
||||
* @param ex 异常
|
||||
* @throws Exception 完成之前处理异常
|
||||
*/
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable Exception ex) throws Exception {
|
||||
ThreadContextHolder.remove();
|
||||
|
||||
super.afterCompletion(request, response, handler, ex);
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package cn.lili.common.context.interceptor;
|
||||
|
||||
import cn.lili.common.context.ThreadContextHolder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 写入request/response
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* @since 2020-06-13 13:38
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RequestInterceptorAdapter extends HandlerInterceptorAdapter {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
|
||||
Object handler) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response,
|
||||
Object handler, ModelAndView modelAndView) throws Exception {
|
||||
|
||||
ThreadContextHolder.setHttpResponse(response);
|
||||
ThreadContextHolder.setHttpRequest(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response,
|
||||
Object handler, Exception ex) throws Exception {
|
||||
ThreadContextHolder.remove();
|
||||
|
||||
super.afterCompletion(request, response, handler, ex);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package cn.lili.common.context.interceptor;
|
||||
|
||||
import cn.lili.common.properties.IgnoredUrlsProperties;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* 过滤路径
|
||||
*
|
||||
* @author Chopper
|
||||
*/
|
||||
@Configuration
|
||||
public class UrlConfiguration implements WebMvcConfigurer {
|
||||
@Autowired
|
||||
private IgnoredUrlsProperties ignoredUrlsProperties;
|
||||
@Autowired
|
||||
private RequestInterceptorAdapter requestInterceptorAdapter;
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
//注册拦截器
|
||||
InterceptorRegistration ir = registry.addInterceptor(requestInterceptorAdapter);
|
||||
//配置拦截的路径
|
||||
ir.addPathPatterns("/**");
|
||||
//配置不拦截的路径
|
||||
ir.excludePathPatterns(ignoredUrlsProperties.getUrls());
|
||||
}
|
||||
|
||||
/**
|
||||
* 开放资源 这里配置swagger可以在前端访问
|
||||
*
|
||||
* @param registry 资源处理
|
||||
*/
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/statics/**").addResourceLocations("classpath:/statics/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
//解决 SWAGGER 404报错
|
||||
registry.addResourceHandler("/swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,6 +37,9 @@ public enum ResultCode {
|
||||
LIMIT_ERROR(1003, "访问过于频繁,请稍后再试"),
|
||||
ILLEGAL_REQUEST_ERROR(1004, "非法请求,请重新刷新页面操作"),
|
||||
IMAGE_FILE_EXT_ERROR(1005, "不支持图片格式"),
|
||||
FILE_TYPE_NOT_SUPPORT(1010, "不支持上传的文件类型!"),
|
||||
PLATFORM_NOT_SUPPORTED_IM(1006, "平台未开启IM"),
|
||||
STORE_NOT_SUPPORTED_IM(1007, "店铺未开启IM"),
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
@@ -63,7 +66,7 @@ public enum ResultCode {
|
||||
GOODS_UPPER_ERROR(11004, "商品上架失败"),
|
||||
GOODS_AUTH_ERROR(11005, "商品审核失败"),
|
||||
POINT_GOODS_ERROR(11006, "积分商品业务异常,请稍后重试"),
|
||||
GOODS_SKU_SN_ERROR(11007, "商品SKU编号不能为空"),
|
||||
GOODS_SKU_SN_ERROR(11007, "商品SKU货号不能为空"),
|
||||
GOODS_SKU_PRICE_ERROR(11008, "商品SKU价格不能小于等于0"),
|
||||
GOODS_SKU_COST_ERROR(11009, "商品SKU成本价不能小于等于0"),
|
||||
GOODS_SKU_WEIGHT_ERROR(11010, "商品重量不能为负数"),
|
||||
@@ -87,7 +90,7 @@ public enum ResultCode {
|
||||
*/
|
||||
SPEC_SAVE_ERROR(13001, "规格修改失败"),
|
||||
SPEC_UPDATE_ERROR(13002, "规格修改失败"),
|
||||
SPEC_DELETE_ERROR(13003, "此规格已绑定分类不允许删除"),
|
||||
SPEC_DELETE_ERROR(13003, "分类已经绑定此规格,请先解除关联"),
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
@@ -97,7 +100,8 @@ public enum ResultCode {
|
||||
BRAND_DISABLE_ERROR(14003, "品牌禁用失败"),
|
||||
BRAND_DELETE_ERROR(14004, "品牌删除失败"),
|
||||
BRAND_NAME_EXIST_ERROR(20002, "品牌名称重复!"),
|
||||
BRAND_USE_DISABLE_ERROR(20003, "当前品牌下存在分类不可禁用"),
|
||||
BRAND_USE_DISABLE_ERROR(20003, "分类已经绑定品牌,请先解除关联"),
|
||||
BRAND_BIND_GOODS_ERROR(20005, "品牌已经绑定商品,请先解除关联"),
|
||||
BRAND_NOT_EXIST(20004, "品牌不存在"),
|
||||
|
||||
/**
|
||||
@@ -152,7 +156,8 @@ public enum ResultCode {
|
||||
* 购物车
|
||||
*/
|
||||
CART_ERROR(30001, "读取结算页的购物车异常"),
|
||||
CART_PINTUAN_NOT_EXIST_ERROR(30002, "拼团活动不存在错误"),
|
||||
CART_NUM_ERROR(30010, "购买数量必须大于0"),
|
||||
CART_PINTUAN_NOT_EXIST_ERROR(30002, "拼团活动已关闭,请稍后重试"),
|
||||
CART_PINTUAN_LIMIT_ERROR(30003, "购买数量超过拼团活动限制数量"),
|
||||
SHIPPING_NOT_APPLY(30005, "购物商品不支持当前收货地址配送"),
|
||||
|
||||
@@ -226,6 +231,7 @@ public enum ResultCode {
|
||||
WALLET_WITHDRAWAL_FROZEN_AMOUNT_INSUFFICIENT(34006, "冻结金额不足,无法处理提现申请请求!"),
|
||||
WALLET_ERROR_INSUFFICIENT(34003, "零钱提现失败!"),
|
||||
WALLET_REMARK_ERROR(34004, "请填写审核备注!"),
|
||||
WALLET_EXIT_ERROR(34000, "钱包已存在,无法重复创建"),
|
||||
WALLET_APPLY_ERROR(34005, "提现申请异常!"),
|
||||
|
||||
/**
|
||||
@@ -237,7 +243,7 @@ public enum ResultCode {
|
||||
* 活动
|
||||
*/
|
||||
PROMOTION_GOODS_NOT_EXIT(40000, "当前促销商品不存在!"),
|
||||
PROMOTION_SAME_ACTIVE_EXIST(40001, "当前时间内已存在同类活动"),
|
||||
PROMOTION_SAME_ACTIVE_EXIST(40001, "活动时间内已存在同类活动,请选择关闭、删除当前时段的活动"),
|
||||
PROMOTION_START_TIME_ERROR(40002, "活动起始时间不能小于当前时间"),
|
||||
PROMOTION_END_TIME_ERROR(40003, "活动结束时间不能小于当前时间"),
|
||||
PROMOTION_TIME_ERROR(40004, "活动起始时间必须大于结束时间"),
|
||||
@@ -283,6 +289,7 @@ public enum ResultCode {
|
||||
PINTUAN_MANUAL_CLOSE_ERROR(42007, "手动关闭拼团活动失败"),
|
||||
PINTUAN_ADD_ERROR(42008, "添加拼团活动失败"),
|
||||
PINTUAN_EDIT_ERROR(42009, "修改拼团活动失败"),
|
||||
PINTUAN_EDIT_ERROR_ITS_OPEN(42019, "拼团活动已开启,无法修改拼团活动!"),
|
||||
PINTUAN_DELETE_ERROR(42010, "删除拼团活动失败"),
|
||||
PINTUAN_JOIN_ERROR(42011, "不能参与自己发起的拼团活动!"),
|
||||
PINTUAN_LIMIT_NUM_ERROR(42012, "购买数量超过拼团活动限制数量!"),
|
||||
@@ -333,7 +340,8 @@ public enum ResultCode {
|
||||
* 其他促销
|
||||
*/
|
||||
MEMBER_SIGN_REPEAT(47001, "请勿重复签到"),
|
||||
POINT_GOODS_ACTIVE_STOCK_ERROR(47002, "最低金额不能高于商品金额"),
|
||||
POINT_GOODS_ACTIVE_STOCK_ERROR(47002, "活动库存数量不能高于商品库存"),
|
||||
POINT_GOODS_ACTIVE_STOCK_INSUFFICIENT(47003, "积分商品库存不足"),
|
||||
|
||||
/**
|
||||
* 砍价活动
|
||||
@@ -420,8 +428,8 @@ public enum ResultCode {
|
||||
*/
|
||||
VERIFICATION_SEND_SUCCESS(80201, "短信验证码,发送成功"),
|
||||
VERIFICATION_ERROR(80202, "验证失败"),
|
||||
VERIFICATION_SMS_ERROR(80203, "短信验证码错误,请重新校验"),
|
||||
VERIFICATION_SMS_EXPIRED_ERROR(80204, "验证码已失效,请重新校验"),
|
||||
VERIFICATION_CODE_INVALID(80204, "验证码已失效,请重新校验"),
|
||||
VERIFICATION_SMS_CHECKED_ERROR(80210, "短信验证码错误,请重新校验"),
|
||||
|
||||
/**
|
||||
* 微信相关异常
|
||||
@@ -444,7 +452,8 @@ public enum ResultCode {
|
||||
CUSTOM_WORDS_SECRET_KEY_ERROR(90002, "秘钥验证失败!"),
|
||||
CONNECT_NOT_EXIST(90000, "登录方式不存在!"),
|
||||
ELASTICSEARCH_INDEX_INIT_ERROR(90003, "索引初始化失败!"),
|
||||
;
|
||||
PURCHASE_ORDER_DEADLINE_ERROR(90004, "供求单,已超过报名截止时间"),
|
||||
INDEX_BUILDING(90005, "索引正在生成");
|
||||
|
||||
private final Integer code;
|
||||
private final String message;
|
||||
|
||||
@@ -2,16 +2,20 @@ package cn.lili.common.exception;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 全局业务异常类
|
||||
*
|
||||
* @author Chopper
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class ServiceException extends RuntimeException {
|
||||
|
||||
public static String DEFAULT_MESSAGE = "网络错误,请稍后重试!";
|
||||
private static final long serialVersionUID = 3447728300174142127L;
|
||||
|
||||
public static final String DEFAULT_MESSAGE = "网络错误,请稍后重试!";
|
||||
|
||||
/**
|
||||
* 异常消息
|
||||
|
||||
@@ -47,7 +47,7 @@ public class UserContext {
|
||||
*/
|
||||
public static AuthUser getAuthUser(Cache cache, String accessToken) {
|
||||
try {
|
||||
if (cache.keys("*" + accessToken).size() == 0) {
|
||||
if (cache.keys("*" + accessToken).isEmpty()) {
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
return getAuthUser(accessToken);
|
||||
@@ -56,6 +56,14 @@ public class UserContext {
|
||||
}
|
||||
}
|
||||
|
||||
public static String getCurrentUserToken() {
|
||||
if (RequestContextHolder.getRequestAttributes() != null) {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
return request.getHeader(SecurityEnum.HEADER_TOKEN.getValue());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据jwt获取token重的用户信息
|
||||
*
|
||||
|
||||
@@ -4,6 +4,7 @@ package cn.lili.common.security.filter;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import org.owasp.html.Sanitizers;
|
||||
|
||||
import javax.servlet.ReadListener;
|
||||
import javax.servlet.ServletInputStream;
|
||||
@@ -16,6 +17,7 @@ import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -28,6 +30,13 @@ import java.util.Map;
|
||||
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
|
||||
/**
|
||||
* xss过滤参数
|
||||
*
|
||||
* @todo 这里的参数应该更智能些,例如iv,前端的参数包含这两个字母就会放过,这是有问题的
|
||||
*/
|
||||
private static final String[] IGNORE_FIELD = {"logo", "url", "photo", "intro", "content", "name", "image", "encrypted", "iv","mail"};
|
||||
|
||||
public XssHttpServletRequestWrapper(HttpServletRequest request) {
|
||||
super(request);
|
||||
}
|
||||
@@ -39,12 +48,12 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
public String[] getParameterValues(String name) {
|
||||
String[] values = super.getParameterValues(name);
|
||||
if (values == null) {
|
||||
return null;
|
||||
return new String[0];
|
||||
}
|
||||
int count = values.length;
|
||||
String[] encodedValues = new String[count];
|
||||
for (int i = 0; i < count; i++) {
|
||||
encodedValues[i] = cleanXSS(values[i]);
|
||||
encodedValues[i] = filterXss(name, values[i]);
|
||||
}
|
||||
return encodedValues;
|
||||
}
|
||||
@@ -58,7 +67,7 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return cleanXSS(value);
|
||||
return filterXss(name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +77,7 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
public Object getAttribute(String name) {
|
||||
Object value = super.getAttribute(name);
|
||||
if (value instanceof String) {
|
||||
value = cleanXSS((String) value);
|
||||
value = filterXss(name, (String) value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@@ -82,7 +91,7 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return cleanXSS(value);
|
||||
return filterXss(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,10 +108,11 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
//遍历数组
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
String value = values[i];
|
||||
value = cleanXSS(value);
|
||||
value = filterXss(entry.getKey(), value);
|
||||
//将转义后的数据放回数组中
|
||||
values[i] = value;
|
||||
}
|
||||
|
||||
//将转义后的数组put到linkMap当中
|
||||
params.put(entry.getKey(), values);
|
||||
}
|
||||
@@ -113,8 +123,8 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
/**
|
||||
* 获取输入流
|
||||
*
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @return 过滤后的输入流
|
||||
* @throws IOException 异常信息
|
||||
*/
|
||||
@Override
|
||||
public ServletInputStream getInputStream() throws IOException {
|
||||
@@ -144,9 +154,9 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
Map<String, Object> resultMap = new HashMap<>(map.size());
|
||||
//遍历数组
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
//如果map.get(key)获取到的是字符串就需要进行转义,如果不是直接存储resultMap
|
||||
//如果map.get(key)获取到的是字符串就需要进行处理,如果不是直接存储resultMap
|
||||
if (map.get(entry.getKey()) instanceof String) {
|
||||
resultMap.put(entry.getKey(), cleanXSS(entry.getValue().toString()));
|
||||
resultMap.put(entry.getKey(), filterXss(entry.getKey(), entry.getValue().toString()));
|
||||
} else {
|
||||
resultMap.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
@@ -171,7 +181,6 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
@Override
|
||||
public void setReadListener(ReadListener readListener) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -211,8 +220,25 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
private String cleanXSS(String value) {
|
||||
if (value != null) {
|
||||
value = HtmlUtil.escape(value);
|
||||
value = Sanitizers.FORMATTING.and(Sanitizers.LINKS).sanitize(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤xss
|
||||
*
|
||||
* @param name 参数名
|
||||
* @param value 参数值
|
||||
* @return 参数值
|
||||
*/
|
||||
private String filterXss(String name, String value) {
|
||||
if (CharSequenceUtil.containsAny(name.toLowerCase(Locale.ROOT), IGNORE_FIELD)) {
|
||||
// 忽略的处理,(过滤敏感字符)
|
||||
return HtmlUtil.unescape(HtmlUtil.filter(value));
|
||||
} else {
|
||||
return cleanXSS(value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,22 +78,14 @@ public class SensitiveJsonSerializer extends JsonSerializer<String>
|
||||
//如果是店铺
|
||||
if (authUser.getRole().equals(UserEnums.STORE)) {
|
||||
//店铺需要进行脱敏,则脱敏处理
|
||||
if (systemSettingProperties.getSensitiveLevel() == 2) {
|
||||
return true;
|
||||
}
|
||||
//默认不需要
|
||||
return false;
|
||||
return systemSettingProperties.getSensitiveLevel() == 2;
|
||||
}
|
||||
|
||||
|
||||
//如果是店铺
|
||||
if (authUser.getRole().equals(UserEnums.MANAGER)) {
|
||||
//店铺需要进行脱敏,则脱敏处理
|
||||
if (systemSettingProperties.getSensitiveLevel() >= 1) {
|
||||
return true;
|
||||
}
|
||||
//默认不需要
|
||||
return false;
|
||||
return systemSettingProperties.getSensitiveLevel() >= 1;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -24,6 +24,14 @@ public enum SensitiveStrategy {
|
||||
* Phone sensitive type.
|
||||
*/
|
||||
PHONE(s -> s.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2")),
|
||||
/**
|
||||
* Email sensitive type.
|
||||
*/
|
||||
EMAIL(s -> s.replaceAll("(^\\w)[^@]*(@.*$)", "$1****$2")),
|
||||
/**
|
||||
* Name sensitive type.
|
||||
*/
|
||||
NAME(s -> s.replaceAll("^(.{3}).+(.{3})$", "$1*****$2")),
|
||||
/**
|
||||
* Address sensitive type.
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,10 @@ public class ThreadPoolUtil {
|
||||
*/
|
||||
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());
|
||||
public static ThreadPoolExecutor threadPool;
|
||||
/**
|
||||
* volatile禁止指令重排
|
||||
*/
|
||||
public static volatile ThreadPoolExecutor threadPool;
|
||||
|
||||
static {
|
||||
POOL.prestartAllCoreThreads();
|
||||
@@ -49,22 +52,20 @@ public class ThreadPoolUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* dcs获取线程池
|
||||
* DCL获取线程池
|
||||
*
|
||||
* @return 线程池对象
|
||||
*/
|
||||
public static ThreadPoolExecutor getThreadPool() {
|
||||
if (threadPool != null) {
|
||||
return threadPool;
|
||||
} else {
|
||||
synchronized (ThreadPoolUtil.class) {
|
||||
if (threadPool == null) {
|
||||
threadPool = (ThreadPoolExecutor) Executors.newCachedThreadPool();
|
||||
return threadPool;
|
||||
}
|
||||
return threadPool;
|
||||
}
|
||||
synchronized (ThreadPoolUtil.class) {
|
||||
if (threadPool == null) {
|
||||
threadPool = (ThreadPoolExecutor) Executors.newCachedThreadPool();
|
||||
}
|
||||
}
|
||||
return threadPool;
|
||||
}
|
||||
|
||||
public static ThreadPoolExecutor getPool() {
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package cn.lili.common.validation;
|
||||
|
||||
import cn.lili.common.validation.impl.EnumValuesValidator;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* 枚举值校验注解
|
||||
*
|
||||
* @author Bulbasaur
|
||||
*/
|
||||
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})
|
||||
@Retention(RUNTIME)
|
||||
@Documented
|
||||
@Constraint(validatedBy = {EnumValuesValidator.class})
|
||||
public @interface EnumValue {
|
||||
|
||||
String message() default "必须为指定值";
|
||||
|
||||
String[] strValues() default {};
|
||||
|
||||
int[] intValues() default {};
|
||||
|
||||
//分组
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
//负载
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
|
||||
|
||||
@Target({FIELD, METHOD, PARAMETER, ANNOTATION_TYPE})
|
||||
@Retention(RUNTIME)
|
||||
@Documented
|
||||
@interface List {
|
||||
EnumValue[] value();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.lili.common.validation.impl;
|
||||
|
||||
import cn.lili.common.validation.EnumValue;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 枚举之校验
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @since 2021/7/9 1:41 上午
|
||||
*/
|
||||
public class EnumValuesValidator implements ConstraintValidator<EnumValue, Object> {
|
||||
|
||||
private String[] strValues;
|
||||
private int[] intValues;
|
||||
|
||||
@Override
|
||||
public boolean isValid(Object o, ConstraintValidatorContext constraintValidatorContext) {
|
||||
if (o instanceof String) {
|
||||
for (String s : strValues) {
|
||||
if (s.equals(o)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (o instanceof Integer) {
|
||||
for (int s : intValues) {
|
||||
if (s == ((Integer) o).intValue()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(EnumValue constraintAnnotation) {
|
||||
strValues = constraintAnnotation.strValues();
|
||||
intValues = constraintAnnotation.intValues();
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package cn.lili.elasticsearch;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.lili.elasticsearch.config.ElasticsearchProperties;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
@@ -89,14 +88,16 @@ public abstract class BaseElasticsearchService {
|
||||
try {
|
||||
CreateIndexRequest request = new CreateIndexRequest(index);
|
||||
//Settings for this index
|
||||
request.settings(Settings.builder().put("index.number_of_shards", elasticsearchProperties.getIndex().getNumberOfShards()).put("index.number_of_replicas", elasticsearchProperties.getIndex().getNumberOfReplicas()));
|
||||
request.settings(Settings.builder()
|
||||
.put("index.number_of_shards", elasticsearchProperties.getIndex().getNumberOfShards())
|
||||
.put("index.number_of_replicas", elasticsearchProperties.getIndex().getNumberOfReplicas())
|
||||
.put("index.mapping.total_fields.limit", 2000));
|
||||
|
||||
//创建索引
|
||||
CreateIndexResponse createIndexResponse = client.indices().create(request, COMMON_OPTIONS);
|
||||
createMapping(index);
|
||||
log.info(" whether all of the nodes have acknowledged the request : {}", createIndexResponse.isAcknowledged());
|
||||
log.info(" Indicates whether the requisite number of shard copies were started for each shard in the index before timing out :{}", createIndexResponse.isShardsAcknowledged());
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
log.error("创建索引错误",e);
|
||||
throw new ElasticsearchException("创建索引 {" + index + "} 失败:" + e.getMessage());
|
||||
@@ -196,6 +197,9 @@ public abstract class BaseElasticsearchService {
|
||||
" \"commentNum\": {\n" +
|
||||
" \"type\": \"long\"\n" +
|
||||
" },\n" +
|
||||
" \"skuSource\": {\n" +
|
||||
" \"type\": \"long\"\n" +
|
||||
" },\n" +
|
||||
" \"goodsId\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fields\": {\n" +
|
||||
@@ -342,7 +346,7 @@ public abstract class BaseElasticsearchService {
|
||||
PutMappingRequest request = new PutMappingRequest(index)
|
||||
.source(source, XContentType.JSON);
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
AtomicReference response = new AtomicReference<AcknowledgedResponse>();
|
||||
AtomicReference<AcknowledgedResponse> response = new AtomicReference<>();
|
||||
client.indices().putMappingAsync(
|
||||
request,
|
||||
RequestOptions.DEFAULT,
|
||||
@@ -359,7 +363,6 @@ public abstract class BaseElasticsearchService {
|
||||
}
|
||||
});
|
||||
latch.await(10, TimeUnit.SECONDS);
|
||||
Assertions.assertThat(((AcknowledgedResponse) response.get()).isAcknowledged()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,345 +0,0 @@
|
||||
package cn.lili.generator;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.generator.bean.Entity;
|
||||
import org.beetl.core.Configuration;
|
||||
import org.beetl.core.GroupTemplate;
|
||||
import org.beetl.core.Template;
|
||||
import org.beetl.core.resource.ClasspathResourceLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
|
||||
/**
|
||||
* 代码生成器 Mybatis-Plus
|
||||
*
|
||||
* @author Chopper
|
||||
*/
|
||||
public class CodeGenerator {
|
||||
|
||||
/**
|
||||
* 代码生成在哪个项目
|
||||
*/
|
||||
private static final String PROJECT = "framework";
|
||||
|
||||
/**
|
||||
* 代码生成在哪个包下边
|
||||
*/
|
||||
private static final String PACKAGES = "cn.lili.modules.";
|
||||
|
||||
/**
|
||||
* modules
|
||||
*/
|
||||
private static final String MODULES = "message";
|
||||
|
||||
|
||||
/**
|
||||
* 实体类名
|
||||
* 建议仅需修改
|
||||
*/
|
||||
private static final String CLASS_NAME = "ShortLink";
|
||||
|
||||
/**
|
||||
* 类说明描述
|
||||
* 建议仅需修改
|
||||
*/
|
||||
private static final String DESCRIPTION = "短链接";
|
||||
|
||||
/**
|
||||
* 作者名
|
||||
* 建议仅需修改
|
||||
*/
|
||||
private static final String AUTHOR = "Chopper";
|
||||
|
||||
/**
|
||||
* 数据库表名前缀
|
||||
* 下方请根据需要修改
|
||||
*/
|
||||
private static final String TABLE_PRE = "li_";
|
||||
|
||||
/**
|
||||
* 主键类型
|
||||
*/
|
||||
private static final String PRIMARY_KEY_TYPE = "String";
|
||||
|
||||
|
||||
/**
|
||||
* endity
|
||||
*/
|
||||
private static final String ENTITY_PACKAGE = PACKAGES + MODULES + ".entity";
|
||||
|
||||
/**
|
||||
* dao
|
||||
*/
|
||||
private static final String DAO_PACKAGE = PACKAGES + MODULES + ".mapper";
|
||||
|
||||
/**
|
||||
* service
|
||||
*/
|
||||
private static final String SERVICE_PACKAGE = PACKAGES + MODULES + ".service";
|
||||
|
||||
/**
|
||||
* serviceImpl
|
||||
*/
|
||||
private static final String SERVICE_IMPL_PACKAGE = PACKAGES + MODULES + ".serviceimpl";
|
||||
|
||||
/**
|
||||
* controller
|
||||
*/
|
||||
private static final String CONTROLLER_PACKAGE = PACKAGES + MODULES + ".controller";
|
||||
|
||||
/**
|
||||
* 运行该主函数即可生成代码
|
||||
*
|
||||
* @param args
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void main(String[] args) throws IOException {
|
||||
//模板路径
|
||||
ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader("/templates/");
|
||||
Configuration cfg = Configuration.defaultConfiguration();
|
||||
GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
|
||||
//生成代码
|
||||
generateCode(gt);
|
||||
//根据类名删除生成的代码
|
||||
// deleteCode(className);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成代码
|
||||
*
|
||||
* @param gt
|
||||
* @throws IOException
|
||||
*/
|
||||
private static void generateCode(GroupTemplate gt) throws IOException {
|
||||
|
||||
Template entityTemplate = gt.getTemplate("entity.btl");
|
||||
Template daoTemplate = gt.getTemplate("mapper.btl");
|
||||
Template serviceTemplate = gt.getTemplate("service.btl");
|
||||
Template serviceImplTemplate = gt.getTemplate("serviceImpl.btl");
|
||||
Template controllerTemplate = gt.getTemplate("controller.btl");
|
||||
Template mapperXmlTemplate = gt.getTemplate("mapperXml.btl");
|
||||
|
||||
Entity entity = new Entity();
|
||||
entity.setEntityPackage(ENTITY_PACKAGE);
|
||||
entity.setDaoPackage(DAO_PACKAGE);
|
||||
entity.setServicePackage(SERVICE_PACKAGE);
|
||||
entity.setServiceImplPackage(SERVICE_IMPL_PACKAGE);
|
||||
entity.setControllerPackage(CONTROLLER_PACKAGE);
|
||||
entity.setAuthor(AUTHOR);
|
||||
entity.setClassName(CLASS_NAME);
|
||||
entity.setTableName(TABLE_PRE + StringUtils.camel2Underline(CLASS_NAME));
|
||||
entity.setClassNameLowerCase(name(CLASS_NAME, false));
|
||||
entity.setDescription(DESCRIPTION);
|
||||
entity.setPrimaryKeyType(PRIMARY_KEY_TYPE);
|
||||
|
||||
OutputStream out = null;
|
||||
|
||||
//生成实体类代码
|
||||
entityTemplate.binding("entity", entity);
|
||||
String entityResult = entityTemplate.render();
|
||||
System.out.println(entityResult);
|
||||
//创建文件
|
||||
String entityFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(ENTITY_PACKAGE) + "/" + CLASS_NAME + ".java";
|
||||
File entityFile = new File(entityFileUrl);
|
||||
File entityDir = entityFile.getParentFile();
|
||||
if (!entityDir.exists()) {
|
||||
entityDir.mkdirs();
|
||||
}
|
||||
if (!entityFile.exists()) {
|
||||
//若文件存在则不重新生成
|
||||
entityFile.createNewFile();
|
||||
out = new FileOutputStream(entityFile);
|
||||
entityTemplate.renderTo(out);
|
||||
}
|
||||
|
||||
//生成dao代码
|
||||
daoTemplate.binding("entity", entity);
|
||||
String daoResult = daoTemplate.render();
|
||||
System.out.println(daoResult);
|
||||
//创建文件
|
||||
String daoFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(DAO_PACKAGE) + "/" + CLASS_NAME + "Mapper.java";
|
||||
File daoFile = new File(daoFileUrl);
|
||||
File daoDir = daoFile.getParentFile();
|
||||
if (!daoDir.exists()) {
|
||||
daoDir.mkdirs();
|
||||
}
|
||||
if (!daoFile.exists()) {
|
||||
//若文件存在则不重新生成
|
||||
daoFile.createNewFile();
|
||||
out = new FileOutputStream(daoFile);
|
||||
daoTemplate.renderTo(out);
|
||||
}
|
||||
|
||||
//生成service代码
|
||||
serviceTemplate.binding("entity", entity);
|
||||
String serviceResult = serviceTemplate.render();
|
||||
System.out.println(serviceResult);
|
||||
//创建文件
|
||||
String serviceFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(SERVICE_PACKAGE) + "/" + CLASS_NAME + "Service.java";
|
||||
File serviceFile = new File(serviceFileUrl);
|
||||
File serviceDir = serviceFile.getParentFile();
|
||||
if (!serviceDir.exists()) {
|
||||
serviceDir.mkdirs();
|
||||
}
|
||||
if (!serviceFile.exists()) {
|
||||
//若文件存在则不重新生成
|
||||
serviceFile.createNewFile();
|
||||
out = new FileOutputStream(serviceFile);
|
||||
serviceTemplate.renderTo(out);
|
||||
}
|
||||
|
||||
//生成serviceImpl代码
|
||||
serviceImplTemplate.binding("entity", entity);
|
||||
String serviceImplResult = serviceImplTemplate.render();
|
||||
System.out.println(serviceImplResult);
|
||||
//创建文件
|
||||
System.out.println(System.getProperty("user.dir"));
|
||||
String serviceImplFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(SERVICE_IMPL_PACKAGE) + "/" + CLASS_NAME + "ServiceImpl.java";
|
||||
File serviceImplFile = new File(serviceImplFileUrl);
|
||||
File serviceImplDir = serviceImplFile.getParentFile();
|
||||
if (!serviceImplDir.exists()) {
|
||||
serviceImplDir.mkdirs();
|
||||
}
|
||||
if (!serviceImplFile.exists()) {
|
||||
//若文件存在则不重新生成
|
||||
serviceImplFile.createNewFile();
|
||||
out = new FileOutputStream(serviceImplFile);
|
||||
serviceImplTemplate.renderTo(out);
|
||||
}
|
||||
|
||||
//生成controller代码
|
||||
controllerTemplate.binding("entity", entity);
|
||||
String controllerResult = controllerTemplate.render();
|
||||
System.out.println(controllerResult);
|
||||
//创建文件
|
||||
String controllerFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(CONTROLLER_PACKAGE) + "/" + CLASS_NAME + "Controller.java";
|
||||
File controllerFile = new File(controllerFileUrl);
|
||||
File controllerDir = controllerFile.getParentFile();
|
||||
if (!controllerDir.exists()) {
|
||||
controllerDir.mkdirs();
|
||||
}
|
||||
if (!controllerFile.exists()) {
|
||||
//若文件存在则不重新生成
|
||||
controllerFile.createNewFile();
|
||||
out = new FileOutputStream(controllerFile);
|
||||
controllerTemplate.renderTo(out);
|
||||
}
|
||||
|
||||
//生成mapperXml代码
|
||||
mapperXmlTemplate.binding("entity", entity);
|
||||
String mapperXmlResult = mapperXmlTemplate.render();
|
||||
System.out.println(mapperXmlResult);
|
||||
//创建文件
|
||||
String mapperXmlFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/resources/mapper/" + CLASS_NAME + "Mapper.xml";
|
||||
File mapperXmlFile = new File(mapperXmlFileUrl);
|
||||
File mapperXmlDir = mapperXmlFile.getParentFile();
|
||||
if (!mapperXmlDir.exists()) {
|
||||
mapperXmlDir.mkdirs();
|
||||
}
|
||||
if (!mapperXmlFile.exists()) {
|
||||
//若文件存在则不重新生成
|
||||
mapperXmlFile.createNewFile();
|
||||
out = new FileOutputStream(mapperXmlFile);
|
||||
mapperXmlTemplate.renderTo(out);
|
||||
}
|
||||
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
System.out.println("生成代码成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定类代码
|
||||
*
|
||||
* @param className
|
||||
* @throws IOException
|
||||
*/
|
||||
private static void deleteCode(String className) throws IOException {
|
||||
|
||||
String entityFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(ENTITY_PACKAGE) + "/" + className + ".java";
|
||||
File entityFile = new File(entityFileUrl);
|
||||
if (entityFile.exists()) {
|
||||
entityFile.delete();
|
||||
}
|
||||
String daoFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(DAO_PACKAGE) + "/" + className + "Mapper.java";
|
||||
File daoFile = new File(daoFileUrl);
|
||||
if (daoFile.exists()) {
|
||||
daoFile.delete();
|
||||
}
|
||||
|
||||
String serviceFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(SERVICE_PACKAGE) + "/" + className + "Service.java";
|
||||
File serviceFile = new File(serviceFileUrl);
|
||||
if (serviceFile.exists()) {
|
||||
serviceFile.delete();
|
||||
}
|
||||
|
||||
String serviceImplFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(SERVICE_IMPL_PACKAGE) + "/" + className + "ServiceImpl.java";
|
||||
File serviceImplFile = new File(serviceImplFileUrl);
|
||||
if (serviceImplFile.exists()) {
|
||||
serviceImplFile.delete();
|
||||
}
|
||||
|
||||
String controllerFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/java/" + dotToLine(CONTROLLER_PACKAGE) + "/" + className + "Controller.java";
|
||||
File controllerFile = new File(controllerFileUrl);
|
||||
if (controllerFile.exists()) {
|
||||
controllerFile.delete();
|
||||
}
|
||||
|
||||
String mapperXmlFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/resources/mapper/" + className + "Mapper.xml";
|
||||
File mapperXmlFile = new File(mapperXmlFileUrl);
|
||||
if (mapperXmlFile.exists()) {
|
||||
mapperXmlFile.delete();
|
||||
}
|
||||
|
||||
System.out.println("删除代码完毕!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 点转斜线
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static String dotToLine(String str) {
|
||||
return str.replace(".", "/");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 首字母是否大小写
|
||||
*
|
||||
* @param name
|
||||
* @param isFirstUpper
|
||||
* @return
|
||||
*/
|
||||
public static String name(String name, boolean isFirstUpper) {
|
||||
|
||||
if (StrUtil.isBlank(name)) {
|
||||
throw new ServiceException("name不能为空");
|
||||
}
|
||||
|
||||
if (name.length() == 1) {
|
||||
if (isFirstUpper) {
|
||||
return name.toUpperCase();
|
||||
} else {
|
||||
return name.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if (isFirstUpper) {
|
||||
sb.append(Character.toUpperCase(name.charAt(0)));
|
||||
} else {
|
||||
sb.append(Character.toLowerCase(name.charAt(0)));
|
||||
}
|
||||
sb.append(name.substring(1));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package cn.lili.generator.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Chopper
|
||||
*/
|
||||
@Data
|
||||
public class Entity {
|
||||
|
||||
/**
|
||||
* 实体类,dao,service,controller目录
|
||||
*/
|
||||
private String entityPackage;
|
||||
|
||||
private String daoPackage;
|
||||
|
||||
private String servicePackage;
|
||||
|
||||
private String serviceImplPackage;
|
||||
|
||||
private String controllerPackage;
|
||||
|
||||
|
||||
/**
|
||||
* 作者
|
||||
*/
|
||||
private String author;
|
||||
|
||||
/**
|
||||
* 类名
|
||||
*/
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 首字母小写的类名字,用于模版内的变量名称
|
||||
*/
|
||||
private String classNameLowerCase;
|
||||
|
||||
/**
|
||||
* 数据库
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 类说明描述,一般设定关键字即可 例如:会员
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 主键类型
|
||||
*/
|
||||
private String primaryKeyType;
|
||||
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package cn.lili.modules.connect.entity.enums;
|
||||
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
@@ -4,16 +4,15 @@ import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.cache.Cache;
|
||||
import cn.lili.cache.CachePrefix;
|
||||
import cn.lili.common.context.ThreadContextHolder;
|
||||
import cn.lili.common.enums.ClientTypeEnum;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.security.token.Token;
|
||||
import cn.lili.modules.member.token.MemberTokenGenerate;
|
||||
import cn.lili.common.utils.CookieUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.context.ThreadContextHolder;
|
||||
import cn.lili.common.enums.ClientTypeEnum;
|
||||
import cn.lili.modules.connect.entity.Connect;
|
||||
import cn.lili.modules.connect.entity.dto.ConnectAuthUser;
|
||||
import cn.lili.modules.connect.entity.dto.WechatMPLoginParams;
|
||||
@@ -22,6 +21,7 @@ import cn.lili.modules.connect.mapper.ConnectMapper;
|
||||
import cn.lili.modules.connect.service.ConnectService;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.modules.member.token.MemberTokenGenerate;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.entity.dto.connect.WechatConnectSetting;
|
||||
import cn.lili.modules.system.entity.dto.connect.dto.WechatConnectSettingItem;
|
||||
@@ -309,6 +309,8 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
* @return 用户信息
|
||||
*/
|
||||
public JSONObject getUserInfo(String encryptedData, String sessionKey, String iv) {
|
||||
|
||||
log.info("encryptedData:{},sessionKey:{},iv:{}", encryptedData, sessionKey, iv);
|
||||
//被加密的数据
|
||||
byte[] dataByte = Base64.getDecoder().decode(encryptedData);
|
||||
//加密秘钥
|
||||
|
||||
@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
@@ -66,17 +67,17 @@ public class Distribution extends BaseEntity {
|
||||
@ApiModelProperty(value = "分销员状态", required = true)
|
||||
private String distributionStatus;
|
||||
|
||||
@Size(min = 1, max = 200, message = "结算银行开户行名称长度为1-200位")
|
||||
@Length(min = 1, max = 200, message = "结算银行开户行名称长度为1-200位")
|
||||
@NotBlank(message = "结算银行开户行名称不能为空")
|
||||
@ApiModelProperty(value = "结算银行开户行名称")
|
||||
private String settlementBankAccountName;
|
||||
|
||||
@Size(min = 1, max = 200, message = "结算银行开户账号长度为1-200位")
|
||||
@Length(min = 1, max = 200, message = "结算银行开户账号长度为1-200位")
|
||||
@NotBlank(message = "结算银行开户账号不能为空")
|
||||
@ApiModelProperty(value = "结算银行开户账号")
|
||||
private String settlementBankAccountNum;
|
||||
|
||||
@Size(min = 1, max = 200, message = "结算银行开户支行名称长度为1-200位")
|
||||
@Length(min = 1, max = 200, message = "结算银行开户支行名称长度为1-200位")
|
||||
@NotBlank(message = "结算银行开户支行名称不能为空")
|
||||
@ApiModelProperty(value = "结算银行开户支行名称")
|
||||
private String settlementBankBranchName;
|
||||
|
||||
@@ -2,6 +2,7 @@ package cn.lili.modules.distribution.entity.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
@@ -23,17 +24,17 @@ public class DistributionApplyDTO {
|
||||
@ApiModelProperty(value = "身份证号")
|
||||
private String idNumber;
|
||||
|
||||
@Size(min = 1, max = 200, message = "结算银行开户行名称长度为1-200位")
|
||||
@Length(min = 1, max = 200, message = "结算银行开户行名称长度为1-200位")
|
||||
@NotBlank(message = "结算银行开户行名称不能为空")
|
||||
@ApiModelProperty(value = "结算银行开户行名称")
|
||||
private String settlementBankAccountName;
|
||||
|
||||
@Size(min = 1, max = 200, message = "结算银行开户账号长度为1-200位")
|
||||
@Length(min = 1, max = 200, message = "结算银行开户账号长度为1-200位")
|
||||
@NotBlank(message = "结算银行开户账号不能为空")
|
||||
@ApiModelProperty(value = "结算银行开户账号")
|
||||
private String settlementBankAccountNum;
|
||||
|
||||
@Size(min = 1, max = 200, message = "结算银行开户支行名称长度为1-200位")
|
||||
@Length(min = 1, max = 200, message = "结算银行开户支行名称长度为1-200位")
|
||||
@NotBlank(message = "结算银行开户支行名称不能为空")
|
||||
@ApiModelProperty(value = "结算银行开户支行名称")
|
||||
private String settlementBankBranchName;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class DistributionGoodsSearchParams extends PageVO {
|
||||
|
||||
public <T> QueryWrapper<T> distributionQueryWrapper() {
|
||||
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotEmpty(goodsName), "dg.goods_name", goodsName);
|
||||
queryWrapper.like(StringUtils.isNotEmpty(goodsName), "dg.goods_name", goodsName);
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user