合并
This commit is contained in:
commit
656e2a9307
208
README.md
208
README.md
@ -1,34 +1,37 @@
|
||||
## Lilishop B2B2C商城系统
|
||||
## 🔥Lilishop B2B2C商城系统
|
||||
|
||||
##### 🌹官方公众号 & 开源不易,如有帮助请点Star
|
||||
|
||||
##### 官方qq群 961316482,官方公众号/小程序体验,扫描二维码
|
||||
|
||||
##### 官方公众号 & 开源不易,如有帮助请点Star
|
||||

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

|
||||

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

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

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

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

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

|
||||
|
||||
##### Java后台
|
||||
##### 🕹后台技术选型
|
||||
|
||||
| 说明 | 框架 | 说明 | |
|
||||
| -------------- | --------------- | -------------- | ------------- |
|
||||
@ -173,7 +161,7 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_
|
||||
| 短信 | 阿里云短信 | 认证 | JWT |
|
||||
| 日志处理 | Log4j | 接口规范 | RESTful |
|
||||
|
||||
##### 前端-运营后台、店铺后台
|
||||
##### 🖥前端-运营后台、店铺后台
|
||||
|
||||
| 说明 | 框架 | 说明 | 框架 |
|
||||
| ---------- | ---------- | ---------- | ------- |
|
||||
@ -183,115 +171,23 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_
|
||||
| 基础UI库 | iView | UI界面基于 | iView |
|
||||
| 网络请求 | axios | | |
|
||||
|
||||
##### 前端-移动端
|
||||
##### 📱前端-移动端
|
||||
|
||||
| 说明 | 架构 | 说明 | 架构 |
|
||||
| --------- | ------- | -------- | ------- |
|
||||
| 基础UI库 | uViewui | 基础框架 | uni-app |
|
||||
| CSS预处理 | scss | 地图引擎 | amap |
|
||||
|
||||
### 升级计划
|
||||
|
||||
#### 计划每个月发布一个版本,具体时间可能有出入
|
||||
|
||||
时间:2021年7月15日
|
||||
### 🌟版本升级
|
||||
|
||||
```
|
||||
新增功能:
|
||||
1.积分商城
|
||||
2.店铺移动端
|
||||
3.店铺支持发货单
|
||||
4.供求单
|
||||
5.店铺自提点
|
||||
6.移动端展示附近店铺
|
||||
7.开屏广告
|
||||
8.会员站内消息
|
||||
9.移动端店铺入驻
|
||||
功能优化:
|
||||
1.用户分享商城、关注店铺、邀请新用户可获取积分、经验值。
|
||||
2.隐私管理功能
|
||||
2.移动端店铺首页优化
|
||||
商城后续会持续版本升级,修复bug,完善功能,覆盖更多业务场景 o2o/b2b/s2b2b2c/跨境电商
|
||||
|
||||
后续会考虑推出微服务商城系统/中台商城等
|
||||
```
|
||||
|
||||
时间:2021年8月16日
|
||||
|
||||
```
|
||||
新增功能:
|
||||
1.微淘功能
|
||||
2.相册管理功能
|
||||
3.店铺申请品牌
|
||||
4.第三方商品导入(淘宝、99api)
|
||||
5.用户等级
|
||||
6.用户升级会员
|
||||
7.会员权益
|
||||
8.促销活动:第二件*折
|
||||
9.促销活动:商品打包价
|
||||
10.促销活动:商品组合购
|
||||
11.促销活动:进店赠券
|
||||
12.代客退单
|
||||
功能优化:
|
||||
1.批量上传商品分类
|
||||
2.店铺维护开票项目
|
||||
3.店铺展示营销中心
|
||||
```
|
||||
|
||||
时间:2021年9月15日
|
||||
|
||||
```
|
||||
新增功能:
|
||||
1.增加供应商功能
|
||||
2.商品预售
|
||||
3.商品预约
|
||||
4.电子券码
|
||||
5.企业会员
|
||||
6.企业会员购
|
||||
7.商品批发价
|
||||
功能优化:
|
||||
1.店铺运费模板支持按照体积计算
|
||||
2.店铺支持自定义移动端首页
|
||||
```
|
||||
|
||||
### 版本升级
|
||||
|
||||
```
|
||||
后续会持续版本升级,修复bug,完善功能,覆盖更多业务场景 o2o/b2b/s2b2b2c/跨境电商
|
||||
|
||||
后续会考虑推出微服务/中台等 企业级版本
|
||||
```
|
||||
|
||||
### 技术亮点
|
||||
|
||||
|
||||
1.后端框架基于Springboot,构建基于maven,持久层使用MyBatisPlus。使用elasticsearch、redis、mongodb、rocketmq 等各种中间健。都是主流架构,轻松应对各种环境。
|
||||
|
||||
2.支持集群、分布式,支持docker 轻松部署,解决各种复杂场景!
|
||||
|
||||
3.代码模块清晰,主要分为三端api(买家、卖家、管理),各端API互相隔离,自己鉴权,自己操作业务。
|
||||
|
||||
4.使用阿里开源的RocketMQ,基于mq解决各种并发场景,解决事务一致性,解决搞并发延迟场景问题。
|
||||
|
||||
5.项目使用多级缓存,应用不同场景,redis缓存业务数据、mongodb缓存关系型多对多关系问题、nginx缓存高频访问低频修改的页面。
|
||||
|
||||
6.支持各种联合登陆,支持各种客户端的支付问题,灵活配置灵活开启。
|
||||
|
||||
7.内置完善的楼层装修机制,各种拖拉拽,维护跳转页面或外网,即便是一个什么都不懂的运营也可以轻松掌握。
|
||||
|
||||
8.内置阿里短信接口,可以在线申请短信模版。内置阿里oss系统,可以对文件执行各种操作。oss商家端资源相互隔离。
|
||||
|
||||
10.强大的统计报表,统计效果,可以实现各个场景,包含在线人数,历史在线人数,活跃人数等信息。
|
||||
|
||||
11.标准Api接口、提供swagger文档,快速二开。
|
||||
|
||||
12.分布式调度任务中心,解决分布式定时任务多次执行问题。
|
||||
|
||||
13.代码注释完善,快速上手。
|
||||
|
||||
14.非移动端采用IView框架,各种自定义插件、选择器实现。移动端采用uniapp,一次编写,全端使用
|
||||
|
||||
15.已经对接好各种第三方插件,支持各种复杂等联合登陆,联合支付等场景。
|
||||
|
||||
|
||||
### 开源须知
|
||||
### ⚠️开源须知
|
||||
1.仅允许用于个人学习研究使用.
|
||||
|
||||
2.禁止将本开源的代码和资源进行任何形式任何名义的出售.
|
||||
@ -301,7 +197,7 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_
|
||||
4.限制商用,如果需要商业使用请联系我们。QQ3409056806.
|
||||
|
||||
|
||||
### 交流群
|
||||
### 🐧交流群
|
||||
|
||||
**QQ群**:961316482
|
||||
|
||||
|
||||
@ -3,21 +3,19 @@
|
||||
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>
|
||||
<properties>
|
||||
<enjoy.version>4.3</enjoy.version>
|
||||
</properties>
|
||||
<artifactId>buyer-api</artifactId>
|
||||
<parent>
|
||||
<groupId>cn.lili</groupId>
|
||||
<artifactId>lili-shop-parent</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.lili</groupId>
|
||||
<artifactId>framework</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@ -36,11 +36,16 @@ public class MemberCollectionController {
|
||||
@Autowired
|
||||
private StoreCollectionService storeCollectionService;
|
||||
|
||||
/**
|
||||
* 商品收藏关键字
|
||||
*/
|
||||
private String goods="GOODS";
|
||||
|
||||
@ApiOperation(value = "查询会员收藏列表")
|
||||
@ApiImplicitParam(name = "type", value = "类型", dataType = "String", paramType = "path", example = "GOODS:商品,STORE:店铺")
|
||||
@GetMapping("/{type}")
|
||||
public ResultMessage<Object> goodsList(@PathVariable String type, PageVO page) {
|
||||
if (type.equals("GOODS")) {
|
||||
if (goods.equals(type)) {
|
||||
return ResultUtil.data(goodsCollectionService.goodsCollection(page));
|
||||
}
|
||||
return ResultUtil.data(storeCollectionService.storeCollection(page));
|
||||
@ -54,7 +59,7 @@ public class MemberCollectionController {
|
||||
@PostMapping("/add/{type}/{id}")
|
||||
public ResultMessage<Object> addGoodsCollection(@PathVariable String type,
|
||||
@NotNull(message = "值不能为空") @PathVariable String id) {
|
||||
if (type.equals("GOODS")) {
|
||||
if (goods.equals(type)) {
|
||||
return ResultUtil.data(goodsCollectionService.addGoodsCollection(id));
|
||||
}
|
||||
return ResultUtil.data(storeCollectionService.addStoreCollection(id));
|
||||
@ -69,7 +74,7 @@ public class MemberCollectionController {
|
||||
@DeleteMapping(value = "/delete/{type}/{id}")
|
||||
public ResultMessage<Object> deleteGoodsCollection(@PathVariable String type,
|
||||
@NotNull(message = "值不能为空") @PathVariable String id) {
|
||||
if (type.equals("GOODS")) {
|
||||
if (goods.equals(type)) {
|
||||
return ResultUtil.data(goodsCollectionService.deleteGoodsCollection(id));
|
||||
}
|
||||
return ResultUtil.data(storeCollectionService.deleteStoreCollection(id));
|
||||
@ -83,7 +88,7 @@ public class MemberCollectionController {
|
||||
@GetMapping(value = "/isCollection/{type}/{id}")
|
||||
public ResultMessage<Boolean> isCollection(@PathVariable String type,
|
||||
@NotNull(message = "值不能为空") @PathVariable String id) {
|
||||
if (type.equals("GOODS")) {
|
||||
if (goods.equals(type)) {
|
||||
return ResultUtil.data(this.goodsCollectionService.isCollection(id));
|
||||
}
|
||||
return ResultUtil.data(this.storeCollectionService.isCollection(id));
|
||||
|
||||
@ -38,8 +38,8 @@ public class MemberWithdrawApplyBuyerController {
|
||||
public ResultMessage<IPage<MemberWithdrawApply>> getByPage(PageVO page, MemberWithdrawApplyQueryVO memberWithdrawApplyQueryVO) {
|
||||
memberWithdrawApplyQueryVO.setMemberId(UserContext.getCurrentUser().getId());
|
||||
//构建查询 返回数据
|
||||
IPage<MemberWithdrawApply> memberWithdrawApplyIPage = memberWithdrawApplyService.getMemberWithdrawPage(page, memberWithdrawApplyQueryVO);
|
||||
return ResultUtil.data(memberWithdrawApplyIPage);
|
||||
IPage<MemberWithdrawApply> memberWithdrawApplyPage = memberWithdrawApplyService.getMemberWithdrawPage(page, memberWithdrawApplyQueryVO);
|
||||
return ResultUtil.data(memberWithdrawApplyPage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -40,7 +40,6 @@ public class DistributionBuyerController {
|
||||
@Autowired
|
||||
private DistributionOrderService distributionOrderService;
|
||||
|
||||
//申请分销员
|
||||
@ApiOperation(value = "申请分销员")
|
||||
@PostMapping
|
||||
public ResultMessage<Object> applyDistribution(DistributionApplyDTO distributionApplyDTO) {
|
||||
@ -63,7 +62,6 @@ public class DistributionBuyerController {
|
||||
return ResultUtil.data(distributionService.getDistribution());
|
||||
}
|
||||
|
||||
//申请分销员
|
||||
@ApiOperation(value = "绑定分销员")
|
||||
@ApiImplicitParam(name = "distributionId", value = "分销员ID", required = true, paramType = "path")
|
||||
@GetMapping("/bindingDistribution/{distributionId}")
|
||||
|
||||
@ -34,6 +34,7 @@ public class MiniProgramBuyerController {
|
||||
public ConnectService connectService;
|
||||
@Autowired
|
||||
public WechatMpCodeUtil wechatMpCodeUtil;
|
||||
@SuppressWarnings("AlibabaLowerCamelCaseVariableNaming")
|
||||
@Autowired
|
||||
public WechatMPMessageService wechatMPMessageService;
|
||||
@Autowired
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
___ ___ ___ ___ ________ ________ _______ ________ _____ ______ ___ __ ________ ________ ___ __
|
||||
|\ \ |\ \|\ \ |\ \ |\ _____\\ __ \|\ ___ \ |\ __ \|\ _ \ _ \|\ \ |\ \|\ __ \|\ __ \|\ \|\ \
|
||||
\ \ \ \ \ \ \ \ \ \ \ ____________\ \ \__/\ \ \|\ \ \ __/|\ \ \|\ \ \ \\\__\ \ \ \ \ \ \ \ \ \|\ \ \ \|\ \ \ \/ /|_
|
||||
\ \ \ \ \ \ \ \ \ \ \|\____________\ \ __\\ \ _ _\ \ \_|/_\ \ __ \ \ \\|__| \ \ \ \ __\ \ \ \ \\\ \ \ _ _\ \ ___ \
|
||||
\ \ \____\ \ \ \ \____\ \ \|____________|\ \ \_| \ \ \\ \\ \ \_|\ \ \ \ \ \ \ \ \ \ \ \ \|\__\_\ \ \ \\\ \ \ \\ \\ \ \\ \ \
|
||||
\ \_______\ \__\ \_______\ \__\ \ \__\ \ \__\\ _\\ \_______\ \__\ \__\ \__\ \ \__\ \____________\ \_______\ \__\\ _\\ \__\\ \__\
|
||||
\|_______|\|__|\|_______|\|__| \|__| \|__|\|__|\|_______|\|__|\|__|\|__| \|__|\|____________|\|_______|\|__|\|__|\|__| \|__|
|
||||
|
||||
|
||||
|
||||
___ ___ ___ ___ ________ ___ ___ ________ ________
|
||||
|\ \ |\ \|\ \ |\ \ |\ ____\|\ \|\ \|\ __ \|\ __ \
|
||||
\ \ \ \ \ \ \ \ \ \ \ ____________\ \ \___|\ \ \\\ \ \ \|\ \ \ \|\ \
|
||||
\ \ \ \ \ \ \ \ \ \ \|\____________\ \_____ \ \ __ \ \ \\\ \ \ ____\
|
||||
\ \ \____\ \ \ \ \____\ \ \|____________|\|____|\ \ \ \ \ \ \ \\\ \ \ \___|
|
||||
\ \_______\ \__\ \_______\ \__\ ____\_\ \ \__\ \__\ \_______\ \__\
|
||||
\|_______|\|__|\|_______|\|__| |\_________\|__|\|__|\|_______|\|__|
|
||||
\|_________|
|
||||
|
||||
@ -7,7 +7,8 @@
|
||||
<parent>
|
||||
<groupId>cn.lili</groupId>
|
||||
<artifactId>lili-shop-parent</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>cn.lili</groupId>
|
||||
@ -17,7 +18,7 @@
|
||||
<dependency>
|
||||
<groupId>cn.lili</groupId>
|
||||
<artifactId>framework</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -81,6 +81,7 @@ public class FileController {
|
||||
if (file.getUserEnums().equals(authUser.getRole().name())) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
fileService.updateById(file);
|
||||
|
||||
@ -28,10 +28,9 @@ public class SliderImageController {
|
||||
@Autowired
|
||||
private VerificationService verificationService;
|
||||
|
||||
//一分钟同一个ip请求10次
|
||||
@LimitPoint(name = "slider_image", key = "verification")
|
||||
@GetMapping("/{verificationEnums}")
|
||||
@ApiOperation(value = "获取校验接口")
|
||||
@ApiOperation(value = "获取校验接口,一分钟同一个ip请求10次")
|
||||
public ResultMessage getSliderImage(@RequestHeader String uuid, @PathVariable VerificationEnums verificationEnums) {
|
||||
try {
|
||||
return ResultUtil.data(verificationService.createVerification(verificationEnums, uuid));
|
||||
|
||||
@ -31,14 +31,13 @@ public class SmsController {
|
||||
@Autowired
|
||||
private VerificationService verificationService;
|
||||
|
||||
//一分钟同一个ip请求1次
|
||||
@LimitPoint(name = "sms_send", key = "sms")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(paramType = "path", dataType = "String", name = "mobile", value = "手机号"),
|
||||
@ApiImplicitParam(paramType = "header", dataType = "String", name = "uuid", value = "uuid"),
|
||||
})
|
||||
@GetMapping("/{verificationEnums}/{mobile}")
|
||||
@ApiOperation(value = "发送短信验证码")
|
||||
@ApiOperation(value = "发送短信验证码,一分钟同一个ip请求1次")
|
||||
public ResultMessage getSmsCode(
|
||||
@RequestHeader String uuid,
|
||||
@PathVariable String mobile,
|
||||
|
||||
@ -121,7 +121,7 @@ spring:
|
||||
props:
|
||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||
sql:
|
||||
show: false
|
||||
show: true
|
||||
|
||||
# 忽略鉴权url
|
||||
ignored:
|
||||
@ -144,6 +144,7 @@ ignored:
|
||||
- /buyer/promotion/pintuan/**
|
||||
- /buyer/promotion/seckill/**
|
||||
- /buyer/promotion/pointsGoods/**
|
||||
- /buyer/promotion/coupon
|
||||
- /buyer/memberEvaluation/**/goodsEvaluation
|
||||
- /buyer/memberEvaluation/**/evaluationNumber
|
||||
- /buyer/appVersion/**
|
||||
@ -163,6 +164,7 @@ ignored:
|
||||
- /v2/api-docs
|
||||
- /configuration/ui
|
||||
- /boot-admin
|
||||
- /manager/promotion/seckill/init
|
||||
statics:
|
||||
- /**/*.js
|
||||
- /**/*.css
|
||||
@ -194,9 +196,9 @@ logging:
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: info
|
||||
org.hibernate: debug
|
||||
org.springframework: debug
|
||||
org.springframework.data.mongodb.core: debug
|
||||
# org.hibernate: debug
|
||||
# org.springframework: debug
|
||||
# org.springframework.data.mongodb.core: debug
|
||||
file:
|
||||
# 指定路径
|
||||
path: lili-logs
|
||||
@ -295,6 +297,8 @@ lili:
|
||||
notice-send-group: lili_send_notice_group
|
||||
rocketmq:
|
||||
name-server: 192.168.0.116:9876
|
||||
namesrvAddr: 192.168.0.116:9876
|
||||
isVIPChannel: false
|
||||
producer:
|
||||
group: lili_group
|
||||
send-message-timeout: 30000
|
||||
|
||||
@ -8,20 +8,21 @@
|
||||
<parent>
|
||||
<groupId>cn.lili</groupId>
|
||||
<artifactId>lili-shop-parent</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.lili</groupId>
|
||||
<artifactId>framework</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>2.2.0</version>
|
||||
<version>${xxl-job}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ import cn.lili.modules.order.order.entity.dto.OrderMessage;
|
||||
import cn.lili.modules.order.trade.entity.enums.AfterSaleStatusEnum;
|
||||
import cn.lili.timetask.handler.EveryDayExecute;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -23,13 +24,18 @@ import javax.annotation.Resource;
|
||||
* @author Chopper
|
||||
* @date 2020-07-03 11:20
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DistributionOrderExecute implements OrderStatusChangeEvent, EveryDayExecute, AfterSaleStatusChangeEvent {
|
||||
|
||||
//分销订单
|
||||
/**
|
||||
* 分销订单
|
||||
*/
|
||||
@Autowired
|
||||
private DistributionOrderService distributionOrderService;
|
||||
//分销订单持久层
|
||||
/**
|
||||
* 分销订单持久层
|
||||
*/
|
||||
@Resource
|
||||
private DistributionOrderMapper distributionOrderMapper;
|
||||
|
||||
@ -48,6 +54,9 @@ public class DistributionOrderExecute implements OrderStatusChangeEvent, EveryDa
|
||||
distributionOrderService.cancelOrder(orderMessage.getOrderSn());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
log.error("分销订单执行异常:", orderMessage.getOrderSn());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,9 +14,11 @@ import org.springframework.stereotype.Service;
|
||||
* @date 2020-07-03 11:20
|
||||
*/
|
||||
@Service
|
||||
public class GoodsSkuExecute implements GoodsCommentCompleteEvent {
|
||||
public class GoodsSkuExecute implements GoodsCommentCompleteEvent {
|
||||
|
||||
//商品
|
||||
/**
|
||||
* 商品
|
||||
*/
|
||||
@Autowired
|
||||
private GoodsSkuService goodsSkuService;
|
||||
|
||||
|
||||
@ -29,18 +29,25 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class MemberExperienceExecute implements MemberRegisterEvent, GoodsCommentCompleteEvent, OrderStatusChangeEvent {
|
||||
|
||||
//配置
|
||||
/**
|
||||
* 配置
|
||||
*/
|
||||
@Autowired
|
||||
private SettingService settingService;
|
||||
//会员
|
||||
/**
|
||||
* 会员
|
||||
*/
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
//订单
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
/**
|
||||
* 会员注册赠送经验值
|
||||
*
|
||||
* @param member 会员
|
||||
*/
|
||||
@Override
|
||||
@ -53,6 +60,7 @@ public class MemberExperienceExecute implements MemberRegisterEvent, GoodsCommen
|
||||
|
||||
/**
|
||||
* 商品评价赠送经验值
|
||||
*
|
||||
* @param memberEvaluation 会员评价
|
||||
*/
|
||||
@Override
|
||||
@ -65,17 +73,18 @@ public class MemberExperienceExecute implements MemberRegisterEvent, GoodsCommen
|
||||
|
||||
/**
|
||||
* 完成订单赠送经验值
|
||||
*
|
||||
* @param orderMessage 订单消息
|
||||
*/
|
||||
@Override
|
||||
public void orderChange(OrderMessage orderMessage) {
|
||||
if(orderMessage.getNewStatus().equals(OrderStatusEnum.COMPLETED)){
|
||||
if (orderMessage.getNewStatus().equals(OrderStatusEnum.COMPLETED)) {
|
||||
//获取经验值设置
|
||||
ExperienceSetting experienceSetting = getExperienceSetting();
|
||||
//获取订单信息
|
||||
Order order = orderService.getBySn(orderMessage.getOrderSn());
|
||||
//计算赠送经验值数量
|
||||
Double point= CurrencyUtil.mul(experienceSetting.getMoney(),order.getFlowPrice(),0);
|
||||
Double point = CurrencyUtil.mul(experienceSetting.getMoney(), order.getFlowPrice(), 0);
|
||||
//赠送会员经验值
|
||||
memberService.updateMemberExperience(point.longValue(), true, order.getMemberId(), "会员下单,赠送经验值" + point + "分");
|
||||
}
|
||||
@ -83,9 +92,10 @@ public class MemberExperienceExecute implements MemberRegisterEvent, GoodsCommen
|
||||
|
||||
/**
|
||||
* 获取经验值设置
|
||||
*
|
||||
* @return 经验值设置
|
||||
*/
|
||||
private ExperienceSetting getExperienceSetting(){
|
||||
private ExperienceSetting getExperienceSetting() {
|
||||
Setting setting = settingService.get(SettingEnum.EXPERIENCE_SETTING.name());
|
||||
return new Gson().fromJson(setting.getSettingValue(), ExperienceSetting.class);
|
||||
}
|
||||
|
||||
@ -33,57 +33,66 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class MemberPointExecute implements MemberRegisterEvent, GoodsCommentCompleteEvent, OrderStatusChangeEvent, AfterSaleStatusChangeEvent {
|
||||
|
||||
//配置
|
||||
/**
|
||||
* 配置
|
||||
*/
|
||||
@Autowired
|
||||
private SettingService settingService;
|
||||
//会员
|
||||
/**
|
||||
* 会员
|
||||
*/
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
//订单
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
/**
|
||||
* 会员注册赠送积分
|
||||
*
|
||||
* @param member 会员
|
||||
*/
|
||||
@Override
|
||||
public void memberRegister(Member member) {
|
||||
//获取积分设置
|
||||
PointSetting pointSetting=getPointSetting();
|
||||
PointSetting pointSetting = getPointSetting();
|
||||
//赠送会员积分
|
||||
memberService.updateMemberPoint(Long.valueOf(pointSetting.getRegister().longValue()), true, member.getId(), "会员注册,赠送积分" + pointSetting.getRegister() + "分");
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员评价赠送积分
|
||||
*
|
||||
* @param memberEvaluation 会员评价
|
||||
*/
|
||||
@Override
|
||||
public void goodsComment(MemberEvaluation memberEvaluation) {
|
||||
//获取积分设置
|
||||
PointSetting pointSetting=getPointSetting();
|
||||
PointSetting pointSetting = getPointSetting();
|
||||
//赠送会员积分
|
||||
memberService.updateMemberPoint(Long.valueOf(pointSetting.getComment().longValue()), true, memberEvaluation.getMemberId(), "会员评价,赠送积分" + pointSetting.getComment() + "分");
|
||||
}
|
||||
|
||||
/**
|
||||
* 非积分订单订单完成后赠送积分
|
||||
*
|
||||
* @param orderMessage 订单消息
|
||||
*/
|
||||
@Override
|
||||
public void orderChange(OrderMessage orderMessage) {
|
||||
|
||||
if(orderMessage.getNewStatus().equals(OrderStatusEnum.COMPLETED)){
|
||||
if (orderMessage.getNewStatus().equals(OrderStatusEnum.COMPLETED)) {
|
||||
//根据订单编号获取订单数据,如果为积分订单则跳回
|
||||
Order order = orderService.getBySn(orderMessage.getOrderSn());
|
||||
if(order.getOrderPromotionType().equals(OrderPromotionTypeEnum.POINT.name())){
|
||||
if (order.getOrderPromotionType().equals(OrderPromotionTypeEnum.POINT.name())) {
|
||||
return;
|
||||
}
|
||||
//获取积分设置
|
||||
PointSetting pointSetting=getPointSetting();
|
||||
PointSetting pointSetting = getPointSetting();
|
||||
//计算赠送积分数量
|
||||
Double point=CurrencyUtil.mul(pointSetting.getMoney(),order.getFlowPrice(),0);
|
||||
Double point = CurrencyUtil.mul(pointSetting.getMoney(), order.getFlowPrice(), 0);
|
||||
//赠送会员积分
|
||||
memberService.updateMemberPoint(point.longValue(), true, order.getMemberId(), "会员下单,赠送积分" + point + "分");
|
||||
|
||||
@ -92,15 +101,16 @@ public class MemberPointExecute implements MemberRegisterEvent, GoodsCommentComp
|
||||
|
||||
/**
|
||||
* 提交售后后扣除积分
|
||||
*
|
||||
* @param afterSale 售后
|
||||
*/
|
||||
@Override
|
||||
public void afterSaleStatusChange(AfterSale afterSale) {
|
||||
if (afterSale.getServiceStatus().equals(AfterSaleStatusEnum.COMPLETE.name())) {
|
||||
//获取积分设置
|
||||
PointSetting pointSetting=getPointSetting();
|
||||
PointSetting pointSetting = getPointSetting();
|
||||
//计算扣除积分数量
|
||||
Double point=CurrencyUtil.mul(pointSetting.getMoney(), afterSale.getActualRefundPrice(),0);
|
||||
Double point = CurrencyUtil.mul(pointSetting.getMoney(), afterSale.getActualRefundPrice(), 0);
|
||||
//扣除会员积分
|
||||
memberService.updateMemberPoint(point.longValue(), false, afterSale.getMemberId(), "会员退款,扣除积分" + point + "分");
|
||||
|
||||
@ -109,9 +119,10 @@ public class MemberPointExecute implements MemberRegisterEvent, GoodsCommentComp
|
||||
|
||||
/**
|
||||
* 获取积分设置
|
||||
*
|
||||
* @return 积分设置
|
||||
*/
|
||||
private PointSetting getPointSetting(){
|
||||
private PointSetting getPointSetting() {
|
||||
Setting setting = settingService.get(SettingEnum.POINT_SETTING.name());
|
||||
return new Gson().fromJson(setting.getSettingValue(), PointSetting.class);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
|
||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||
noticeMessageDTO.setMemberId(tradeDTO.getMemberId());
|
||||
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.ORDER_CREATE_SUCCESS);
|
||||
Map<String, String> params = new HashMap<>();
|
||||
Map<String, String> params = new HashMap<>(2);
|
||||
params.put("goods", tradeDTO.getSkuList().get(0).getGoodsSku().getGoodsName());
|
||||
noticeMessageDTO.setParameter(params);
|
||||
//保存站内信
|
||||
@ -58,7 +58,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
|
||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||
//如果订单状态不为空
|
||||
if (orderDetailVO != null) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
Map<String, String> params = new HashMap<>(2);
|
||||
switch (orderMessage.getNewStatus()) {
|
||||
//如果订单新的状态为已取消 则发送取消订单站内信
|
||||
case CANCELLED:
|
||||
@ -103,7 +103,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
|
||||
public void afterSaleStatusChange(AfterSale afterSale) {
|
||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||
noticeMessageDTO.setMemberId(afterSale.getMemberId());
|
||||
Map<String, String> params = new HashMap<>();
|
||||
Map<String, String> params = new HashMap<>(2);
|
||||
params.put("goods", afterSale.getGoodsName());
|
||||
params.put("refuse", afterSale.getAuditRemark());
|
||||
noticeMessageDTO.setParameter(params);
|
||||
@ -154,7 +154,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
|
||||
//组织站内信参数
|
||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||
noticeMessageDTO.setMemberId(memberPointMessage.getMemberId());
|
||||
Map<String, String> params = new HashMap<>();
|
||||
Map<String, String> params = new HashMap<>(2);
|
||||
if (memberPointMessage.getType()) {
|
||||
params.put("expenditure_points", "0");
|
||||
params.put("income_points", memberPointMessage.getPoint().toString());
|
||||
@ -178,7 +178,7 @@ public class NoticeMessageExecute implements TradeEvent, OrderStatusChangeEvent,
|
||||
//组织参数
|
||||
NoticeMessageDTO noticeMessageDTO = new NoticeMessageDTO();
|
||||
noticeMessageDTO.setMemberId(memberWithdrawalMessage.getMemberId());
|
||||
Map<String, String> params = new HashMap<>();
|
||||
Map<String, String> params = new HashMap<>(2);
|
||||
params.put("income", memberWithdrawalMessage.getPrice().toString());
|
||||
noticeMessageDTO.setParameter(params);
|
||||
noticeMessageDTO.setNoticeMessageNodeEnum(NoticeMessageNodeEnum.WALLET_WITHDRAWAL_SUCCESS);
|
||||
|
||||
@ -10,6 +10,7 @@ import cn.lili.modules.order.order.service.OrderService;
|
||||
import cn.lili.modules.payment.entity.RefundLog;
|
||||
import cn.lili.modules.payment.kit.Payment;
|
||||
import cn.lili.modules.payment.kit.enums.PaymentMethodEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -19,10 +20,13 @@ import org.springframework.stereotype.Service;
|
||||
* @author Chopper
|
||||
* @date 2021-03-13 16:58
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PaymentExecute implements OrderStatusChangeEvent {
|
||||
|
||||
//订单
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
@ -36,7 +40,10 @@ public class PaymentExecute implements OrderStatusChangeEvent {
|
||||
if (order.getPayStatus() == PayStatusEnum.UNPAID.name()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//如果未付款,则不去要退回相关代码执行
|
||||
if (order.getPayStatus().equals(PayStatusEnum.UNPAID.name())) {
|
||||
return;
|
||||
}
|
||||
PaymentMethodEnum paymentMethodEnum = PaymentMethodEnum.valueOf(order.getPaymentMethod());
|
||||
//进行退款操作
|
||||
switch (paymentMethodEnum) {
|
||||
@ -64,6 +71,9 @@ public class PaymentExecute implements OrderStatusChangeEvent {
|
||||
break;
|
||||
case BANK_TRANSFER:
|
||||
break;
|
||||
default:
|
||||
log.error("订单支付执行异常,订单编号:{}", orderMessage.getOrderSn());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -32,23 +32,35 @@ import java.util.List;
|
||||
@Service
|
||||
public class StockUpdateExecute implements OrderStatusChangeEvent {
|
||||
|
||||
//出库失败消息
|
||||
/**
|
||||
* 出库失败消息
|
||||
*/
|
||||
static String outOfStockMessage = "库存不足,出库失败";
|
||||
//Redis
|
||||
/**
|
||||
* Redis
|
||||
*/
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
@Autowired
|
||||
private DefaultRedisScript<Boolean> quantityScript;
|
||||
//订单
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
//规格商品
|
||||
/**
|
||||
* 规格商品
|
||||
*/
|
||||
@Autowired
|
||||
private GoodsSkuService goodsSkuService;
|
||||
//促销商品
|
||||
/**
|
||||
* 促销商品
|
||||
*/
|
||||
@Autowired
|
||||
private PromotionGoodsService promotionGoodsService;
|
||||
//缓存
|
||||
/**
|
||||
* 缓存
|
||||
*/
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
|
||||
@ -24,7 +24,9 @@ import java.util.List;
|
||||
@RocketMQMessageListener(topic = "${lili.data.rocketmq.after-sale-topic}", consumerGroup = "${lili.data.rocketmq.after-sale-group}")
|
||||
public class AfterSaleMessageListener implements RocketMQListener<MessageExt> {
|
||||
|
||||
//售后订单状态
|
||||
/**
|
||||
* 售后订单状态
|
||||
*/
|
||||
@Autowired
|
||||
private List<AfterSaleStatusChangeEvent> afterSaleStatusChangeEvents;
|
||||
|
||||
@ -43,6 +45,8 @@ public class AfterSaleMessageListener implements RocketMQListener<MessageExt> {
|
||||
e);
|
||||
}
|
||||
}
|
||||
default:
|
||||
log.error("售后状态修改事件执行异常:", new String(messageExt.getBody()));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@ import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||
import cn.lili.modules.search.service.EsGoodsIndexService;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.rocketmq.common.message.MessageExt;
|
||||
@ -42,31 +41,49 @@ import java.util.List;
|
||||
@RocketMQMessageListener(topic = "${lili.data.rocketmq.goods-topic}", consumerGroup = "${lili.data.rocketmq.goods-group}")
|
||||
public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
||||
|
||||
//ES商品
|
||||
/**
|
||||
* ES商品
|
||||
*/
|
||||
@Autowired
|
||||
private EsGoodsIndexService goodsIndexService;
|
||||
//店铺
|
||||
/**
|
||||
* 店铺
|
||||
*/
|
||||
@Autowired
|
||||
private StoreService storeService;
|
||||
//商品
|
||||
/**
|
||||
* 商品
|
||||
*/
|
||||
@Autowired
|
||||
private GoodsService goodsService;
|
||||
//商品
|
||||
/**
|
||||
* 商品Sku
|
||||
*/
|
||||
@Autowired
|
||||
private GoodsSkuService goodsSkuService;
|
||||
//用户足迹
|
||||
/**
|
||||
* 用户足迹
|
||||
*/
|
||||
@Autowired
|
||||
private FootprintService footprintService;
|
||||
//商品收藏
|
||||
/**
|
||||
* 商品收藏
|
||||
*/
|
||||
@Autowired
|
||||
private GoodsCollectionService goodsCollectionService;
|
||||
//商品评价
|
||||
/**
|
||||
* 商品评价
|
||||
*/
|
||||
@Autowired
|
||||
private List<GoodsCommentCompleteEvent> goodsCommentCompleteEvents;
|
||||
//分销商品
|
||||
/**
|
||||
* 分销商品
|
||||
*/
|
||||
@Autowired
|
||||
private DistributionGoodsService distributionGoodsService;
|
||||
//分销员-商品关联表
|
||||
/**
|
||||
* 分销员-商品关联表
|
||||
*/
|
||||
@Autowired
|
||||
private DistributionSelectedGoodsService distributionSelectedGoodsService;
|
||||
|
||||
@ -123,6 +140,9 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
||||
case BUY_GOODS_COMPLETE:
|
||||
this.goodsBuyComplete(messageExt);
|
||||
break;
|
||||
default:
|
||||
log.error("商品执行异常:", new String(messageExt.getBody()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,20 +151,21 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
||||
* 1.更新店铺的商品数量
|
||||
* 2.删除分销员-分销商品绑定关系
|
||||
* 3.删除分销商品
|
||||
*
|
||||
* @param messageExt 消息
|
||||
*/
|
||||
private void deleteGoods(MessageExt messageExt){
|
||||
Goods goods=JSONUtil.toBean(new String(messageExt.getBody()),Goods.class);
|
||||
private void deleteGoods(MessageExt messageExt) {
|
||||
Goods goods = JSONUtil.toBean(new String(messageExt.getBody()), Goods.class);
|
||||
//更新店铺商品数量
|
||||
storeService.updateStoreGoodsNum(goods.getStoreId());
|
||||
|
||||
//删除获取分销商品
|
||||
DistributionGoods distributionGoods=distributionGoodsService.getOne(new LambdaQueryWrapper<DistributionGoods>()
|
||||
.eq(DistributionGoods::getGoodsId,goods.getId()));
|
||||
DistributionGoods distributionGoods = distributionGoodsService.getOne(new LambdaQueryWrapper<DistributionGoods>()
|
||||
.eq(DistributionGoods::getGoodsId, goods.getId()));
|
||||
|
||||
//删除分销商品绑定关系
|
||||
distributionSelectedGoodsService.remove(new LambdaQueryWrapper<DistributionSelectedGoods>()
|
||||
.eq(DistributionSelectedGoods::getDistributionGoodsId,distributionGoods.getId()));
|
||||
.eq(DistributionSelectedGoods::getDistributionGoodsId, distributionGoods.getId()));
|
||||
|
||||
//删除分销商品
|
||||
distributionGoodsService.removeById(distributionGoods.getId());
|
||||
@ -155,9 +176,10 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
||||
* 1.更新商品购买数量
|
||||
* 2.更新SKU购买数量
|
||||
* 3.更新索引购买数量
|
||||
*
|
||||
* @param messageExt
|
||||
*/
|
||||
private void goodsBuyComplete(MessageExt messageExt){
|
||||
private void goodsBuyComplete(MessageExt messageExt) {
|
||||
String goodsCompleteMessageStr = new String(messageExt.getBody());
|
||||
List<GoodsCompleteMessage> goodsCompleteMessageList = JSONUtil.toList(JSONUtil.parseArray(goodsCompleteMessageStr), GoodsCompleteMessage.class);
|
||||
for (GoodsCompleteMessage goodsCompleteMessage : goodsCompleteMessageList) {
|
||||
|
||||
@ -30,16 +30,24 @@ import java.util.List;
|
||||
@RocketMQMessageListener(topic = "${lili.data.rocketmq.member-topic}", consumerGroup = "${lili.data.rocketmq.member-group}")
|
||||
public class MemberMessageListener implements RocketMQListener<MessageExt> {
|
||||
|
||||
//会员签到
|
||||
/**
|
||||
* 会员签到
|
||||
*/
|
||||
@Autowired
|
||||
private MemberSignService memberSignService;
|
||||
//会员积分变化
|
||||
/**
|
||||
* 会员积分变化
|
||||
*/
|
||||
@Autowired
|
||||
private List<MemberPointChangeEvent> memberPointChangeEvents;
|
||||
//会员提现
|
||||
/**
|
||||
* 会员提现
|
||||
*/
|
||||
@Autowired
|
||||
private List<MemberWithdrawalEvent> memberWithdrawalEvents;
|
||||
//会员注册
|
||||
/**
|
||||
* 会员注册
|
||||
*/
|
||||
@Autowired
|
||||
private List<MemberRegisterEvent> memberSignEvents;
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@ package cn.lili.listener;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.modules.message.entity.dto.NoticeMessageDTO;
|
||||
import cn.lili.modules.message.service.NoticeMessageService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.rocketmq.common.message.MessageExt;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
@ -20,7 +19,9 @@ import org.springframework.stereotype.Component;
|
||||
@RocketMQMessageListener(topic = "${lili.data.rocketmq.notice-topic}", consumerGroup = "${lili.data.rocketmq.notice-group}")
|
||||
public class NoticeMessageListener implements RocketMQListener<MessageExt> {
|
||||
|
||||
//站内信
|
||||
/**
|
||||
* 站内信
|
||||
*/
|
||||
@Autowired
|
||||
private NoticeMessageService noticeMessageService;
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -41,22 +42,34 @@ import java.util.List;
|
||||
@RocketMQMessageListener(topic = "${lili.data.rocketmq.notice-send-topic}", consumerGroup = "${lili.data.rocketmq.notice-send-group}")
|
||||
public class NoticeSendMessageListener implements RocketMQListener<MessageExt> {
|
||||
|
||||
//会员
|
||||
@Autowired
|
||||
/**
|
||||
* 会员
|
||||
*/
|
||||
@Resource
|
||||
private MemberMapper memberMapper;
|
||||
//短信
|
||||
/**
|
||||
* 短信
|
||||
*/
|
||||
@Autowired
|
||||
private SmsUtil smsUtil;
|
||||
//店铺消息
|
||||
/**
|
||||
* 店铺消息
|
||||
*/
|
||||
@Autowired
|
||||
private StoreMessageService storeMessageService;
|
||||
//会员消息
|
||||
/**
|
||||
* 会员消息
|
||||
*/
|
||||
@Autowired
|
||||
private MemberMessageService memberMessageService;
|
||||
//店铺
|
||||
/**
|
||||
* 店铺
|
||||
*/
|
||||
@Autowired
|
||||
private StoreService storeService;
|
||||
//会员
|
||||
/**
|
||||
* 会员
|
||||
*/
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
|
||||
@ -100,7 +113,7 @@ public class NoticeSendMessageListener implements RocketMQListener<MessageExt> {
|
||||
private void saveStoreMessage(Message message) {
|
||||
List<StoreMessage> list = new ArrayList<>();
|
||||
//发送全部商家情况
|
||||
if (message.getMessageRange().equals("ALL")) {
|
||||
if ("ALL".equals(message.getMessageRange())) {
|
||||
List<Store> storeList = storeService.list(new QueryWrapper<Store>().eq("store_disable", "OPEN"));
|
||||
storeList.forEach(item -> {
|
||||
StoreMessage storeMessage = new StoreMessage();
|
||||
@ -141,7 +154,7 @@ public class NoticeSendMessageListener implements RocketMQListener<MessageExt> {
|
||||
private void saveMemberMessage(Message message) {
|
||||
List<MemberMessage> list = new ArrayList<>();
|
||||
//如果是给所有会员发送消息
|
||||
if (message.getMessageRange().equals("ALL")) {
|
||||
if ("ALL".equals(message.getMessageRange())) {
|
||||
//查询所有会员总数,因为会员总数比较大 如果一次性查出来会占用数据库资源,所以要分页查询
|
||||
MemberSearchVO memberSearchVO = new MemberSearchVO();
|
||||
memberSearchVO.setDisabled(SwitchEnum.OPEN.name());
|
||||
|
||||
@ -27,13 +27,19 @@ import java.util.List;
|
||||
@RocketMQMessageListener(topic = "${lili.data.rocketmq.order-topic}", consumerGroup = "${lili.data.rocketmq.order-group}")
|
||||
public class OrderMessageListener implements RocketMQListener<MessageExt> {
|
||||
|
||||
//交易
|
||||
/**
|
||||
* 交易
|
||||
*/
|
||||
@Autowired
|
||||
private List<TradeEvent> tradeEvent;
|
||||
//订单状态
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
@Autowired
|
||||
private List<OrderStatusChangeEvent> orderStatusChangeEvents;
|
||||
//缓存
|
||||
/**
|
||||
* 缓存
|
||||
*/
|
||||
@Autowired
|
||||
private Cache<Object> cache;
|
||||
|
||||
|
||||
@ -21,10 +21,14 @@ import java.util.List;
|
||||
@Component
|
||||
public class BillExecute implements EveryDayExecute {
|
||||
|
||||
//结算单
|
||||
/**
|
||||
* 结算单
|
||||
*/
|
||||
@Autowired
|
||||
private BillService billService;
|
||||
//店铺详情
|
||||
/**
|
||||
* 店铺详情
|
||||
*/
|
||||
@Resource
|
||||
private StoreDetailMapper storeDetailMapper;
|
||||
|
||||
|
||||
@ -8,9 +8,9 @@ import cn.lili.modules.member.entity.dos.MemberEvaluation;
|
||||
import cn.lili.modules.member.mapper.MemberEvaluationMapper;
|
||||
import cn.lili.timetask.handler.EveryDayExecute;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -22,11 +22,15 @@ import java.util.Map;
|
||||
*/
|
||||
@Component
|
||||
public class GoodsExecute implements EveryDayExecute {
|
||||
//会员评价
|
||||
@Autowired
|
||||
/**
|
||||
* 会员评价
|
||||
*/
|
||||
@Resource
|
||||
private MemberEvaluationMapper memberEvaluationMapper;
|
||||
//商品
|
||||
@Autowired
|
||||
/**
|
||||
* 商品
|
||||
*/
|
||||
@Resource
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
/**
|
||||
|
||||
@ -12,7 +12,6 @@ import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import cn.lili.timetask.handler.EveryMinuteExecute;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -28,12 +27,15 @@ import java.util.stream.Collectors;
|
||||
**/
|
||||
@Slf4j
|
||||
@Component
|
||||
|
||||
public class CancelOrderTaskExecute implements EveryMinuteExecute {
|
||||
//订单
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
//设置
|
||||
/**
|
||||
* 设置
|
||||
*/
|
||||
@Autowired
|
||||
private SettingService settingService;
|
||||
|
||||
|
||||
@ -10,7 +10,12 @@ import cn.lili.modules.member.entity.enums.EvaluationGradeEnum;
|
||||
import cn.lili.modules.member.service.MemberEvaluationService;
|
||||
import cn.lili.modules.order.order.entity.dos.Order;
|
||||
import cn.lili.modules.order.order.entity.dos.OrderItem;
|
||||
import cn.lili.modules.order.order.entity.enums.CommentStatusEnum;
|
||||
import cn.lili.modules.order.order.entity.enums.OrderComplaintStatusEnum;
|
||||
import cn.lili.modules.order.order.entity.enums.OrderItemAfterSaleStatusEnum;
|
||||
import cn.lili.modules.order.order.entity.enums.OrderStatusEnum;
|
||||
import cn.lili.modules.order.order.mapper.OrderItemMapper;
|
||||
import cn.lili.modules.order.order.service.AfterSaleService;
|
||||
import cn.lili.modules.order.order.service.OrderItemService;
|
||||
import cn.lili.modules.order.order.service.OrderService;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
@ -19,12 +24,13 @@ import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import cn.lili.timetask.handler.EveryDayExecute;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -37,26 +43,40 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class OrderEveryDayTaskExecute implements EveryDayExecute {
|
||||
|
||||
//订单
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
//订单货物
|
||||
/**
|
||||
* 订单货物
|
||||
*/
|
||||
@Autowired
|
||||
private OrderItemService orderItemService;
|
||||
//设置
|
||||
@Resource
|
||||
private OrderItemMapper orderItemMapper;
|
||||
/**
|
||||
* 设置
|
||||
*/
|
||||
@Autowired
|
||||
private SettingService settingService;
|
||||
//会员评价
|
||||
/**
|
||||
* 会员评价
|
||||
*/
|
||||
@Autowired
|
||||
private MemberEvaluationService memberEvaluationService;
|
||||
|
||||
@Autowired
|
||||
private AfterSaleService afterSaleService;
|
||||
|
||||
/**
|
||||
* 执行每日任务
|
||||
*/
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
Setting setting = settingService.get(SettingEnum.ORDER_SETTING.name());
|
||||
//自动确认收货
|
||||
//订单设置
|
||||
OrderSetting orderSetting = JSONUtil.toBean(setting.getSettingValue(), OrderSetting.class);
|
||||
if (orderSetting == null) {
|
||||
throw new ServiceException(ResultCode.ORDER_SETTING_ERROR);
|
||||
@ -66,6 +86,10 @@ public class OrderEveryDayTaskExecute implements EveryDayExecute {
|
||||
completedOrder(orderSetting);
|
||||
//自动好评
|
||||
memberEvaluation(orderSetting);
|
||||
//关闭允许售后申请
|
||||
closeAfterSale(orderSetting);
|
||||
//关闭允许投诉
|
||||
closeComplaint(orderSetting);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,21 +98,21 @@ public class OrderEveryDayTaskExecute implements EveryDayExecute {
|
||||
* @param orderSetting 订单设置
|
||||
*/
|
||||
private void completedOrder(OrderSetting orderSetting) {
|
||||
|
||||
//订单自动收货时间 = 当前时间 - 自动收货时间天数
|
||||
DateTime receiveTime = DateUtil.offsetDay(DateUtil.date(), -orderSetting.getAutoEvaluation());
|
||||
DateTime receiveTime = DateUtil.offsetDay(DateUtil.date(), -orderSetting.getAutoReceive());
|
||||
LambdaQueryWrapper<Order> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Order::getOrderStatus, OrderStatusEnum.DELIVERED.name());
|
||||
|
||||
//订单发货时间 >= 订单自动收货时间
|
||||
queryWrapper.ge(Order::getLogisticsTime, receiveTime);
|
||||
List<Order> list = orderService.list(queryWrapper);
|
||||
List<String> receiveSnList = list.stream().map(Order::getSn).collect(Collectors.toList());
|
||||
if (!receiveSnList.isEmpty()) {
|
||||
LambdaUpdateWrapper<Order> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.in(Order::getSn, receiveSnList);
|
||||
updateWrapper.set(Order::getOrderStatus, OrderStatusEnum.COMPLETED.name()).set(Order::getCompleteTime, new Date());
|
||||
boolean update = orderService.update(updateWrapper);
|
||||
if (Boolean.FALSE.equals(update)) {
|
||||
log.error("自动收货订单失败!订单编号为[{}]", receiveSnList);
|
||||
|
||||
//判断是否有符合条件的订单,进行订单完成处理
|
||||
if (!list.isEmpty()) {
|
||||
List<String> receiveSnList = list.stream().map(Order::getSn).collect(Collectors.toList());
|
||||
for (String orderSn : receiveSnList) {
|
||||
orderService.complete(orderSn);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -100,26 +124,93 @@ public class OrderEveryDayTaskExecute implements EveryDayExecute {
|
||||
*/
|
||||
private void memberEvaluation(OrderSetting orderSetting) {
|
||||
//订单自动收货时间 = 当前时间 - 自动收货时间天数
|
||||
DateTime receiveTime = DateUtil.offsetDay(DateUtil.date(), -orderSetting.getAutoReceive());
|
||||
DateTime receiveTime = DateUtil.offsetDay(DateUtil.date(), -orderSetting.getAutoEvaluation());
|
||||
|
||||
//订单完成时间 <= 订单自动好评时间
|
||||
List<OrderItem> orderItems = orderItemService.waitEvaluate(receiveTime);
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.ge("o.complete_time", receiveTime);
|
||||
queryWrapper.eq("oi.comment_status", CommentStatusEnum.UNFINISHED.name());
|
||||
List<OrderItem> orderItems = orderItemMapper.waitOperationOrderItem(queryWrapper);
|
||||
|
||||
for (OrderItem orderItem : orderItems) {
|
||||
|
||||
MemberEvaluationDTO memberEvaluationDTO = new MemberEvaluationDTO();
|
||||
memberEvaluationDTO.setOrderItemSn(orderItem.getSn());
|
||||
memberEvaluationDTO.setContent("系统默认好评");
|
||||
memberEvaluationDTO.setGoodsId(orderItem.getGoodsId());
|
||||
memberEvaluationDTO.setSkuId(orderItem.getSkuId());
|
||||
memberEvaluationDTO.setGrade(EvaluationGradeEnum.GOOD.name());
|
||||
memberEvaluationDTO.setDeliveryScore(5);
|
||||
memberEvaluationDTO.setDescriptionScore(5);
|
||||
memberEvaluationDTO.setServiceScore(5);
|
||||
|
||||
memberEvaluationService.addMemberEvaluation(memberEvaluationDTO);
|
||||
//判断是否有符合条件的订单,进行自动评价处理
|
||||
if (!orderItems.isEmpty()) {
|
||||
for (OrderItem orderItem : orderItems) {
|
||||
MemberEvaluationDTO memberEvaluationDTO = new MemberEvaluationDTO();
|
||||
memberEvaluationDTO.setOrderItemSn(orderItem.getSn());
|
||||
memberEvaluationDTO.setContent("系统默认好评");
|
||||
memberEvaluationDTO.setGoodsId(orderItem.getGoodsId());
|
||||
memberEvaluationDTO.setSkuId(orderItem.getSkuId());
|
||||
memberEvaluationDTO.setGrade(EvaluationGradeEnum.GOOD.name());
|
||||
memberEvaluationDTO.setDeliveryScore(5);
|
||||
memberEvaluationDTO.setDescriptionScore(5);
|
||||
memberEvaluationDTO.setServiceScore(5);
|
||||
|
||||
memberEvaluationService.addMemberEvaluation(memberEvaluationDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 关闭允许售后申请
|
||||
*
|
||||
* @param orderSetting 订单设置
|
||||
*/
|
||||
private void closeAfterSale(OrderSetting orderSetting) {
|
||||
|
||||
//订单关闭售后申请时间 = 当前时间 - 自动关闭售后申请天数
|
||||
DateTime receiveTime = DateUtil.offsetDay(DateUtil.date(), -orderSetting.getAutoEvaluation());
|
||||
|
||||
//关闭售后订单=未售后订单+小于订单关闭售后申请时间
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.ge("o.complete_time", receiveTime);
|
||||
queryWrapper.eq("oi.after_sale_status", OrderItemAfterSaleStatusEnum.NOT_APPLIED.name());
|
||||
List<OrderItem> orderItems = orderItemMapper.waitOperationOrderItem(queryWrapper);
|
||||
|
||||
//判断是否有符合条件的订单,关闭允许售后申请处理
|
||||
if (!orderItems.isEmpty()) {
|
||||
|
||||
//获取订单货物ID
|
||||
List<String> orderItemIdList = orderItems.stream().map(OrderItem::getId).collect(Collectors.toList());
|
||||
|
||||
//修改订单售后状态
|
||||
LambdaUpdateWrapper<OrderItem> lambdaUpdateWrapper = new LambdaUpdateWrapper<OrderItem>()
|
||||
.set(OrderItem::getAfterSaleStatus, OrderItemAfterSaleStatusEnum.EXPIRED.name())
|
||||
.in(OrderItem::getId, orderItemIdList);
|
||||
orderItemService.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭允许交易投诉
|
||||
*
|
||||
* @param orderSetting 订单设置
|
||||
*/
|
||||
private void closeComplaint(OrderSetting orderSetting) {
|
||||
|
||||
//订单关闭交易投诉申请时间 = 当前时间 - 自动关闭交易投诉申请天数
|
||||
DateTime receiveTime = DateUtil.offsetDay(DateUtil.date(), -orderSetting.getCloseComplaint());
|
||||
|
||||
//关闭售后订单=未售后订单+小于订单关闭售后申请时间
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.ge("o.complete_time", receiveTime);
|
||||
queryWrapper.eq("oi.complain_status", OrderComplaintStatusEnum.NO_APPLY.name());
|
||||
List<OrderItem> orderItems = orderItemMapper.waitOperationOrderItem(queryWrapper);
|
||||
|
||||
//判断是否有符合条件的订单,关闭允许售后申请处理
|
||||
if (!orderItems.isEmpty()) {
|
||||
|
||||
//获取订单货物ID
|
||||
List<String> orderItemIdList = orderItems.stream().map(OrderItem::getId).collect(Collectors.toList());
|
||||
|
||||
//修改订单投诉状态
|
||||
LambdaUpdateWrapper<OrderItem> lambdaUpdateWrapper = new LambdaUpdateWrapper<OrderItem>()
|
||||
.set(OrderItem::getComplainStatus, OrderItemAfterSaleStatusEnum.EXPIRED.name())
|
||||
.in(OrderItem::getId, orderItemIdList);
|
||||
orderItemService.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -39,33 +39,49 @@ import java.util.List;
|
||||
@Component
|
||||
public class PromotionEverydayExecute implements EveryDayExecute {
|
||||
|
||||
//Mongo
|
||||
/**
|
||||
* Mongo
|
||||
*/
|
||||
@Autowired
|
||||
private MongoTemplate mongoTemplate;
|
||||
//es
|
||||
/**
|
||||
* ES商品索引
|
||||
*/
|
||||
@Autowired
|
||||
private EsGoodsIndexService esGoodsIndexService;
|
||||
//满额活动
|
||||
/**
|
||||
* 满额活动
|
||||
*/
|
||||
@Autowired
|
||||
private FullDiscountService fullDiscountService;
|
||||
//拼团
|
||||
/**
|
||||
* 拼团
|
||||
*/
|
||||
@Autowired
|
||||
private PintuanService pintuanService;
|
||||
//优惠券
|
||||
/**
|
||||
* 优惠券
|
||||
*/
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
//会员优惠券
|
||||
/**
|
||||
* 会员优惠券
|
||||
*/
|
||||
@Autowired
|
||||
private MemberCouponService memberCouponService;
|
||||
//促销商品
|
||||
/**
|
||||
* 促销商品
|
||||
*/
|
||||
@Autowired
|
||||
private PromotionGoodsService promotionGoodsService;
|
||||
|
||||
//系统设置
|
||||
/**
|
||||
* 系统设置
|
||||
*/
|
||||
@Autowired
|
||||
private SettingService settingService;
|
||||
|
||||
//秒杀活动
|
||||
/**
|
||||
* 秒杀活动
|
||||
*/
|
||||
@Autowired
|
||||
private SeckillService seckillService;
|
||||
|
||||
|
||||
@ -20,7 +20,9 @@ import java.util.Date;
|
||||
@Component
|
||||
public class MemberStatisticsExecute implements EveryDayExecute {
|
||||
|
||||
//会员统计
|
||||
/**
|
||||
* 会员统计
|
||||
*/
|
||||
@Autowired
|
||||
private MemberStatisticsDataService memberStatisticsDataService;
|
||||
|
||||
|
||||
@ -24,10 +24,14 @@ import java.util.stream.Collectors;
|
||||
@Component
|
||||
public class OnlineMemberStatistics implements EveryHourExecute {
|
||||
|
||||
//缓存
|
||||
/**
|
||||
* 缓存
|
||||
*/
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
//统计小时
|
||||
/**
|
||||
* 统计小时
|
||||
*/
|
||||
@Autowired
|
||||
private StatisticsProperties statisticsProperties;
|
||||
|
||||
|
||||
@ -11,10 +11,10 @@ import cn.lili.timetask.handler.EveryDayExecute;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -25,11 +25,15 @@ import java.util.List;
|
||||
*/
|
||||
@Component
|
||||
public class StoreRatingExecute implements EveryDayExecute {
|
||||
//店铺
|
||||
/**
|
||||
* 店铺
|
||||
*/
|
||||
@Autowired
|
||||
private StoreService storeService;
|
||||
//会员评价
|
||||
@Autowired
|
||||
/**
|
||||
* 会员评价
|
||||
*/
|
||||
@Resource
|
||||
private MemberEvaluationMapper memberEvaluationMapper;
|
||||
|
||||
|
||||
@ -39,10 +43,10 @@ public class StoreRatingExecute implements EveryDayExecute {
|
||||
List<Store> storeList = storeService.list(new LambdaQueryWrapper<Store>().eq(Store::getStoreDisable, StoreStatusEnum.OPEN.name()));
|
||||
for (Store store : storeList) {
|
||||
//店铺所有开启的评价
|
||||
LambdaQueryWrapper<MemberEvaluation> QueryWrapper = Wrappers.lambdaQuery();
|
||||
QueryWrapper.eq(MemberEvaluation::getStoreId, store.getId());
|
||||
QueryWrapper.eq(MemberEvaluation::getStatus, SwitchEnum.OPEN.name());
|
||||
StoreRatingVO storeRatingVO = memberEvaluationMapper.getStoreRatingVO(QueryWrapper);
|
||||
LambdaQueryWrapper<MemberEvaluation> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.eq(MemberEvaluation::getStoreId, store.getId());
|
||||
lambdaQueryWrapper.eq(MemberEvaluation::getStatus, SwitchEnum.OPEN.name());
|
||||
StoreRatingVO storeRatingVO = memberEvaluationMapper.getStoreRatingVO(lambdaQueryWrapper);
|
||||
|
||||
if (storeRatingVO != null) {
|
||||
//保存评分
|
||||
|
||||
@ -4,7 +4,6 @@ import cn.hutool.core.convert.Convert;
|
||||
import cn.lili.common.cache.Cache;
|
||||
import cn.lili.common.cache.CachePrefix;
|
||||
import cn.lili.common.utils.BeanUtil;
|
||||
import cn.lili.common.utils.DateUtil;
|
||||
import cn.lili.modules.statistics.model.dos.PlatformViewData;
|
||||
import cn.lili.modules.statistics.service.PlatformViewDataService;
|
||||
import cn.lili.timetask.handler.EveryDayExecute;
|
||||
@ -29,10 +28,14 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PageViewStatisticsExecute implements EveryDayExecute {
|
||||
//缓存
|
||||
/**
|
||||
* 缓存
|
||||
*/
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
//平台PV统计
|
||||
/**
|
||||
* 平台PV统计
|
||||
*/
|
||||
@Autowired
|
||||
private PlatformViewDataService platformViewDataService;
|
||||
|
||||
|
||||
@ -79,6 +79,7 @@ public abstract class AbstractDelayQueueListen {
|
||||
|
||||
/**
|
||||
* 要实现延时队列的名字
|
||||
* @return 促销延时队列名称
|
||||
*/
|
||||
public abstract String setDelayQueueName();
|
||||
|
||||
@ -88,7 +89,7 @@ public abstract class AbstractDelayQueueListen {
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
new Thread(this::startDelayQueueMachine).start();
|
||||
ThreadPoolUtil.getPool().execute(this::startDelayQueueMachine);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -25,16 +25,24 @@ import org.springframework.stereotype.Component;
|
||||
@Slf4j
|
||||
@Component(TimeExecuteConstant.PROMOTION_EXECUTOR)
|
||||
public class PromotionTimeTriggerExecutor implements TimeTriggerExecutor {
|
||||
//促销
|
||||
/**
|
||||
* 促销
|
||||
*/
|
||||
@Autowired
|
||||
private PromotionService promotionService;
|
||||
//Rocketmq
|
||||
/**
|
||||
* RocketMQ
|
||||
*/
|
||||
@Autowired
|
||||
private RocketmqCustomProperties rocketmqCustomProperties;
|
||||
//延时任务
|
||||
/**
|
||||
* 延时任务
|
||||
*/
|
||||
@Autowired
|
||||
private TimeTrigger timeTrigger;
|
||||
//订单
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
|
||||
@ -7,53 +7,13 @@
|
||||
<parent>
|
||||
<groupId>cn.lili</groupId>
|
||||
<artifactId>lili-shop-parent</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>framework</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<swagger-bootstrap-ui-version>1.9.6</swagger-bootstrap-ui-version>
|
||||
<alipay-sdk-version>4.13.40.ALL</alipay-sdk-version>
|
||||
<mysql-connector-version>5.1.48</mysql-connector-version>
|
||||
<mybatis-plus-version>3.3.1.tmp</mybatis-plus-version>
|
||||
<Hutool-version>5.5.8</Hutool-version>
|
||||
<TinyPinyin-verions>2.0.3.RELEASE</TinyPinyin-verions>
|
||||
<jasypt-version>3.0.0</jasypt-version>
|
||||
<neetl-version>2.9.10</neetl-version>
|
||||
<lombok-version>1.18.10</lombok-version>
|
||||
<minio-version>6.0.11</minio-version>
|
||||
<aliyun-version>4.5.18</aliyun-version>
|
||||
<aliyun-sdk-oss-version>3.11.1</aliyun-sdk-oss-version>
|
||||
<aliyun-sdk-dysms-version>2.0.1</aliyun-sdk-dysms-version>
|
||||
<rocketmq-version>2.1.1</rocketmq-version>
|
||||
<jwt-version>0.10.7</jwt-version>
|
||||
<antlr4-runtime-version>4.7.2</antlr4-runtime-version>
|
||||
<sharding-jdbc-version>4.0.0</sharding-jdbc-version>
|
||||
<druid-version>1.1.20</druid-version>
|
||||
<simple-http-version>1.0.3</simple-http-version>
|
||||
<antlr4-version>4.7.2</antlr4-version>
|
||||
<okhttp-version>4.4.1</okhttp-version>
|
||||
<httpclient-version>4.5.12</httpclient-version>
|
||||
<beetl-version>2.9.10</beetl-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<skipTests>true</skipTests>
|
||||
<knife4j.version>2.0.8</knife4j.version>
|
||||
<de.codecentric>2.3.1</de.codecentric>
|
||||
<userAgentUtils>1.21</userAgentUtils>
|
||||
<interceptor-api>1.2</interceptor-api>
|
||||
<poi-version>4.1.2</poi-version>
|
||||
<poi-ooxml-version>4.1.2</poi-ooxml-version>
|
||||
<logstash-logback-encoder>6.6</logstash-logback-encoder>
|
||||
<zxing>3.4.1</zxing>
|
||||
<slf4j-api>1.7.28</slf4j-api>
|
||||
<xk-time>2.2.0</xk-time>
|
||||
<commons-text>1.4</commons-text>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@ -75,10 +75,15 @@ public class LimitInterceptor {
|
||||
}
|
||||
|
||||
|
||||
//默认unknown常量值
|
||||
/**
|
||||
* 默认unknown常量值
|
||||
*/
|
||||
private static final String UNKNOWN = "unknown";
|
||||
|
||||
//获取ip
|
||||
/**
|
||||
* 获取ip
|
||||
* @return ip
|
||||
*/
|
||||
public String getIpAddress() {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
String ip = request.getHeader("x-forwarded-for");
|
||||
|
||||
@ -7,7 +7,7 @@ import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.utils.IpHelper;
|
||||
import cn.lili.common.utils.SpelUtil;
|
||||
import cn.lili.common.utils.ThreadPoolUtil;
|
||||
import cn.lili.modules.base.entity.systemlog.SystemLogVO;
|
||||
import cn.lili.modules.permission.entity.vo.SystemLogVO;
|
||||
import cn.lili.modules.connect.util.IpUtils;
|
||||
import cn.lili.modules.permission.service.SystemLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -39,7 +39,7 @@ public class SystemLogAspect {
|
||||
/**
|
||||
* 启动线程异步记录日志
|
||||
*/
|
||||
private static final ThreadLocal<Date> beginTimeThreadLocal = new NamedThreadLocal<>("SYSTEM-LOG");
|
||||
private static final ThreadLocal<Date> BEGIN_TIME_THREAD_LOCAL = new NamedThreadLocal<>("SYSTEM-LOG");
|
||||
|
||||
@Autowired
|
||||
private SystemLogService systemLogService;
|
||||
@ -61,7 +61,7 @@ public class SystemLogAspect {
|
||||
*/
|
||||
@Before("controllerAspect()")
|
||||
public void doBefore() {
|
||||
beginTimeThreadLocal.set(new Date());
|
||||
BEGIN_TIME_THREAD_LOCAL.set(new Date());
|
||||
}
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ public class SystemLogAspect {
|
||||
//写入自定义日志内容
|
||||
systemLogVO.setCustomerLog(customerLog);
|
||||
//请求开始时间
|
||||
long beginTime = beginTimeThreadLocal.get().getTime();
|
||||
long beginTime = BEGIN_TIME_THREAD_LOCAL.get().getTime();
|
||||
long endTime = System.currentTimeMillis();
|
||||
//请求耗时
|
||||
Long usedTime = endTime - beginTime;
|
||||
@ -157,7 +157,7 @@ public class SystemLogAspect {
|
||||
*/
|
||||
private static Map<String, String> spelFormat(JoinPoint joinPoint, Object rvt) {
|
||||
|
||||
Map<String, String> result = new HashMap<>();
|
||||
Map<String, String> result = new HashMap<>(2);
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
SystemLogPoint systemLogPoint = signature.getMethod().getAnnotation(SystemLogPoint.class);
|
||||
String description = systemLogPoint.description();
|
||||
|
||||
@ -164,6 +164,7 @@ public interface Cache<T> {
|
||||
* 如需清零,按照普通key 移除即可
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
Long cumulative(Object key, Object value);
|
||||
|
||||
@ -454,25 +454,39 @@ public enum CachePrefix {
|
||||
/**
|
||||
* 店铺分类
|
||||
*/
|
||||
STORE_CATEGORY
|
||||
;
|
||||
STORE_CATEGORY;
|
||||
|
||||
|
||||
public static String removePrefix(String str) {
|
||||
return str.substring(str.lastIndexOf("}_") + 2);
|
||||
}
|
||||
|
||||
//通用获取缓存key值
|
||||
/**
|
||||
* 通用获取缓存key值
|
||||
*
|
||||
* @return 缓存key值
|
||||
*/
|
||||
public String getPrefix() {
|
||||
return "{" + this.name() + "}_";
|
||||
}
|
||||
|
||||
//通用获取缓存key值
|
||||
/**
|
||||
* 通用获取缓存key值
|
||||
*
|
||||
* @param typeEnum 促销枚举
|
||||
* @return 缓存key值
|
||||
*/
|
||||
public String getPrefix(PromotionTypeEnum typeEnum) {
|
||||
return "{" + this.name() + "_" + typeEnum.name() + "}_";
|
||||
}
|
||||
|
||||
//获取缓存key值 + 用户端,例如:三端都有用户体系,需要分别登录,如果用户名一致,则redis中的权限可能会冲突出错
|
||||
/**
|
||||
* 获取缓存key值 + 用户端
|
||||
* 例如:三端都有用户体系,需要分别登录,如果用户名一致,则redis中的权限可能会冲突出错
|
||||
*
|
||||
* @param user 角色
|
||||
* @return 缓存key值 + 用户端
|
||||
*/
|
||||
public String getPrefix(UserEnums user) {
|
||||
return "{" + this.name() + "_" + user.name() + "}_";
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ public class RedisCache implements Cache {
|
||||
return null;
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error("scan错误",e);
|
||||
log.error("scan错误", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
@ -206,8 +206,8 @@ public class RedisCache implements Cache {
|
||||
public Long incr(String key, long liveTime) {
|
||||
RedisAtomicLong entityIdCounter = new RedisAtomicLong(key, redisTemplate.getConnectionFactory());
|
||||
Long increment = entityIdCounter.getAndIncrement();
|
||||
|
||||
if ((null == increment || increment.longValue() == 0) && liveTime > 0) {//初始设置过期时间
|
||||
//初始设置过期时间
|
||||
if ((null == increment || increment.longValue() == 0) && liveTime > 0) {
|
||||
entityIdCounter.expire(liveTime, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@ -254,8 +254,7 @@ public class RedisCache implements Cache {
|
||||
*/
|
||||
@Override
|
||||
public boolean zAdd(String key, long score, String value) {
|
||||
Boolean result = redisTemplate.opsForZSet().add(key, value, score);
|
||||
return result;
|
||||
return redisTemplate.opsForZSet().add(key, value, score);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -308,13 +308,6 @@ public abstract class BaseElasticsearchService {
|
||||
|
||||
PutMappingRequest request = new PutMappingRequest(index)
|
||||
.source(source, XContentType.JSON);
|
||||
// AcknowledgedResponse putMappingResponse = client.indices().putMapping(request,
|
||||
// RequestOptions.DEFAULT);
|
||||
//
|
||||
// boolean acknowledged = putMappingResponse.isAcknowledged();
|
||||
// if (acknowledged) {
|
||||
// log.error("Succeed to put mapping");
|
||||
// }
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
AtomicReference response = new AtomicReference<AcknowledgedResponse>();
|
||||
client.indices().putMappingAsync(
|
||||
|
||||
@ -34,8 +34,9 @@ public enum ResultCode {
|
||||
*/
|
||||
WECHAT_CONNECT_NOT_EXIST(1001, "微信联合登录未配置"),
|
||||
VERIFICATION_EXIST(1002, "验证码服务异常"),
|
||||
LIMIT_ERROR(1003,"访问过于频繁,请稍后再试"),
|
||||
LIMIT_ERROR(1003, "访问过于频繁,请稍后再试"),
|
||||
ILLEGAL_REQUEST_ERROR(1004, "非法请求,请重新刷新页面操作"),
|
||||
IMAGE_FILE_EXT_ERROR(1005, "不支持图片格式"),
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
@ -49,6 +50,7 @@ public enum ResultCode {
|
||||
CATEGORY_PARAMETER_SAVE_ERROR(10008, "分类绑定参数组添加失败"),
|
||||
CATEGORY_PARAMETER_UPDATE_ERROR(10009, "分类绑定参数组添加失败"),
|
||||
CATEGORY_DELETE_FLAG_ERROR(10010, "子类状态不能与父类不一致!"),
|
||||
CATEGORY_COMMISSION_RATE_ERROR(10011, "分类的佣金不正确!"),
|
||||
|
||||
/**
|
||||
* 商品
|
||||
@ -66,10 +68,10 @@ public enum ResultCode {
|
||||
GOODS_SKU_WEIGHT_ERROR(11010, "商品重量不能为负数"),
|
||||
GOODS_SKU_QUANTITY_ERROR(11011, "商品库存数量不能为负数"),
|
||||
GOODS_SKU_QUANTITY_NOT_ENOUGH(11011, "商品库存不足"),
|
||||
MUST_HAVE_GOODS_SKU(11012,"规格必须要有一个!"),
|
||||
GOODS_PARAMS_ERROR(11013,"商品参数错误,刷新后重试"),
|
||||
PHYSICAL_GOODS_NEED_TEMP(11014,"实物商品需选择配送模板"),
|
||||
VIRTUAL_GOODS_NOT_NEED_TEMP(11015,"实物商品需选择配送模板"),
|
||||
MUST_HAVE_GOODS_SKU(11012, "规格必须要有一个!"),
|
||||
GOODS_PARAMS_ERROR(11013, "商品参数错误,刷新后重试"),
|
||||
PHYSICAL_GOODS_NEED_TEMP(11014, "实物商品需选择配送模板"),
|
||||
VIRTUAL_GOODS_NOT_NEED_TEMP(11015, "实物商品需选择配送模板"),
|
||||
GOODS_TYPE_ERROR(11016, "需选择商品类型"),
|
||||
|
||||
/**
|
||||
@ -118,10 +120,10 @@ public enum ResultCode {
|
||||
USER_COLLECTION_EXIST(20017, "无法重复收藏"),
|
||||
USER_GRADE_IS_DEFAULT(20018, "会员等级为默认会员等级"),
|
||||
DELETE_EXIST(20019, "无法重复收藏"),
|
||||
USER_NOT_BINDING(20020,"未绑定用户"),
|
||||
USER_AUTO_REGISTER_ERROR(20021,"自动注册失败,请稍后重试"),
|
||||
USER_OVERDUE_CONNECT_ERROR(20022,"授权信息已过期,请重新授权/登录"),
|
||||
USER_CONNECT_BANDING_ERROR(20023,"当前联合登陆方式,已绑定其他账号,需进行解绑操作"),
|
||||
USER_NOT_BINDING(20020, "未绑定用户"),
|
||||
USER_AUTO_REGISTER_ERROR(20021, "自动注册失败,请稍后重试"),
|
||||
USER_OVERDUE_CONNECT_ERROR(20022, "授权信息已过期,请重新授权/登录"),
|
||||
USER_CONNECT_BANDING_ERROR(20023, "当前联合登陆方式,已绑定其他账号,需进行解绑操作"),
|
||||
USER_CONNECT_NOT_EXIST_ERROR(20024, "暂无联合登陆信息,无法实现一键注册功能,请点击第三方登录进行授权"),
|
||||
|
||||
/**
|
||||
@ -276,47 +278,47 @@ public enum ResultCode {
|
||||
PINTUAN_DELETE_ERROR(42010, "删除拼团活动失败"),
|
||||
PINTUAN_JOIN_ERROR(42011, "不能参与自己发起的拼团活动!"),
|
||||
PINTUAN_LIMIT_NUM_ERROR(42012, "购买数量超过拼团活动限制数量!"),
|
||||
PINTUAN_NOT_EXIST_ERROR(42013,"当前拼团商品不存在!"),
|
||||
PINTUAN_NOT_EXIST_ERROR(42013, "当前拼团商品不存在!"),
|
||||
|
||||
/**
|
||||
* 满额活动
|
||||
*/
|
||||
FULL_DISCOUNT_EDIT_SUCCESS(43001, "修改满优惠活动成功"),
|
||||
FULL_DISCOUNT_EDIT_DELETE(43002, "删除满优惠活动成功"),
|
||||
FULL_DISCOUNT_MODIFY_ERROR(43003,"当前编辑的满优惠活动已经开始或者已经结束,无法修改"),
|
||||
FULL_DISCOUNT_NOT_EXIST_ERROR(43004,"当前要操作的满优惠活动不存在!"),
|
||||
FULL_DISCOUNT_WAY_ERROR(43005,"请选择一种优惠方式!"),
|
||||
FULL_DISCOUNT_GIFT_ERROR(43006,"请选择赠品!"),
|
||||
FULL_DISCOUNT_COUPON_TIME_ERROR(43007,"赠送的优惠券有效时间必须大于活动时间"),
|
||||
FULL_DISCOUNT_MONEY_ERROR(43008,"请填写满减金额"),
|
||||
FULL_DISCOUNT_MONEY_GREATER_THAN_MINUS(43009,"满减金额不能大于优惠门槛"),
|
||||
FULL_RATE_NUM_ERROR(43010,"请填写打折数值"),
|
||||
FULL_DISCOUNT_MODIFY_ERROR(43003, "当前编辑的满优惠活动已经开始或者已经结束,无法修改"),
|
||||
FULL_DISCOUNT_NOT_EXIST_ERROR(43004, "当前要操作的满优惠活动不存在!"),
|
||||
FULL_DISCOUNT_WAY_ERROR(43005, "请选择一种优惠方式!"),
|
||||
FULL_DISCOUNT_GIFT_ERROR(43006, "请选择赠品!"),
|
||||
FULL_DISCOUNT_COUPON_TIME_ERROR(43007, "赠送的优惠券有效时间必须大于活动时间"),
|
||||
FULL_DISCOUNT_MONEY_ERROR(43008, "请填写满减金额"),
|
||||
FULL_DISCOUNT_MONEY_GREATER_THAN_MINUS(43009, "满减金额不能大于优惠门槛"),
|
||||
FULL_RATE_NUM_ERROR(43010, "请填写打折数值"),
|
||||
|
||||
/**
|
||||
* 直播
|
||||
*/
|
||||
STODIO_GOODS_EXIST_ERROR(44001,"直播商品已存在"),
|
||||
COMMODITY_ERROR(44002,"添加直播商品失败"),
|
||||
STODIO_GOODS_EXIST_ERROR(44001, "直播商品已存在"),
|
||||
COMMODITY_ERROR(44002, "添加直播商品失败"),
|
||||
|
||||
/**
|
||||
* 秒杀
|
||||
*/
|
||||
SECKILL_NOT_EXIST_ERROR(45001,"当前参与的秒杀活动不存在!"),
|
||||
SECKILL_UPDATE_ERROR(45002,"当前秒杀活动活动已经开始,无法修改!"),
|
||||
SECKILL_PRICE_ERROR(45003,"活动价格不能大于商品原价"),
|
||||
SECKILL_TIME_ERROR(45004,"时刻参数异常"),
|
||||
SECKILL_DELETE_ERROR(45005,"该秒杀活动活动的状态不能删除"),
|
||||
SECKILL_CLOSE_ERROR(45006,"该秒杀活动活动的状态不能关闭"),
|
||||
SECKILL_NOT_EXIST_ERROR(45001, "当前参与的秒杀活动不存在!"),
|
||||
SECKILL_UPDATE_ERROR(45002, "当前秒杀活动活动已经开始,无法修改!"),
|
||||
SECKILL_PRICE_ERROR(45003, "活动价格不能大于商品原价"),
|
||||
SECKILL_TIME_ERROR(45004, "时刻参数异常"),
|
||||
SECKILL_DELETE_ERROR(45005, "该秒杀活动活动的状态不能删除"),
|
||||
SECKILL_CLOSE_ERROR(45006, "该秒杀活动活动的状态不能关闭"),
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券活动
|
||||
*/
|
||||
COUPON_ACTIVITY_START_TIME_ERROR(46001,"活动时间小于当前时间,不能进行编辑删除操作"),
|
||||
COUPON_ACTIVITY_MEMBER_ERROR(46002,"指定精准发券则必须指定会员,会员不可以为空"),
|
||||
COUPON_ACTIVITY_ITEM_ERROR(46003,"优惠券活动必须指定优惠券,不能为空"),
|
||||
COUPON_ACTIVITY_ITEM_MUST_NUM_ERROR(46004,"优惠券活动最多指定10个优惠券"),
|
||||
COUPON_ACTIVITY_ITEM_NUM_ERROR(46005,"赠券数量必须大于0"),
|
||||
COUPON_ACTIVITY_START_TIME_ERROR(46001, "活动时间小于当前时间,不能进行编辑删除操作"),
|
||||
COUPON_ACTIVITY_MEMBER_ERROR(46002, "指定精准发券则必须指定会员,会员不可以为空"),
|
||||
COUPON_ACTIVITY_ITEM_ERROR(46003, "优惠券活动必须指定优惠券,不能为空"),
|
||||
COUPON_ACTIVITY_ITEM_MUST_NUM_ERROR(46004, "优惠券活动最多指定10个优惠券"),
|
||||
COUPON_ACTIVITY_ITEM_NUM_ERROR(46005, "赠券数量必须大于0"),
|
||||
|
||||
/**
|
||||
* 其他促销
|
||||
@ -381,9 +383,9 @@ public enum ResultCode {
|
||||
ALIPAY_NOT_SETTING(70002, "支付宝支付未配置"),
|
||||
ALIPAY_EXCEPTION(70003, "支付宝支付错误,请稍后重试"),
|
||||
ALIPAY_PARAMS_EXCEPTION(70004, "支付宝参数异常"),
|
||||
LOGISTICS_NOT_SETTING(70005,"您还未配置快递查询"),
|
||||
ORDER_SETTING_ERROR(70006,"系统订单配置异常"),
|
||||
ALI_SMS_SETTING_ERROR(70007,"您还未配置阿里云短信"),
|
||||
LOGISTICS_NOT_SETTING(70005, "您还未配置快递查询"),
|
||||
ORDER_SETTING_ERROR(70006, "系统订单配置异常"),
|
||||
ALI_SMS_SETTING_ERROR(70007, "您还未配置阿里云短信"),
|
||||
SMS_SIGN_EXIST_ERROR(70008, "短信签名已存在"),
|
||||
|
||||
/**
|
||||
@ -416,10 +418,10 @@ public enum ResultCode {
|
||||
WECHAT_PAYMENT_NOT_SETTING(80301, "微信支付信息未配置"),
|
||||
WECHAT_QRCODE_ERROR(80302, "微信二维码生成异常"),
|
||||
WECHAT_MP_MESSAGE_ERROR(80303, "微信小程序小消息订阅异常"),
|
||||
WECHAT_JSAPI_SIGN_ERROR(80304,"微信JsApi签名异常"),
|
||||
WECHAT_CERT_ERROR(80305,"证书获取失败"),
|
||||
WECHAT_MP_MESSAGE_TMPL_ERROR(80306,"未能获取到微信模版消息id"),
|
||||
WECHAT_ERROR(80307,"微信接口异常"),
|
||||
WECHAT_JSAPI_SIGN_ERROR(80304, "微信JsApi签名异常"),
|
||||
WECHAT_CERT_ERROR(80305, "证书获取失败"),
|
||||
WECHAT_MP_MESSAGE_TMPL_ERROR(80306, "未能获取到微信模版消息id"),
|
||||
WECHAT_ERROR(80307, "微信接口异常"),
|
||||
APP_VERSION_EXIST(80307, "APP版本已存在"),
|
||||
|
||||
/**
|
||||
@ -427,8 +429,8 @@ public enum ResultCode {
|
||||
*/
|
||||
CUSTOM_WORDS_EXIST_ERROR(90000, "当前自定义分词已存在!"),
|
||||
CUSTOM_WORDS_NOT_EXIST_ERROR(90001, "当前自定义分词不存在!"),
|
||||
CUSTOM_WORDS_SECRET_KEY_ERROR(90002, "秘钥验证失败!"),
|
||||
CONNECT_NOT_EXIST(90000,"登录方式不存在"),
|
||||
CUSTOM_WORDS_SECRET_KEY_ERROR(90002, "秘钥验证失败!"),
|
||||
CONNECT_NOT_EXIST(90000, "登录方式不存在"),
|
||||
|
||||
;
|
||||
|
||||
|
||||
@ -56,7 +56,12 @@ public class ResultUtil<T> {
|
||||
|
||||
}
|
||||
|
||||
//抽象静态方法,返回结果集
|
||||
/**
|
||||
* 抽象静态方法,返回结果集
|
||||
* @param t
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> ResultMessage<T> data(T t) {
|
||||
return new ResultUtil<T>().setData(t);
|
||||
}
|
||||
|
||||
@ -13,10 +13,14 @@ public class ServiceException extends RuntimeException {
|
||||
|
||||
public static String DEFAULT_MESSAGE = "网络错误,请稍后重试!";
|
||||
|
||||
//异常消息
|
||||
/**
|
||||
* 异常消息
|
||||
*/
|
||||
private String msg = DEFAULT_MESSAGE;
|
||||
|
||||
//错误码
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
private ResultCode resultCode;
|
||||
|
||||
public ServiceException(String msg) {
|
||||
|
||||
@ -1,12 +1,20 @@
|
||||
package cn.lili.common.rocketmq.tags;
|
||||
|
||||
/**
|
||||
* 售后标签枚举
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/12/9
|
||||
**/
|
||||
public enum AfterSaleTagsEnum {
|
||||
|
||||
/**
|
||||
* "售后退款"
|
||||
*/
|
||||
REFUND("售后退款"),
|
||||
/**
|
||||
* "售后单状态改变"
|
||||
*/
|
||||
AFTER_SALE_STATUS_CHANGE("售后单状态改变");
|
||||
|
||||
private final String description;
|
||||
|
||||
@ -6,13 +6,37 @@ package cn.lili.common.rocketmq.tags;
|
||||
**/
|
||||
public enum GoodsTagsEnum {
|
||||
|
||||
/**
|
||||
* "生成商品索引"
|
||||
*/
|
||||
GENERATOR_GOODS_INDEX("生成商品索引"),
|
||||
/**
|
||||
* "删除商品"
|
||||
*/
|
||||
GOODS_DELETE("删除商品"),
|
||||
/**
|
||||
* "审核商品"
|
||||
*/
|
||||
GOODS_AUDIT("审核商品"),
|
||||
/**
|
||||
* "收藏商品"
|
||||
*/
|
||||
GOODS_COLLECTION("收藏商品"),
|
||||
/**
|
||||
* "购买商品完成"
|
||||
*/
|
||||
BUY_GOODS_COMPLETE("购买商品完成"),
|
||||
/**
|
||||
* "删除商品SKU"
|
||||
*/
|
||||
SKU_DELETE("删除商品SKU"),
|
||||
/**
|
||||
* "查看商品"
|
||||
*/
|
||||
VIEW_GOODS("查看商品"),
|
||||
/**
|
||||
* "商品评价"
|
||||
*/
|
||||
GOODS_COMMENT_COMPLETE("商品评价");
|
||||
|
||||
private final String description;
|
||||
|
||||
@ -1,14 +1,27 @@
|
||||
package cn.lili.common.rocketmq.tags;
|
||||
|
||||
/**
|
||||
* 会员操作枚举
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/12/9
|
||||
**/
|
||||
public enum MemberTagsEnum {
|
||||
|
||||
/**
|
||||
* 会员注册
|
||||
*/
|
||||
MEMBER_REGISTER("会员注册"),
|
||||
/**
|
||||
* 会员签到
|
||||
*/
|
||||
MEMBER_SING("会员签到"),
|
||||
/**
|
||||
* 会员提现
|
||||
*/
|
||||
MEMBER_WITHDRAWAL("会员提现"),
|
||||
/**
|
||||
* 会员积分变动
|
||||
*/
|
||||
MEMBER_POINT_CHANGE("会员积分变动");
|
||||
|
||||
private final String description;
|
||||
|
||||
@ -1,18 +1,23 @@
|
||||
package cn.lili.common.rocketmq.tags;
|
||||
|
||||
/**
|
||||
* 订单操作枚举
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/12/9
|
||||
**/
|
||||
public enum MqOrderTagsEnum {
|
||||
|
||||
|
||||
/**
|
||||
* 订单创建
|
||||
*/
|
||||
ORDER_CREATE("订单创建"),
|
||||
/**
|
||||
* 订单状态改变
|
||||
*/
|
||||
STATUS_CHANGE("订单状态改变");
|
||||
|
||||
|
||||
|
||||
|
||||
private final String description;
|
||||
|
||||
MqOrderTagsEnum(String description) {
|
||||
|
||||
@ -1,12 +1,19 @@
|
||||
package cn.lili.common.rocketmq.tags;
|
||||
|
||||
/**
|
||||
* 其他操作枚举
|
||||
*
|
||||
* @author paulG
|
||||
* @since 2020/12/9
|
||||
**/
|
||||
public enum OtherTagsEnum {
|
||||
|
||||
/**
|
||||
* 站内消息提醒
|
||||
*/
|
||||
MESSAGE("站内消息提醒"),
|
||||
/**
|
||||
* 短信消息提醒
|
||||
*/
|
||||
SMS("短信消息提醒");
|
||||
|
||||
private final String description;
|
||||
|
||||
@ -9,6 +9,10 @@ import cn.lili.common.token.SecretKeyUtil;
|
||||
import com.google.gson.Gson;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 用户上下文
|
||||
@ -20,15 +24,18 @@ import io.jsonwebtoken.Jwts;
|
||||
*/
|
||||
public class UserContext {
|
||||
|
||||
private static AuthenticationHandler authenticationHandler;
|
||||
|
||||
public static void setHolder(AuthenticationHandler authenticationHandler) {
|
||||
UserContext.authenticationHandler = authenticationHandler;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据request获取用户信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static AuthUser getCurrentUser() {
|
||||
return authenticationHandler.getAuthUser();
|
||||
if (RequestContextHolder.getRequestAttributes() != null) {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
String accessToken = request.getHeader(SecurityEnum.HEADER_TOKEN.getValue());
|
||||
return getAuthUser(accessToken);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -44,6 +51,20 @@ public class UserContext {
|
||||
if (cache.keys("*" + accessToken).size() == 0) {
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
return getAuthUser(accessToken);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据jwt获取token重的用户信息
|
||||
*
|
||||
* @param accessToken token
|
||||
* @return
|
||||
*/
|
||||
public static AuthUser getAuthUser(String accessToken) {
|
||||
try {
|
||||
//获取token的信息
|
||||
Claims claims
|
||||
= Jwts.parser()
|
||||
|
||||
@ -31,6 +31,6 @@ public class UserContextInit implements ApplicationRunner {
|
||||
*/
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
UserContext.setHolder(authenticationHandler);
|
||||
//UserContext.setHolder(authenticationHandler);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,10 @@ import java.util.regex.Pattern;
|
||||
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
private HttpServletRequest request;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public XssHttpServletRequestWrapper(HttpServletRequest request) {
|
||||
super(request);
|
||||
this.request = request;
|
||||
@ -90,46 +94,38 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
private static final Pattern SCRIPT_PATTERN1 = Pattern.compile("<script>(.*?)</script>", Pattern.CASE_INSENSITIVE);
|
||||
private static final Pattern SCRIPT_PATTERN2 = Pattern.compile("</script>", Pattern.CASE_INSENSITIVE);
|
||||
private static final Pattern SCRIPT_PATTERN3 = Pattern.compile("<script(.*?)>", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
private static final Pattern SCRIPT_PATTERN4 = Pattern.compile("javascript:", Pattern.CASE_INSENSITIVE);
|
||||
private static final Pattern SRC_PATTERN = Pattern.compile("src[\r\n]*=[\r\n]*\\\'(.*?)\\\'", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
private static final Pattern EVAL_PATTERN = Pattern.compile("eval\\((.*?)\\)", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
private static final Pattern E__XPRESSION_PATTERN = Pattern.compile("expression\\((.*?)\\)", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
private static final Pattern VB_SCRIPT_PATTERN = Pattern.compile("vbscript:", Pattern.CASE_INSENSITIVE);
|
||||
private static final Pattern ONLOAD_PATTERN = Pattern.compile("onload(.*?)=", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
|
||||
private String cleanXSS(String value) {
|
||||
if (value != null) {
|
||||
//推荐使用ESAPI库来避免脚本攻击,value = ESAPI.encoder().canonicalize(value);
|
||||
// //避免空字符串
|
||||
// value = value.replaceAll(" ", "");
|
||||
//避免script 标签
|
||||
Pattern scriptPattern = Pattern.compile("<script>(.*?)</script>", Pattern.CASE_INSENSITIVE);
|
||||
value = scriptPattern.matcher(value).replaceAll("");
|
||||
//避免src形式的表达式
|
||||
scriptPattern = Pattern.compile("src[\r\n]*=[\r\n]*\\\'(.*?)\\\'",
|
||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
value = scriptPattern.matcher(value).replaceAll("");
|
||||
scriptPattern = Pattern.compile("src[\r\n]*=[\r\n]*\\\"(.*?)\\\"",
|
||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
value = scriptPattern.matcher(value).replaceAll("");
|
||||
value = SCRIPT_PATTERN1.matcher(value).replaceAll("");
|
||||
//删除单个的 </script> 标签
|
||||
scriptPattern = Pattern.compile("</script>", Pattern.CASE_INSENSITIVE);
|
||||
value = scriptPattern.matcher(value).replaceAll("");
|
||||
value = SCRIPT_PATTERN2.matcher(value).replaceAll("");
|
||||
//删除单个的<script ...> 标签
|
||||
scriptPattern = Pattern.compile("<script(.*?)>",
|
||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
value = scriptPattern.matcher(value).replaceAll("");
|
||||
//避免 eval(...) 形式表达式
|
||||
scriptPattern = Pattern.compile("eval\\((.*?)\\)",
|
||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
value = scriptPattern.matcher(value).replaceAll("");
|
||||
//避免 expression(...) 表达式
|
||||
scriptPattern = Pattern.compile("expression\\((.*?)\\)",
|
||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
value = scriptPattern.matcher(value).replaceAll("");
|
||||
value = SCRIPT_PATTERN3.matcher(value).replaceAll("");
|
||||
//避免 javascript: 表达式
|
||||
scriptPattern = Pattern.compile("javascript:", Pattern.CASE_INSENSITIVE);
|
||||
value = scriptPattern.matcher(value).replaceAll("");
|
||||
value = SCRIPT_PATTERN4.matcher(value).replaceAll("");
|
||||
//避免src形式的表达式
|
||||
value = SRC_PATTERN.matcher(value).replaceAll("");
|
||||
//避免 eval(...) 形式表达式
|
||||
value = EVAL_PATTERN.matcher(value).replaceAll("");
|
||||
//避免 expression(...) 表达式
|
||||
value = E__XPRESSION_PATTERN.matcher(value).replaceAll("");
|
||||
//避免 vbscript:表达式
|
||||
scriptPattern = Pattern.compile("vbscript:", Pattern.CASE_INSENSITIVE);
|
||||
value = scriptPattern.matcher(value).replaceAll("");
|
||||
value = VB_SCRIPT_PATTERN.matcher(value).replaceAll("");
|
||||
//避免 onload= 表达式
|
||||
scriptPattern = Pattern.compile("onload(.*?)=",
|
||||
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
|
||||
value = scriptPattern.matcher(value).replaceAll("");
|
||||
value = ONLOAD_PATTERN.matcher(value).replaceAll("");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ public interface AliSmsUtil {
|
||||
* 申请短信签名
|
||||
*
|
||||
* @param smsSign 短信签名
|
||||
* @throws Exception 阿里短信签名错误
|
||||
*/
|
||||
void addSmsSign(SmsSign smsSign) throws Exception;
|
||||
|
||||
@ -24,6 +25,7 @@ public interface AliSmsUtil {
|
||||
* 删除短信签名
|
||||
*
|
||||
* @param signName 签名名称
|
||||
* @throws Exception 阿里短信签名错误
|
||||
*/
|
||||
void deleteSmsSign(String signName) throws Exception;
|
||||
|
||||
@ -31,6 +33,8 @@ public interface AliSmsUtil {
|
||||
* 查询短信签名申请状态
|
||||
*
|
||||
* @param signName 签名名称
|
||||
* @return 短信签名申请状态
|
||||
* @throws Exception 阿里短信签名错误
|
||||
*/
|
||||
Map<String, Object> querySmsSign(String signName) throws Exception;
|
||||
|
||||
@ -38,6 +42,7 @@ public interface AliSmsUtil {
|
||||
* 修改未审核通过的短信签名,并重新提交审核。
|
||||
*
|
||||
* @param smsSign 短信签名
|
||||
* @throws Exception 阿里短信签名错误
|
||||
*/
|
||||
void modifySmsSign(SmsSign smsSign) throws Exception;
|
||||
|
||||
@ -45,7 +50,7 @@ public interface AliSmsUtil {
|
||||
* 修改未审核通过的短信模板,并重新提交审核。
|
||||
*
|
||||
* @param smsTemplate 短信模板
|
||||
* @throws Exception
|
||||
* @throws Exception 阿里短信签名错误
|
||||
*/
|
||||
void modifySmsTemplate(SmsTemplate smsTemplate) throws Exception;
|
||||
|
||||
@ -53,7 +58,8 @@ public interface AliSmsUtil {
|
||||
* 查看短信模板
|
||||
*
|
||||
* @param templateCode 短信模板CODE
|
||||
* @throws Exception
|
||||
* @return 短信模板
|
||||
* @throws Exception 阿里短信签名错误
|
||||
*/
|
||||
Map<String, Object> querySmsTemplate(String templateCode) throws Exception;
|
||||
|
||||
@ -61,8 +67,8 @@ public interface AliSmsUtil {
|
||||
* 申请短信模板
|
||||
*
|
||||
* @param smsTemplate 短信模板
|
||||
* @return
|
||||
* @throws Exception
|
||||
* @return 短信模板
|
||||
* @throws Exception 阿里短信签名错误
|
||||
*/
|
||||
String addSmsTemplate(SmsTemplate smsTemplate) throws Exception;
|
||||
|
||||
@ -70,7 +76,7 @@ public interface AliSmsUtil {
|
||||
* 删除短信模板
|
||||
*
|
||||
* @param templateCode 短信模板CODE
|
||||
* @throws Exception
|
||||
* @throws Exception 阿里短信签名错误
|
||||
*/
|
||||
void deleteSmsTemplate(String templateCode) throws Exception;
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@ public interface SmsUtil {
|
||||
* @param verificationEnums 验证码场景
|
||||
* @param uuid 用户标识uuid
|
||||
* @param code 待验证code
|
||||
* @return 操作状态
|
||||
*/
|
||||
boolean verifyCode(String mobile, VerificationEnums verificationEnums, String uuid, String code);
|
||||
|
||||
@ -41,6 +42,7 @@ public interface SmsUtil {
|
||||
* @param mobile 接收手机号
|
||||
* @param param 参数
|
||||
* @param templateCode 模版code
|
||||
* @param signName 签名名称
|
||||
*/
|
||||
void sendSmsCode(String signName, String mobile, Map<String, String> param, String templateCode);
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
String code = CommonUtil.getRandomNum();
|
||||
|
||||
//准备发送短信参数
|
||||
Map<String, String> params = new HashMap<>();
|
||||
Map<String, String> params = new HashMap<>(2);
|
||||
//验证码内容
|
||||
params.put("code", code);
|
||||
|
||||
@ -221,7 +221,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
signFileList1
|
||||
));
|
||||
AddSmsSignResponse response = client.addSmsSign(addSmsSignRequest);
|
||||
if (!response.getBody().getCode().equals("OK")) {
|
||||
if (!("OK").equals(response.getBody().getCode())) {
|
||||
throw new ServiceException(response.getBody().getMessage());
|
||||
}
|
||||
}
|
||||
@ -233,7 +233,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
.setSignName(signName);
|
||||
|
||||
DeleteSmsSignResponse response = client.deleteSmsSign(deleteSmsSignRequest);
|
||||
if (!response.getBody().getCode().equals("OK")) {
|
||||
if (!("OK").equals(response.getBody().getCode())) {
|
||||
throw new ServiceException(response.getBody().getMessage());
|
||||
}
|
||||
|
||||
@ -246,10 +246,10 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
QuerySmsSignRequest querySmsSignRequest = new QuerySmsSignRequest().setSignName(signName);
|
||||
|
||||
QuerySmsSignResponse response = client.querySmsSign(querySmsSignRequest);
|
||||
if (!response.getBody().getCode().equals("OK")) {
|
||||
if (!("OK").equals(response.getBody().getCode())) {
|
||||
throw new ServiceException(response.getBody().getMessage());
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Map<String, Object> map = new HashMap<>(2);
|
||||
map.put("SignStatus", response.getBody().getSignStatus());
|
||||
map.put("Reason", response.getBody().getReason());
|
||||
return map;
|
||||
@ -275,7 +275,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
signFileList1
|
||||
));
|
||||
ModifySmsSignResponse response = client.modifySmsSign(modifySmsSign);
|
||||
if (!response.getBody().getCode().equals("OK")) {
|
||||
if (!("OK").equals(response.getBody().getCode())) {
|
||||
throw new ServiceException(response.getBody().getMessage());
|
||||
}
|
||||
}
|
||||
@ -291,7 +291,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
.setTemplateCode(smsTemplate.getTemplateCode());
|
||||
|
||||
ModifySmsTemplateResponse response = client.modifySmsTemplate(modifySmsTemplateRequest);
|
||||
if (!response.getBody().getCode().equals("OK")) {
|
||||
if (!("OK").equals(response.getBody().getCode())) {
|
||||
throw new ServiceException(response.getBody().getMessage());
|
||||
}
|
||||
}
|
||||
@ -303,10 +303,10 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
.setTemplateCode(templateCode);
|
||||
QuerySmsTemplateResponse response = client.querySmsTemplate(querySmsTemplateRequest);
|
||||
|
||||
if (!response.getBody().getCode().equals("OK")) {
|
||||
if (!("OK").equals(response.getBody().getCode())) {
|
||||
throw new ServiceException(response.getBody().getMessage());
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Map<String, Object> map = new HashMap<>(4);
|
||||
map.put("TemplateStatus", response.getBody().getTemplateStatus());
|
||||
map.put("Reason", response.getBody().getReason());
|
||||
map.put("TemplateCode", response.getBody().getTemplateCode());
|
||||
@ -323,7 +323,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
.setRemark(smsTemplate.getRemark());
|
||||
|
||||
AddSmsTemplateResponse response = client.addSmsTemplate(addSmsTemplateRequest);
|
||||
if (!response.getBody().getCode().equals("OK")) {
|
||||
if (!("OK").equals(response.getBody().getCode())) {
|
||||
throw new ServiceException(response.getBody().getMessage());
|
||||
}
|
||||
return response.getBody().getTemplateCode();
|
||||
@ -336,7 +336,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
.setTemplateCode(templateCode);
|
||||
|
||||
DeleteSmsTemplateResponse response = client.deleteSmsTemplate(deleteSmsTemplateRequest);
|
||||
if (!response.getBody().getCode().equals("OK")) {
|
||||
if (!("OK").equals(response.getBody().getCode())) {
|
||||
throw new ServiceException(response.getBody().getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,8 @@ import javax.crypto.SecretKey;
|
||||
*/
|
||||
public class SecretKeyUtil {
|
||||
public static SecretKey generalKey() {
|
||||
byte[] encodedKey = Base64.decodeBase64("cuAihCz53DZRjZwbsGcZJ2Ai6At+T142uphtJMsk7iQ=");//自定义
|
||||
//自定义
|
||||
byte[] encodedKey = Base64.decodeBase64("cuAihCz53DZRjZwbsGcZJ2Ai6At+T142uphtJMsk7iQ=");
|
||||
javax.crypto.SecretKey key = Keys.hmacShaKeyFor(encodedKey);
|
||||
return key;
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ public class ManagerTokenGenerate extends AbstractTokenGenerate {
|
||||
* @return
|
||||
*/
|
||||
private Map<String, List<String>> permissionList(List<UserMenuVO> userMenuVOList) {
|
||||
Map<String, List<String>> permission = new HashMap<>();
|
||||
Map<String, List<String>> permission = new HashMap<>(2);
|
||||
if (userMenuVOList == null || userMenuVOList.size() == 0) {
|
||||
return permission;
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ public abstract class AbstractDelayQueueMachineFactory {
|
||||
|
||||
/**
|
||||
* 要实现延时队列的名字
|
||||
* @return 延时队列的名字
|
||||
*/
|
||||
public abstract String setDelayQueueName();
|
||||
|
||||
|
||||
@ -2,6 +2,9 @@ package cn.lili.common.trigger.enums;
|
||||
|
||||
/**
|
||||
* 队列枚举
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/7/9 1:40 上午
|
||||
*/
|
||||
public enum DelayQueueEnums {
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package cn.lili.common.trigger.message;
|
||||
|
||||
import cn.lili.modules.promotion.entity.enums.PromotionStatusEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -43,10 +41,4 @@ public class PromotionMessage {
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
public <T> UpdateWrapper<T> updateWrapper() {
|
||||
UpdateWrapper<T> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", promotionId);
|
||||
updateWrapper.set("promotion_status", PromotionStatusEnum.valueOf(promotionStatus));
|
||||
return updateWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package cn.lili.common.utils;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.modules.payment.kit.dto.PayParam;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@ -9,16 +7,18 @@ import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* 对象属性复制
|
||||
*
|
||||
* @author Chopper
|
||||
*/
|
||||
public class BeanUtil {
|
||||
|
||||
/**
|
||||
* 复制属性
|
||||
*
|
||||
* @param objectFrom
|
||||
* @param objectTo
|
||||
*/
|
||||
public static void copyProperties(Object objectFrom,Object objectTo){
|
||||
public static void copyProperties(Object objectFrom, Object objectTo) {
|
||||
BeanUtils.copyProperties(objectFrom, objectTo);
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ public class BeanUtil {
|
||||
index++;
|
||||
}
|
||||
for (int i = 0; i < superFields.length; i++) {
|
||||
if (superFields[i].getName().equals("id")) {
|
||||
if ("id".equals(superFields[i].getName())) {
|
||||
continue;
|
||||
}
|
||||
fieldNames[index] = superFields[i].getName();
|
||||
@ -45,8 +45,12 @@ public class BeanUtil {
|
||||
return fieldNames;
|
||||
}
|
||||
|
||||
/* 根据属性名获取属性值
|
||||
* */
|
||||
/**
|
||||
* 根据属性名获取属性值
|
||||
* @param fieldName 属性名
|
||||
* @param o 对象
|
||||
* @return 属性值
|
||||
*/
|
||||
public static Object getFieldValueByName(String fieldName, Object o) {
|
||||
try {
|
||||
String firstLetter = fieldName.substring(0, 1).toUpperCase();
|
||||
@ -117,16 +121,4 @@ public class BeanUtil {
|
||||
return t;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IllegalAccessException {
|
||||
PayParam payParam = new PayParam();
|
||||
payParam.setClientType("client");
|
||||
payParam.setOrderType("");
|
||||
payParam.setSn("sn");
|
||||
String val = formatKeyValuePair(payParam);
|
||||
System.out.println(val);
|
||||
|
||||
PayParam param = formatKeyValuePair(val, new PayParam());
|
||||
System.out.println(JSONUtil.toJsonStr(param));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
package cn.lili.common.utils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* CheckMobileUtil
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* 2021-02-04 14:56
|
||||
*/
|
||||
public class CheckMobileUtil {
|
||||
|
||||
|
||||
//\b 是单词边界(连着的两个(字母字符 与 非字母字符) 之间的逻辑上的间隔),
|
||||
//字符串在编译时会被转码一次,所以是 "\\b"
|
||||
//\B 是单词内部逻辑间隔(连着的两个字母字符之间的逻辑上的间隔)
|
||||
static String phoneReg = "\\b(ip(hone|od)|android|opera m(ob|in)i"
|
||||
+ "|windows (phone|ce)|blackberry"
|
||||
+ "|s(ymbian|eries60|amsung)|p(laybook|alm|rofile/midp"
|
||||
+ "|laystation portable)|nokia|fennec|htc[-_]"
|
||||
+ "|mobile|up.browser|[1-4][0-9]{2}x[1-4][0-9]{2})\\b";
|
||||
static String tableReg = "\\b(ipad|tablet|(Nexus 7)|up.browser"
|
||||
+ "|[1-4][0-9]{2}x[1-4][0-9]{2})\\b";
|
||||
|
||||
//移动设备正则匹配:手机端、平板
|
||||
static Pattern phonePat = Pattern.compile(phoneReg, Pattern.CASE_INSENSITIVE);
|
||||
static Pattern tablePat = Pattern.compile(tableReg, Pattern.CASE_INSENSITIVE);
|
||||
|
||||
/**
|
||||
* 检测是否是移动设备访问
|
||||
*
|
||||
* @param request 浏览器标识 获取方式:
|
||||
* @return true:移动设备接入,false:pc端接入
|
||||
* @Title: check
|
||||
*/
|
||||
public static boolean check(HttpServletRequest request) {
|
||||
String userAgent = request.getHeader("USER-AGENT").toLowerCase();
|
||||
if (null == userAgent) {
|
||||
userAgent = "";
|
||||
}
|
||||
//匹配
|
||||
Matcher matcherPhone = phonePat.matcher(userAgent);
|
||||
Matcher matcherTable = tablePat.matcher(userAgent);
|
||||
if (matcherPhone.find() || matcherTable.find()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,9 @@ import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 金额计算工具
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/7/9 1:40 上午
|
||||
*/
|
||||
public final class CurrencyUtil {
|
||||
/**
|
||||
@ -25,8 +28,8 @@ public final class CurrencyUtil {
|
||||
* @return 两个参数的和
|
||||
*/
|
||||
public static Double add(double v1, double v2) {
|
||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.add(b2).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
@ -38,8 +41,8 @@ public final class CurrencyUtil {
|
||||
* @return 两个参数的差
|
||||
*/
|
||||
public static double sub(double v1, double v2) {
|
||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.subtract(b2).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
@ -51,16 +54,16 @@ public final class CurrencyUtil {
|
||||
* @return 两个参数的积
|
||||
*/
|
||||
public static Double mul(double v1, double v2) {
|
||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.multiply(b2).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供精确的乘法运算。
|
||||
*
|
||||
* @param v1 被乘数
|
||||
* @param v2 乘数
|
||||
* @param v1 被乘数
|
||||
* @param v2 乘数
|
||||
* @param scale 表示表示需要精确到小数点以后几位。
|
||||
* @return 两个参数的积
|
||||
*/
|
||||
@ -69,8 +72,8 @@ public final class CurrencyUtil {
|
||||
throw new IllegalArgumentException(
|
||||
"The scale must be a positive integer or zero");
|
||||
}
|
||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.multiply(b2).setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
@ -102,8 +105,8 @@ public final class CurrencyUtil {
|
||||
if (v2 == 0) {
|
||||
return 0;
|
||||
}
|
||||
BigDecimal b1 = new BigDecimal(Double.toString(v1));
|
||||
BigDecimal b2 = new BigDecimal(Double.toString(v2));
|
||||
BigDecimal b1 = new BigDecimal(v1);
|
||||
BigDecimal b2 = new BigDecimal(v2);
|
||||
return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
@ -119,7 +122,7 @@ public final class CurrencyUtil {
|
||||
throw new IllegalArgumentException(
|
||||
"The scale must be a positive integer or zero");
|
||||
}
|
||||
BigDecimal b = new BigDecimal(Double.toString(v));
|
||||
BigDecimal b = new BigDecimal(v);
|
||||
BigDecimal one = new BigDecimal("1");
|
||||
return b.divide(one, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
@ -174,12 +174,12 @@ public class DateUtil {
|
||||
year--;
|
||||
month = 12;
|
||||
}
|
||||
if (!(String.valueOf(month).length() > 1)) {
|
||||
if (String.valueOf(month).length() <= 1) {
|
||||
months = "0" + month;
|
||||
} else {
|
||||
months = String.valueOf(month);
|
||||
}
|
||||
if (!(String.valueOf(day).length() > 1)) {
|
||||
if (String.valueOf(day).length() <= 1) {
|
||||
days = "0" + day;
|
||||
} else {
|
||||
days = String.valueOf(day);
|
||||
|
||||
@ -9,7 +9,6 @@ import org.apache.http.client.HttpRequestRetryHandler;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.protocol.HttpClientContext;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.config.Registry;
|
||||
@ -19,8 +18,6 @@ import org.apache.http.conn.socket.ConnectionSocketFactory;
|
||||
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
|
||||
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
@ -34,29 +31,60 @@ import java.net.URI;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* HttpClientUtils
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/7/9 1:40 上午
|
||||
*/
|
||||
@Slf4j
|
||||
public class HttpClientUtils {
|
||||
|
||||
//org.apache.http.impl.client.CloseableHttpClient
|
||||
/**
|
||||
* org.apache.http.impl.client.CloseableHttpClient
|
||||
*/
|
||||
private static CloseableHttpClient httpClient = null;
|
||||
|
||||
//这里就直接默认固定了,因为以下三个参数在新建的method中仍然可以重新配置并被覆盖.
|
||||
static final int connectionRequestTimeout = 30000;//ms毫秒,从池中获取链接超时时间
|
||||
static final int connectTimeout = 60000;//ms毫秒,建立链接超时时间
|
||||
static final int socketTimeout = 60000;//ms毫秒,读取超时时间
|
||||
/**
|
||||
* ms毫秒,从池中获取链接超时时间
|
||||
*/
|
||||
static final int CONNECTION_REQUEST_TIMEOUT = 30000;
|
||||
/**
|
||||
* ms毫秒,建立链接超时时间
|
||||
*/
|
||||
static final int CONNECT_TIMEOUT = 60000;
|
||||
/**
|
||||
* ms毫秒,读取超时时间
|
||||
*/
|
||||
static final int SOCKET_TIMEOUT = 60000;
|
||||
|
||||
//总配置,主要涉及是以下两个参数,如果要作调整没有用到properties会比较后麻烦,但鉴于一经粘贴,随处可用的特点,就不再做依赖性配置化处理了.
|
||||
//而且这个参数同一家公司基本不会变动.
|
||||
static final int maxTotal = 500;//最大总并发,很重要的参数
|
||||
static final int maxPerRoute = 100;//每路并发,很重要的参数
|
||||
/**
|
||||
* 总配置,主要涉及是以下两个参数,如果要作调整没有用到properties会比较后麻烦,但鉴于一经粘贴,随处可用的特点,就不再做依赖性配置化处理了.
|
||||
* 而且这个参数同一家公司基本不会变动.
|
||||
* 最大总并发,很重要的参数
|
||||
*/
|
||||
static final int MAX_TOTAL = 500;
|
||||
/**
|
||||
* 每路并发,很重要的参数
|
||||
*/
|
||||
static final int MAX_PER_ROUTE = 100;
|
||||
|
||||
//正常情况这里应该配成MAP或LIST
|
||||
//细化配置参数,用来对每路参数做精细化处理,可以管控各ip的流量,比如默认配置请求baidu:80端口最大100个并发链接,
|
||||
static final String detailHostName = "http://www.baidu.com";//每个细化配置之ip(不重要,在特殊场景很有用)
|
||||
//每个细化配置之port(不重要,在特殊场景很有用)
|
||||
static final int detailPort = 80;
|
||||
//每个细化配置之最大并发数(不重要,在特殊场景很有用)
|
||||
static final int detailMaxPerRoute = 100;
|
||||
/**
|
||||
* 正常情况这里应该配成MAP或LIST
|
||||
* 细化配置参数,用来对每路参数做精细化处理,可以管控各ip的流量,比如默认配置请求baidu:80端口最大100个并发链接,
|
||||
* 每个细化配置之ip(不重要,在特殊场景很有用)
|
||||
*/
|
||||
static final String DETAIL_HOST_NAME = "http://www.baidu.com";
|
||||
|
||||
/**
|
||||
* 每个细化配置之port(不重要,在特殊场景很有用)
|
||||
*/
|
||||
static final int DETAIL_PORT = 80;
|
||||
/**
|
||||
* 每个细化配置之最大并发数(不重要,在特殊场景很有用)
|
||||
*/
|
||||
static final int DETAIL_MAX_PER_ROUTE = 100;
|
||||
|
||||
private synchronized static CloseableHttpClient getHttpClient() {
|
||||
if (null == httpClient) {
|
||||
@ -78,15 +106,15 @@ public class HttpClientUtils {
|
||||
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create().register("http", plainsf).register("https", sslsf).build();
|
||||
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(registry);
|
||||
//将最大连接数增加
|
||||
cm.setMaxTotal(maxTotal);
|
||||
cm.setMaxTotal(MAX_TOTAL);
|
||||
//将每个路由基础的连接增加
|
||||
cm.setDefaultMaxPerRoute(maxPerRoute);
|
||||
cm.setDefaultMaxPerRoute(MAX_PER_ROUTE);
|
||||
|
||||
//细化配置开始,其实这里用Map或List的for循环来配置每个链接,在特殊场景很有用.
|
||||
//将每个路由基础的连接做特殊化配置,一般用不着
|
||||
HttpHost httpHost = new HttpHost(detailHostName, detailPort);
|
||||
HttpHost httpHost = new HttpHost(DETAIL_HOST_NAME, DETAIL_PORT);
|
||||
//将目标主机的最大连接数增加
|
||||
cm.setMaxPerRoute(new HttpRoute(httpHost), detailMaxPerRoute);
|
||||
cm.setMaxPerRoute(new HttpRoute(httpHost), DETAIL_MAX_PER_ROUTE);
|
||||
//细化配置结束
|
||||
|
||||
//请求重试处理
|
||||
@ -117,7 +145,7 @@ public class HttpClientUtils {
|
||||
};
|
||||
|
||||
//配置请求的超时设置
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(connectionRequestTimeout).setConnectTimeout(connectTimeout).setSocketTimeout(socketTimeout).build();
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(CONNECTION_REQUEST_TIMEOUT).setConnectTimeout(CONNECT_TIMEOUT).setSocketTimeout(SOCKET_TIMEOUT).build();
|
||||
newHotpoint = HttpClients.custom().setConnectionManager(cm).setDefaultRequestConfig(requestConfig).setRetryHandler(httpRequestRetryHandler).build();
|
||||
return newHotpoint;
|
||||
}
|
||||
@ -149,7 +177,7 @@ public class HttpClientUtils {
|
||||
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("get请求错误",e);
|
||||
log.error("get请求错误", e);
|
||||
} finally {
|
||||
try {
|
||||
if (response != null) {
|
||||
@ -157,7 +185,7 @@ public class HttpClientUtils {
|
||||
}
|
||||
httpClient.close();
|
||||
} catch (IOException e) {
|
||||
log.error("Get错误",e);
|
||||
log.error("Get错误", e);
|
||||
}
|
||||
}
|
||||
return resultString;
|
||||
|
||||
@ -23,14 +23,18 @@ import javax.servlet.http.HttpServletRequest;
|
||||
@Component
|
||||
public class IpHelper {
|
||||
|
||||
//qq lbs 地区查询key
|
||||
/**
|
||||
* qq lbs 地区查询key
|
||||
*/
|
||||
@Value("${lili.lbs.key}")
|
||||
private String key;
|
||||
//qq lbs 地区查询key
|
||||
/**
|
||||
* qq lbs 地区查询key
|
||||
*/
|
||||
@Value("${lili.lbs.sk}")
|
||||
private String sk;
|
||||
|
||||
private static final String api = "https://apis.map.qq.com";
|
||||
private static final String API = "https://apis.map.qq.com";
|
||||
|
||||
|
||||
/**
|
||||
@ -43,7 +47,7 @@ public class IpHelper {
|
||||
|
||||
String url = "/ws/location/v1/ip?key=" + key + "&ip=" + IpUtils.getIpAddress(request);
|
||||
String sign = SecureUtil.md5(url + sk);
|
||||
url = api + url + "&sign=" + sign;
|
||||
url = API + url + "&sign=" + sign;
|
||||
String result = "未知";
|
||||
try {
|
||||
String json = HttpUtil.get(url, 3000);
|
||||
|
||||
@ -51,7 +51,8 @@ public class OperationalJudgment<t> {
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
default:
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,157 +0,0 @@
|
||||
package cn.lili.common.utils;
|
||||
|
||||
import java.security.Key;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import javax.crypto.spec.PBEParameterSpec;
|
||||
|
||||
public class PasswordUtil {
|
||||
|
||||
/**
|
||||
* JAVA6支持以下任意一种算法
|
||||
* PBEWITHMD5ANDDES
|
||||
* PBEWITHMD5ANDTRIPLEDES
|
||||
* PBEWITHSHAANDDESEDE
|
||||
* PBEWITHSHA1ANDRC2_40
|
||||
* PBKDF2WITHHMACSHA1
|
||||
* */
|
||||
|
||||
/**
|
||||
* 定义使用的算法为:PBEWITHMD5andDES算法
|
||||
*/
|
||||
public static final String ALGORITHM = "PBEWithMD5AndDES";
|
||||
|
||||
/**
|
||||
* 定义迭代次数为1000次
|
||||
*/
|
||||
private static final int ITERATIONCOUNT = 1000;
|
||||
|
||||
/**
|
||||
* 获取加密算法中使用的盐值,解密中使用的盐值必须与加密中使用的相同才能完成操作.
|
||||
* 盐长度必须为8字节
|
||||
*
|
||||
* @return byte[] 盐值
|
||||
*/
|
||||
public static byte[] getSalt() throws Exception {
|
||||
//实例化安全随机数
|
||||
SecureRandom random = new SecureRandom();
|
||||
//产出盐
|
||||
return random.generateSeed(8);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据PBE密码生成一把密钥
|
||||
*
|
||||
* @param password 生成密钥时所使用的密码
|
||||
* @return Key PBE算法密钥
|
||||
*/
|
||||
private static Key getPBEKey(String password) throws Exception {
|
||||
//实例化使用的算法
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
|
||||
//设置PBE密钥参数
|
||||
PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
|
||||
//生成密钥
|
||||
SecretKey secretKey = keyFactory.generateSecret(keySpec);
|
||||
|
||||
return secretKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密明文字符串
|
||||
*
|
||||
* @param plaintext 待加密的明文字符串
|
||||
* @param password 生成密钥时所使用的密码
|
||||
* @param salt 盐值
|
||||
* @return 加密后的密文字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encrypt(String plaintext, String password, byte[] salt) throws Exception {
|
||||
|
||||
Key key = getPBEKey(password);
|
||||
|
||||
PBEParameterSpec parameterSpec = new PBEParameterSpec(salt, ITERATIONCOUNT);
|
||||
|
||||
Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
|
||||
cipher.init(Cipher.ENCRYPT_MODE, key, parameterSpec);
|
||||
|
||||
byte encipheredData[] = cipher.doFinal(plaintext.getBytes());
|
||||
|
||||
return bytesToHexString(encipheredData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密密文字符串
|
||||
*
|
||||
* @param ciphertext 待解密的密文字符串
|
||||
* @param password 生成密钥时所使用的密码(如需解密,该参数需要与加密时使用的一致)
|
||||
* @param salt 盐值(如需解密,该参数需要与加密时使用的一致)
|
||||
* @return 解密后的明文字符串
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decrypt(String ciphertext, String password, byte[] salt) throws Exception {
|
||||
|
||||
Key key = getPBEKey(password);
|
||||
|
||||
PBEParameterSpec parameterSpec = new PBEParameterSpec(salt, ITERATIONCOUNT);
|
||||
|
||||
Cipher cipher = Cipher.getInstance(ALGORITHM);
|
||||
|
||||
cipher.init(Cipher.DECRYPT_MODE, key, parameterSpec);
|
||||
|
||||
byte[] passDec = cipher.doFinal(hexStringToBytes(ciphertext));
|
||||
|
||||
return new String(passDec);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字节数组转换为十六进制字符串
|
||||
*
|
||||
* @param src 字节数组
|
||||
* @return
|
||||
*/
|
||||
public static String bytesToHexString(byte[] src) {
|
||||
StringBuilder stringBuilder = new StringBuilder("");
|
||||
if (src == null || src.length <= 0) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < src.length; i++) {
|
||||
int v = src[i] & 0xFF;
|
||||
String hv = Integer.toHexString(v);
|
||||
if (hv.length() < 2) {
|
||||
stringBuilder.append(0);
|
||||
}
|
||||
stringBuilder.append(hv);
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将十六进制字符串转换为字节数组
|
||||
*
|
||||
* @param hexString 十六进制字符串
|
||||
* @return
|
||||
*/
|
||||
public static byte[] hexStringToBytes(String hexString) {
|
||||
if (hexString == null || hexString.equals("")) {
|
||||
return null;
|
||||
}
|
||||
hexString = hexString.toUpperCase();
|
||||
int length = hexString.length() / 2;
|
||||
char[] hexChars = hexString.toCharArray();
|
||||
byte[] d = new byte[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
int pos = i * 2;
|
||||
d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
private static byte charToByte(char c) {
|
||||
return (byte) "0123456789ABCDEF".indexOf(c);
|
||||
}
|
||||
}
|
||||
@ -217,8 +217,7 @@ public class RedisUtil {
|
||||
* @return
|
||||
*/
|
||||
public boolean zadd(String key, long score, String value) {
|
||||
Boolean result = redisTemplate.opsForZSet().add(key, value, score);
|
||||
return result;
|
||||
return redisTemplate.opsForZSet().add(key, value, score);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package cn.lili.common.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -15,25 +13,25 @@ public class RegularUtil {
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private static final Pattern mobile = Pattern.compile("^1[3|4|5|8][0-9]\\d{8}$");
|
||||
private static final Pattern MOBILE = Pattern.compile("^1[3|4|5|8][0-9]\\d{8}$");
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private static final Pattern email = Pattern.compile("^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z0-9]{2,6}$");
|
||||
private static final Pattern EMAIL = Pattern.compile("^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z0-9]{2,6}$");
|
||||
|
||||
public static boolean Mobile(String v){
|
||||
public static boolean mobile(String v){
|
||||
|
||||
Matcher m = mobile.matcher(v);
|
||||
Matcher m = MOBILE.matcher(v);
|
||||
if(m.matches()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean Email(String v){
|
||||
public static boolean email(String v){
|
||||
|
||||
Matcher m = email.matcher(v);
|
||||
Matcher m = EMAIL.matcher(v);
|
||||
if(m.matches()){
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -17,10 +17,13 @@ import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
public class SpelUtil {
|
||||
|
||||
|
||||
//spel表达式解析器
|
||||
/**
|
||||
* spel表达式解析器
|
||||
*/
|
||||
private static SpelExpressionParser spelExpressionParser = new SpelExpressionParser();
|
||||
|
||||
//参数名发现器
|
||||
/**
|
||||
* 参数名发现器
|
||||
*/
|
||||
private static DefaultParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
|
||||
|
||||
/**
|
||||
@ -41,7 +44,8 @@ public class SpelUtil {
|
||||
//获取方法参数值
|
||||
Object[] args = joinPoint.getArgs();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
context.setVariable(parameterNames[i], args[i]); //替换spel里的变量值为实际值, 比如 #user --> user对象
|
||||
//替换spel里的变量值为实际值, 比如 #user --> user对象
|
||||
context.setVariable(parameterNames[i], args[i]);
|
||||
}
|
||||
return spelExpressionParser.parseExpression(spel).getValue(context).toString();
|
||||
}
|
||||
@ -66,7 +70,8 @@ public class SpelUtil {
|
||||
//获取方法参数值
|
||||
Object[] args = joinPoint.getArgs();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
context.setVariable(parameterNames[i], args[i]); //替换spel里的变量值为实际值, 比如 #user --> user对象
|
||||
//替换spel里的变量值为实际值, 比如 #user --> user对象
|
||||
context.setVariable(parameterNames[i], args[i]);
|
||||
}
|
||||
context.setVariable("rvt", rvt);
|
||||
return spelExpressionParser.parseExpression(spel).getValue(context).toString();
|
||||
|
||||
@ -195,7 +195,7 @@ public class StringUtils extends StrUtil {
|
||||
if (obj == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, Object> map = new HashMap<String, Object>(16);
|
||||
|
||||
BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
|
||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||
|
||||
@ -22,12 +22,12 @@ 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());
|
||||
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;
|
||||
|
||||
static {
|
||||
pool.prestartAllCoreThreads();
|
||||
POOL.prestartAllCoreThreads();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,10 +68,10 @@ public class ThreadPoolUtil {
|
||||
}
|
||||
|
||||
public static ThreadPoolExecutor getPool() {
|
||||
return pool;
|
||||
return POOL;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(pool.getPoolSize());
|
||||
System.out.println(POOL.getPoolSize());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package cn.lili.common.validation.impl;
|
||||
|
||||
import cn.lili.common.validation.Mobile;
|
||||
import cn.lili.common.validation.Phone;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
@ -11,22 +10,29 @@ import java.util.regex.Pattern;
|
||||
/**
|
||||
* 电话校验
|
||||
* 支持手机号+电话同时校验
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/7/9 1:41 上午
|
||||
*/
|
||||
public class MobileValidator implements ConstraintValidator<Mobile, String> {
|
||||
|
||||
private static final Pattern PHONE = Pattern.compile("^0?(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$");
|
||||
private static final Pattern AREA_MOBILE = Pattern.compile("0\\d{2,3}[-]?\\d{7,8}|0\\d{2,3}\\s?\\d{7,8}|13[0-9]\\d{8}|15[1089]\\d{8}");
|
||||
private static final Pattern MOBILE = Pattern.compile("^[1-9]{1}[0-9]{5,8}$");
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
|
||||
Pattern p1 = null, p2 = null, p3 = null;
|
||||
Matcher m = null;
|
||||
p1 = Pattern.compile("0\\d{2,3}[-]?\\d{7,8}|0\\d{2,3}\\s?\\d{7,8}|13[0-9]\\d{8}|15[1089]\\d{8}"); // 验证带区号的
|
||||
p2 = Pattern.compile("^[1-9]{1}[0-9]{5,8}$"); // 验证没有区号的
|
||||
p3 = Pattern.compile("^0?(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$");// 验证手机号
|
||||
Pattern pattern = null;
|
||||
// 验证手机号
|
||||
if (value.length() == 11) {
|
||||
m = p3.matcher(value);
|
||||
m = PHONE.matcher(value);
|
||||
// 验证带区号的电话
|
||||
} else if (value.length() > 9) {
|
||||
m = p1.matcher(value);
|
||||
m = AREA_MOBILE.matcher(value);
|
||||
//验证没有区号的电话
|
||||
} else {
|
||||
m = p2.matcher(value);
|
||||
m = MOBILE.matcher(value);
|
||||
}
|
||||
return m.matches();
|
||||
}
|
||||
|
||||
@ -7,7 +7,12 @@ import javax.validation.ConstraintValidatorContext;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
/**
|
||||
* 手机号校验
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/7/9 1:42 上午
|
||||
*/
|
||||
public class PhoneValidator implements ConstraintValidator<Phone, String> {
|
||||
|
||||
private static Pattern pattern = Pattern.compile("^0?(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$");
|
||||
|
||||
@ -72,12 +72,13 @@ public class ImageUtil {
|
||||
int rightRgb = templateImage.getRGB(i + 1, j);
|
||||
int downRgb = templateImage.getRGB(i, j + 1);
|
||||
//描边处理,,取带像素和无像素的界点,判断该点是不是临界轮廓点,如果是设置该坐标像素是白色
|
||||
if ((rgb >= 0 && rightRgb < 0) || (rgb < 0 && rightRgb >= 0) || (rgb >= 0 && downRgb < 0)
|
||||
|| (rgb < 0 && downRgb >= 0)) {
|
||||
boolean rgbImage = ((rgb >= 0 && rightRgb < 0)
|
||||
|| (rgb < 0 && rightRgb >= 0)
|
||||
|| (rgb >= 0 && downRgb < 0)
|
||||
|| (rgb < 0 && downRgb >= 0));
|
||||
|
||||
if (rgbImage) {
|
||||
newImage.setRGB(i, j, Color.GRAY.getRGB());
|
||||
|
||||
// oriImage.setRGB(x + i, y + j, Color.white.getRGB());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -87,7 +88,7 @@ public class ImageUtil {
|
||||
int xStart = x - 1;
|
||||
int yStart = y - 1;
|
||||
int current = 0;
|
||||
for (int i = xStart; i < 3 + xStart; i++)
|
||||
for (int i = xStart; i < 3 + xStart; i++) {
|
||||
for (int j = yStart; j < 3 + yStart; j++) {
|
||||
int tx = i;
|
||||
if (tx < 0) {
|
||||
@ -105,6 +106,7 @@ public class ImageUtil {
|
||||
pixels[current++] = img.getRGB(tx, ty);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void fillMatrix(int[][] matrix, int[] values) {
|
||||
|
||||
@ -43,7 +43,7 @@ public class SliderImageUtil {
|
||||
public static Map<String, Object> pictureTemplatesCut(SerializableStream sliderFile, SerializableStream originalFile) throws Exception {
|
||||
|
||||
Random random = new Random();
|
||||
Map<String, Object> pictureMap = new HashMap<>();
|
||||
Map<String, Object> pictureMap = new HashMap<>(16);
|
||||
//拼图
|
||||
BufferedImage sliderImage = ImageIO.read(Base64DecodeMultipartFile.base64ToInputStream(sliderFile.getBase64()));
|
||||
int sliderWidth = sliderImage.getWidth();
|
||||
@ -79,12 +79,15 @@ public class SliderImageUtil {
|
||||
|
||||
//添加水印
|
||||
ImageUtil.addWatermark(originalImage, "LILI-SHOP");
|
||||
ByteArrayOutputStream newImageOs = new ByteArrayOutputStream();//新建流。
|
||||
ImageIO.write(newImage, TEMP_IMG_FILE_TYPE, newImageOs);//利用ImageIO类提供的write方法,将bi以png图片的数据模式写入流。
|
||||
//新建流
|
||||
ByteArrayOutputStream newImageOs = new ByteArrayOutputStream();
|
||||
//利用ImageIO类提供的write方法,将bi以png图片的数据模式写入流。
|
||||
ImageIO.write(newImage, TEMP_IMG_FILE_TYPE, newImageOs);
|
||||
byte[] newImagery = newImageOs.toByteArray();
|
||||
|
||||
ByteArrayOutputStream oriImagesOs = new ByteArrayOutputStream();//新建流。
|
||||
ImageIO.write(originalImage, IMG_FILE_TYPE, oriImagesOs);//利用ImageIO类提供的write方法,将bi以jpg图片的数据模式写入流。
|
||||
//新建流
|
||||
ByteArrayOutputStream oriImagesOs = new ByteArrayOutputStream();
|
||||
//利用ImageIO类提供的write方法,将bi以jpg图片的数据模式写入流
|
||||
ImageIO.write(originalImage, IMG_FILE_TYPE, oriImagesOs);
|
||||
byte[] oriImageByte = oriImagesOs.toByteArray();
|
||||
|
||||
pictureMap.put("slidingImage", "data:image/png;base64," + Base64Utils.encodeToString(newImagery));
|
||||
|
||||
@ -7,6 +7,9 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* 验证码模块
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/7/9 1:42 上午
|
||||
*/
|
||||
public interface VerificationService {
|
||||
/**
|
||||
@ -15,6 +18,7 @@ public interface VerificationService {
|
||||
* @param verificationEnums 校验枚举
|
||||
* @param uuid uuid
|
||||
* @return 校验对象
|
||||
* @throws IOException 校验错误
|
||||
*/
|
||||
Map<String, Object> createVerification(VerificationEnums verificationEnums, String uuid) throws IOException;
|
||||
|
||||
@ -29,9 +33,11 @@ public interface VerificationService {
|
||||
boolean preCheck(Integer xPos, String uuid, VerificationEnums verificationEnums);
|
||||
|
||||
/**
|
||||
* 验证码校验
|
||||
*
|
||||
* @param uuid 用户唯一表示
|
||||
* @param verificationEnums 校验枚举
|
||||
* @return
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean check(String uuid, VerificationEnums verificationEnums);
|
||||
}
|
||||
|
||||
@ -7,8 +7,11 @@ import org.springframework.data.redis.serializer.SerializationException;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/*
|
||||
*要实现对象的缓存,定义自己的序列化和反序列化器。使用阿里的fastjson来实现的比较多。
|
||||
/**
|
||||
* 要实现对象的缓存,定义自己的序列化和反序列化器。使用阿里的fastjson来实现的比较多
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/7/9 12:25 上午
|
||||
*/
|
||||
public class FastJsonRedisSerializer<T> implements RedisSerializer<T> {
|
||||
private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
||||
|
||||
@ -51,8 +51,14 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||
private Integer timeout;
|
||||
|
||||
|
||||
/**
|
||||
* 当有多个管理器的时候,必须使用该注解在一个管理器上注释:表示该管理器为默认的管理器
|
||||
*
|
||||
* @param connectionFactory
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
@Primary//当有多个管理器的时候,必须使用该注解在一个管理器上注释:表示该管理器为默认的管理器
|
||||
@Primary
|
||||
public CacheManager cacheManager(RedisConnectionFactory connectionFactory) {
|
||||
//初始化一个RedisCacheWriter
|
||||
RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory);
|
||||
|
||||
@ -85,11 +85,9 @@ public class ElasticsearchConfig extends AbstractElasticsearchConfiguration {
|
||||
return (response, context) -> 2 * 60 * 1000;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* it gets called when bean instance is getting removed from the context if
|
||||
* scope is not a prototype
|
||||
*/
|
||||
/*
|
||||
* If there is a method named shutdown or close then spring container will try
|
||||
* to automatically configure them as callback methods when bean is being
|
||||
* destroyed
|
||||
@ -99,7 +97,7 @@ public class ElasticsearchConfig extends AbstractElasticsearchConfiguration {
|
||||
try {
|
||||
this.client.close();
|
||||
} catch (IOException e) {
|
||||
log.error("es clientClose错误",e);
|
||||
log.error("es clientClose错误", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package cn.lili.config.interceptor;
|
||||
|
||||
import cn.lili.config.properties.IgnoredUrlsProperties;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
||||
@ -31,7 +30,10 @@ public class UrlConfiguration implements WebMvcConfigurer {
|
||||
ir.excludePathPatterns(ignoredUrlsProperties.getUrls());
|
||||
}
|
||||
|
||||
//开放资源 这里配置swagger可以在前端访问
|
||||
/**
|
||||
* 开放资源 这里配置swagger可以在前端访问
|
||||
* @param registry
|
||||
*/
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/statics/**").addResourceLocations("classpath:/statics/");
|
||||
|
||||
@ -13,14 +13,24 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "lili.sms")
|
||||
public class SmsTemplateSetting {
|
||||
//登录
|
||||
private String LOGIN = "SMS_205755300";
|
||||
//注册
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
private String lOGIN = "SMS_205755300";
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
private String REGISTER = "SMS_205755298";
|
||||
//找回密码
|
||||
/**
|
||||
* 找回密码
|
||||
*/
|
||||
private String FIND_USER = "SMS_205755301";
|
||||
//设置密码
|
||||
/**
|
||||
* 设置密码
|
||||
*/
|
||||
private String UPDATE_PASSWORD = "SMS_205755297";
|
||||
//设置支付密码
|
||||
/**
|
||||
* 设置支付密码
|
||||
*/
|
||||
private String WALLET_PASSWORD = "SMS_205755297";
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ public class ThreadProperties {
|
||||
/**
|
||||
* 保持存活时间
|
||||
*/
|
||||
private Integer KeepAliveSeconds = 60;
|
||||
private Integer keepAliveSeconds = 60;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -20,8 +20,8 @@ public class CreateTimeShardingDatabaseAlgorithm implements PreciseShardingAlgor
|
||||
|
||||
@Override
|
||||
public String doSharding(Collection<String> collection, PreciseShardingValue<Long> preciseShardingValue) {
|
||||
Long create_time = preciseShardingValue.getValue();
|
||||
String value = DateUtil.toString(create_time, "yyyy");
|
||||
Long createTime = preciseShardingValue.getValue();
|
||||
String value = DateUtil.toString(createTime, "yyyy");
|
||||
//data2019,data2020
|
||||
return "data" + value;
|
||||
}
|
||||
|
||||
@ -21,9 +21,9 @@ public class CreateTimeShardingTableAlgorithm implements PreciseShardingAlgorith
|
||||
|
||||
@Override
|
||||
public String doSharding(Collection<String> collection, PreciseShardingValue<Long> preciseShardingValue) {
|
||||
Long create_time = preciseShardingValue.getValue();
|
||||
String monthValue = DateUtil.toString(create_time, "MM");
|
||||
String yearValue = DateUtil.toString(create_time, "yyyy");
|
||||
Long createTime = preciseShardingValue.getValue();
|
||||
String monthValue = DateUtil.toString(createTime, "MM");
|
||||
String yearValue = DateUtil.toString(createTime, "yyyy");
|
||||
Integer month = Integer.valueOf(monthValue);
|
||||
Integer year = Integer.valueOf(yearValue);
|
||||
//li_order_1,li_order_2~
|
||||
|
||||
@ -19,8 +19,8 @@ public class CreateTimeShardingTableAlgorithmBak implements PreciseShardingAlgor
|
||||
|
||||
@Override
|
||||
public String doSharding(Collection<String> collection, PreciseShardingValue<Long> preciseShardingValue) {
|
||||
Long create_time = preciseShardingValue.getValue();
|
||||
String value = DateUtil.toString(create_time, "MM");
|
||||
Long createTime = preciseShardingValue.getValue();
|
||||
String value = DateUtil.toString(createTime, "MM");
|
||||
Integer month = Integer.valueOf(value);
|
||||
//li_order_1,li_order_2~
|
||||
return "li_order_" + month;
|
||||
@ -30,17 +30,9 @@ public class CreateTimeShardingTableAlgorithmBak implements PreciseShardingAlgor
|
||||
@Override
|
||||
public Collection<String> doSharding(Collection collection, RangeShardingValue rangeShardingValue) {
|
||||
Collection<String> collect = new ArrayList<>();
|
||||
//Range<Integer> valueRange = rangeShardingValue.getValueRange();
|
||||
//开始年份结束年份
|
||||
//String start = DateUtil.toString(valueRange.lowerEndpoint().longValue(), "MM");
|
||||
//String end = DateUtil.toString(valueRange.upperEndpoint().longValue(), "MM");
|
||||
//循环增加区间的查询条件
|
||||
|
||||
|
||||
//因为考虑到 假设2019-05~2020-05
|
||||
//这快是没办法处理的,因为分库分表之后,每个库都要进行查询,如果操作为,1-4月,那么2020年数据查询正确了,可是2019年到5-12月数据就查询不到了
|
||||
//这里需要做一些性能的浪费,现在看来是没办法处理到
|
||||
|
||||
for (Integer i = 1; i <= 12; i++) {
|
||||
collect.add("li_order_" + i);
|
||||
}
|
||||
|
||||
@ -25,73 +25,73 @@ public class CodeGenerator {
|
||||
/**
|
||||
* 代码生成在哪个项目
|
||||
*/
|
||||
private static final String project = "framework";
|
||||
private static final String PROJECT = "framework";
|
||||
|
||||
/**
|
||||
* 代码生成在哪个包下边
|
||||
*/
|
||||
private static final String packages = "cn.lili.modules.";
|
||||
private static final String PACKAGES = "cn.lili.modules.";
|
||||
|
||||
/**
|
||||
* modules
|
||||
*/
|
||||
private static final String modules = "message";
|
||||
private static final String MODULES = "message";
|
||||
|
||||
|
||||
/**
|
||||
* 实体类名
|
||||
* 建议仅需修改
|
||||
*/
|
||||
private static final String className = "ShortLink";
|
||||
private static final String CLASS_NAME = "ShortLink";
|
||||
|
||||
/**
|
||||
* 类说明描述
|
||||
* 建议仅需修改
|
||||
*/
|
||||
private static final String description = "短链接";
|
||||
private static final String DESCRIPTION = "短链接";
|
||||
|
||||
/**
|
||||
* 作者名
|
||||
* 建议仅需修改
|
||||
*/
|
||||
private static final String author = "Chopper";
|
||||
private static final String AUTHOR = "Chopper";
|
||||
|
||||
/**
|
||||
* 数据库表名前缀
|
||||
* 下方请根据需要修改
|
||||
*/
|
||||
private static final String tablePre = "li_";
|
||||
private static final String TABLE_PRE = "li_";
|
||||
|
||||
/**
|
||||
* 主键类型
|
||||
*/
|
||||
private static final String primaryKeyType = "String";
|
||||
private static final String PRIMARY_KEY_TYPE = "String";
|
||||
|
||||
|
||||
/**
|
||||
* endity
|
||||
*/
|
||||
private static final String entityPackage = packages + modules + ".entity";
|
||||
private static final String ENTITY_PACKAGE = PACKAGES + MODULES + ".entity";
|
||||
|
||||
/**
|
||||
* dao
|
||||
*/
|
||||
private static final String daoPackage = packages + modules + ".mapper";
|
||||
private static final String DAO_PACKAGE = PACKAGES + MODULES + ".mapper";
|
||||
|
||||
/**
|
||||
* service
|
||||
*/
|
||||
private static final String servicePackage = packages + modules + ".service";
|
||||
private static final String SERVICE_PACKAGE = PACKAGES + MODULES + ".service";
|
||||
|
||||
/**
|
||||
* serviceImpl
|
||||
*/
|
||||
private static final String serviceImplPackage = packages + modules + ".serviceimpl";
|
||||
private static final String SERVICE_IMPL_PACKAGE = PACKAGES + MODULES + ".serviceimpl";
|
||||
|
||||
/**
|
||||
* controller
|
||||
*/
|
||||
private static final String controllerPackage = packages + modules + ".controller";
|
||||
private static final String CONTROLLER_PACKAGE = PACKAGES + MODULES + ".controller";
|
||||
|
||||
/**
|
||||
* 运行该主函数即可生成代码
|
||||
@ -126,17 +126,17 @@ public class CodeGenerator {
|
||||
Template mapperXmlTemplate = gt.getTemplate("mapperXml.btl");
|
||||
|
||||
Entity entity = new Entity();
|
||||
entity.setEntityPackage(entityPackage);
|
||||
entity.setDaoPackage(daoPackage);
|
||||
entity.setServicePackage(servicePackage);
|
||||
entity.setServiceImplPackage(serviceImplPackage);
|
||||
entity.setControllerPackage(controllerPackage);
|
||||
entity.setAuthor(author);
|
||||
entity.setClassName(className);
|
||||
entity.setTableName(tablePre + StringUtils.camel2Underline(className));
|
||||
entity.setClassNameLowerCase(name(className, false));
|
||||
entity.setDescription(description);
|
||||
entity.setPrimaryKeyType(primaryKeyType);
|
||||
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;
|
||||
|
||||
@ -145,7 +145,7 @@ public class CodeGenerator {
|
||||
String entityResult = entityTemplate.render();
|
||||
System.out.println(entityResult);
|
||||
//创建文件
|
||||
String entityFileUrl = System.getProperty("user.dir") + "/" + project + "/src/main/java/" + dotToLine(entityPackage) + "/" + className + ".java";
|
||||
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()) {
|
||||
@ -163,7 +163,7 @@ public class CodeGenerator {
|
||||
String daoResult = daoTemplate.render();
|
||||
System.out.println(daoResult);
|
||||
//创建文件
|
||||
String daoFileUrl = System.getProperty("user.dir") + "/" + project + "/src/main/java/" + dotToLine(daoPackage) + "/" + className + "Mapper.java";
|
||||
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()) {
|
||||
@ -181,7 +181,7 @@ public class CodeGenerator {
|
||||
String serviceResult = serviceTemplate.render();
|
||||
System.out.println(serviceResult);
|
||||
//创建文件
|
||||
String serviceFileUrl = System.getProperty("user.dir") + "/" + project + "/src/main/java/" + dotToLine(servicePackage) + "/" + className + "Service.java";
|
||||
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()) {
|
||||
@ -200,7 +200,7 @@ public class CodeGenerator {
|
||||
System.out.println(serviceImplResult);
|
||||
//创建文件
|
||||
System.out.println(System.getProperty("user.dir"));
|
||||
String serviceImplFileUrl = System.getProperty("user.dir") + "/" + project + "/src/main/java/" + dotToLine(serviceImplPackage) + "/" + className + "ServiceImpl.java";
|
||||
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()) {
|
||||
@ -218,7 +218,7 @@ public class CodeGenerator {
|
||||
String controllerResult = controllerTemplate.render();
|
||||
System.out.println(controllerResult);
|
||||
//创建文件
|
||||
String controllerFileUrl = System.getProperty("user.dir") + "/" + project + "/src/main/java/" + dotToLine(controllerPackage) + "/" + className + "Controller.java";
|
||||
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()) {
|
||||
@ -236,7 +236,7 @@ public class CodeGenerator {
|
||||
String mapperXmlResult = mapperXmlTemplate.render();
|
||||
System.out.println(mapperXmlResult);
|
||||
//创建文件
|
||||
String mapperXmlFileUrl = System.getProperty("user.dir") + "/" + project + "/src/main/resources/mapper/" + className + "Mapper.xml";
|
||||
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()) {
|
||||
@ -263,36 +263,36 @@ public class CodeGenerator {
|
||||
*/
|
||||
private static void deleteCode(String className) throws IOException {
|
||||
|
||||
String entityFileUrl = System.getProperty("user.dir") + "/" + project + "/src/main/java/" + dotToLine(entityPackage) + "/" + className + ".java";
|
||||
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(daoPackage) + "/" + className + "Mapper.java";
|
||||
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(servicePackage) + "/" + className + "Service.java";
|
||||
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(serviceImplPackage) + "/" + className + "ServiceImpl.java";
|
||||
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(controllerPackage) + "/" + className + "Controller.java";
|
||||
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";
|
||||
String mapperXmlFileUrl = System.getProperty("user.dir") + "/" + PROJECT + "/src/main/resources/mapper/" + className + "Mapper.xml";
|
||||
File mapperXmlFile = new File(mapperXmlFileUrl);
|
||||
if (mapperXmlFile.exists()) {
|
||||
mapperXmlFile.delete();
|
||||
|
||||
@ -4,6 +4,9 @@ import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 演示站点注解
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/7/9 1:40 上午
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
@ -10,10 +10,25 @@ package cn.lili.modules.base.entity.enums;
|
||||
|
||||
public enum ClientTypeEnum {
|
||||
|
||||
/**
|
||||
* "移动端"
|
||||
*/
|
||||
H5("移动端"),
|
||||
/**
|
||||
* "PC端"
|
||||
*/
|
||||
PC("PC端"),
|
||||
/**
|
||||
* "小程序端"
|
||||
*/
|
||||
WECHAT_MP("小程序端"),
|
||||
/**
|
||||
* "移动应用端"
|
||||
*/
|
||||
APP("移动应用端"),
|
||||
/**
|
||||
* "未知"
|
||||
*/
|
||||
UNKNOWN("未知");
|
||||
|
||||
private final String clientName;
|
||||
|
||||
@ -8,8 +8,13 @@ package cn.lili.modules.base.entity.enums;
|
||||
* @date 2021/1/26 15:55
|
||||
*/
|
||||
public enum VerificationSourceEnum {
|
||||
|
||||
/**
|
||||
* 滑块
|
||||
*/
|
||||
SLIDER("滑块"),
|
||||
/**
|
||||
* 验证码源
|
||||
*/
|
||||
RESOURCE("验证码源");
|
||||
|
||||
private final String description;
|
||||
|
||||
@ -27,7 +27,12 @@ public interface RegionService extends IService<Region> {
|
||||
@CacheEvict
|
||||
void synchronizationData(String url);
|
||||
|
||||
|
||||
/**
|
||||
* 获取地区列表
|
||||
*
|
||||
* @param id 地区ID
|
||||
* @return 地区列表
|
||||
*/
|
||||
@Cacheable(key = "#id")
|
||||
List<Region> getItem(String id);
|
||||
|
||||
|
||||
@ -13,7 +13,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface VerificationSourceService extends IService<VerificationSource> {
|
||||
|
||||
//缓存
|
||||
/**
|
||||
* 缓存
|
||||
*/
|
||||
String VERIFICATION_CACHE = CachePrefix.VERIFICATION.getPrefix();
|
||||
|
||||
|
||||
@ -26,6 +28,8 @@ public interface VerificationSourceService extends IService<VerificationSource>
|
||||
|
||||
/**
|
||||
* 获取验证缓存
|
||||
*
|
||||
* @return 验证码
|
||||
*/
|
||||
VerificationVO getVerificationCache();
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
package cn.lili.modules.base.serviceimpl;
|
||||
|
||||
import cn.lili.common.cache.Cache;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.utils.HttpClientUtils;
|
||||
import cn.lili.common.utils.SnowFlake;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.modules.base.mapper.RegionMapper;
|
||||
import cn.lili.modules.base.service.RegionService;
|
||||
import cn.lili.modules.system.entity.dos.Region;
|
||||
@ -27,7 +27,7 @@ import java.util.*;
|
||||
* @date 2020/12/2 11:11
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> implements RegionService {
|
||||
|
||||
/**
|
||||
@ -37,6 +37,7 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
@Override
|
||||
public void synchronizationData(String url) {
|
||||
try {
|
||||
@ -58,7 +59,7 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
//删除缓存
|
||||
cache.vagueDel("{regions}");
|
||||
} catch (Exception e) {
|
||||
log.error("同步行政数据错误",e);
|
||||
log.error("同步行政数据错误", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,8 +90,10 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
//因为有无用数据 所以先删除前两个
|
||||
result = ArrayUtils.remove(result, 0);
|
||||
result = ArrayUtils.remove(result, 0);
|
||||
String regionIds = ""; //地址id
|
||||
String regionNames = "";//地址名称
|
||||
//地址id
|
||||
String regionIds = "";
|
||||
//地址名称
|
||||
String regionNames = "";
|
||||
//循环构建新的数据
|
||||
for (String regionId : result) {
|
||||
Region reg = this.baseMapper.selectById(regionId);
|
||||
@ -102,7 +105,7 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
regionIds += region.getId();
|
||||
regionNames += region.getName();
|
||||
//构建返回数据
|
||||
Map<String, Object> obj = new HashMap<>();
|
||||
Map<String, Object> obj = new HashMap<>(2);
|
||||
obj.put("id", regionIds);
|
||||
obj.put("name", regionNames);
|
||||
return obj;
|
||||
@ -120,10 +123,10 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
|
||||
private List<RegionVO> regionTree(List<Region> regions) {
|
||||
List<RegionVO> regionVOS = new ArrayList<>();
|
||||
regions.stream().filter(region -> region.getLevel().equals("province")).forEach(item -> {
|
||||
regions.stream().filter(region -> ("province").equals(region.getLevel())).forEach(item -> {
|
||||
regionVOS.add(new RegionVO(item));
|
||||
});
|
||||
regions.stream().filter(region -> region.getLevel().equals("city")).forEach(item -> {
|
||||
regions.stream().filter(region -> ("city").equals(region.getLevel())).forEach(item -> {
|
||||
for (RegionVO region : regionVOS) {
|
||||
if (region.getId().equals(item.getParentId())) {
|
||||
region.getChildren().add(new RegionVO(item));
|
||||
@ -148,18 +151,6 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
JSONArray countryAll = jsonObject.getJSONArray("districts");
|
||||
for (int i = 0; i < countryAll.size(); i++) {
|
||||
JSONObject contry = countryAll.getJSONObject(i);
|
||||
// String citycode0 = contry.getString("citycode");
|
||||
// String adcode0 = contry.getString("adcode");
|
||||
// String name0 = contry.getString("name");
|
||||
// String center0 = contry.getString("center");
|
||||
// String country = contry.getString("level");
|
||||
// int level = 0;
|
||||
// if (country.equals("country")) {
|
||||
// level = 0;
|
||||
// }
|
||||
// 插入国家
|
||||
// Integer id1 = insert(0, adcode0, citycode0, name0, center0, level, name0);
|
||||
// Integer id1 = insert(0, adcode0, citycode0, name0, center0, level);
|
||||
String id1 = "0";
|
||||
JSONArray provinceAll = contry.getJSONArray("districts");
|
||||
for (int j = 0; j < provinceAll.size(); j++) {
|
||||
@ -192,7 +183,6 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
String level3 = district.getString("level");
|
||||
//插入区县
|
||||
String id4 = insert(regions, id3, citycode3, adcode3, name3, center3, level3, w, id1, id2, id3);
|
||||
// JSONArray street = street3.getJSONArray("districts");
|
||||
//有需要可以继续向下遍历
|
||||
JSONArray streetAll = district.getJSONArray("districts");
|
||||
for (int r = 0; r < streetAll.size(); r++) {
|
||||
@ -238,10 +228,10 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
// " \"center\": \"116.3683244,39.915085\",\n" +
|
||||
// " \"level\": \"country\",\n" +
|
||||
Region record = new Region();
|
||||
if (!adCode.equals("[]")) {
|
||||
if (!("[]").equals(adCode)) {
|
||||
record.setAdCode(adCode);
|
||||
}
|
||||
if (!cityCode.equals("[]")) {
|
||||
if (!("[]").equals(cityCode)) {
|
||||
record.setCityCode(cityCode);
|
||||
}
|
||||
record.setCenter(center);
|
||||
@ -250,14 +240,14 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
record.setParentId(parentId);
|
||||
record.setOrderNum(order);
|
||||
record.setId(String.valueOf(SnowFlake.getId()));
|
||||
String megName = ",";
|
||||
StringBuffer megName = new StringBuffer(",");
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
megName = megName + ids[i];
|
||||
megName = megName.append(ids[i]) ;
|
||||
if (i < ids.length - 1) {
|
||||
megName = megName + ",";
|
||||
megName.append(",");
|
||||
}
|
||||
}
|
||||
record.setPath(megName);
|
||||
record.setPath(megName.toString());
|
||||
regions.add(record);
|
||||
return record.getId();
|
||||
}
|
||||
|
||||
@ -28,9 +28,11 @@ public class Commodity extends BaseEntity {
|
||||
@ApiModelProperty(value = "商品名称")
|
||||
private String name;
|
||||
|
||||
//1:一口价(只需要传入price,price2不传)
|
||||
//2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传)
|
||||
//3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传
|
||||
/**
|
||||
* 1:一口价(只需要传入price,price2不传)
|
||||
* 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传)
|
||||
* 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传
|
||||
*/
|
||||
@ApiModelProperty(value = "价格类型")
|
||||
private Integer priceType;
|
||||
|
||||
|
||||
@ -11,12 +11,20 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class CommodityDTO {
|
||||
//商品ID
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Integer goods_id;
|
||||
//商品名称
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String name;
|
||||
//地址
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String url;
|
||||
//审核状态
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
private Integer audit_status;
|
||||
}
|
||||
|
||||
@ -8,9 +8,9 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 微信小程序直播商品DTO
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/5/17 11:03 上午
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ -22,9 +22,11 @@ public class GoodsInfo {
|
||||
@ApiModelProperty(value = "商品名称")
|
||||
private String name;
|
||||
|
||||
//1:一口价(只需要传入price,price2不传)
|
||||
//2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传)
|
||||
//3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传
|
||||
/**
|
||||
* 1:一口价(只需要传入price,price2不传)
|
||||
* 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传)
|
||||
* 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传
|
||||
*/
|
||||
@ApiModelProperty(value = "价格类型")
|
||||
private Integer priceType;
|
||||
|
||||
@ -37,7 +39,7 @@ public class GoodsInfo {
|
||||
@ApiModelProperty(value = "商品详情页的小程序路径")
|
||||
private String url;
|
||||
|
||||
public GoodsInfo(Commodity commodity){
|
||||
public GoodsInfo(Commodity commodity) {
|
||||
BeanUtil.copyProperties(commodity, this);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user