You've already forked FrameTour-BE
Compare commits
103 Commits
aaddbab2ab
...
master
Author | SHA1 | Date | |
---|---|---|---|
1059d30c21 | |||
4d53986277 | |||
156c487c0f | |||
38e9763033 | |||
1dc9e16c55 | |||
4f0d1813c9 | |||
d2577f0c0f | |||
2adce97503 | |||
1eb527574b | |||
22dea22fc1 | |||
a425c155d0 | |||
ceaf10977d | |||
a5a7957f9e | |||
ce0cbb1c91 | |||
2274ca7010 | |||
18fd50f5d6 | |||
13ef1d1334 | |||
8b957ee96d | |||
b3df268964 | |||
f54595466a | |||
d7d503212f | |||
52086dbea4 | |||
f084b7a21f | |||
3aa039f0ea | |||
1ca7182979 | |||
78079b242a | |||
fd66448f4d | |||
64c4180e4d | |||
af141161de | |||
0317600910 | |||
eda2c75533 | |||
0ecd9d5e20 | |||
722b8a9e90 | |||
69f4ad11ad | |||
49c313b4a0 | |||
5bac59653b | |||
0dbaf5eaba | |||
d180128edb | |||
bd308f35ae | |||
cb312b1a74 | |||
6862ddbf58 | |||
51ba702d82 | |||
ecc011269c | |||
f84adc8ebe | |||
17d63688c6 | |||
3f5dc41310 | |||
b0adf414d0 | |||
529b52f19c | |||
7a21fb01d0 | |||
f40837cd05 | |||
66334b8963 | |||
206696deb8 | |||
e8488d081f | |||
245387f280 | |||
6d8261ff25 | |||
7d6c87cc74 | |||
5f8c4fd6e6 | |||
53a09c1cab | |||
b0c8643e92 | |||
fae62ab7c2 | |||
5895d9c56f | |||
207fcb6414 | |||
c2ce6f91ed | |||
da3de2cc89 | |||
d245d09837 | |||
4d8236afa1 | |||
04e2ade669 | |||
cd4678120d | |||
cf9802f9ec | |||
a84b38dab5 | |||
e32f231a8f | |||
f9fcb06355 | |||
2ae0b3c4b3 | |||
3bd8face68 | |||
1841e43b85 | |||
a9655814ae | |||
c1b4bc8952 | |||
4bacdbe39a | |||
4273cda7cd | |||
ceba1e1b01 | |||
34dbc7d036 | |||
89e112e13a | |||
26a9be80f6 | |||
a4a6e9b5af | |||
0d5aabe317 | |||
5d2cf4fd31 | |||
80f4491836 | |||
115edc19fa | |||
bfd37fc764 | |||
ef0ba3ddb4 | |||
88cce9357d | |||
c50cd84af0 | |||
0c40cdad4e | |||
a41b87713f | |||
06a07514cc | |||
0292b754fe | |||
460b4ea42a | |||
7fd62e9aba | |||
3b3c768bbe | |||
1e993c6fd4 | |||
937c2b33d3 | |||
9b00b34a68 | |||
c01ff160c3 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
|||||||
.idea/
|
.idea/
|
||||||
logs/
|
logs/
|
||||||
target/
|
target/
|
||||||
|
|
||||||
|
.claude
|
123
CLAUDE.md
Normal file
123
CLAUDE.md
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
# CLAUDE.md
|
||||||
|
|
||||||
|
本文件为 Claude Code (claude.ai/code) 在此代码仓库中工作时提供指导。
|
||||||
|
|
||||||
|
## 构建和开发命令
|
||||||
|
|
||||||
|
### 构建应用程序
|
||||||
|
```bash
|
||||||
|
# 清理构建(默认跳过测试)
|
||||||
|
mvn clean package
|
||||||
|
|
||||||
|
# 清理构建并执行测试
|
||||||
|
mvn clean package -DskipTests=false
|
||||||
|
|
||||||
|
# 运行应用程序
|
||||||
|
mvn spring-boot:run
|
||||||
|
```
|
||||||
|
|
||||||
|
### 测试命令
|
||||||
|
```bash
|
||||||
|
# 运行特定测试类
|
||||||
|
mvn test -Dtest=FaceCleanerTest
|
||||||
|
|
||||||
|
# 运行特定包的测试
|
||||||
|
mvn test -Dtest="com.ycwl.basic.storage.adapters.*Test"
|
||||||
|
|
||||||
|
# 运行所有测试
|
||||||
|
mvn test -DskipTests=false
|
||||||
|
```
|
||||||
|
|
||||||
|
### 开发环境配置
|
||||||
|
应用程序使用 Spring 配置文件:
|
||||||
|
- 默认激活配置文件:`dev`
|
||||||
|
- 生产环境配置文件:`prod`(启用定时任务)
|
||||||
|
- 配置文件:`application-dev.yml`、`application-prod.yml`
|
||||||
|
|
||||||
|
## 架构概览
|
||||||
|
|
||||||
|
这是一个 Spring Boot 3.3.5 应用程序(Java 21),采用多租户架构,通过不同的 API 端点为不同的客户端类型提供服务。
|
||||||
|
|
||||||
|
### 控制器架构
|
||||||
|
- **移动端 APIs** (`/api/mobile/`):面向移动应用的客户端端点
|
||||||
|
- **PC 端 APIs** (`/api/`):Web 仪表板/管理面板端点
|
||||||
|
- **任务 APIs** (`/task/`):后台工作和渲染任务端点
|
||||||
|
- **外部 APIs**:专用集成(打印机、代理、viid、vpt、wvp)
|
||||||
|
|
||||||
|
### 核心业务模块
|
||||||
|
|
||||||
|
#### 工厂模式实现
|
||||||
|
三个主要工厂类管理第三方集成:
|
||||||
|
|
||||||
|
1. **StorageFactory** (`com.ycwl.basic.storage.StorageFactory`)
|
||||||
|
- 管理:本地存储、AWS S3、阿里云 OSS 存储适配器
|
||||||
|
- 配置节:`storage.configs[]`
|
||||||
|
|
||||||
|
2. **PayFactory** (`com.ycwl.basic.pay.PayFactory`)
|
||||||
|
- 管理:微信支付、聪明支付适配器
|
||||||
|
- 配置节:`pay.configs[]`
|
||||||
|
|
||||||
|
3. **FaceBodyFactory** (`com.ycwl.basic.facebody.FaceBodyFactory`)
|
||||||
|
- 管理:阿里云、百度人脸识别适配器
|
||||||
|
- 配置节:`facebody.configs[]`
|
||||||
|
|
||||||
|
#### 适配器模式
|
||||||
|
每个工厂使用标准化接口:
|
||||||
|
- `IStorageAdapter`:文件操作(上传/下载/删除/ACL)
|
||||||
|
- `IPayAdapter`:支付生命周期(创建/回调/退款)
|
||||||
|
- `IFaceBodyAdapter`:人脸识别操作
|
||||||
|
|
||||||
|
#### 定时任务系统
|
||||||
|
`com.ycwl.basic.task` 包中的后台任务(仅生产环境):
|
||||||
|
- `VideoTaskGenerator`:人脸识别和视频处理
|
||||||
|
- `FaceCleaner`:人脸和存储清理任务
|
||||||
|
- `DynamicTaskGenerator`:带延迟队列的动态任务创建
|
||||||
|
- `ScenicStatsTask`:统计数据聚合
|
||||||
|
|
||||||
|
### 数据库和持久化
|
||||||
|
- **MyBatis Plus**:具有自动 CRUD 操作的 ORM
|
||||||
|
- **MapperScan**:扫描 `com.ycwl.basic.mapper` 及子包
|
||||||
|
- **数据库**:MySQL 配合 HikariCP 连接池
|
||||||
|
- **Redis**:会话管理和缓存
|
||||||
|
|
||||||
|
### 主要库和依赖
|
||||||
|
- Spring Boot 3.3.5 启用 Java 21 虚拟线程
|
||||||
|
- MyBatis Plus 3.5.5 用于数据库操作
|
||||||
|
- JWT (jjwt 0.9.0) 用于身份验证
|
||||||
|
- 微信支付 SDK 用于支付处理
|
||||||
|
- 阿里云 OSS 和 AWS S3 用于文件存储
|
||||||
|
- 阿里云和百度 SDK 用于人脸识别
|
||||||
|
- OpenTelemetry 用于可观测性(开发环境中禁用)
|
||||||
|
|
||||||
|
### 业务逻辑组织
|
||||||
|
- **Service 层**:`service` 包中的业务逻辑实现
|
||||||
|
- **Biz 层**:`biz` 包中的高级业务编排
|
||||||
|
- **Repository 模式**:`repository` 包中的数据访问抽象
|
||||||
|
- **自定义异常**:特定领域的异常处理
|
||||||
|
|
||||||
|
### 配置管理
|
||||||
|
每个模块使用 Spring Boot 自动配置启动器:
|
||||||
|
- 支持多供应商的命名配置
|
||||||
|
- 通过配置进行默认供应商选择
|
||||||
|
- 针对不同环境的特定配置文件
|
||||||
|
|
||||||
|
## 常见开发模式
|
||||||
|
|
||||||
|
### 添加新的存储/支付/人脸识别供应商
|
||||||
|
1. 实现相应接口(`IStorageAdapter`、`IPayAdapter`、`IFaceBodyAdapter`)
|
||||||
|
2. 在相应的类型枚举中添加枚举值
|
||||||
|
3. 更新工厂的 switch 表达式
|
||||||
|
4. 如需要,添加配置类
|
||||||
|
5. 在 application.yml 中更新新供应商配置
|
||||||
|
|
||||||
|
### 身份验证上下文
|
||||||
|
在整个应用程序中使用 `BaseContextHandler.getUserId()` 获取当前已认证用户 ID。
|
||||||
|
|
||||||
|
### API 响应模式
|
||||||
|
所有 API 都返回 `ApiResponse<T>` 包装器,通过 `CustomExceptionHandle` 进行一致的错误处理。
|
||||||
|
|
||||||
|
### 添加新的定时任务
|
||||||
|
1. 在 `com.ycwl.basic.task` 包中创建类
|
||||||
|
2. 添加 `@Component` 和 `@Profile("prod")` 注解
|
||||||
|
3. 使用 `@Scheduled` 进行基于 cron 的执行
|
||||||
|
4. 遵循现有的错误处理和日志记录模式
|
20
Jenkinsfile
vendored
Normal file
20
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
tools {
|
||||||
|
jdk 'openjdk21'
|
||||||
|
maven 'Default'
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
sh 'mvn clean package -DskipTests=true'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
archiveArtifacts artifacts: 'target/*.jar', allowEmptyArchive: true, onlyIfSuccessful: true
|
||||||
|
publishGiteaAssets assets: 'target/*.jar', followSymlinks: false, onlyIfSuccessful: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
43
pom.xml
43
pom.xml
@@ -5,33 +5,49 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.7.18</version>
|
<version>3.3.5</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.ycwl</groupId>
|
<groupId>com.ycwl</groupId>
|
||||||
<artifactId>basic</artifactId>
|
<artifactId>basic21</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name>liuying</name>
|
<name>liuying</name>
|
||||||
<description>流影</description>
|
<description>流影</description>
|
||||||
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>8</java.version>
|
<java.version>21</java.version>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>21</maven.compiler.source>
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>21</maven.compiler.target>
|
||||||
<mybatisplus.boot.starter.version>3.4.0</mybatisplus.boot.starter.version>
|
|
||||||
<hutool-all.version>5.8.24</hutool-all.version>
|
<hutool-all.version>5.8.24</hutool-all.version>
|
||||||
<mysql-connector.version>8.0.33</mysql-connector.version>
|
<mysql-connector.version>8.0.33</mysql-connector.version>
|
||||||
<fastjson.version>1.2.83</fastjson.version>
|
<fastjson.version>1.2.83</fastjson.version>
|
||||||
<knife4j-spring-boot-starter.version>2.0.7</knife4j-spring-boot-starter.version>
|
<knife4j-spring-boot-starter.version>2.0.7</knife4j-spring-boot-starter.version>
|
||||||
<pagehelper.version>5.3.1</pagehelper.version>
|
<pagehelper.version>5.3.1</pagehelper.version>
|
||||||
<tomcat.version>9.0.102</tomcat.version>
|
|
||||||
<!--跳过单元测试-->
|
<!--跳过单元测试-->
|
||||||
<skipTests>true</skipTests>
|
<skipTests>true</skipTests>
|
||||||
</properties>
|
</properties>
|
||||||
|
<!-- OpenTelemetry -->
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.opentelemetry.instrumentation</groupId>
|
||||||
|
<artifactId>opentelemetry-instrumentation-bom</artifactId>
|
||||||
|
<version>2.16.0</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!-- 添加 jakarta.servlet-api 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.servlet</groupId>
|
||||||
|
<artifactId>jakarta.servlet-api</artifactId>
|
||||||
|
<version>6.0.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<!-- 微信支付 -->
|
<!-- 微信支付 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.wechatpay-apiv3</groupId>
|
<groupId>com.github.wechatpay-apiv3</groupId>
|
||||||
@@ -84,8 +100,8 @@
|
|||||||
<!--mybatis plus和springboot整合-->
|
<!--mybatis plus和springboot整合-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||||
<version>${mybatisplus.boot.starter.version}</version>
|
<version>3.5.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 引入lombok工具 -->
|
<!-- 引入lombok工具 -->
|
||||||
@@ -179,7 +195,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.aliyun</groupId>
|
<groupId>com.aliyun</groupId>
|
||||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||||
<version>4.6.1</version>
|
<version>4.6.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.aliyun</groupId>
|
<groupId>com.aliyun</groupId>
|
||||||
@@ -193,6 +209,11 @@
|
|||||||
<artifactId>java-sdk</artifactId>
|
<artifactId>java-sdk</artifactId>
|
||||||
<version>4.16.19</version>
|
<version>4.16.19</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.opentelemetry.instrumentation</groupId>
|
||||||
|
<artifactId>opentelemetry-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@@ -13,8 +13,8 @@ import org.springframework.stereotype.Component;
|
|||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@@ -53,7 +53,11 @@ public class BrokerBiz {
|
|||||||
expireDay = scenicConfig.getSampleStoreDay();
|
expireDay = scenicConfig.getSampleStoreDay();
|
||||||
}
|
}
|
||||||
List<Long> brokerIdList = statisticsMapper.getBrokerIdListForUser(order.getMemberId(), DateUtil.offsetDay(DateUtil.beginOfDay(order.getCreateAt()), -expireDay), order.getCreateAt());
|
List<Long> brokerIdList = statisticsMapper.getBrokerIdListForUser(order.getMemberId(), DateUtil.offsetDay(DateUtil.beginOfDay(order.getCreateAt()), -expireDay), order.getCreateAt());
|
||||||
Long directBrokerId = brokerIdList.get(0);
|
if (brokerIdList == null || brokerIdList.isEmpty()) {
|
||||||
|
log.info("用户与推客无关,订单ID:{}", orderId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Long directBrokerId = brokerIdList.getFirst();
|
||||||
List<BrokerRespVO> brokerInfoList = brokerIdList.stream().map(brokerId -> {
|
List<BrokerRespVO> brokerInfoList = brokerIdList.stream().map(brokerId -> {
|
||||||
BrokerRespVO broker = brokerMapper.getById(brokerId);
|
BrokerRespVO broker = brokerMapper.getById(brokerId);
|
||||||
if (broker == null) {
|
if (broker == null) {
|
||||||
@@ -77,7 +81,7 @@ public class BrokerBiz {
|
|||||||
if (brokerInfoList.size() == 1) {
|
if (brokerInfoList.size() == 1) {
|
||||||
// 直接算佣金
|
// 直接算佣金
|
||||||
String reason = "单人提成:";
|
String reason = "单人提成:";
|
||||||
BrokerRespVO broker = brokerInfoList.get(0);
|
BrokerRespVO broker = brokerInfoList.getFirst();
|
||||||
BrokerRecord brokerRecord = new BrokerRecord();
|
BrokerRecord brokerRecord = new BrokerRecord();
|
||||||
brokerRecord.setBrokerId(broker.getId());
|
brokerRecord.setBrokerId(broker.getId());
|
||||||
brokerRecord.setOrderId(orderId);
|
brokerRecord.setOrderId(orderId);
|
||||||
@@ -95,7 +99,7 @@ public class BrokerBiz {
|
|||||||
brokerRecord.setReason(reason);
|
brokerRecord.setReason(reason);
|
||||||
brokerRecordList.add(brokerRecord);
|
brokerRecordList.add(brokerRecord);
|
||||||
} else {
|
} else {
|
||||||
BrokerRespVO broker = brokerInfoList.get(0);
|
BrokerRespVO broker = brokerInfoList.getFirst();
|
||||||
BigDecimal realRate = broker.getBrokerRate();
|
BigDecimal realRate = broker.getBrokerRate();
|
||||||
BigDecimal brokerPrice = order.getPayPrice().multiply(realRate).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN);
|
BigDecimal brokerPrice = order.getPayPrice().multiply(realRate).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN);
|
||||||
// todo 需要计算实际提成比例
|
// todo 需要计算实际提成比例
|
||||||
@@ -141,9 +145,7 @@ public class BrokerBiz {
|
|||||||
brokerRecordList.add(brokerRecord);
|
brokerRecordList.add(brokerRecord);
|
||||||
}
|
}
|
||||||
revokeOrder(orderId);
|
revokeOrder(orderId);
|
||||||
brokerRecordList.forEach(brokerRecord -> {
|
brokerRecordList.forEach(brokerRecordMapper::add);
|
||||||
brokerRecordMapper.add(brokerRecord);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void revokeOrder(Long orderId) {
|
public void revokeOrder(Long orderId) {
|
||||||
|
@@ -32,8 +32,10 @@ import com.ycwl.basic.repository.SourceRepository;
|
|||||||
import com.ycwl.basic.repository.TemplateRepository;
|
import com.ycwl.basic.repository.TemplateRepository;
|
||||||
import com.ycwl.basic.repository.VideoRepository;
|
import com.ycwl.basic.repository.VideoRepository;
|
||||||
import com.ycwl.basic.repository.VideoTaskRepository;
|
import com.ycwl.basic.repository.VideoTaskRepository;
|
||||||
|
import com.ycwl.basic.service.printer.PrinterService;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -74,6 +76,9 @@ public class OrderBiz {
|
|||||||
private BrokerBiz brokerBiz;
|
private BrokerBiz brokerBiz;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CouponBiz couponBiz;
|
private CouponBiz couponBiz;
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
private PrinterService printerService;
|
||||||
|
|
||||||
public PriceObj queryPrice(Long scenicId, int goodsType, Long goodsId) {
|
public PriceObj queryPrice(Long scenicId, int goodsType, Long goodsId) {
|
||||||
PriceObj priceObj = new PriceObj();
|
PriceObj priceObj = new PriceObj();
|
||||||
@@ -161,15 +166,11 @@ public class OrderBiz {
|
|||||||
}
|
}
|
||||||
// 免费送逻辑,之前已经赠送了的
|
// 免费送逻辑,之前已经赠送了的
|
||||||
if (!isBuy) {
|
if (!isBuy) {
|
||||||
switch (goodsType) {
|
isBuy = switch (goodsType) {
|
||||||
case 0:
|
case 0 -> videoRepository.getUserIsBuy(userId, goodsId);
|
||||||
isBuy = videoRepository.getUserIsBuy(userId, goodsId);
|
case 1, 2 -> sourceRepository.getUserIsBuy(userId, goodsType, goodsId);
|
||||||
break;
|
default -> false;
|
||||||
case 1:
|
};
|
||||||
case 2:
|
|
||||||
isBuy = sourceRepository.getUserIsBuy(userId, goodsType, goodsId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
OrderEntity orderEntity = orderRepository.getUserBuyItem(userId, goodsType, goodsId);
|
OrderEntity orderEntity = orderRepository.getUserBuyItem(userId, goodsType, goodsId);
|
||||||
if (orderEntity != null) {
|
if (orderEntity != null) {
|
||||||
@@ -237,6 +238,8 @@ public class OrderBiz {
|
|||||||
case 1: // 视频原素材
|
case 1: // 视频原素材
|
||||||
case 2: // 照片原素材
|
case 2: // 照片原素材
|
||||||
sourceRepository.setUserIsBuyItem(order.getMemberId(), item.getGoodsType(), item.getGoodsId(), order.getId());
|
sourceRepository.setUserIsBuyItem(order.getMemberId(), item.getGoodsType(), item.getGoodsId(), order.getId());
|
||||||
|
case 3:
|
||||||
|
printerService.setUserIsBuyItem(order.getMemberId(), item.getGoodsId(), order.getId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
orderRepository.clearOrderCache(orderId); // 更新完了,清理下
|
orderRepository.clearOrderCache(orderId); // 更新完了,清理下
|
||||||
@@ -250,7 +253,7 @@ public class OrderBiz {
|
|||||||
//商品创建时间
|
//商品创建时间
|
||||||
Date goodsCreateTime = new Date();
|
Date goodsCreateTime = new Date();
|
||||||
if (!orderDetail.getOrderItemList().isEmpty()) {
|
if (!orderDetail.getOrderItemList().isEmpty()) {
|
||||||
OrderItemVO orderItemVO = orderDetail.getOrderItemList().get(0);
|
OrderItemVO orderItemVO = orderDetail.getOrderItemList().getFirst();
|
||||||
switch (orderItemVO.getGoodsType()) {
|
switch (orderItemVO.getGoodsType()) {
|
||||||
case 0:
|
case 0:
|
||||||
VideoEntity video = videoRepository.getVideo(orderItemVO.getGoodsId());
|
VideoEntity video = videoRepository.getVideo(orderItemVO.getGoodsId());
|
||||||
|
@@ -112,7 +112,7 @@ public class TaskStatusBiz {
|
|||||||
int faceCutStatus = getFaceCutStatus(faceId);
|
int faceCutStatus = getFaceCutStatus(faceId);
|
||||||
if (faceCutStatus != 1) {
|
if (faceCutStatus != 1) {
|
||||||
// 正在切片
|
// 正在切片
|
||||||
if (templateBiz.determineTemplateCanGenerate(templateList.get(0).getId(), faceId, false)) {
|
if (templateBiz.determineTemplateCanGenerate(templateList.getFirst().getId(), faceId, false)) {
|
||||||
response.setStatus(2);
|
response.setStatus(2);
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(0);
|
response.setStatus(0);
|
||||||
|
@@ -107,7 +107,7 @@ public class TemplateBiz {
|
|||||||
List<SourceEntity> sourceEntities = sourceMapper.listVideoByScenicFaceRelation(face.getScenicId(), faceId);
|
List<SourceEntity> sourceEntities = sourceMapper.listVideoByScenicFaceRelation(face.getScenicId(), faceId);
|
||||||
count = sourceEntities.stream()
|
count = sourceEntities.stream()
|
||||||
.map(SourceEntity::getDeviceId)
|
.map(SourceEntity::getDeviceId)
|
||||||
.filter(deviceId -> deviceId != null) // 添加对 null 的检查
|
.filter(Objects::nonNull) // 添加对 null 的检查
|
||||||
.distinct()
|
.distinct()
|
||||||
.filter(deviceId -> placeholderList.contains(deviceId.toString()))
|
.filter(deviceId -> placeholderList.contains(deviceId.toString()))
|
||||||
.count();
|
.count();
|
||||||
|
@@ -10,29 +10,29 @@ import java.util.Map;
|
|||||||
@Data
|
@Data
|
||||||
public class BaseContextHandler {
|
public class BaseContextHandler {
|
||||||
|
|
||||||
public static ThreadLocal<Map<String, Object>> threadLocal = new ThreadLocal();
|
public static ThreadLocal<Map<String, Object>> threadLocal = new ThreadLocal<>();
|
||||||
|
|
||||||
public BaseContextHandler() {
|
public BaseContextHandler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void set(String key, Object value) {
|
public static void set(String key, Object value) {
|
||||||
Object map;
|
Map<String, Object> map;
|
||||||
if ((map = (Map) threadLocal.get()) == null) {
|
if ((map = threadLocal.get()) == null) {
|
||||||
map = new HashMap();
|
map = new HashMap<>();
|
||||||
threadLocal.set((Map<String, Object>) map);
|
threadLocal.set(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
((Map) map).put(key, value);
|
map.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object get(String key) {
|
public static Object get(String key) {
|
||||||
Object map;
|
Map<String, Object> map;
|
||||||
if ((map = (Map) threadLocal.get()) == null) {
|
if ((map = threadLocal.get()) == null) {
|
||||||
map = new HashMap();
|
map = new HashMap<>();
|
||||||
threadLocal.set((Map<String, Object>) map);
|
threadLocal.set(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((Map) map).get(key);
|
return (map).get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setToken(String token) {
|
public static void setToken(String token) {
|
||||||
|
13
src/main/java/com/ycwl/basic/constant/JwtRoleConstant.java
Normal file
13
src/main/java/com/ycwl/basic/constant/JwtRoleConstant.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.ycwl.basic.constant;
|
||||||
|
|
||||||
|
public enum JwtRoleConstant {
|
||||||
|
MERCHANT("merchant"),
|
||||||
|
ADMIN("admin"),
|
||||||
|
APP_USER("app_user");
|
||||||
|
|
||||||
|
public final String type;
|
||||||
|
|
||||||
|
JwtRoleConstant(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,126 +0,0 @@
|
|||||||
package com.ycwl.basic.constant;
|
|
||||||
|
|
||||||
import com.wechat.pay.java.service.payments.model.Transaction;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>@description: 微信常量 </p>
|
|
||||||
* <p>@author: songmingsong </p>
|
|
||||||
**/
|
|
||||||
public class WeiXinConstant {
|
|
||||||
|
|
||||||
private static final Map<Transaction.TradeStateEnum, String> STATE_DESCRIPTION_MAP = new HashMap<>();
|
|
||||||
|
|
||||||
static {
|
|
||||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.SUCCESS, "SUCCESS");
|
|
||||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.REFUND, "REFUND");
|
|
||||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.NOTPAY, "NOTPAY");
|
|
||||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.CLOSED, "CLOSED");
|
|
||||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.REVOKED, "REVOKED");
|
|
||||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.USERPAYING, "USERPAYING");
|
|
||||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.PAYERROR, "PAYERROR");
|
|
||||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.ACCEPT, "ACCEPT");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getDescriptionState(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum state) {
|
|
||||||
return STATE_DESCRIPTION_MAP.getOrDefault(state, "未知状态");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Map<com.wechat.pay.java.service.payments.model.Transaction.TradeTypeEnum, String> STATE_DESCRIPTION_MAP_TYPE = new HashMap<>();
|
|
||||||
|
|
||||||
static {
|
|
||||||
STATE_DESCRIPTION_MAP_TYPE.put(Transaction.TradeTypeEnum.JSAPI, "JSAPI");
|
|
||||||
STATE_DESCRIPTION_MAP_TYPE.put(Transaction.TradeTypeEnum.NATIVE, "NATIVE");
|
|
||||||
STATE_DESCRIPTION_MAP_TYPE.put(Transaction.TradeTypeEnum.APP, "APP");
|
|
||||||
STATE_DESCRIPTION_MAP_TYPE.put(Transaction.TradeTypeEnum.MICROPAY, "MICROPAY");
|
|
||||||
STATE_DESCRIPTION_MAP_TYPE.put(Transaction.TradeTypeEnum.MWEB, "MWEB");
|
|
||||||
STATE_DESCRIPTION_MAP_TYPE.put(Transaction.TradeTypeEnum.FACEPAY, "FACEPAY");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getDescriptionType(Transaction.TradeTypeEnum type) {
|
|
||||||
return STATE_DESCRIPTION_MAP_TYPE.getOrDefault(type, "未知类型");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 公众号模板地址
|
|
||||||
*/
|
|
||||||
public static final String PUBLIC_ACCOUNT_TEMPLATE =
|
|
||||||
"https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=";
|
|
||||||
/**
|
|
||||||
* 获取微信用户基本信息地址
|
|
||||||
*/
|
|
||||||
public static final String WECHAT_OAUTH_ACCESS_TOKEN = "https://api.weixin.qq.com/sns/oauth2/access_token";
|
|
||||||
/**
|
|
||||||
* 获取ACCESS_TOKEN
|
|
||||||
*/
|
|
||||||
public static final String ACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
|
|
||||||
/**
|
|
||||||
* 登录凭证校验
|
|
||||||
*/
|
|
||||||
public static final String GET_OPEN_ID = "https://api.weixin.qq.com/sns/jscode2session";
|
|
||||||
/**
|
|
||||||
* 获取小程序地址
|
|
||||||
*/
|
|
||||||
public static final String GET_MINI_QRCODE = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=%s";
|
|
||||||
/**
|
|
||||||
* 获取用户基本信息
|
|
||||||
*/
|
|
||||||
public static final String GET_USER_BASIC_INFO = "https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s&lang=zh_CN";
|
|
||||||
/**
|
|
||||||
* 获取包含请求参数ACCESS_TOKEN
|
|
||||||
*/
|
|
||||||
public static final String ACCESS_TOKEN_WITH_PARAM = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
|
|
||||||
/**
|
|
||||||
* 获取小程序 URL Link
|
|
||||||
*/
|
|
||||||
public static final String GENERATE_URL_LINK = "https://api.weixin.qq.com/wxa/generate_urllink?access_token=%s";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发送模板消息
|
|
||||||
*/
|
|
||||||
public static final String MESSAGE_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=";
|
|
||||||
|
|
||||||
/*-----------------------------*/
|
|
||||||
/* */
|
|
||||||
/* 支付相关 */
|
|
||||||
/* */
|
|
||||||
/*-----------------------------*/
|
|
||||||
/**
|
|
||||||
* 退款链接
|
|
||||||
*/
|
|
||||||
public static final String REFUNDS_URL = "https://api.mch.weixin.qq.com/v3/refund/domestic/refunds";
|
|
||||||
public static final String REFUNDS_URi = "/v3/refund/domestic/refunds/";
|
|
||||||
/**
|
|
||||||
* 其他
|
|
||||||
*/
|
|
||||||
public static final String WECHATPAY_STATUS = "status";
|
|
||||||
public static final String WECHATPAY_SUCCESS = "SUCCESS";
|
|
||||||
public static final String WECHATPAY_PROCESSING = "PROCESSING";
|
|
||||||
public static final String WECHATPAY_OUT_TRADE_NO = "out_trade_no";
|
|
||||||
public static final String WECHATPAY_OUT_REFUND_NO = "out_refund_no";
|
|
||||||
public static final String WECHATPAY_REFUND = "refund";
|
|
||||||
public static final String WECHATPAY_TOTAL = "total";
|
|
||||||
public static final String WECHATPAY_CURRENCY = "currency";
|
|
||||||
public static final String WECHATPAY_CURRENCY_CNY = "CNY";
|
|
||||||
public static final String WECHATPAY_AMOUNT = "amount";
|
|
||||||
public static final String WECHATPAY_NOTIFY_URL = "notify_url";
|
|
||||||
|
|
||||||
public static final String REFUNDS_RESOURCE = "resource";
|
|
||||||
public static final String REFUNDS_CIPHERTEXT = "ciphertext";
|
|
||||||
public static final String REFUNDS_NONCE = "nonce";
|
|
||||||
public static final String REFUNDS_REFUND_STATUS = "refund_status";
|
|
||||||
public static final String REFUNDS_ASSOCIATED_DATA = "associated_data";
|
|
||||||
public static final String WECHAT_ERRCODE = "errcode";
|
|
||||||
public static final String WECHAT_ERRMSG = "errmsg";
|
|
||||||
/**
|
|
||||||
* 退款的token的SCHEMA
|
|
||||||
*/
|
|
||||||
public static final String REFUNDS_SCHEMA = "Wechatpay-Signature-Type "; // 注意有一个空格
|
|
||||||
/**
|
|
||||||
* 支付请求头
|
|
||||||
*/
|
|
||||||
public static final String WECHATPAY_SIGNATURE_TYPE = "Wechatpay-Signature-Type";
|
|
||||||
}
|
|
148
src/main/java/com/ycwl/basic/controller/extern/AioDeviceController.java
vendored
Normal file
148
src/main/java/com/ycwl/basic/controller/extern/AioDeviceController.java
vendored
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
package com.ycwl.basic.controller.extern;
|
||||||
|
|
||||||
|
import com.ycwl.basic.annotation.IgnoreToken;
|
||||||
|
import com.ycwl.basic.mapper.AioDeviceMapper;
|
||||||
|
import com.ycwl.basic.mapper.MemberMapper;
|
||||||
|
import com.ycwl.basic.model.aio.entity.AioDeviceBannerEntity;
|
||||||
|
import com.ycwl.basic.model.aio.entity.AioDeviceEntity;
|
||||||
|
import com.ycwl.basic.model.aio.entity.AioDevicePriceConfigEntity;
|
||||||
|
import com.ycwl.basic.model.aio.req.AioDeviceCreateOrderReq;
|
||||||
|
import com.ycwl.basic.model.aio.resp.AioDeviceCreateOrderResp;
|
||||||
|
import com.ycwl.basic.model.aio.resp.AioDeviceInfoResp;
|
||||||
|
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||||
|
import com.ycwl.basic.model.mobile.face.FaceRecognizeResp;
|
||||||
|
import com.ycwl.basic.model.mobile.goods.GoodsDetailVO;
|
||||||
|
import com.ycwl.basic.model.mobile.goods.GoodsReqQuery;
|
||||||
|
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||||
|
import com.ycwl.basic.model.pc.member.entity.MemberEntity;
|
||||||
|
import com.ycwl.basic.model.pc.member.resp.MemberRespVO;
|
||||||
|
import com.ycwl.basic.pay.entity.PayResponse;
|
||||||
|
import com.ycwl.basic.service.aio.AioDeviceService;
|
||||||
|
import com.ycwl.basic.service.mobile.GoodsService;
|
||||||
|
import com.ycwl.basic.service.pc.FaceService;
|
||||||
|
import com.ycwl.basic.service.pc.OrderService;
|
||||||
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
|
import com.ycwl.basic.utils.JwtTokenUtil;
|
||||||
|
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import jakarta.servlet.ServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@IgnoreToken
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/aio")
|
||||||
|
public class AioDeviceController {
|
||||||
|
@Autowired
|
||||||
|
private GoodsService goodsService;
|
||||||
|
@Autowired
|
||||||
|
private FaceService faceService;
|
||||||
|
@Autowired
|
||||||
|
private MemberMapper memberMapper;
|
||||||
|
@Autowired
|
||||||
|
private AioDeviceMapper aioDeviceMapper;
|
||||||
|
@Autowired
|
||||||
|
private AioDeviceService aioDeviceService;
|
||||||
|
@Autowired
|
||||||
|
private OrderService orderService;
|
||||||
|
|
||||||
|
@GetMapping("/info")
|
||||||
|
public ApiResponse<AioDeviceInfoResp> getDeviceInfo(HttpServletRequest request) {
|
||||||
|
String deviceId = request.getHeader("X-DeviceId");
|
||||||
|
AioDeviceEntity aioDevice = aioDeviceMapper.getByKey(deviceId);
|
||||||
|
if (aioDevice == null) {
|
||||||
|
return ApiResponse.fail("设备不存在");
|
||||||
|
}
|
||||||
|
List<AioDeviceBannerEntity> banners = aioDeviceMapper.getBannerByDeviceId(aioDevice.getId());
|
||||||
|
return ApiResponse.success(new AioDeviceInfoResp(aioDevice, banners));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/banners")
|
||||||
|
public ApiResponse<List<AioDeviceBannerEntity>> getBanners(HttpServletRequest request) {
|
||||||
|
String deviceId = request.getHeader("X-DeviceId");
|
||||||
|
AioDeviceEntity aioDevice = aioDeviceMapper.getByKey(deviceId);
|
||||||
|
if (aioDevice == null) {
|
||||||
|
return ApiResponse.fail("设备不存在");
|
||||||
|
}
|
||||||
|
List<AioDeviceBannerEntity> banners = aioDeviceMapper.getBannerByDeviceId(aioDevice.getId());
|
||||||
|
return ApiResponse.success(banners);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/config")
|
||||||
|
public ApiResponse<AioDevicePriceConfigEntity> getPriceConfig(HttpServletRequest request) {
|
||||||
|
String deviceId = request.getHeader("X-DeviceId");
|
||||||
|
AioDeviceEntity aioDevice = aioDeviceMapper.getByKey(deviceId);
|
||||||
|
if (aioDevice == null) {
|
||||||
|
return ApiResponse.fail("设备不存在");
|
||||||
|
}
|
||||||
|
AioDevicePriceConfigEntity config = aioDeviceMapper.getPriceConfigByDeviceId(aioDevice.getId());
|
||||||
|
return ApiResponse.success(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/faceUpload")
|
||||||
|
public ApiResponse<FaceRecognizeResp> faceUpload(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
|
||||||
|
String deviceId = request.getHeader("X-DeviceId");
|
||||||
|
AioDeviceEntity aioDevice = aioDeviceMapper.getByKey(deviceId);
|
||||||
|
if (aioDevice == null) {
|
||||||
|
return ApiResponse.fail("设备不存在");
|
||||||
|
}
|
||||||
|
MemberEntity memberEntity = new MemberEntity();
|
||||||
|
memberEntity.setScenicId(aioDevice.getScenicId());
|
||||||
|
memberEntity.setCreateDate(new Date());
|
||||||
|
memberEntity.setId(SnowFlakeUtil.getLongId());
|
||||||
|
memberEntity.setNickname("用户");
|
||||||
|
memberMapper.add(memberEntity);
|
||||||
|
FaceRecognizeResp resp = faceService.faceUpload(file, aioDevice.getScenicId(), memberEntity.getId());
|
||||||
|
return ApiResponse.success(resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("人脸信息")
|
||||||
|
@GetMapping("/{faceId}")
|
||||||
|
public ApiResponse<FaceRespVO> faceInfo(@PathVariable Long faceId) {
|
||||||
|
return faceService.getById(faceId);
|
||||||
|
}
|
||||||
|
@ApiOperation("照片商品列表")
|
||||||
|
@GetMapping("/{faceId}/photo")
|
||||||
|
public ApiResponse<List<GoodsDetailVO>> sourceGoodsList(@PathVariable Long faceId) {
|
||||||
|
GoodsReqQuery query = new GoodsReqQuery();
|
||||||
|
query.setSourceType(2);
|
||||||
|
query.setFaceId(faceId);
|
||||||
|
List<GoodsDetailVO> goodsDetailVOS = goodsService.sourceGoodsList(query);
|
||||||
|
return ApiResponse.success(goodsDetailVOS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("创建订单")
|
||||||
|
@PostMapping("/order")
|
||||||
|
public ApiResponse<AioDeviceCreateOrderResp> createOrder(HttpServletRequest request, @RequestBody AioDeviceCreateOrderReq req) {
|
||||||
|
String deviceId = request.getHeader("X-DeviceId");
|
||||||
|
AioDeviceEntity aioDevice = aioDeviceMapper.getByKey(deviceId);
|
||||||
|
if (aioDevice == null) {
|
||||||
|
return ApiResponse.fail("设备不存在");
|
||||||
|
}
|
||||||
|
return ApiResponse.success(aioDeviceService.createOrder(aioDevice, req));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询订单")
|
||||||
|
@GetMapping("/order/{orderId}")
|
||||||
|
public ApiResponse<PayResponse> queryOrder(HttpServletRequest request, @PathVariable("orderId") Long orderId) {
|
||||||
|
String deviceId = request.getHeader("X-DeviceId");
|
||||||
|
AioDeviceEntity aioDevice = aioDeviceMapper.getByKey(deviceId);
|
||||||
|
if (aioDevice == null) {
|
||||||
|
return ApiResponse.fail("设备不存在");
|
||||||
|
}
|
||||||
|
return ApiResponse.success(orderService.queryOrder(orderId));
|
||||||
|
}
|
||||||
|
}
|
@@ -14,8 +14,10 @@ import com.ycwl.basic.model.mobile.scenic.content.ContentPageVO;
|
|||||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||||
import com.ycwl.basic.model.pc.member.entity.MemberEntity;
|
import com.ycwl.basic.model.pc.member.entity.MemberEntity;
|
||||||
import com.ycwl.basic.model.pc.member.resp.MemberRespVO;
|
import com.ycwl.basic.model.pc.member.resp.MemberRespVO;
|
||||||
|
import com.ycwl.basic.model.pc.task.entity.TaskEntity;
|
||||||
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
||||||
import com.ycwl.basic.repository.VideoRepository;
|
import com.ycwl.basic.repository.VideoRepository;
|
||||||
|
import com.ycwl.basic.repository.VideoTaskRepository;
|
||||||
import com.ycwl.basic.service.mobile.AppScenicService;
|
import com.ycwl.basic.service.mobile.AppScenicService;
|
||||||
import com.ycwl.basic.service.mobile.GoodsService;
|
import com.ycwl.basic.service.mobile.GoodsService;
|
||||||
import com.ycwl.basic.service.pc.FaceService;
|
import com.ycwl.basic.service.pc.FaceService;
|
||||||
@@ -31,7 +33,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
@@ -62,11 +64,13 @@ public class LyCompatibleController {
|
|||||||
private TaskTaskServiceImpl taskTaskServiceImpl;
|
private TaskTaskServiceImpl taskTaskServiceImpl;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisTemplate<String, String> redisTemplate;
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
|
@Autowired
|
||||||
|
private VideoTaskRepository videoTaskRepository;
|
||||||
|
|
||||||
@PostMapping("sendPhoto")
|
@PostMapping("sendPhoto")
|
||||||
@IgnoreToken
|
@IgnoreToken
|
||||||
public R sendPhoto(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request) {
|
public R sendPhoto(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request) {
|
||||||
Map<String, String> headersMap = new HashMap<String, String>();
|
Map<String, String> headersMap = new HashMap<>();
|
||||||
Enumeration<String> headerNames = request.getHeaderNames();
|
Enumeration<String> headerNames = request.getHeaderNames();
|
||||||
while (headerNames.hasMoreElements()) {
|
while (headerNames.hasMoreElements()) {
|
||||||
String key = (String) headerNames.nextElement();
|
String key = (String) headerNames.nextElement();
|
||||||
@@ -123,7 +127,7 @@ public class LyCompatibleController {
|
|||||||
@RequestMapping("getIsVideo")
|
@RequestMapping("getIsVideo")
|
||||||
@IgnoreToken
|
@IgnoreToken
|
||||||
public R getIsVideo(HttpServletRequest request) {
|
public R getIsVideo(HttpServletRequest request) {
|
||||||
Map<String, String> headersMap = new HashMap<String, String>();
|
Map<String, String> headersMap = new HashMap<>();
|
||||||
Enumeration<String> headerNames = request.getHeaderNames();
|
Enumeration<String> headerNames = request.getHeaderNames();
|
||||||
while (headerNames.hasMoreElements()) {
|
while (headerNames.hasMoreElements()) {
|
||||||
String key = (String) headerNames.nextElement();
|
String key = (String) headerNames.nextElement();
|
||||||
@@ -165,7 +169,7 @@ public class LyCompatibleController {
|
|||||||
@RequestMapping("getNewVideo")
|
@RequestMapping("getNewVideo")
|
||||||
@IgnoreToken
|
@IgnoreToken
|
||||||
public R getNewVideo(HttpServletRequest request) {
|
public R getNewVideo(HttpServletRequest request) {
|
||||||
Map<String, String> headersMap = new HashMap<String, String>();
|
Map<String, String> headersMap = new HashMap<>();
|
||||||
Enumeration<String> headerNames = request.getHeaderNames();
|
Enumeration<String> headerNames = request.getHeaderNames();
|
||||||
while (headerNames.hasMoreElements()) {
|
while (headerNames.hasMoreElements()) {
|
||||||
String key = (String) headerNames.nextElement();
|
String key = (String) headerNames.nextElement();
|
||||||
@@ -198,16 +202,22 @@ public class LyCompatibleController {
|
|||||||
R response = R.ok();
|
R response = R.ok();
|
||||||
if (collect.get(0) == null) {
|
if (collect.get(0) == null) {
|
||||||
response.put("isgen", 1)
|
response.put("isgen", 1)
|
||||||
|
.put("face_id", faceVO.getId().toString())
|
||||||
.put("newvideo", Collections.emptyList())
|
.put("newvideo", Collections.emptyList())
|
||||||
.put("newuservideo", Collections.emptyList());
|
.put("newuservideo", Collections.emptyList());
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
List<Map<String, Object>> videoList = collect.get(0).stream().collect(Collectors.groupingBy(ContentPageVO::getTemplateId))
|
List<Map<String, Object>> videoList = collect.get(0).stream().collect(Collectors.groupingBy(ContentPageVO::getTemplateId))
|
||||||
.values().stream().map(contentPageVOs -> {
|
.values().stream().map(contentPageVOs -> {
|
||||||
ContentPageVO contentPageVO = contentPageVOs.get(0);
|
ContentPageVO contentPageVO = contentPageVOs.getFirst();
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
VideoEntity videoRespVO = videoRepository.getVideo(contentPageVO.getContentId());
|
VideoEntity videoRespVO = videoRepository.getVideo(contentPageVO.getContentId());
|
||||||
map.put("id", videoRespVO.getId().toString());
|
map.put("id", videoRespVO.getId().toString());
|
||||||
|
map.put("task_id", videoRespVO.getTaskId().toString());
|
||||||
|
TaskEntity task = videoTaskRepository.getTaskById(videoRespVO.getTaskId());
|
||||||
|
if (task != null) {
|
||||||
|
map.put("face_id", String.valueOf(task.getFaceId()));
|
||||||
|
}
|
||||||
map.put("template_cover_image", contentPageVO.getTemplateCoverUrl());
|
map.put("template_cover_image", contentPageVO.getTemplateCoverUrl());
|
||||||
Date taskShotDate = taskTaskServiceImpl.getTaskShotDate(videoRespVO.getTaskId());
|
Date taskShotDate = taskTaskServiceImpl.getTaskShotDate(videoRespVO.getTaskId());
|
||||||
map.put("shoottime", DateUtil.format(taskShotDate, "yyyy-MM-dd HH:mm"));
|
map.put("shoottime", DateUtil.format(taskShotDate, "yyyy-MM-dd HH:mm"));
|
||||||
@@ -224,6 +234,7 @@ public class LyCompatibleController {
|
|||||||
List<Map<String, Object>> userVideoList = sourceGoodsList.stream().map(goodsDetailVO -> {
|
List<Map<String, Object>> userVideoList = sourceGoodsList.stream().map(goodsDetailVO -> {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("id", goodsDetailVO.getGoodsId().toString());
|
map.put("id", goodsDetailVO.getGoodsId().toString());
|
||||||
|
map.put("face_id", String.valueOf(goodsDetailVO.getFaceId()));
|
||||||
map.put("openid", openId);
|
map.put("openid", openId);
|
||||||
map.put("template_cover_image", goodsDetailVO.getUrl());
|
map.put("template_cover_image", goodsDetailVO.getUrl());
|
||||||
map.put("scenicname", goodsDetailVO.getScenicName());
|
map.put("scenicname", goodsDetailVO.getScenicName());
|
||||||
@@ -233,6 +244,8 @@ public class LyCompatibleController {
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
response
|
response
|
||||||
.put("isgen", taskStatusVO.getStatus() == 1 ? 0 : 1)
|
.put("isgen", taskStatusVO.getStatus() == 1 ? 0 : 1)
|
||||||
|
.put("member_id", faceVO.getMemberId().toString())
|
||||||
|
.put("face_id", faceVO.getId().toString())
|
||||||
.put("newvideo", videoList)
|
.put("newvideo", videoList)
|
||||||
.put("newuservideo", userVideoList);
|
.put("newuservideo", userVideoList);
|
||||||
redisTemplate.opsForValue().set("ly:"+openId, JSON.toJSONString(response), 5, TimeUnit.SECONDS);
|
redisTemplate.opsForValue().set("ly:"+openId, JSON.toJSONString(response), 5, TimeUnit.SECONDS);
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.ycwl.basic.controller.extern;
|
package com.ycwl.basic.controller.extern;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -11,6 +12,7 @@ import java.util.Map;
|
|||||||
* @date 2016年10月27日 下午9:59:27
|
* @date 2016年10月27日 下午9:59:27
|
||||||
*/
|
*/
|
||||||
public class R extends HashMap<String, Object> {
|
public class R extends HashMap<String, Object> {
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public R() {
|
public R() {
|
||||||
|
@@ -39,7 +39,7 @@ AppFaceController {
|
|||||||
*/
|
*/
|
||||||
@ApiOperation("人脸照片上传")
|
@ApiOperation("人脸照片上传")
|
||||||
@PostMapping("/faceUPload")
|
@PostMapping("/faceUPload")
|
||||||
public ApiResponse faceUpload(@RequestParam("file")MultipartFile file, @RequestParam("scenicId") Long scenicId) {
|
public ApiResponse<FaceRecognizeResp> faceUpload(@RequestParam("file")MultipartFile file, @RequestParam("scenicId") Long scenicId) {
|
||||||
//获取用户id
|
//获取用户id
|
||||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||||
Long userId = worker.getUserId();
|
Long userId = worker.getUserId();
|
||||||
@@ -61,12 +61,12 @@ AppFaceController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{faceId}")
|
@DeleteMapping("/{faceId}")
|
||||||
public ApiResponse deleteFace(@PathVariable("faceId") Long faceId) {
|
public ApiResponse<String> deleteFace(@PathVariable("faceId") Long faceId) {
|
||||||
return faceService.deleteFace(faceId);
|
return faceService.deleteFace(faceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/{faceId}/match")
|
@PostMapping("/{faceId}/match")
|
||||||
public ApiResponse match(@PathVariable("faceId") Long faceId) {
|
public ApiResponse<String> match(@PathVariable("faceId") Long faceId) {
|
||||||
faceService.matchFaceId(faceId);
|
faceService.matchFaceId(faceId);
|
||||||
return ApiResponse.success("");
|
return ApiResponse.success("");
|
||||||
}
|
}
|
||||||
@@ -78,4 +78,13 @@ AppFaceController {
|
|||||||
List<ContentPageVO> contentPageVOS = faceService.faceContentList(faceId);
|
List<ContentPageVO> contentPageVOS = faceService.faceContentList(faceId);
|
||||||
return ApiResponse.success(contentPageVOS);
|
return ApiResponse.success(contentPageVOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("绑定人脸")
|
||||||
|
@PostMapping("/{faceId}/bind")
|
||||||
|
public ApiResponse<String> bind(@PathVariable Long faceId) {
|
||||||
|
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||||
|
Long userId = worker.getUserId();
|
||||||
|
faceService.bindFace(faceId, userId);
|
||||||
|
return ApiResponse.success("OK");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -64,7 +64,7 @@ public class AppMemberController {
|
|||||||
|
|
||||||
@ApiOperation("新增或修改景区服务通知状态")
|
@ApiOperation("新增或修改景区服务通知状态")
|
||||||
@GetMapping("/updateScenicServiceNoticeStatus")
|
@GetMapping("/updateScenicServiceNoticeStatus")
|
||||||
public ApiResponse updateScenicServiceNoticeStatus(Long scenicId) {
|
public ApiResponse<String> updateScenicServiceNoticeStatus(Long scenicId) {
|
||||||
return memberService.updateScenicServiceNoticeStatus(scenicId);
|
return memberService.updateScenicServiceNoticeStatus(scenicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,6 +14,7 @@ import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
|||||||
import com.ycwl.basic.model.pc.order.req.CreateBatchOrderReqVO;
|
import com.ycwl.basic.model.pc.order.req.CreateBatchOrderReqVO;
|
||||||
import com.ycwl.basic.model.pc.order.req.CreateOrderReqVO;
|
import com.ycwl.basic.model.pc.order.req.CreateOrderReqVO;
|
||||||
import com.ycwl.basic.model.pc.order.resp.OrderAppRespVO;
|
import com.ycwl.basic.model.pc.order.resp.OrderAppRespVO;
|
||||||
|
import com.ycwl.basic.pay.entity.PayResponse;
|
||||||
import com.ycwl.basic.service.pc.OrderService;
|
import com.ycwl.basic.service.pc.OrderService;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import com.ycwl.basic.utils.JwtTokenUtil;
|
import com.ycwl.basic.utils.JwtTokenUtil;
|
||||||
@@ -63,6 +64,11 @@ public class AppOrderController {
|
|||||||
return orderService.createOrder(worker.getUserId(), orderAddReq);
|
return orderService.createOrder(worker.getUserId(), orderAddReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询订单")
|
||||||
|
@GetMapping("/queryOrder")
|
||||||
|
public ApiResponse<PayResponse> queryOrder(@RequestParam("orderId") Long orderId) {
|
||||||
|
return ApiResponse.success(orderService.queryOrder(orderId));
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("用户端打包订单新增")
|
@ApiOperation("用户端打包订单新增")
|
||||||
@PostMapping("/addBatchOrder")
|
@PostMapping("/addBatchOrder")
|
||||||
@@ -97,6 +103,9 @@ public class AppOrderController {
|
|||||||
Long userId = Long.parseLong(BaseContextHandler.getUserId());
|
Long userId = Long.parseLong(BaseContextHandler.getUserId());
|
||||||
if (faceId == null) {
|
if (faceId == null) {
|
||||||
FaceRespVO lastFaceByUserId = faceMapper.findLastFaceByUserId(BaseContextHandler.getUserId());
|
FaceRespVO lastFaceByUserId = faceMapper.findLastFaceByUserId(BaseContextHandler.getUserId());
|
||||||
|
if (lastFaceByUserId == null) {
|
||||||
|
return ApiResponse.fail("您还未上传人脸");
|
||||||
|
}
|
||||||
faceId = lastFaceByUserId.getId();
|
faceId = lastFaceByUserId.getId();
|
||||||
}
|
}
|
||||||
IsBuyBatchRespVO buy = priceBiz.isBuy(userId, faceId, scenicId, type, goodsIds);
|
IsBuyBatchRespVO buy = priceBiz.isBuy(userId, faceId, scenicId, type, goodsIds);
|
||||||
|
@@ -3,6 +3,8 @@ package com.ycwl.basic.controller.mobile;
|
|||||||
import com.ycwl.basic.annotation.IgnoreToken;
|
import com.ycwl.basic.annotation.IgnoreToken;
|
||||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||||
import com.ycwl.basic.model.pc.printer.resp.MemberPrintResp;
|
import com.ycwl.basic.model.pc.printer.resp.MemberPrintResp;
|
||||||
|
import com.ycwl.basic.model.pc.printer.resp.PrinterResp;
|
||||||
|
import com.ycwl.basic.model.printer.req.FromSourceReq;
|
||||||
import com.ycwl.basic.service.printer.PrinterService;
|
import com.ycwl.basic.service.printer.PrinterService;
|
||||||
import com.ycwl.basic.storage.StorageFactory;
|
import com.ycwl.basic.storage.StorageFactory;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
@@ -11,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -18,6 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -27,7 +31,7 @@ public class AppPrinterController {
|
|||||||
private PrinterService printerService;
|
private PrinterService printerService;
|
||||||
@GetMapping("/listFor/{scenicId}")
|
@GetMapping("/listFor/{scenicId}")
|
||||||
@IgnoreToken
|
@IgnoreToken
|
||||||
public ApiResponse<List> listFor(@PathVariable("scenicId") Long scenicId) {
|
public ApiResponse<List<PrinterResp>> listFor(@PathVariable("scenicId") Long scenicId) {
|
||||||
return ApiResponse.success(printerService.listByScenicId(scenicId));
|
return ApiResponse.success(printerService.listByScenicId(scenicId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,6 +73,12 @@ public class AppPrinterController {
|
|||||||
printerService.setPhotoCropped(JwtTokenUtil.getWorker().getUserId(), scenicId, id, url);
|
printerService.setPhotoCropped(JwtTokenUtil.getWorker().getUserId(), scenicId, id, url);
|
||||||
return ApiResponse.success(url);
|
return ApiResponse.success(url);
|
||||||
}
|
}
|
||||||
|
@PostMapping("/uploadTo/{scenicId}/formSource")
|
||||||
|
public ApiResponse<?> uploadFromSource(@PathVariable("scenicId") Long scenicId, @RequestBody FromSourceReq req) throws IOException {
|
||||||
|
printerService.addUserPhotoFromSource(JwtTokenUtil.getWorker().getUserId(), scenicId, req);
|
||||||
|
return ApiResponse.success(null);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/setQuantity/{scenicId}/{id}")
|
@PostMapping("/setQuantity/{scenicId}/{id}")
|
||||||
public ApiResponse<?> setQuantity(@PathVariable("scenicId") Long scenicId, @PathVariable("id") Long id, @RequestParam("quantity") Integer quantity) {
|
public ApiResponse<?> setQuantity(@PathVariable("scenicId") Long scenicId, @PathVariable("id") Long id, @RequestParam("quantity") Integer quantity) {
|
||||||
if (quantity == null) {
|
if (quantity == null) {
|
||||||
@@ -84,4 +94,13 @@ public class AppPrinterController {
|
|||||||
public ApiResponse<?> queryPrice(@PathVariable("scenicId") Long scenicId) {
|
public ApiResponse<?> queryPrice(@PathVariable("scenicId") Long scenicId) {
|
||||||
return ApiResponse.success(printerService.queryPrice(JwtTokenUtil.getWorker().getUserId(), scenicId));
|
return ApiResponse.success(printerService.queryPrice(JwtTokenUtil.getWorker().getUserId(), scenicId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/order/{scenicId}")
|
||||||
|
public ApiResponse<Map<String, Object>> createOrder(@PathVariable("scenicId") Long scenicId) {
|
||||||
|
return ApiResponse.success(printerService.createOrder(JwtTokenUtil.getWorker().getUserId(), scenicId, null));
|
||||||
|
}
|
||||||
|
@PostMapping("/order/{scenicId}/toPrinter/{printerId}")
|
||||||
|
public ApiResponse<Map<String, Object>> createOrderToPrinter(@PathVariable("scenicId") Long scenicId, @PathVariable("printerId") Integer printerId) {
|
||||||
|
return ApiResponse.success(printerService.createOrder(JwtTokenUtil.getWorker().getUserId(), scenicId, printerId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,11 @@ package com.ycwl.basic.controller.mobile;
|
|||||||
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ycwl.basic.annotation.IgnoreToken;
|
import com.ycwl.basic.annotation.IgnoreToken;
|
||||||
|
import com.ycwl.basic.constant.BaseContextHandler;
|
||||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||||
import com.ycwl.basic.model.mobile.scenic.ScenicAppVO;
|
import com.ycwl.basic.model.mobile.scenic.ScenicAppVO;
|
||||||
import com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO;
|
import com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO;
|
||||||
|
import com.ycwl.basic.model.mobile.scenic.ScenicIndexVO;
|
||||||
import com.ycwl.basic.model.mobile.scenic.content.ContentPageVO;
|
import com.ycwl.basic.model.mobile.scenic.content.ContentPageVO;
|
||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||||
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||||
@@ -22,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,6 +32,7 @@ import java.util.List;
|
|||||||
* @Date:2024/12/5 10:22
|
* @Date:2024/12/5 10:22
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@Deprecated
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/mobile/scenic/v1")
|
@RequestMapping("/api/mobile/scenic/v1")
|
||||||
@Api(tags = "景区相关接口")
|
@Api(tags = "景区相关接口")
|
||||||
@@ -40,11 +44,21 @@ public class AppScenicController {
|
|||||||
private AppScenicService appScenicService;
|
private AppScenicService appScenicService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScenicRepository scenicRepository;
|
private ScenicRepository scenicRepository;
|
||||||
|
private static final List<String> ENABLED_USER_IDs = new ArrayList<>(){{
|
||||||
|
add("3932535453961555968");
|
||||||
|
add("3936121342868459520");
|
||||||
|
add("3936940597855784960");
|
||||||
|
}};
|
||||||
|
|
||||||
@ApiOperation("分页查询景区列表")
|
@ApiOperation("分页查询景区列表")
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
public ApiResponse<PageInfo<ScenicAppVO>> pageQuery(@RequestBody ScenicReqQuery scenicReqQuery){
|
public ApiResponse<PageInfo<ScenicAppVO>> pageQuery(@RequestBody ScenicReqQuery scenicReqQuery){
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
if (ENABLED_USER_IDs.contains(userId)) {
|
||||||
return appScenicService.pageQuery(scenicReqQuery);
|
return appScenicService.pageQuery(scenicReqQuery);
|
||||||
|
} else {
|
||||||
|
return ApiResponse.success(new PageInfo<>(new ArrayList<>()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ApiOperation("根据id查询景区详情")
|
@ApiOperation("根据id查询景区详情")
|
||||||
@IgnoreToken
|
@IgnoreToken
|
||||||
@@ -95,4 +109,10 @@ public class AppScenicController {
|
|||||||
List<ContentPageVO> contentPageVOS = faceService.faceContentList(faceId);
|
List<ContentPageVO> contentPageVOS = faceService.faceContentList(faceId);
|
||||||
return ApiResponse.success(contentPageVOS);
|
return ApiResponse.success(contentPageVOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/nearby")
|
||||||
|
public ApiResponse<List<ScenicAppVO>> nearby(@RequestBody ScenicIndexVO scenicIndexVO) {
|
||||||
|
List<ScenicAppVO> list = appScenicService.scenicListByLnLa(scenicIndexVO);
|
||||||
|
return ApiResponse.success(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/mobile/video/v1")
|
@RequestMapping("/api/mobile/video/v1")
|
||||||
public class AppVideoController {
|
public class AppVideoController {
|
||||||
|
@@ -39,7 +39,7 @@ public class AppWxNotifyController {
|
|||||||
@GetMapping({"/getIds", "/"})
|
@GetMapping({"/getIds", "/"})
|
||||||
@IgnoreToken
|
@IgnoreToken
|
||||||
public ApiResponse<List<String>> getIds() {
|
public ApiResponse<List<String>> getIds() {
|
||||||
return ApiResponse.success(new ArrayList<String>() {{
|
return ApiResponse.success(new ArrayList<>() {{
|
||||||
add("5b8vTm7kvwYubqDxb3dxBs0BqxMsgVgGw573aahTEd8");
|
add("5b8vTm7kvwYubqDxb3dxBs0BqxMsgVgGw573aahTEd8");
|
||||||
add("vPIzbkA0x4mMj-vdbWx6_45e8juWXzs3FGYnDsIPv3A");
|
add("vPIzbkA0x4mMj-vdbWx6_45e8juWXzs3FGYnDsIPv3A");
|
||||||
add("HB1vp-0BXc2WyYeoYN3a3GuZV9HtPLXUTT7blCBq9eY");
|
add("HB1vp-0BXc2WyYeoYN3a3GuZV9HtPLXUTT7blCBq9eY");
|
||||||
@@ -49,7 +49,7 @@ public class AppWxNotifyController {
|
|||||||
@GetMapping("/{scenicId}")
|
@GetMapping("/{scenicId}")
|
||||||
@IgnoreToken
|
@IgnoreToken
|
||||||
public ApiResponse<List<String>> getIds(@PathVariable("scenicId") Long scenicId) {
|
public ApiResponse<List<String>> getIds(@PathVariable("scenicId") Long scenicId) {
|
||||||
return ApiResponse.success(new ArrayList<String>() {{
|
return ApiResponse.success(new ArrayList<>() {{
|
||||||
String videoGeneratedTemplateId = scenicRepository.getVideoGeneratedTemplateId(scenicId);
|
String videoGeneratedTemplateId = scenicRepository.getVideoGeneratedTemplateId(scenicId);
|
||||||
if (StringUtils.isNotBlank(videoGeneratedTemplateId)) {
|
if (StringUtils.isNotBlank(videoGeneratedTemplateId)) {
|
||||||
add(videoGeneratedTemplateId);
|
add(videoGeneratedTemplateId);
|
||||||
|
@@ -5,10 +5,12 @@ import com.ycwl.basic.annotation.IgnoreToken;
|
|||||||
import com.ycwl.basic.enums.BizCodeEnum;
|
import com.ycwl.basic.enums.BizCodeEnum;
|
||||||
import com.ycwl.basic.model.wx.WXPayOrderReqVO;
|
import com.ycwl.basic.model.wx.WXPayOrderReqVO;
|
||||||
import com.ycwl.basic.model.wx.WxPayRespVO;
|
import com.ycwl.basic.model.wx.WxPayRespVO;
|
||||||
|
import com.ycwl.basic.pay.entity.PayResponse;
|
||||||
import com.ycwl.basic.service.mobile.WxPayService;
|
import com.ycwl.basic.service.mobile.WxPayService;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -16,7 +18,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
|
|
||||||
@@ -41,10 +44,17 @@ public class AppWxPayController {
|
|||||||
wxPayService.payNotify(request);
|
wxPayService.payNotify(request);
|
||||||
return ApiResponse.success(BizCodeEnum.REQUEST_OK);
|
return ApiResponse.success(BizCodeEnum.REQUEST_OK);
|
||||||
}
|
}
|
||||||
@PostMapping("/{scenicId}/payNotify")
|
|
||||||
|
@RequestMapping("/{scenicId}/payNotify")
|
||||||
@IgnoreToken
|
@IgnoreToken
|
||||||
public ApiResponse<?> payNotifyByScenicId(@PathVariable Long scenicId, HttpServletRequest request) {
|
public Object payNotifyByScenicId(@PathVariable Long scenicId, HttpServletRequest request) {
|
||||||
wxPayService.payNotify(scenicId, request);
|
PayResponse payResponse = wxPayService.payNotify(scenicId, request);
|
||||||
|
if (payResponse == null) {
|
||||||
|
return ApiResponse.buildResult(BizCodeEnum.ADVANCE_PAYMENT_CALLBACK_FAILED);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(payResponse.getCustomResponse())) {
|
||||||
|
return payResponse.getCustomResponse();
|
||||||
|
}
|
||||||
return ApiResponse.success(BizCodeEnum.REQUEST_OK);
|
return ApiResponse.success(BizCodeEnum.REQUEST_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,25 +1,37 @@
|
|||||||
package com.ycwl.basic.controller.mobile.manage;
|
package com.ycwl.basic.controller.mobile.manage;
|
||||||
|
|
||||||
import com.ycwl.basic.annotation.IgnoreToken;
|
import com.ycwl.basic.annotation.IgnoreToken;
|
||||||
|
import com.ycwl.basic.constant.BaseContextHandler;
|
||||||
|
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginOldRespVO;
|
||||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginReq;
|
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginReq;
|
||||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginRespVO;
|
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginRespVO;
|
||||||
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoDTO;
|
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoDTO;
|
||||||
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||||
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||||
import com.ycwl.basic.service.mobile.AppScenicService;
|
import com.ycwl.basic.service.mobile.AppScenicService;
|
||||||
|
import com.ycwl.basic.service.pc.ScenicAccountService;
|
||||||
|
import com.ycwl.basic.service.pc.ScenicService;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.ycwl.basic.constant.JwtRoleConstant.MERCHANT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/12/12 18:28
|
* @Date:2024/12/12 18:28
|
||||||
@@ -28,24 +40,94 @@ import java.util.List;
|
|||||||
@RequestMapping("/api/mobile/scenicAccount/v1")
|
@RequestMapping("/api/mobile/scenicAccount/v1")
|
||||||
@Api(tags = "景区账号相关接口")
|
@Api(tags = "景区账号相关接口")
|
||||||
public class AppScenicAccountController {
|
public class AppScenicAccountController {
|
||||||
|
@Autowired
|
||||||
|
private ScenicAccountService accountService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AppScenicService scenicService;
|
private AppScenicService scenicService;
|
||||||
|
@Autowired
|
||||||
|
private ScenicService adminScenicService;
|
||||||
|
|
||||||
@ApiOperation("登录")
|
@ApiOperation("登录")
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
@IgnoreToken
|
@IgnoreToken
|
||||||
public ApiResponse<ScenicLoginRespVO> login(@RequestBody ScenicLoginReq scenicLoginReq) throws Exception {
|
public ApiResponse<ScenicLoginOldRespVO> login(@RequestBody ScenicLoginReq scenicLoginReq) throws Exception {
|
||||||
return scenicService.login(scenicLoginReq);
|
ApiResponse<ScenicLoginRespVO> logined = scenicService.login(scenicLoginReq);
|
||||||
|
ScenicLoginOldRespVO vo = new ScenicLoginOldRespVO();
|
||||||
|
if (!logined.isSuccess()) {
|
||||||
|
return ApiResponse.fail(logined.getMsg());
|
||||||
|
}
|
||||||
|
vo.setId(logined.getData().getId());
|
||||||
|
vo.setScenicId(logined.getData().getScenicId().getFirst());
|
||||||
|
vo.setIsSuper(logined.getData().getIsSuper());
|
||||||
|
vo.setName(logined.getData().getName());
|
||||||
|
vo.setAccount(logined.getData().getAccount());
|
||||||
|
vo.setStatus(logined.getData().getStatus());
|
||||||
|
vo.setToken(logined.getData().getToken());
|
||||||
|
return ApiResponse.success(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/myScenicList")
|
||||||
|
public ApiResponse<List<ScenicRespVO>> myScenicList() {
|
||||||
|
List<ScenicRespVO> list = Collections.emptyList();
|
||||||
|
if (StringUtils.equals(BaseContextHandler.getRoleId(), MERCHANT.type)) {
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = accountService.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
list = account.getScenicId().stream().map(id -> {
|
||||||
|
return scenicService.getDetails(id).getData();
|
||||||
|
}).toList();
|
||||||
|
} else {
|
||||||
|
list = adminScenicService.list(new ScenicReqQuery()).getData();
|
||||||
|
}
|
||||||
|
return ApiResponse.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getScenic")
|
@GetMapping("/getScenic")
|
||||||
public ApiResponse<ScenicRespVO> getMyScenic() {
|
public ApiResponse<ScenicRespVO> getMyScenic() {
|
||||||
return scenicService.getMyScenic();
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = accountService.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
return scenicService.getDetails(account.getScenicId().getFirst());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{scenicId}")
|
||||||
|
public ApiResponse<ScenicRespVO> getScenic(@PathVariable Long scenicId) {
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = accountService.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
if (!account.getScenicId().contains(scenicId)) {
|
||||||
|
return ApiResponse.fail("无权限");
|
||||||
|
}
|
||||||
|
return scenicService.getDetails(scenicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/devices")
|
@GetMapping("/devices")
|
||||||
public ApiResponse<List<DeviceRespVO>> getDeviceList() {
|
public ApiResponse<List<DeviceRespVO>> getDeviceList() {
|
||||||
return scenicService.getMyDevices();
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = accountService.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
}
|
}
|
||||||
|
return scenicService.getDevices(account.getScenicId().getFirst());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{scenicId}/devices")
|
||||||
|
public ApiResponse<List<DeviceRespVO>> getDeviceList(@PathVariable Long scenicId) {
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = accountService.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
if (!account.getScenicId().contains(scenicId)) {
|
||||||
|
return ApiResponse.fail("无权限");
|
||||||
|
}
|
||||||
|
return scenicService.getDevices(scenicId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -7,9 +7,11 @@ import com.ycwl.basic.model.pc.order.req.OrderReqQuery;
|
|||||||
import com.ycwl.basic.model.pc.order.resp.OrderRespVO;
|
import com.ycwl.basic.model.pc.order.resp.OrderRespVO;
|
||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||||
import com.ycwl.basic.service.pc.OrderService;
|
import com.ycwl.basic.service.pc.OrderService;
|
||||||
|
import com.ycwl.basic.service.pc.ScenicAccountService;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -24,27 +26,57 @@ public class AppScenicOrderController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScenicAccountMapper scenicAccountMapper;
|
private ScenicAccountService service;
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
|
@Deprecated
|
||||||
public ApiResponse<List<OrderRespVO>> list(@RequestBody OrderReqQuery query) {
|
public ApiResponse<List<OrderRespVO>> list(@RequestBody OrderReqQuery query) {
|
||||||
String userId = BaseContextHandler.getUserId();
|
String userId = BaseContextHandler.getUserId();
|
||||||
ScenicAccountEntity account = scenicAccountMapper.findAccountById(userId);
|
ScenicAccountEntity account = service.getScenicAccountById(Long.valueOf(userId));
|
||||||
if (account == null) {
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
return ApiResponse.fail("用户未绑定景区");
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
}
|
}
|
||||||
query.setScenicId(account.getScenicId());
|
query.setScenicId(account.getScenicId().getFirst());
|
||||||
|
return orderService.list(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/{scenicId}/list")
|
||||||
|
public ApiResponse<List<OrderRespVO>> list(@PathVariable Long scenicId, @RequestBody OrderReqQuery query) {
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = service.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
if (!account.getScenicId().contains(scenicId)) {
|
||||||
|
return ApiResponse.fail("无权限查看该景区订单");
|
||||||
|
}
|
||||||
|
query.setScenicId(scenicId);
|
||||||
return orderService.list(query);
|
return orderService.list(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
|
@Deprecated
|
||||||
public ApiResponse<PageInfo<OrderRespVO>> page(@RequestBody OrderReqQuery query) {
|
public ApiResponse<PageInfo<OrderRespVO>> page(@RequestBody OrderReqQuery query) {
|
||||||
String userId = BaseContextHandler.getUserId();
|
String userId = BaseContextHandler.getUserId();
|
||||||
ScenicAccountEntity account = scenicAccountMapper.findAccountById(userId);
|
ScenicAccountEntity account = service.getScenicAccountById(Long.valueOf(userId));
|
||||||
if (account == null) {
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
return ApiResponse.fail("用户未绑定景区");
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
}
|
}
|
||||||
query.setScenicId(account.getScenicId());
|
query.setScenicId(account.getScenicId().getFirst());
|
||||||
|
return orderService.pageQueryDetail(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/{scenicId}/page")
|
||||||
|
public ApiResponse<PageInfo<OrderRespVO>> page(@PathVariable Long scenicId, @RequestBody OrderReqQuery query) {
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = service.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
if (!account.getScenicId().contains(scenicId)) {
|
||||||
|
return ApiResponse.fail("无权限查看该景区订单");
|
||||||
|
}
|
||||||
|
query.setScenicId(scenicId);
|
||||||
return orderService.pageQueryDetail(query);
|
return orderService.pageQueryDetail(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ public class AppStatisticsController {
|
|||||||
@ApiOperation("统计数据记录")
|
@ApiOperation("统计数据记录")
|
||||||
@PostMapping("/addStatistics")
|
@PostMapping("/addStatistics")
|
||||||
@IgnoreToken
|
@IgnoreToken
|
||||||
public ApiResponse addStatistics(@RequestBody StatisticsRecordAddReq req) {
|
public ApiResponse<String> addStatistics(@RequestBody StatisticsRecordAddReq req) {
|
||||||
|
|
||||||
return statisticsService.addStatistics(req);
|
return statisticsService.addStatistics(req);
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,23 @@
|
|||||||
|
package com.ycwl.basic.controller.pc;
|
||||||
|
|
||||||
|
import com.ycwl.basic.model.pc.scenicDeviceStats.req.DeviceStatsReq;
|
||||||
|
import com.ycwl.basic.model.pc.scenicDeviceStats.resp.ScenicDeviceStatsListResp;
|
||||||
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/deviceStats/v1")
|
||||||
|
public class DeviceStatsController {
|
||||||
|
@Autowired
|
||||||
|
private com.ycwl.basic.service.pc.DeviceStatsService service;
|
||||||
|
|
||||||
|
@PostMapping("/{scenicId}")
|
||||||
|
public ApiResponse<ScenicDeviceStatsListResp> queryByScenic(@PathVariable("scenicId") Long scenicId, @RequestBody DeviceStatsReq req) {
|
||||||
|
return ApiResponse.success(service.queryByScenicId(scenicId, req.getStartTime(), req.getEndTime()));
|
||||||
|
}
|
||||||
|
}
|
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/face/detect_log/v1")
|
@RequestMapping("/api/face/detect_log/v1")
|
||||||
public class FaceDetectLogController {
|
public class FaceDetectLogController {
|
||||||
|
@@ -17,6 +17,7 @@ import java.util.List;
|
|||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/12/2 16:33
|
* @Date:2024/12/2 16:33
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/faceSample/v1")
|
@RequestMapping("/api/faceSample/v1")
|
||||||
@Api(tags = "人脸样本管理")
|
@Api(tags = "人脸样本管理")
|
||||||
@@ -39,28 +40,5 @@ public class FaceSampleController {
|
|||||||
public ApiResponse<FaceSampleRespVO> getDetail(@PathVariable("id") Long id) {
|
public ApiResponse<FaceSampleRespVO> getDetail(@PathVariable("id") Long id) {
|
||||||
return FaceSampleService.getById(id);
|
return FaceSampleService.getById(id);
|
||||||
}
|
}
|
||||||
@ApiOperation("添加人脸样本")
|
|
||||||
@PostMapping("/add")
|
|
||||||
public ApiResponse<Integer> add(@RequestBody FaceSampleEntity FaceSample) {
|
|
||||||
return FaceSampleService.add(FaceSample);
|
|
||||||
}
|
|
||||||
@ApiOperation("删除人脸样本")
|
|
||||||
@PostMapping("/deleteById/{id}")
|
|
||||||
public ApiResponse<Integer> deleteById(@PathVariable Long id) {
|
|
||||||
return FaceSampleService.deleteById(id);
|
|
||||||
}
|
|
||||||
@ApiOperation("批量删除人脸样本")
|
|
||||||
@PostMapping("/deleteByIds")
|
|
||||||
public ApiResponse<Integer> deleteByIds(@RequestBody List<Long> ids) {
|
|
||||||
return FaceSampleService.deleteByIds(ids);
|
|
||||||
}
|
|
||||||
@ApiOperation("修改人脸样本信息")
|
|
||||||
@PostMapping("/update")
|
|
||||||
public ApiResponse<Integer> update(@RequestBody FaceSampleEntity FaceSample) {
|
|
||||||
return FaceSampleService.update(FaceSample);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,45 +0,0 @@
|
|||||||
package com.ycwl.basic.controller.pc;
|
|
||||||
|
|
||||||
import com.ycwl.basic.annotation.IgnoreToken;
|
|
||||||
import com.ycwl.basic.model.pc.menu.entity.MenuEntity;
|
|
||||||
import com.ycwl.basic.service.pc.MenuService;
|
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:longbinbin
|
|
||||||
* @Date:2024/12/3 10:03
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/menu/v1")
|
|
||||||
@Api(tags = "系统菜单管理")
|
|
||||||
public class MenuController {
|
|
||||||
|
|
||||||
private MenuService menuService;
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = "/list/{type}")
|
|
||||||
@ApiOperation(value = " 菜单列表")
|
|
||||||
@IgnoreToken
|
|
||||||
public ApiResponse list(@PathVariable("type") Integer type) {
|
|
||||||
return menuService.list(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/add")
|
|
||||||
@ApiOperation(value = "添加菜单")
|
|
||||||
public ApiResponse add(@RequestBody MenuEntity menu) {
|
|
||||||
return menuService.add(menu);
|
|
||||||
}
|
|
||||||
@PostMapping("/update")
|
|
||||||
@ApiOperation(value = "修改菜单")
|
|
||||||
public ApiResponse update(@RequestBody MenuEntity menu) {
|
|
||||||
return menuService.update(menu);
|
|
||||||
}
|
|
||||||
@GetMapping("/delete/{id}")
|
|
||||||
@ApiOperation(value = "删除菜单")
|
|
||||||
public ApiResponse delete(@PathVariable("id") Long id) {
|
|
||||||
return menuService.deleteById(id);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,10 +1,14 @@
|
|||||||
package com.ycwl.basic.controller.pc;
|
package com.ycwl.basic.controller.pc;
|
||||||
|
|
||||||
import com.ycwl.basic.constant.BaseContextHandler;
|
import com.ycwl.basic.constant.BaseContextHandler;
|
||||||
|
import com.ycwl.basic.mapper.AdminUserMapper;
|
||||||
|
import com.ycwl.basic.model.pc.adminUser.entity.LoginEntity;
|
||||||
import com.ycwl.basic.model.pc.permission.entity.PermissionEntity;
|
import com.ycwl.basic.model.pc.permission.entity.PermissionEntity;
|
||||||
import com.ycwl.basic.model.pc.permission.req.PermissionSaveReq;
|
import com.ycwl.basic.model.pc.permission.req.PermissionSaveReq;
|
||||||
import com.ycwl.basic.model.pc.permission.resp.PermissionResp;
|
import com.ycwl.basic.model.pc.permission.resp.PermissionResp;
|
||||||
|
import com.ycwl.basic.model.pc.role.resp.RolePermissionResp;
|
||||||
import com.ycwl.basic.service.pc.PermissionService;
|
import com.ycwl.basic.service.pc.PermissionService;
|
||||||
|
import com.ycwl.basic.service.pc.RoleService;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -20,21 +24,37 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static com.ycwl.basic.constant.JwtRoleConstant.MERCHANT;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/permission/v1")
|
@RequestMapping("/api/permission/v1")
|
||||||
@Api(tags = "权限管理接口")
|
@Api(tags = "权限管理接口")
|
||||||
public class PermissionController {
|
public class PermissionController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private PermissionService permissionService;
|
private PermissionService permissionService;
|
||||||
|
@Autowired
|
||||||
|
private AdminUserMapper adminUserMapper;
|
||||||
|
@Autowired
|
||||||
|
private RoleService roleService;
|
||||||
|
|
||||||
@GetMapping("/get/")
|
@GetMapping("/get/")
|
||||||
public ApiResponse<PermissionResp> getPermissionByUser() {
|
public ApiResponse<PermissionResp> getPermissionByUser() {
|
||||||
String userId = BaseContextHandler.getUserId();
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
if (MERCHANT.type.equals(BaseContextHandler.getRoleId())) {
|
||||||
PermissionEntity permission = permissionService.getPermissionByUserId(Long.parseLong(userId));
|
PermissionEntity permission = permissionService.getPermissionByUserId(Long.parseLong(userId));
|
||||||
if (permission == null || StringUtils.isEmpty(permission.getPermString())) {
|
if (permission == null || StringUtils.isEmpty(permission.getPermString())) {
|
||||||
return ApiResponse.success(new PermissionResp(new ArrayList<>()));
|
return ApiResponse.success(new PermissionResp(new ArrayList<>(), new ArrayList<>()));
|
||||||
|
}
|
||||||
|
return ApiResponse.success(new PermissionResp(Arrays.asList(StringUtils.split(permission.getPermString(), ",")), Arrays.asList(StringUtils.split(permission.getMenuString(), ","))));
|
||||||
|
} else {
|
||||||
|
// admin
|
||||||
|
LoginEntity login = adminUserMapper.getById(Long.parseLong(userId));
|
||||||
|
RolePermissionResp permissionByRoleId = roleService.getPermissionByRoleId(login.getRoleId());
|
||||||
|
if (permissionByRoleId == null) {
|
||||||
|
return ApiResponse.success(new PermissionResp(new ArrayList<>(), new ArrayList<>()));
|
||||||
|
}
|
||||||
|
return ApiResponse.success(new PermissionResp(Arrays.asList(StringUtils.split(permissionByRoleId.getPermStr(), ",")), Arrays.asList(StringUtils.split(permissionByRoleId.getMenuStr(), ","))));
|
||||||
}
|
}
|
||||||
return ApiResponse.success(new PermissionResp(Arrays.asList(StringUtils.split(permission.getPermString(), ","))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("根据用户ID查询权限信息")
|
@ApiOperation("根据用户ID查询权限信息")
|
||||||
@@ -42,15 +62,15 @@ public class PermissionController {
|
|||||||
public ApiResponse<PermissionResp> getPermissionByUser(@PathVariable Long userId) {
|
public ApiResponse<PermissionResp> getPermissionByUser(@PathVariable Long userId) {
|
||||||
PermissionEntity permission = permissionService.getPermissionByUserId(userId);
|
PermissionEntity permission = permissionService.getPermissionByUserId(userId);
|
||||||
if (permission == null || StringUtils.isEmpty(permission.getPermString())) {
|
if (permission == null || StringUtils.isEmpty(permission.getPermString())) {
|
||||||
return ApiResponse.success(new PermissionResp(new ArrayList<>()));
|
return ApiResponse.success(new PermissionResp(new ArrayList<>(), new ArrayList<>()));
|
||||||
}
|
}
|
||||||
return ApiResponse.success(new PermissionResp(Arrays.asList(StringUtils.split(permission.getPermString(), ","))));
|
return ApiResponse.success(new PermissionResp(Arrays.asList(StringUtils.split(permission.getPermString(), ",")), Arrays.asList(StringUtils.split(permission.getMenuString(), ","))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("保存或更新权限信息")
|
@ApiOperation("保存或更新权限信息")
|
||||||
@PostMapping("/save/{userId}")
|
@PostMapping("/save/{userId}")
|
||||||
public ApiResponse saveOrUpdate(@PathVariable Long userId, @RequestBody PermissionSaveReq req) {
|
public ApiResponse saveOrUpdate(@PathVariable Long userId, @RequestBody PermissionSaveReq req) {
|
||||||
permissionService.saveOrUpdate(userId, StringUtils.join(req.getPermissions(), ","));
|
permissionService.saveOrUpdate(userId, StringUtils.join(req.getPermissions(), ","), StringUtils.join(req.getMenus(), ","));
|
||||||
return ApiResponse.success(true);
|
return ApiResponse.success(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -2,16 +2,20 @@ package com.ycwl.basic.controller.pc;
|
|||||||
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ycwl.basic.annotation.IgnoreToken;
|
import com.ycwl.basic.annotation.IgnoreToken;
|
||||||
|
import com.ycwl.basic.model.pc.permission.resp.PermissionResp;
|
||||||
import com.ycwl.basic.model.pc.role.req.AddOrUpdateRoleReqVO;
|
import com.ycwl.basic.model.pc.role.req.AddOrUpdateRoleReqVO;
|
||||||
import com.ycwl.basic.model.pc.role.req.RoleListReqVO;
|
import com.ycwl.basic.model.pc.role.req.RoleListReqVO;
|
||||||
import com.ycwl.basic.model.pc.role.resp.RoleListRespVO;
|
import com.ycwl.basic.model.pc.role.resp.RoleListRespVO;
|
||||||
|
import com.ycwl.basic.model.pc.role.resp.RolePermissionResp;
|
||||||
import com.ycwl.basic.service.pc.RoleService;
|
import com.ycwl.basic.service.pc.RoleService;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -24,34 +28,38 @@ public class RoleController {
|
|||||||
|
|
||||||
@PostMapping(value = "/page")
|
@PostMapping(value = "/page")
|
||||||
@ApiOperation(value = "角色列表分页查询")
|
@ApiOperation(value = "角色列表分页查询")
|
||||||
@IgnoreToken
|
|
||||||
public ApiResponse<PageInfo<RoleListRespVO>> page(@RequestBody RoleListReqVO roleListReqVO) {
|
public ApiResponse<PageInfo<RoleListRespVO>> page(@RequestBody RoleListReqVO roleListReqVO) {
|
||||||
return roleService.pageQuery(roleListReqVO);
|
return roleService.pageQuery(roleListReqVO);
|
||||||
}
|
}
|
||||||
@PostMapping(value = "/list")
|
@PostMapping(value = "/list")
|
||||||
@ApiOperation(value = "角色列表")
|
@ApiOperation(value = "角色列表")
|
||||||
@IgnoreToken
|
|
||||||
public ApiResponse<List<RoleListRespVO>> list(@RequestBody RoleListReqVO roleListReqVO) {
|
public ApiResponse<List<RoleListRespVO>> list(@RequestBody RoleListReqVO roleListReqVO) {
|
||||||
return roleService.list(roleListReqVO);
|
return roleService.list(roleListReqVO);
|
||||||
}
|
}
|
||||||
|
@GetMapping("/{roleId}/permission")
|
||||||
|
@ApiOperation(value = "角色权限列表")
|
||||||
|
public ApiResponse<PermissionResp> getPermissionByRoleId(@PathVariable("roleId") Long roleId) {
|
||||||
|
RolePermissionResp permission = roleService.getPermissionByRoleId(roleId);
|
||||||
|
if (permission == null) {
|
||||||
|
return ApiResponse.fail("角色不存在");
|
||||||
|
}
|
||||||
|
return ApiResponse.success(new PermissionResp(Arrays.asList(StringUtils.split(permission.getPermStr(), ",")), Arrays.asList(StringUtils.split(permission.getMenuStr(), ","))));
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/addOrUpdate")
|
@PostMapping(value = "/addOrUpdate")
|
||||||
@ApiOperation(value = "添加或更新角色")
|
@ApiOperation(value = "添加或更新角色")
|
||||||
@IgnoreToken
|
|
||||||
public ApiResponse addOrUpdate(@RequestBody AddOrUpdateRoleReqVO addOrUpdateRoleReqVO) {
|
public ApiResponse addOrUpdate(@RequestBody AddOrUpdateRoleReqVO addOrUpdateRoleReqVO) {
|
||||||
return roleService.addOrUpdate(addOrUpdateRoleReqVO);
|
return roleService.addOrUpdate(addOrUpdateRoleReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/delete/{id}")
|
@GetMapping(value = "/delete/{id}")
|
||||||
@ApiOperation(value = "删除")
|
@ApiOperation(value = "删除")
|
||||||
@IgnoreToken
|
|
||||||
public ApiResponse delete(@PathVariable("id") String id) {
|
public ApiResponse delete(@PathVariable("id") String id) {
|
||||||
return roleService.delete(id);
|
return roleService.delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/updateReturnMenu/{id}")
|
@GetMapping(value = "/updateReturnMenu/{id}")
|
||||||
@ApiOperation(value = "编辑回显该角色当前菜单")
|
@ApiOperation(value = "编辑回显该角色当前菜单")
|
||||||
@IgnoreToken
|
|
||||||
public ApiResponse updateReturnMenu(@PathVariable("id") String id) {
|
public ApiResponse updateReturnMenu(@PathVariable("id") String id) {
|
||||||
return roleService.updateReturnMenu(id);
|
return roleService.updateReturnMenu(id);
|
||||||
}
|
}
|
||||||
@@ -60,7 +68,6 @@ public class RoleController {
|
|||||||
|
|
||||||
@GetMapping(value = "/updateStatus/{id}")
|
@GetMapping(value = "/updateStatus/{id}")
|
||||||
@ApiOperation(value = "更改角色类型状态")
|
@ApiOperation(value = "更改角色类型状态")
|
||||||
//@IgnoreToken
|
|
||||||
public ApiResponse updateStatus(@PathVariable("id") String id) {
|
public ApiResponse updateStatus(@PathVariable("id") String id) {
|
||||||
return roleService.updateStatus(id);
|
return roleService.updateStatus(id);
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@ package com.ycwl.basic.controller.pc;
|
|||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.ycwl.basic.mapper.ScenicAccountMapper;
|
||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||||
import com.ycwl.basic.model.pc.scenic.req.ScenicAccountReqQuery;
|
import com.ycwl.basic.model.pc.scenic.req.ScenicAccountReqQuery;
|
||||||
import com.ycwl.basic.service.pc.ScenicAccountService;
|
import com.ycwl.basic.service.pc.ScenicAccountService;
|
||||||
@@ -16,6 +17,8 @@ import java.util.List;
|
|||||||
public class ScenicAccountController {
|
public class ScenicAccountController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScenicAccountService service;
|
private ScenicAccountService service;
|
||||||
|
@Autowired
|
||||||
|
private ScenicAccountMapper scenicAccountMapper;
|
||||||
|
|
||||||
// 添加景区账号
|
// 添加景区账号
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@@ -62,6 +65,10 @@ public class ScenicAccountController {
|
|||||||
public ApiResponse<PageInfo<ScenicAccountEntity>> pageQuery(@RequestBody ScenicAccountReqQuery req) {
|
public ApiResponse<PageInfo<ScenicAccountEntity>> pageQuery(@RequestBody ScenicAccountReqQuery req) {
|
||||||
PageHelper.startPage(req.getPageNum(), req.getPageSize());
|
PageHelper.startPage(req.getPageNum(), req.getPageSize());
|
||||||
List<ScenicAccountEntity> list = service.pageQuery(req);
|
List<ScenicAccountEntity> list = service.pageQuery(req);
|
||||||
|
list.forEach(entity -> {
|
||||||
|
entity.setPassword("");
|
||||||
|
entity.setScenicId(scenicAccountMapper.getAccountRelations(entity.getId()));
|
||||||
|
});
|
||||||
PageInfo<ScenicAccountEntity> pageInfo = new PageInfo<>(list);
|
PageInfo<ScenicAccountEntity> pageInfo = new PageInfo<>(list);
|
||||||
return ApiResponse.success(pageInfo);
|
return ApiResponse.success(pageInfo);
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,16 @@
|
|||||||
package com.ycwl.basic.controller.pc;
|
package com.ycwl.basic.controller.pc;
|
||||||
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.ycwl.basic.constant.BaseContextHandler;
|
||||||
import com.ycwl.basic.model.mobile.statistic.req.CommonQueryReq;
|
import com.ycwl.basic.model.mobile.statistic.req.CommonQueryReq;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||||
import com.ycwl.basic.model.pc.scenic.req.ScenicAddOrUpdateReq;
|
import com.ycwl.basic.model.pc.scenic.req.ScenicAddOrUpdateReq;
|
||||||
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||||
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||||
|
import com.ycwl.basic.service.mobile.AppScenicService;
|
||||||
import com.ycwl.basic.service.mobile.AppStatisticsService;
|
import com.ycwl.basic.service.mobile.AppStatisticsService;
|
||||||
|
import com.ycwl.basic.service.pc.ScenicAccountService;
|
||||||
import com.ycwl.basic.service.pc.ScenicService;
|
import com.ycwl.basic.service.pc.ScenicService;
|
||||||
import com.ycwl.basic.storage.StorageFactory;
|
import com.ycwl.basic.storage.StorageFactory;
|
||||||
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
||||||
@@ -17,12 +21,16 @@ import com.ycwl.basic.repository.ScenicRepository;
|
|||||||
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.ycwl.basic.constant.JwtRoleConstant.MERCHANT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/12/3 15:20
|
* @Date:2024/12/3 15:20
|
||||||
@@ -34,11 +42,15 @@ public class ScenicController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScenicService scenicService;
|
private ScenicService scenicService;
|
||||||
|
@Autowired
|
||||||
|
private AppScenicService appScenicService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScenicRepository scenicRepository;
|
private ScenicRepository scenicRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AppStatisticsService appStatisticsService;
|
private AppStatisticsService appStatisticsService;
|
||||||
|
@Autowired
|
||||||
|
private ScenicAccountService accountService;
|
||||||
|
|
||||||
@ApiOperation("分页查询景区")
|
@ApiOperation("分页查询景区")
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
@@ -150,4 +162,27 @@ public class ScenicController {
|
|||||||
query.setScenicId(scenicId);
|
query.setScenicId(scenicId);
|
||||||
return appStatisticsService.userConversionFunnel(query);
|
return appStatisticsService.userConversionFunnel(query);
|
||||||
}
|
}
|
||||||
|
@PostMapping("/{scenicId}/orderChart")
|
||||||
|
public ApiResponse getOrderChart(@PathVariable("scenicId") Long scenicId, @RequestBody CommonQueryReq query) {
|
||||||
|
query.setScenicId(scenicId);
|
||||||
|
return appStatisticsService.orderChart(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/myScenicList")
|
||||||
|
public ApiResponse<List<ScenicRespVO>> myScenicList() {
|
||||||
|
List<ScenicRespVO> list = Collections.emptyList();
|
||||||
|
if (StringUtils.equals(BaseContextHandler.getRoleId(), MERCHANT.type)) {
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = accountService.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
list = account.getScenicId().stream().map(id -> {
|
||||||
|
return appScenicService.getDetails(id).getData();
|
||||||
|
}).toList();
|
||||||
|
} else {
|
||||||
|
list = scenicService.list(new ScenicReqQuery()).getData();
|
||||||
|
}
|
||||||
|
return ApiResponse.success(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.ycwl.basic.controller.pc;
|
package com.ycwl.basic.controller.pc;
|
||||||
|
|
||||||
|
import com.ycwl.basic.annotation.IgnoreToken;
|
||||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||||
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
||||||
import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
|
import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
|
||||||
@@ -23,41 +24,29 @@ public class SourceController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SourceService sourceService;
|
private SourceService sourceService;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@ApiOperation("分页查询视频源")
|
@ApiOperation("分页查询视频源")
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
public ApiResponse pageQuery(@RequestBody SourceReqQuery sourceReqQuery) {
|
public ApiResponse pageQuery(@RequestBody SourceReqQuery sourceReqQuery) {
|
||||||
return sourceService.pageQuery(sourceReqQuery);
|
return sourceService.pageQuery(sourceReqQuery);
|
||||||
}
|
}
|
||||||
|
@Deprecated
|
||||||
@ApiOperation("查询视频源列表")
|
@ApiOperation("查询视频源列表")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public ApiResponse list(@RequestBody SourceReqQuery sourceReqQuery) {
|
public ApiResponse list(@RequestBody SourceReqQuery sourceReqQuery) {
|
||||||
return sourceService.list(sourceReqQuery);
|
return sourceService.list(sourceReqQuery);
|
||||||
}
|
}
|
||||||
@ApiOperation("查询视频源详情")
|
|
||||||
@GetMapping("getDetail/{id}")
|
|
||||||
public ApiResponse getById(@PathVariable Long id) {
|
|
||||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
|
||||||
return sourceService.getById(id, worker.getUserId());
|
|
||||||
}
|
|
||||||
@PostMapping("/{id}/cutVideo")
|
@PostMapping("/{id}/cutVideo")
|
||||||
|
@IgnoreToken
|
||||||
public ApiResponse cutVideo(@PathVariable("id") Long id) {
|
public ApiResponse cutVideo(@PathVariable("id") Long id) {
|
||||||
return sourceService.cutVideo(id);
|
return sourceService.cutVideo(id);
|
||||||
}
|
}
|
||||||
@ApiOperation("添加视频源")
|
@Deprecated
|
||||||
@PostMapping("/add")
|
|
||||||
public ApiResponse add(@RequestBody SourceEntity source) {
|
|
||||||
return sourceService.add(source);
|
|
||||||
}
|
|
||||||
@ApiOperation("删除视频源")
|
@ApiOperation("删除视频源")
|
||||||
@DeleteMapping("/delete/{id}")
|
@DeleteMapping("/delete/{id}")
|
||||||
public ApiResponse deleteById(@PathVariable Long id) {
|
public ApiResponse deleteById(@PathVariable Long id) {
|
||||||
return sourceService.deleteById(id);
|
return sourceService.deleteById(id);
|
||||||
}
|
}
|
||||||
@ApiOperation("修改视频源")
|
|
||||||
@PostMapping("/update")
|
|
||||||
public ApiResponse update(@RequestBody SourceEntity source) {
|
|
||||||
return sourceService.update(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/task/v1")
|
@RequestMapping("/api/task/v1")
|
||||||
|
@Deprecated
|
||||||
@Api(tags = "任务列表管理")
|
@Api(tags = "任务列表管理")
|
||||||
public class TaskController {
|
public class TaskController {
|
||||||
|
|
||||||
|
@@ -20,6 +20,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/video/v1")
|
@RequestMapping("/api/video/v1")
|
||||||
|
@Deprecated
|
||||||
@Api(tags = "视频成片管理")
|
@Api(tags = "视频成片管理")
|
||||||
public class VideoController {
|
public class VideoController {
|
||||||
|
|
||||||
|
@@ -7,8 +7,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@@ -18,6 +18,7 @@ import java.util.Enumeration;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@RestController
|
@RestController
|
||||||
public class ProxyController {
|
public class ProxyController {
|
||||||
@IgnoreToken
|
@IgnoreToken
|
||||||
|
@@ -12,6 +12,7 @@ import com.ycwl.basic.mapper.DeviceMapper;
|
|||||||
import com.ycwl.basic.mapper.FaceSampleMapper;
|
import com.ycwl.basic.mapper.FaceSampleMapper;
|
||||||
import com.ycwl.basic.mapper.SourceMapper;
|
import com.ycwl.basic.mapper.SourceMapper;
|
||||||
import com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity;
|
import com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity;
|
||||||
|
import com.ycwl.basic.model.pc.device.entity.DeviceCropConfig;
|
||||||
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
||||||
import com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity;
|
import com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity;
|
||||||
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
||||||
@@ -52,7 +53,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import java.awt.image.RasterFormatException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -66,7 +69,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static com.ycwl.basic.constant.StorageConstant.PHOTO_PATH;
|
import static com.ycwl.basic.constant.StorageConstant.PHOTO_PATH;
|
||||||
import static com.ycwl.basic.constant.StorageConstant.VIID_FACE;
|
import static com.ycwl.basic.constant.StorageConstant.VIID_FACE;
|
||||||
@@ -244,8 +246,14 @@ public class ViidController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DeviceConfigEntity deviceConfig = deviceRepository.getDeviceConfig(device.getId());
|
DeviceConfigEntity deviceConfig = deviceRepository.getDeviceConfig(device.getId());
|
||||||
|
if (deviceConfig == null) {
|
||||||
|
log.warn("设备配置不存在:" + deviceID);
|
||||||
|
return new VIIDBaseResp(
|
||||||
|
new ResponseStatusObject(faceId, "/VIID/Faces", "0", "OK", sdfTime.format(new Date()))
|
||||||
|
);
|
||||||
|
}
|
||||||
int viidMode = 0;
|
int viidMode = 0;
|
||||||
if (deviceConfig != null && deviceConfig.getViidType() != null) {
|
if (deviceConfig.getViidType() != null) {
|
||||||
viidMode = deviceConfig.getViidType();
|
viidMode = deviceConfig.getViidType();
|
||||||
}
|
}
|
||||||
Date shotTime = null;
|
Date shotTime = null;
|
||||||
@@ -267,7 +275,7 @@ public class ViidController {
|
|||||||
}
|
}
|
||||||
if (shotTime == null) {
|
if (shotTime == null) {
|
||||||
shotTime = new Date();
|
shotTime = new Date();
|
||||||
} else if (Math.abs(shotTime.getTime() - System.currentTimeMillis()) > + 24 * 60 * 60 * 1000) {
|
} else if (Math.abs(shotTime.getTime() - System.currentTimeMillis()) > 24 * 60 * 60 * 1000) {
|
||||||
shotTime = new Date();
|
shotTime = new Date();
|
||||||
}
|
}
|
||||||
Long scenicId = device.getScenicId();
|
Long scenicId = device.getScenicId();
|
||||||
@@ -285,13 +293,15 @@ public class ViidController {
|
|||||||
if (viidMode == 0) {
|
if (viidMode == 0) {
|
||||||
// 遍历每个图片对象
|
// 遍历每个图片对象
|
||||||
// 先找到type14的图片
|
// 先找到type14的图片
|
||||||
List<SubImageInfoObject> type14ImageList = subImageList.getSubImageInfoObject().stream().filter(subImage -> "14".equals(subImage.getType())).collect(Collectors.toList());
|
List<SubImageInfoObject> type14ImageList = subImageList.getSubImageInfoObject().stream().filter(subImage -> "14".equals(subImage.getType())).toList();
|
||||||
for (SubImageInfoObject subImage : subImageList.getSubImageInfoObject()) {
|
for (SubImageInfoObject subImage : subImageList.getSubImageInfoObject()) {
|
||||||
// base64转换成MultipartFIle
|
// base64转换成MultipartFIle
|
||||||
MultipartFile file = ImageUtils.base64ToMultipartFile(subImage.getData());
|
MultipartFile file = ImageUtils.base64ToMultipartFile(subImage.getData());
|
||||||
String ext = subImage.getFileFormat();
|
String ext;
|
||||||
if (ext.equalsIgnoreCase("jpeg")) {
|
if (subImage.getFileFormat().equalsIgnoreCase("jpeg")) {
|
||||||
ext = "jpg";
|
ext = "jpg";
|
||||||
|
} else {
|
||||||
|
ext = subImage.getFileFormat();
|
||||||
}
|
}
|
||||||
IStorageAdapter adapter = StorageFactory.use("faces");
|
IStorageAdapter adapter = StorageFactory.use("faces");
|
||||||
// Type=11 人脸
|
// Type=11 人脸
|
||||||
@@ -315,10 +325,10 @@ public class ViidController {
|
|||||||
AddFaceResp addFaceResp = faceBodyAdapter.addFace(scenicId.toString(), faceSample.getId().toString(), url, newFaceSampleId.toString());
|
AddFaceResp addFaceResp = faceBodyAdapter.addFace(scenicId.toString(), faceSample.getId().toString(), url, newFaceSampleId.toString());
|
||||||
if (addFaceResp != null) {
|
if (addFaceResp != null) {
|
||||||
faceSample.setScore(addFaceResp.getScore());
|
faceSample.setScore(addFaceResp.getScore());
|
||||||
faceSampleMapper.update(faceSample);
|
faceSampleMapper.updateScore(faceSample.getId(), addFaceResp.getScore());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (deviceConfig != null && Integer.valueOf(1).equals(deviceConfig.getEnablePreBook())) {
|
if (Integer.valueOf(1).equals(deviceConfig.getEnablePreBook())) {
|
||||||
DynamicTaskGenerator.addTask(faceSample.getId());
|
DynamicTaskGenerator.addTask(faceSample.getId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -328,7 +338,6 @@ public class ViidController {
|
|||||||
facePosition.setImgHeight(_subImage.getHeight());
|
facePosition.setImgHeight(_subImage.getHeight());
|
||||||
facePosition.setImgWidth(_subImage.getWidth());
|
facePosition.setImgWidth(_subImage.getWidth());
|
||||||
SourceEntity source = new SourceEntity();
|
SourceEntity source = new SourceEntity();
|
||||||
source.setId(SnowFlakeUtil.getLongId());
|
|
||||||
source.setDeviceId(device.getId());
|
source.setDeviceId(device.getId());
|
||||||
source.setScenicId(device.getScenicId());
|
source.setScenicId(device.getScenicId());
|
||||||
source.setFaceSampleId(newFaceSampleId);
|
source.setFaceSampleId(newFaceSampleId);
|
||||||
@@ -336,13 +345,44 @@ public class ViidController {
|
|||||||
source.setType(2);
|
source.setType(2);
|
||||||
// 上传oss
|
// 上传oss
|
||||||
MultipartFile _file = ImageUtils.base64ToMultipartFile(_subImage.getData());
|
MultipartFile _file = ImageUtils.base64ToMultipartFile(_subImage.getData());
|
||||||
|
ThreadPoolExecutor executor = getExecutor(scenicId);
|
||||||
|
executor.execute(() -> {
|
||||||
|
List<DeviceCropConfig> cropConfigs = deviceConfig._getCropConfig();
|
||||||
|
for (DeviceCropConfig cropConfig : cropConfigs) {
|
||||||
|
source.setId(SnowFlakeUtil.getLongId());
|
||||||
String filename = StorageUtil.joinPath(PHOTO_PATH, UUID.randomUUID() + "." + ext);
|
String filename = StorageUtil.joinPath(PHOTO_PATH, UUID.randomUUID() + "." + ext);
|
||||||
String _sourceUrl = scenicStorageAdapter.uploadFile(_file, filename);
|
MultipartFile _finalFile = _file;
|
||||||
|
if (cropConfig.getCropType() == 1) {
|
||||||
|
// 按固定位置截图
|
||||||
|
try {
|
||||||
|
_finalFile = ImageUtils.cropImage(_file, cropConfig.getTargetX(), cropConfig.getTargetY(), cropConfig.getTargetWidth(), cropConfig.getTargetHeight());
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("裁切图片失败!", e);
|
||||||
|
} catch (RasterFormatException e) {
|
||||||
|
log.error("裁切图片出错!", e);
|
||||||
|
}
|
||||||
|
} else if (cropConfig.getCropType() == 2) {
|
||||||
|
// 按人脸位置
|
||||||
|
try {
|
||||||
|
int targetX = facePosition.getLtX() - (cropConfig.getTargetWidth() - facePosition.getWidth())/2;
|
||||||
|
int targetY = facePosition.getLtY() - (cropConfig.getTargetHeight() - facePosition.getHeight())/2;
|
||||||
|
_finalFile = ImageUtils.cropImage(_file, targetX, targetY, cropConfig.getTargetWidth(), cropConfig.getTargetHeight());
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("裁切图片失败!", e);
|
||||||
|
} catch (RasterFormatException e) {
|
||||||
|
log.error("裁切图片出错!", e);
|
||||||
|
}
|
||||||
|
facePosition.setImgHeight(cropConfig.getTargetHeight());
|
||||||
|
facePosition.setImgWidth(cropConfig.getTargetWidth());
|
||||||
|
}
|
||||||
|
String _sourceUrl = scenicStorageAdapter.uploadFile(_finalFile, filename);
|
||||||
scenicStorageAdapter.setAcl(StorageAcl.PUBLIC_READ, filename);
|
scenicStorageAdapter.setAcl(StorageAcl.PUBLIC_READ, filename);
|
||||||
source.setUrl(_sourceUrl);
|
source.setUrl(_sourceUrl);
|
||||||
source.setPosJson(JSON.toJSONString(facePosition));
|
source.setPosJson(JSON.toJSONString(facePosition));
|
||||||
sourceMapper.add(source);
|
sourceMapper.add(source);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
log.info("人脸信息及原图{}张入库成功!设备ID:{}", type14ImageList.size(), deviceID);
|
log.info("人脸信息及原图{}张入库成功!设备ID:{}", type14ImageList.size(), deviceID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -377,10 +417,10 @@ public class ViidController {
|
|||||||
AddFaceResp addFaceResp = faceBodyAdapter.addFace(scenicId.toString(), faceSample.getId().toString(), url, newFaceSampleId.toString());
|
AddFaceResp addFaceResp = faceBodyAdapter.addFace(scenicId.toString(), faceSample.getId().toString(), url, newFaceSampleId.toString());
|
||||||
if (addFaceResp != null) {
|
if (addFaceResp != null) {
|
||||||
faceSample.setScore(addFaceResp.getScore());
|
faceSample.setScore(addFaceResp.getScore());
|
||||||
faceSampleMapper.update(faceSample);
|
faceSampleMapper.updateScore(faceSample.getId(), addFaceResp.getScore());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (deviceConfig != null && Integer.valueOf(1).equals(deviceConfig.getEnablePreBook())) {
|
if (Integer.valueOf(1).equals(deviceConfig.getEnablePreBook())) {
|
||||||
DynamicTaskGenerator.addTask(faceSample.getId());
|
DynamicTaskGenerator.addTask(faceSample.getId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -117,6 +117,7 @@ public class VptPassiveStorageOperator extends ADeviceStorageOperator {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
//noinspection BusyWait 得等待
|
||||||
Thread.sleep(1000L);
|
Thread.sleep(1000L);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@@ -113,6 +113,7 @@ public class WvpPassiveStorageOperator extends ADeviceStorageOperator {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
//noinspection BusyWait 得等待
|
||||||
Thread.sleep(1000L);
|
Thread.sleep(1000L);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@@ -2,11 +2,13 @@ package com.ycwl.basic.exception;
|
|||||||
|
|
||||||
import com.ycwl.basic.enums.BizCodeEnum;
|
import com.ycwl.basic.enums.BizCodeEnum;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author songminsgong
|
* @author songminsgong
|
||||||
* @since 2022-11-23
|
* @since 2022-11-23
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
public class AppException extends RuntimeException {
|
public class AppException extends RuntimeException {
|
||||||
|
|
||||||
|
@@ -2,11 +2,13 @@ package com.ycwl.basic.exception;
|
|||||||
|
|
||||||
import com.ycwl.basic.enums.BizCodeEnum;
|
import com.ycwl.basic.enums.BizCodeEnum;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wenshijia
|
* @author wenshijia
|
||||||
* @date 2021年05月25日 22:41
|
* @date 2021年05月25日 22:41
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
public class BizException extends RuntimeException {
|
public class BizException extends RuntimeException {
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ package com.ycwl.basic.exception;
|
|||||||
|
|
||||||
import com.ycwl.basic.enums.BizCodeEnum;
|
import com.ycwl.basic.enums.BizCodeEnum;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import org.apache.tomcat.util.http.fileupload.impl.SizeLimitExceededException;
|
import org.apache.tomcat.util.http.fileupload.impl.SizeLimitExceededException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -10,7 +11,9 @@ import org.springframework.http.converter.HttpMessageNotReadableException;
|
|||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,13 +53,21 @@ public class CustomExceptionHandle {
|
|||||||
* 自定义异常统一处理类
|
* 自定义异常统一处理类
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(value = BizException.class)
|
@ExceptionHandler(value = BizException.class)
|
||||||
public ApiResponse<String> handle(BizException bizException) {
|
public ApiResponse<String> handle(HttpServletResponse response, BizException bizException) {
|
||||||
|
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||||
return ApiResponse.buildResponse(bizException.getCode(), bizException.getMsg());
|
return ApiResponse.buildResponse(bizException.getCode(), bizException.getMsg());
|
||||||
}
|
}
|
||||||
|
@ExceptionHandler(value = MethodArgumentTypeMismatchException.class)
|
||||||
|
public ApiResponse<String> handle(HttpServletRequest request, HttpServletResponse response, MethodArgumentTypeMismatchException exception) {
|
||||||
|
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||||
|
LOGGER.error("参数错误 -> 请求地址:{},请求方式:{}", request.getRequestURI(), request.getMethod());
|
||||||
|
return ApiResponse.buildResponse(5000, "参数错误!");
|
||||||
|
}
|
||||||
|
|
||||||
@ExceptionHandler(value =IOException.class)
|
@ExceptionHandler(value =IOException.class)
|
||||||
public ApiResponse<String> handle(IOException e) {
|
public ApiResponse<String> handle(HttpServletResponse response, IOException e) {
|
||||||
LOGGER.error("系统异常 -> {}", e.getMessage(), e);
|
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||||
|
LOGGER.error("IO异常 -> {}", e.getMessage(), e);
|
||||||
return ApiResponse.buildResult(BizCodeEnum.SERVER_UNKONWN_ERROR);
|
return ApiResponse.buildResult(BizCodeEnum.SERVER_UNKONWN_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +75,8 @@ public class CustomExceptionHandle {
|
|||||||
* 异常统一返回处理
|
* 异常统一返回处理
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(value = Exception.class)
|
@ExceptionHandler(value = Exception.class)
|
||||||
public ApiResponse<String> handle(Exception e) {
|
public ApiResponse<String> handle(HttpServletResponse response, Exception e) {
|
||||||
|
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||||
LOGGER.error("系统异常 -> {}", e.getMessage(), e);
|
LOGGER.error("系统异常 -> {}", e.getMessage(), e);
|
||||||
return ApiResponse.buildResult(BizCodeEnum.SERVER_UNKONWN_ERROR);
|
return ApiResponse.buildResult(BizCodeEnum.SERVER_UNKONWN_ERROR);
|
||||||
}
|
}
|
||||||
@@ -73,7 +85,8 @@ public class CustomExceptionHandle {
|
|||||||
* 移动端自定义异常统一处理类
|
* 移动端自定义异常统一处理类
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(value = AppException.class)
|
@ExceptionHandler(value = AppException.class)
|
||||||
public ApiResponse<String> handle(AppException appException) {
|
public ApiResponse<String> handle(HttpServletResponse response, AppException appException) {
|
||||||
|
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||||
return ApiResponse.buildResponse(appException.getCode(), appException.getMsg());
|
return ApiResponse.buildResponse(appException.getCode(), appException.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +94,8 @@ public class CustomExceptionHandle {
|
|||||||
* 移动端自定义异常统一处理类
|
* 移动端自定义异常统一处理类
|
||||||
*/
|
*/
|
||||||
@ExceptionHandler(value = HttpMessageNotReadableException.class)
|
@ExceptionHandler(value = HttpMessageNotReadableException.class)
|
||||||
public ApiResponse<String> handle(HttpMessageNotReadableException httpMessageNotReadableException) {
|
public ApiResponse<String> handle(HttpServletResponse response, HttpMessageNotReadableException httpMessageNotReadableException) {
|
||||||
|
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||||
return ApiResponse.buildResponse(500, "请求参数格式错误");
|
return ApiResponse.buildResponse(500, "请求参数格式错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,14 +23,11 @@ public class FaceBodyFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static IFaceBodyAdapter getAdapter(FaceBodyAdapterType type) {
|
public static IFaceBodyAdapter getAdapter(FaceBodyAdapterType type) {
|
||||||
switch (type) {
|
return switch (type) {
|
||||||
case ALI:
|
case ALI -> new AliFaceBodyAdapter();
|
||||||
return new AliFaceBodyAdapter();
|
case BCE -> new BceFaceBodyAdapter();
|
||||||
case BCE:
|
default -> throw new FaceBodyUnsupportedException("不支持的Adapter类型");
|
||||||
return new BceFaceBodyAdapter();
|
};
|
||||||
default:
|
|
||||||
throw new FaceBodyUnsupportedException("不支持的Adapter类型");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -62,33 +63,31 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private IRateLimiter getLimiter(LOCK_TYPE type) {
|
private IRateLimiter getLimiter(LOCK_TYPE type) {
|
||||||
switch (type) {
|
return switch (type) {
|
||||||
case ADD_DB:
|
case ADD_DB ->
|
||||||
return addDbLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
addDbLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||||
case ADD_ENTITY:
|
case ADD_ENTITY ->
|
||||||
return addEntityLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
addEntityLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||||
case ADD_FACE:
|
case ADD_FACE ->
|
||||||
return addFaceLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
addFaceLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||||
case LIST_DB:
|
case LIST_DB ->
|
||||||
return listDbLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(500, TimeUnit.MILLISECONDS));
|
listDbLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(500, TimeUnit.MILLISECONDS));
|
||||||
case LIST_FACE:
|
case LIST_FACE -> listFaceLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(2));
|
||||||
return listFaceLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(2));
|
case SEARCH_FACE ->
|
||||||
case SEARCH_FACE:
|
searchFaceLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(200, TimeUnit.MILLISECONDS));
|
||||||
return searchFaceLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(200, TimeUnit.MILLISECONDS));
|
case DELETE_DB ->
|
||||||
case DELETE_DB:
|
deleteDbLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||||
return deleteDbLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
case DELETE_ENTITY ->
|
||||||
case DELETE_ENTITY:
|
deleteEntityLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||||
return deleteEntityLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
default -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS);
|
||||||
default:
|
};
|
||||||
return new FixedRateLimiter(600, TimeUnit.MILLISECONDS);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addFaceDb(String dbName) {
|
public boolean addFaceDb(String dbName) {
|
||||||
IRateLimiter addDbLimiter = getLimiter(LOCK_TYPE.ADD_DB);
|
IRateLimiter addDbLimiter = getLimiter(LOCK_TYPE.ADD_DB);
|
||||||
try (ClientWrapper clientWrapper = getClient()) {
|
try (ClientWrapper clientWrapper = getClient()) {
|
||||||
IAcsClient client = clientWrapper.getClient();
|
IAcsClient client = clientWrapper.client();
|
||||||
CreateFaceDbRequest request = new CreateFaceDbRequest();
|
CreateFaceDbRequest request = new CreateFaceDbRequest();
|
||||||
request.setName(dbName);
|
request.setName(dbName);
|
||||||
try {
|
try {
|
||||||
@@ -112,7 +111,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
request.setOrder("asc");
|
request.setOrder("asc");
|
||||||
request.setLimit(200);
|
request.setLimit(200);
|
||||||
try (ClientWrapper clientWrapper = getClient()) {
|
try (ClientWrapper clientWrapper = getClient()) {
|
||||||
IAcsClient client = clientWrapper.getClient();
|
IAcsClient client = clientWrapper.client();
|
||||||
while (true) {
|
while (true) {
|
||||||
ListFaceEntitiesResponse response = client.getAcsResponse(request);
|
ListFaceEntitiesResponse response = client.getAcsResponse(request);
|
||||||
if (response.getData().getTotalCount() == 0) {
|
if (response.getData().getTotalCount() == 0) {
|
||||||
@@ -151,7 +150,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
public List<String> listFaceDb() {
|
public List<String> listFaceDb() {
|
||||||
ListFaceDbsRequest request = new ListFaceDbsRequest();
|
ListFaceDbsRequest request = new ListFaceDbsRequest();
|
||||||
try (ClientWrapper clientWrapper = getClient()) {
|
try (ClientWrapper clientWrapper = getClient()) {
|
||||||
IAcsClient client = clientWrapper.getClient();
|
IAcsClient client = clientWrapper.client();
|
||||||
ListFaceDbsResponse response = client.getAcsResponse(request);
|
ListFaceDbsResponse response = client.getAcsResponse(request);
|
||||||
return response.getData().getDbList().stream().map(ListFaceDbsResponse.Data.DbListItem::getName).collect(Collectors.toList());
|
return response.getData().getDbList().stream().map(ListFaceDbsResponse.Data.DbListItem::getName).collect(Collectors.toList());
|
||||||
} catch (ClientException e) {
|
} catch (ClientException e) {
|
||||||
@@ -168,7 +167,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
request.setDbName(dbName);
|
request.setDbName(dbName);
|
||||||
request.setEntityId(entityId);
|
request.setEntityId(entityId);
|
||||||
try (ClientWrapper clientWrapper = getClient()) {
|
try (ClientWrapper clientWrapper = getClient()) {
|
||||||
IAcsClient client = clientWrapper.getClient();
|
IAcsClient client = clientWrapper.client();
|
||||||
try {
|
try {
|
||||||
addEntityLimiter.acquire();
|
addEntityLimiter.acquire();
|
||||||
} catch (InterruptedException ignored) {
|
} catch (InterruptedException ignored) {
|
||||||
@@ -207,7 +206,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
request.setDbName(dbName);
|
request.setDbName(dbName);
|
||||||
request.setEntityId(entityId);
|
request.setEntityId(entityId);
|
||||||
try (ClientWrapper clientWrapper = getClient()) {
|
try (ClientWrapper clientWrapper = getClient()) {
|
||||||
IAcsClient client = clientWrapper.getClient();
|
IAcsClient client = clientWrapper.client();
|
||||||
try {
|
try {
|
||||||
deleteEntityLimiter.acquire();
|
deleteEntityLimiter.acquire();
|
||||||
} catch (InterruptedException ignored) {
|
} catch (InterruptedException ignored) {
|
||||||
@@ -231,16 +230,12 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
if (offset != null) {
|
if (offset != null) {
|
||||||
listFaceEntitiesRequest.setOffset(offset);
|
listFaceEntitiesRequest.setOffset(offset);
|
||||||
}
|
}
|
||||||
if (size != null) {
|
listFaceEntitiesRequest.setLimit(Objects.requireNonNullElse(size, 200));
|
||||||
listFaceEntitiesRequest.setLimit(size);
|
|
||||||
} else {
|
|
||||||
listFaceEntitiesRequest.setLimit(200);
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotEmpty(prefix)) {
|
if (StringUtils.isNotEmpty(prefix)) {
|
||||||
listFaceEntitiesRequest.setEntityIdPrefix(prefix);
|
listFaceEntitiesRequest.setEntityIdPrefix(prefix);
|
||||||
}
|
}
|
||||||
try (ClientWrapper clientWrapper = getClient()) {
|
try (ClientWrapper clientWrapper = getClient()) {
|
||||||
IAcsClient client = clientWrapper.getClient();
|
IAcsClient client = clientWrapper.client();
|
||||||
try {
|
try {
|
||||||
listFaceLimiter.acquire();
|
listFaceLimiter.acquire();
|
||||||
} catch (InterruptedException ignored) {
|
} catch (InterruptedException ignored) {
|
||||||
@@ -260,7 +255,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
SearchFaceResp resp = new SearchFaceResp();
|
SearchFaceResp resp = new SearchFaceResp();
|
||||||
IRateLimiter searchFaceLimiter = getLimiter(LOCK_TYPE.SEARCH_FACE);
|
IRateLimiter searchFaceLimiter = getLimiter(LOCK_TYPE.SEARCH_FACE);
|
||||||
try (ClientWrapper clientWrapper = getClient()) {
|
try (ClientWrapper clientWrapper = getClient()) {
|
||||||
IAcsClient client = clientWrapper.getClient();
|
IAcsClient client = clientWrapper.client();
|
||||||
SearchFaceRequest request = new SearchFaceRequest();
|
SearchFaceRequest request = new SearchFaceRequest();
|
||||||
request.setDbName(dbName);
|
request.setDbName(dbName);
|
||||||
request.setImageUrl(faceUrl);
|
request.setImageUrl(faceUrl);
|
||||||
@@ -276,7 +271,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
resp.setOriginalFaceScore(0f);
|
resp.setOriginalFaceScore(0f);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
SearchFaceResponse.Data.MatchListItem matchItem = matchList.get(0);
|
SearchFaceResponse.Data.MatchListItem matchItem = matchList.getFirst();
|
||||||
resp.setOriginalFaceScore(matchItem.getQualitieScore());
|
resp.setOriginalFaceScore(matchItem.getQualitieScore());
|
||||||
resp.setResult(matchItem.getFaceItems().stream().map(item -> {
|
resp.setResult(matchItem.getFaceItems().stream().map(item -> {
|
||||||
SearchFaceResultItem resultItem = new SearchFaceResultItem();
|
SearchFaceResultItem resultItem = new SearchFaceResultItem();
|
||||||
@@ -287,7 +282,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
return resultItem;
|
return resultItem;
|
||||||
}).collect(Collectors.toList()));
|
}).collect(Collectors.toList()));
|
||||||
if (!resp.getResult().isEmpty()) {
|
if (!resp.getResult().isEmpty()) {
|
||||||
resp.setFirstMatchRate(resp.getResult().get(0).getScore());
|
resp.setFirstMatchRate(resp.getResult().getFirst().getScore());
|
||||||
}
|
}
|
||||||
return resp;
|
return resp;
|
||||||
} catch (ClientException e) {
|
} catch (ClientException e) {
|
||||||
@@ -304,13 +299,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
return new ClientWrapper(client);
|
return new ClientWrapper(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
public record ClientWrapper(IAcsClient client) implements AutoCloseable {
|
||||||
public static class ClientWrapper implements AutoCloseable {
|
|
||||||
private final IAcsClient client;
|
|
||||||
|
|
||||||
public ClientWrapper(IAcsClient client) {
|
|
||||||
this.client = client;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
@@ -319,7 +308,6 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
}
|
}
|
||||||
client.shutdown();
|
client.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
protected enum LOCK_TYPE {
|
protected enum LOCK_TYPE {
|
||||||
ADD_DB,
|
ADD_DB,
|
||||||
|
@@ -2,13 +2,11 @@ package com.ycwl.basic.facebody.adapter;
|
|||||||
|
|
||||||
import com.baidu.aip.face.AipFace;
|
import com.baidu.aip.face.AipFace;
|
||||||
import com.ycwl.basic.facebody.entity.AddFaceResp;
|
import com.ycwl.basic.facebody.entity.AddFaceResp;
|
||||||
import com.ycwl.basic.facebody.entity.AliFaceBodyConfig;
|
|
||||||
import com.ycwl.basic.facebody.entity.BceFaceBodyConfig;
|
import com.ycwl.basic.facebody.entity.BceFaceBodyConfig;
|
||||||
import com.ycwl.basic.facebody.entity.SearchFaceResp;
|
import com.ycwl.basic.facebody.entity.SearchFaceResp;
|
||||||
import com.ycwl.basic.facebody.entity.SearchFaceResultItem;
|
import com.ycwl.basic.facebody.entity.SearchFaceResultItem;
|
||||||
import com.ycwl.basic.utils.ratelimiter.FixedRateLimiter;
|
import com.ycwl.basic.utils.ratelimiter.FixedRateLimiter;
|
||||||
import com.ycwl.basic.utils.ratelimiter.IRateLimiter;
|
import com.ycwl.basic.utils.ratelimiter.IRateLimiter;
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
@@ -23,7 +21,6 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class BceFaceBodyAdapter implements IFaceBodyAdapter {
|
public class BceFaceBodyAdapter implements IFaceBodyAdapter {
|
||||||
@@ -247,6 +244,7 @@ public class BceFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
if (response.getInt("error_code") == 0) {
|
if (response.getInt("error_code") == 0) {
|
||||||
JSONObject resultObj = response.getJSONObject("result");
|
JSONObject resultObj = response.getJSONObject("result");
|
||||||
if (resultObj != null) {
|
if (resultObj != null) {
|
||||||
|
try {
|
||||||
JSONArray faceList = resultObj.getJSONArray("face_list");
|
JSONArray faceList = resultObj.getJSONArray("face_list");
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
for (int i = 0; i < faceList.length(); i++) {
|
for (int i = 0; i < faceList.length(); i++) {
|
||||||
@@ -254,6 +252,9 @@ public class BceFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
result.add(jsonObject.getString("face_token"));
|
result.add(jsonObject.getString("face_token"));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@@ -277,7 +278,6 @@ public class BceFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
try {
|
try {
|
||||||
AipFace client = getClient();
|
AipFace client = getClient();
|
||||||
HashMap<String, Object> options = new HashMap<>();
|
HashMap<String, Object> options = new HashMap<>();
|
||||||
options.put("quality_control", "LOW");
|
|
||||||
options.put("max_user_num", "50");
|
options.put("max_user_num", "50");
|
||||||
try {
|
try {
|
||||||
searchFaceLimiter.acquire();
|
searchFaceLimiter.acquire();
|
||||||
@@ -304,7 +304,7 @@ public class BceFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
}
|
}
|
||||||
resp.setResult(result);
|
resp.setResult(result);
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
resp.setFirstMatchRate(result.get(0).getScore());
|
resp.setFirstMatchRate(result.getFirst().getScore());
|
||||||
}
|
}
|
||||||
return resp;
|
return resp;
|
||||||
} else {
|
} else {
|
||||||
@@ -334,26 +334,25 @@ public class BceFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private IRateLimiter getLimiter(LOCK_TYPE type) {
|
private IRateLimiter getLimiter(LOCK_TYPE type) {
|
||||||
switch (type) {
|
return switch (type) {
|
||||||
case ADD_DB:
|
case ADD_DB ->
|
||||||
return addDbLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
addDbLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||||
case ADD_FACE:
|
case ADD_FACE ->
|
||||||
return addFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(config.getAddQps()));
|
addFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(config.getAddQps()));
|
||||||
case LIST_DB:
|
case LIST_DB ->
|
||||||
return listDbLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
listDbLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||||
case LIST_FACE:
|
case LIST_FACE ->
|
||||||
return listFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
listFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||||
case SEARCH_FACE:
|
case SEARCH_FACE ->
|
||||||
return searchFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(config.getSearchQps()));
|
searchFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(config.getSearchQps()));
|
||||||
case DELETE_DB:
|
case DELETE_DB ->
|
||||||
return deleteDbLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
deleteDbLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||||
case DELETE_ENTITY:
|
case DELETE_ENTITY ->
|
||||||
return deleteEntityLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
deleteEntityLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||||
case DELETE_FACE:
|
case DELETE_FACE ->
|
||||||
return deleteFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
deleteFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||||
default:
|
default -> new FixedRateLimiter(500, TimeUnit.MILLISECONDS);
|
||||||
return new FixedRateLimiter(500, TimeUnit.MILLISECONDS);
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected enum LOCK_TYPE {
|
protected enum LOCK_TYPE {
|
||||||
|
@@ -16,15 +16,11 @@ public class ImageWatermarkFactory {
|
|||||||
return get(type);
|
return get(type);
|
||||||
}
|
}
|
||||||
public static IOperator get(ImageWatermarkOperatorEnum type) {
|
public static IOperator get(ImageWatermarkOperatorEnum type) {
|
||||||
switch (type) {
|
return switch (type) {
|
||||||
case WATERMARK:
|
case WATERMARK -> new DefaultImageWatermarkOperator();
|
||||||
return new DefaultImageWatermarkOperator();
|
case NORMAL -> new NormalWatermarkOperator();
|
||||||
case NORMAL:
|
case LEICA -> new LeicaWatermarkOperator();
|
||||||
return new NormalWatermarkOperator();
|
default -> throw new ImageWatermarkUnsupportedException("不支持的类型" + type.name());
|
||||||
case LEICA:
|
};
|
||||||
return new LeicaWatermarkOperator();
|
|
||||||
default:
|
|
||||||
throw new ImageWatermarkUnsupportedException("不支持的类型"+type.name());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,8 +52,9 @@ public class LeicaWatermarkOperator implements IOperator {
|
|||||||
public static int LOGO_EXTRA_BORDER = 20;
|
public static int LOGO_EXTRA_BORDER = 20;
|
||||||
public static int LOGO_FONT_SIZE = 38;
|
public static int LOGO_FONT_SIZE = 38;
|
||||||
public static Color logoTextColor = new Color(0x33, 0x33, 0x33);
|
public static Color logoTextColor = new Color(0x33, 0x33, 0x33);
|
||||||
public static int QRCODE_SIZE = 80;
|
public static int QRCODE_SIZE = 120;
|
||||||
public static int QRCODE_OFFSET_X = 5;
|
public static int QRCODE_OFFSET_X = 5;
|
||||||
|
public static int QRCODE_OFFSET_Y = 20;
|
||||||
public static int OFFSET_X = 80;
|
public static int OFFSET_X = 80;
|
||||||
public static int OFFSET_Y = 30;
|
public static int OFFSET_Y = 30;
|
||||||
public static int SCENIC_FONT_SIZE = 32;
|
public static int SCENIC_FONT_SIZE = 32;
|
||||||
@@ -106,13 +107,30 @@ public class LeicaWatermarkOperator implements IOperator {
|
|||||||
int dtLineHeight = datetimeFontMetrics.getHeight();
|
int dtLineHeight = datetimeFontMetrics.getHeight();
|
||||||
int scenicLineWidth = scenicFontMetrics.stringWidth(info.getScenicLine());
|
int scenicLineWidth = scenicFontMetrics.stringWidth(info.getScenicLine());
|
||||||
int datetimeLineWidth = scenicFontMetrics.stringWidth(info.getDatetimeLine());
|
int datetimeLineWidth = scenicFontMetrics.stringWidth(info.getDatetimeLine());
|
||||||
g2d.drawImage(qrcodeImage, newImage.getWidth() + EXTRA_BORDER_PX - OFFSET_X - newQrcodeWidth - QRCODE_OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth), EXTRA_BORDER_PX + baseImage.getHeight() + + OFFSET_Y, newQrcodeWidth, newQrcodeHeight, null);
|
// 计算二维码的位置
|
||||||
|
int qrcodeX = newImage.getWidth() + EXTRA_BORDER_PX - OFFSET_X - newQrcodeWidth - QRCODE_OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth);
|
||||||
|
int qrcodeY = EXTRA_BORDER_PX + baseImage.getHeight() + OFFSET_Y - QRCODE_OFFSET_Y;
|
||||||
|
|
||||||
|
g2d.drawImage(qrcodeImage, qrcodeX, qrcodeY, newQrcodeWidth, newQrcodeHeight, null);
|
||||||
|
|
||||||
|
// 计算文字与二维码垂直居中对齐的Y坐标
|
||||||
|
int qrcodeTop = qrcodeY;
|
||||||
|
int qrcodeBottom = qrcodeTop + newQrcodeHeight;
|
||||||
|
int qrcodeCenter = (qrcodeTop + qrcodeBottom) / 2;
|
||||||
|
|
||||||
|
// 两行文字的总高度
|
||||||
|
int totalTextHeight = scenicLineHeight + dtLineHeight;
|
||||||
|
|
||||||
|
// 计算第一行文字的Y坐标(基线位置),使两行文字整体垂直居中于二维码
|
||||||
|
int textStartY = qrcodeCenter - totalTextHeight / 2 + scenicFontMetrics.getAscent();
|
||||||
|
|
||||||
g2d.setFont(scenicFont);
|
g2d.setFont(scenicFont);
|
||||||
g2d.setColor(scenicColor);
|
g2d.setColor(scenicColor);
|
||||||
g2d.drawString(info.getScenicLine(), newImage.getWidth() + EXTRA_BORDER_PX - OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth), EXTRA_BORDER_PX + baseImage.getHeight() + + OFFSET_Y + scenicLineHeight + scenicLineHeight * FONT_GLOBAL_OFFSET_PERCENT);
|
g2d.drawString(info.getScenicLine(), newImage.getWidth() + EXTRA_BORDER_PX - OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth), textStartY);
|
||||||
|
|
||||||
g2d.setFont(datetimeFont);
|
g2d.setFont(datetimeFont);
|
||||||
g2d.setColor(datetimeColor);
|
g2d.setColor(datetimeColor);
|
||||||
g2d.drawString(info.getDatetimeLine(), newImage.getWidth() + EXTRA_BORDER_PX - OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth), EXTRA_BORDER_PX + baseImage.getHeight() + + OFFSET_Y + scenicLineHeight + dtLineHeight + dtLineHeight * FONT_GLOBAL_OFFSET_PERCENT);
|
g2d.drawString(info.getDatetimeLine(), newImage.getWidth() + EXTRA_BORDER_PX - OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth), textStartY + scenicLineHeight);
|
||||||
String fileName = info.getWatermarkedFile().getName();
|
String fileName = info.getWatermarkedFile().getName();
|
||||||
String formatName = "jpg"; // 默认格式为 jpg
|
String formatName = "jpg"; // 默认格式为 jpg
|
||||||
if (fileName.endsWith(".png")) {
|
if (fileName.endsWith(".png")) {
|
||||||
@@ -133,7 +151,7 @@ public class LeicaWatermarkOperator implements IOperator {
|
|||||||
ImageWriteParam writeParam = writer.getDefaultWriteParam();
|
ImageWriteParam writeParam = writer.getDefaultWriteParam();
|
||||||
if (writeParam.canWriteCompressed()) {
|
if (writeParam.canWriteCompressed()) {
|
||||||
writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
|
writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
|
||||||
writeParam.setCompressionQuality(0.95f); // 设置写入质量为 95%
|
writeParam.setCompressionQuality(0.75f); // 设置写入质量为 75%
|
||||||
}
|
}
|
||||||
writer.write(null, new javax.imageio.IIOImage(newImage, null, null), writeParam);
|
writer.write(null, new javax.imageio.IIOImage(newImage, null, null), writeParam);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@@ -9,6 +9,7 @@ import javax.imageio.ImageWriteParam;
|
|||||||
import javax.imageio.ImageWriter;
|
import javax.imageio.ImageWriter;
|
||||||
import javax.imageio.stream.ImageOutputStream;
|
import javax.imageio.stream.ImageOutputStream;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.geom.Ellipse2D;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -45,8 +46,9 @@ public class NormalWatermarkOperator implements IOperator {
|
|||||||
public static int EXTRA_BORDER_PX = 0;
|
public static int EXTRA_BORDER_PX = 0;
|
||||||
public static int OFFSET_Y = 90;
|
public static int OFFSET_Y = 90;
|
||||||
public static Color BG_COLOR = Color.WHITE;
|
public static Color BG_COLOR = Color.WHITE;
|
||||||
public static int QRCODE_SIZE = 100;
|
public static int QRCODE_SIZE = 150;
|
||||||
public static int QRCODE_OFFSET_X = 10;
|
public static int QRCODE_OFFSET_X = 10;
|
||||||
|
public static int QRCODE_OFFSET_Y = -20;
|
||||||
|
|
||||||
public static int SCENIC_FONT_SIZE = 42;
|
public static int SCENIC_FONT_SIZE = 42;
|
||||||
public static Color scenicColor = Color.white;
|
public static Color scenicColor = Color.white;
|
||||||
@@ -82,13 +84,29 @@ public class NormalWatermarkOperator implements IOperator {
|
|||||||
int datetimeLineWidth = scenicFontMetrics.stringWidth(info.getDatetimeLine());
|
int datetimeLineWidth = scenicFontMetrics.stringWidth(info.getDatetimeLine());
|
||||||
int offsetX = (newImage.getWidth() - newQrcodeWidth - QRCODE_OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth)) / 2;
|
int offsetX = (newImage.getWidth() - newQrcodeWidth - QRCODE_OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth)) / 2;
|
||||||
int offsetY = EXTRA_BORDER_PX + baseImage.getHeight() - OFFSET_Y - newQrcodeHeight;
|
int offsetY = EXTRA_BORDER_PX + baseImage.getHeight() - OFFSET_Y - newQrcodeHeight;
|
||||||
g2d.drawImage(qrcodeImage, offsetX, offsetY, newQrcodeWidth, newQrcodeHeight, null);
|
Shape originalClip = g2d.getClip();
|
||||||
|
Ellipse2D circle = new Ellipse2D.Double(offsetX, offsetY + QRCODE_OFFSET_Y, newQrcodeWidth, newQrcodeHeight);
|
||||||
|
g2d.setClip(circle);
|
||||||
|
g2d.drawImage(qrcodeImage, offsetX, offsetY + QRCODE_OFFSET_Y, newQrcodeWidth, newQrcodeHeight, null);
|
||||||
|
g2d.setClip(originalClip);
|
||||||
|
// 计算文字与二维码垂直居中对齐的Y坐标
|
||||||
|
int qrcodeTop = offsetY + QRCODE_OFFSET_Y;
|
||||||
|
int qrcodeBottom = qrcodeTop + newQrcodeHeight;
|
||||||
|
int qrcodeCenter = (qrcodeTop + qrcodeBottom) / 2;
|
||||||
|
|
||||||
|
// 两行文字的总高度
|
||||||
|
int totalTextHeight = scenicLineHeight + dtLineHeight;
|
||||||
|
|
||||||
|
// 计算第一行文字的Y坐标(基线位置),使两行文字整体垂直居中于二维码
|
||||||
|
int textStartY = qrcodeCenter - totalTextHeight / 2 + scenicFontMetrics.getAscent();
|
||||||
|
|
||||||
g2d.setFont(scenicFont);
|
g2d.setFont(scenicFont);
|
||||||
g2d.setColor(scenicColor);
|
g2d.setColor(scenicColor);
|
||||||
g2d.drawString(info.getScenicLine(), offsetX + newQrcodeWidth + QRCODE_OFFSET_X, offsetY + scenicLineHeight + FONT_GLOBAL_OFFSET_PERCENT * scenicLineHeight);
|
g2d.drawString(info.getScenicLine(), offsetX + newQrcodeWidth + QRCODE_OFFSET_X, textStartY);
|
||||||
|
|
||||||
g2d.setFont(datetimeFont);
|
g2d.setFont(datetimeFont);
|
||||||
g2d.setColor(datetimeColor);
|
g2d.setColor(datetimeColor);
|
||||||
g2d.drawString(info.getDatetimeLine(), offsetX + newQrcodeWidth + QRCODE_OFFSET_X, offsetY + scenicLineHeight + dtLineHeight + FONT_GLOBAL_OFFSET_PERCENT * dtLineHeight);
|
g2d.drawString(info.getDatetimeLine(), offsetX + newQrcodeWidth + QRCODE_OFFSET_X, textStartY + scenicLineHeight);
|
||||||
String fileName = info.getWatermarkedFile().getName();
|
String fileName = info.getWatermarkedFile().getName();
|
||||||
String formatName = "jpg"; // 默认格式为 jpg
|
String formatName = "jpg"; // 默认格式为 jpg
|
||||||
if (fileName.endsWith(".png")) {
|
if (fileName.endsWith(".png")) {
|
||||||
@@ -109,7 +127,7 @@ public class NormalWatermarkOperator implements IOperator {
|
|||||||
ImageWriteParam writeParam = writer.getDefaultWriteParam();
|
ImageWriteParam writeParam = writer.getDefaultWriteParam();
|
||||||
if (writeParam.canWriteCompressed()) {
|
if (writeParam.canWriteCompressed()) {
|
||||||
writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
|
writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
|
||||||
writeParam.setCompressionQuality(0.95f); // 设置写入质量为 95%
|
writeParam.setCompressionQuality(0.75f); // 设置写入质量为 75%
|
||||||
}
|
}
|
||||||
writer.write(null, new javax.imageio.IIOImage(newImage, null, null), writeParam);
|
writer.write(null, new javax.imageio.IIOImage(newImage, null, null), writeParam);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@@ -7,7 +7,13 @@ import com.ycwl.basic.constant.PermissionConstant;
|
|||||||
import com.ycwl.basic.constant.RequestConstant;
|
import com.ycwl.basic.constant.RequestConstant;
|
||||||
import com.ycwl.basic.exception.CheckTokenException;
|
import com.ycwl.basic.exception.CheckTokenException;
|
||||||
import com.ycwl.basic.exception.MissTokenException;
|
import com.ycwl.basic.exception.MissTokenException;
|
||||||
|
import com.ycwl.basic.exception.PermissionException;
|
||||||
|
import com.ycwl.basic.exception.TokenExpireException;
|
||||||
|
import com.ycwl.basic.mapper.AdminUserMapper;
|
||||||
|
import com.ycwl.basic.mapper.ScenicAccountMapper;
|
||||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||||
|
import com.ycwl.basic.model.pc.adminUser.entity.LoginEntity;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||||
import com.ycwl.basic.utils.JwtTokenUtil;
|
import com.ycwl.basic.utils.JwtTokenUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -15,37 +21,46 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.method.HandlerMethod;
|
import org.springframework.web.method.HandlerMethod;
|
||||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
import javax.servlet.http.Cookie;
|
import jakarta.servlet.http.Cookie;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.ycwl.basic.constant.JwtRoleConstant.ADMIN;
|
||||||
|
import static com.ycwl.basic.constant.JwtRoleConstant.MERCHANT;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class AuthInterceptor extends HandlerInterceptorAdapter {
|
public class AuthInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
RedisTemplate redisTemplate;
|
RedisTemplate redisTemplate;
|
||||||
|
@Autowired
|
||||||
|
private ScenicAccountMapper scenicAccountMapper;
|
||||||
|
@Autowired
|
||||||
|
private AdminUserMapper adminUserMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
if (!(handler instanceof HandlerMethod)) {
|
if (!(handler instanceof HandlerMethod handlerMethod)) {
|
||||||
return super.preHandle(request, response, handler);
|
return true;
|
||||||
}
|
}
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
|
|
||||||
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
|
||||||
// 获取类上面的注解
|
// 获取类上面的注解
|
||||||
IgnoreToken ignoreClassToken = handlerMethod.getBeanType().getAnnotation(IgnoreToken.class);
|
IgnoreToken ignoreClassToken = handlerMethod.getBeanType().getAnnotation(IgnoreToken.class);
|
||||||
// 获取方法上的注解
|
// 获取方法上的注解
|
||||||
IgnoreToken ignoreMethodToken = handlerMethod.getMethodAnnotation(IgnoreToken.class);
|
IgnoreToken ignoreMethodToken = handlerMethod.getMethodAnnotation(IgnoreToken.class);
|
||||||
if (ignoreClassToken != null || ignoreMethodToken != null) {
|
if (ignoreClassToken != null || ignoreMethodToken != null) {
|
||||||
// 放行
|
// 放行
|
||||||
return super.preHandle(request, response, handler);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 放行白名单
|
// 放行白名单
|
||||||
@@ -68,10 +83,22 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
|
|||||||
JwtInfo jwtInfo;
|
JwtInfo jwtInfo;
|
||||||
try {
|
try {
|
||||||
jwtInfo = JwtTokenUtil.parsingToken(token);
|
jwtInfo = JwtTokenUtil.parsingToken(token);
|
||||||
// LocalDateTime expireTime = jwtInfo.getExpireTime();
|
if (StringUtils.equals(jwtInfo.getRoleId(), MERCHANT.type)) {
|
||||||
// if (LocalDateTime.now(ZoneId.systemDefault()).isAfter(expireTime)) {
|
Long merchantId = jwtInfo.getUserId();
|
||||||
// throw new TokenExpireException("token过期");
|
ScenicAccountEntity account = scenicAccountMapper.findAccountById(merchantId.toString());
|
||||||
// }
|
LocalDateTime expireTime = jwtInfo.getExpireTime();
|
||||||
|
if (account.getUpdateTime().toInstant().getEpochSecond() != expireTime.atZone(ZoneId.systemDefault()).toEpochSecond()) {
|
||||||
|
throw new TokenExpireException("token过期");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(jwtInfo.getRoleId(), ADMIN.type)) {
|
||||||
|
Long adminId = jwtInfo.getUserId();
|
||||||
|
LoginEntity account = adminUserMapper.getById(adminId);
|
||||||
|
LocalDateTime expireTime = jwtInfo.getExpireTime();
|
||||||
|
if (account.getUpdateAt().toInstant().getEpochSecond() != expireTime.atZone(ZoneId.systemDefault()).toEpochSecond()) {
|
||||||
|
throw new TokenExpireException("token过期");
|
||||||
|
}
|
||||||
|
}
|
||||||
BaseContextHandler.setToken(token);
|
BaseContextHandler.setToken(token);
|
||||||
BaseContextHandler.setName(jwtInfo.getName());
|
BaseContextHandler.setName(jwtInfo.getName());
|
||||||
BaseContextHandler.setUserId(String.valueOf(jwtInfo.getUserId()));
|
BaseContextHandler.setUserId(String.valueOf(jwtInfo.getUserId()));
|
||||||
@@ -113,7 +140,6 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
|
|||||||
@Override
|
@Override
|
||||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||||
BaseContextHandler.remove();
|
BaseContextHandler.remove();
|
||||||
super.afterCompletion(request, response, handler, ex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToken(HttpServletRequest request) {
|
public String getToken(HttpServletRequest request) {
|
||||||
|
@@ -25,4 +25,6 @@ public interface AdminUserMapper {
|
|||||||
int updatePassword(UpdatePasswordReqVO updatePasswordReqVO);
|
int updatePassword(UpdatePasswordReqVO updatePasswordReqVO);
|
||||||
|
|
||||||
String getPasswordByAccount(@Param("id")String id);
|
String getPasswordByAccount(@Param("id")String id);
|
||||||
|
|
||||||
|
LoginEntity getById(Long id);
|
||||||
}
|
}
|
||||||
|
14
src/main/java/com/ycwl/basic/mapper/AioDeviceMapper.java
Normal file
14
src/main/java/com/ycwl/basic/mapper/AioDeviceMapper.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ycwl.basic.mapper;
|
||||||
|
|
||||||
|
import com.ycwl.basic.model.aio.entity.AioDeviceBannerEntity;
|
||||||
|
import com.ycwl.basic.model.aio.entity.AioDeviceEntity;
|
||||||
|
import com.ycwl.basic.model.aio.entity.AioDevicePriceConfigEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface AioDeviceMapper {
|
||||||
|
AioDeviceEntity getById(Long id);
|
||||||
|
AioDeviceEntity getByKey(String key);
|
||||||
|
List<AioDeviceBannerEntity> getBannerByDeviceId(Long deviceId);
|
||||||
|
AioDevicePriceConfigEntity getPriceConfigByDeviceId(Long deviceId);
|
||||||
|
}
|
@@ -30,7 +30,7 @@ public interface DeviceMapper {
|
|||||||
DeviceEntity getByDeviceId(Long deviceId);
|
DeviceEntity getByDeviceId(Long deviceId);
|
||||||
List<DeviceRespVO> listByScenicIdWithWVP(Long scenicId);
|
List<DeviceRespVO> listByScenicIdWithWVP(Long scenicId);
|
||||||
|
|
||||||
ScenicDeviceCountVO deviceCountByScenicId(@Param("scenicId") Long scenicId,@Param("userId") Long userId);
|
ScenicDeviceCountVO deviceCountByScenicId(@Param("scenicId") Long scenicId);
|
||||||
|
|
||||||
DeviceConfigEntity getConfigByDeviceId(Long deviceId);
|
DeviceConfigEntity getConfigByDeviceId(Long deviceId);
|
||||||
int addConfig(DeviceConfigEntity deviceConfigEntity);
|
int addConfig(DeviceConfigEntity deviceConfigEntity);
|
||||||
|
11
src/main/java/com/ycwl/basic/mapper/ExtraDeviceMapper.java
Normal file
11
src/main/java/com/ycwl/basic/mapper/ExtraDeviceMapper.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.ycwl.basic.mapper;
|
||||||
|
|
||||||
|
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ExtraDeviceMapper {
|
||||||
|
List<DeviceRespVO> listExtraDeviceByScenicId(Long scenicId);
|
||||||
|
}
|
@@ -36,5 +36,5 @@ public interface FaceMapper {
|
|||||||
|
|
||||||
List<FaceRespVO> listByScenicAndUserId(String scenicId, Long userId);
|
List<FaceRespVO> listByScenicAndUserId(String scenicId, Long userId);
|
||||||
|
|
||||||
List<FaceEntity> listEntityBeforeDate(Long scenicId, Date endDate);
|
List<FaceEntity> listUnpaidEntityBeforeDate(Long scenicId, Date endDate);
|
||||||
}
|
}
|
||||||
|
@@ -27,4 +27,6 @@ public interface FaceSampleMapper {
|
|||||||
|
|
||||||
FaceSampleEntity getEntity(Long faceSampleId);
|
FaceSampleEntity getEntity(Long faceSampleId);
|
||||||
List<FaceSampleEntity> listEntityBeforeDate(Long scenicId, Date endDate);
|
List<FaceSampleEntity> listEntityBeforeDate(Long scenicId, Date endDate);
|
||||||
|
|
||||||
|
void updateScore(Long id, Float score);
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@ package com.ycwl.basic.mapper;
|
|||||||
|
|
||||||
import com.ycwl.basic.model.pc.menu.MenuNode;
|
import com.ycwl.basic.model.pc.menu.MenuNode;
|
||||||
import com.ycwl.basic.model.pc.menu.entity.MenuEntity;
|
import com.ycwl.basic.model.pc.menu.entity.MenuEntity;
|
||||||
|
import com.ycwl.basic.model.pc.role.resp.RolePermissionResp;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@@ -15,18 +16,6 @@ public interface MenuMapper {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int deleteRoleMenuByRoleId(@Param("id")String roleId);
|
int deleteRoleMenuByRoleId(@Param("id")String roleId);
|
||||||
int addRoleMenu(@Param("id")String roleId,@Param("list") List<Integer> list);
|
int addRoleMenu(@Param("id")String roleId,@Param("menuStr") String menuStr, @Param("permStr") String permStr);
|
||||||
int add(MenuEntity menuEntity);
|
RolePermissionResp getPermissionByRoleId(Long roleId);
|
||||||
|
|
||||||
List<MenuNode>getListByType(@Param("type")Integer type);
|
|
||||||
|
|
||||||
int update(MenuEntity menuEntity);
|
|
||||||
int deleteById(@Param("id")Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据菜单id删除角色菜单
|
|
||||||
* @param menuId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int deleteRoleMenuByMenuId(@Param("id")String menuId);
|
|
||||||
}
|
}
|
||||||
|
10
src/main/java/com/ycwl/basic/mapper/PrintTaskMapper.java
Normal file
10
src/main/java/com/ycwl/basic/mapper/PrintTaskMapper.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package com.ycwl.basic.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ycwl.basic.model.pc.printer.entity.PrintTaskEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface PrintTaskMapper extends BaseMapper<PrintTaskEntity> {
|
||||||
|
int insertTask(PrintTaskEntity entity);
|
||||||
|
}
|
@@ -42,4 +42,12 @@ public interface PrinterMapper {
|
|||||||
int setPhotoCropped(Long memberId, Long scenicId, Long id, String url);
|
int setPhotoCropped(Long memberId, Long scenicId, Long id, String url);
|
||||||
|
|
||||||
int setPhotoQuantity(Long memberId, Long scenicId, Long id, Integer quantity);
|
int setPhotoQuantity(Long memberId, Long scenicId, Long id, Integer quantity);
|
||||||
|
|
||||||
|
List<MemberPrintResp> getUserPhotoByIds(List<Long> ids);
|
||||||
|
|
||||||
|
int setUserIsBuyItem(Long memberId, Long id, Long orderId);
|
||||||
|
|
||||||
|
void updateUserPhotoListToPrinter(Long memberId, Long scenicId, Integer printerId);
|
||||||
|
|
||||||
|
List<MemberPrintResp> listRelationByOrderId(Long orderId);
|
||||||
}
|
}
|
@@ -21,4 +21,6 @@ public interface RenderWorkerMapper {
|
|||||||
int updateStatus(Long id);
|
int updateStatus(Long id);
|
||||||
|
|
||||||
RenderWorkerEntity findByAccessKey(String accessKey);
|
RenderWorkerEntity findByAccessKey(String accessKey);
|
||||||
|
|
||||||
|
int updateHost(Long id, RenderWorkerEntity status);
|
||||||
}
|
}
|
||||||
|
@@ -19,4 +19,11 @@ public interface ScenicAccountMapper {
|
|||||||
ScenicAccountEntity findAccountById(String id);
|
ScenicAccountEntity findAccountById(String id);
|
||||||
List<ScenicAccountEntity> pageQuery(ScenicAccountReqQuery req);
|
List<ScenicAccountEntity> pageQuery(ScenicAccountReqQuery req);
|
||||||
|
|
||||||
|
int addAccountScenicRelation(Long accountId, Long scenicId, int isAdmin);
|
||||||
|
|
||||||
|
int deleteRelationByScenicId(Long scenicId);
|
||||||
|
|
||||||
|
List<Long> getAccountRelations(Long accountId);
|
||||||
|
|
||||||
|
int deleteRelationById(Long accountId);
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,25 @@
|
|||||||
|
package com.ycwl.basic.mapper;
|
||||||
|
|
||||||
|
import com.ycwl.basic.model.pc.scenicDeviceStats.entity.ScenicDeviceStatsEntity;
|
||||||
|
import com.ycwl.basic.model.pc.scenicDeviceStats.resp.ScenicDeviceStatsResp;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 景区设备统计Mapper接口
|
||||||
|
*/
|
||||||
|
public interface ScenicDeviceStatsMapper {
|
||||||
|
/**
|
||||||
|
* 插入景区设备统计记录
|
||||||
|
* @param stats 景区设备统计对象
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int insert(@Param("stats") ScenicDeviceStatsEntity stats);
|
||||||
|
|
||||||
|
List<ScenicDeviceStatsEntity> countDeviceStats(Date start, Date end);
|
||||||
|
|
||||||
|
List<ScenicDeviceStatsResp> countCachedStatsByScenicId(Long scenicId, Date start, Date end);
|
||||||
|
List<ScenicDeviceStatsResp> countRealtimeStatsByScenicId(Long scenicId, Date start, Date end);
|
||||||
|
}
|
@@ -57,6 +57,7 @@ public interface SourceMapper {
|
|||||||
int addRelations(List<MemberSourceEntity> list);
|
int addRelations(List<MemberSourceEntity> list);
|
||||||
|
|
||||||
int updateRelation(MemberSourceEntity memberSourceEntity);
|
int updateRelation(MemberSourceEntity memberSourceEntity);
|
||||||
|
int freeRelations(List<Long> ids, int type);
|
||||||
|
|
||||||
List<SourceRespVO> queryByRelation(SourceReqQuery sourceReqQuery);
|
List<SourceRespVO> queryByRelation(SourceReqQuery sourceReqQuery);
|
||||||
|
|
||||||
@@ -68,6 +69,7 @@ public interface SourceMapper {
|
|||||||
List<SourceEntity> listVideoByFaceRelation(Long memberId, Long faceId);
|
List<SourceEntity> listVideoByFaceRelation(Long memberId, Long faceId);
|
||||||
|
|
||||||
List<SourceEntity> listImageByFaceRelation(Long memberId, Long faceId);
|
List<SourceEntity> listImageByFaceRelation(Long memberId, Long faceId);
|
||||||
|
List<MemberSourceEntity> listByFaceRelation(Long memberId, Long faceId, Integer type);
|
||||||
|
|
||||||
SourceEntity getEntity(Long id);
|
SourceEntity getEntity(Long id);
|
||||||
|
|
||||||
@@ -79,4 +81,6 @@ public interface SourceMapper {
|
|||||||
List<SourceWatermarkEntity> listSourceWatermark(List<Long> sourceIds, Long faceId, String watermarkType);
|
List<SourceWatermarkEntity> listSourceWatermark(List<Long> sourceIds, Long faceId, String watermarkType);
|
||||||
|
|
||||||
void addSourceWatermark(Long sourceId, Long faceId, String type, String url);
|
void addSourceWatermark(Long sourceId, Long faceId, String type, String url);
|
||||||
|
|
||||||
|
int deleteUselessSource();
|
||||||
}
|
}
|
||||||
|
@@ -2,10 +2,12 @@ package com.ycwl.basic.mapper;
|
|||||||
|
|
||||||
import com.ycwl.basic.model.mobile.statistic.req.CommonQueryReq;
|
import com.ycwl.basic.model.mobile.statistic.req.CommonQueryReq;
|
||||||
import com.ycwl.basic.model.mobile.statistic.req.StatisticsRecordAddReq;
|
import com.ycwl.basic.model.mobile.statistic.req.StatisticsRecordAddReq;
|
||||||
|
import com.ycwl.basic.model.mobile.statistic.resp.AppStatisticsFunnelVO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,4 +95,11 @@ public interface StatisticsMapper {
|
|||||||
List<Long> getBrokerIdListForUser(Long memberId, Date startTime, Date endTime);
|
List<Long> getBrokerIdListForUser(Long memberId, Date startTime, Date endTime);
|
||||||
|
|
||||||
Long getUserRecentEnterType(Long memberId, Date endTime);
|
Long getUserRecentEnterType(Long memberId, Date endTime);
|
||||||
|
|
||||||
|
List<AppStatisticsFunnelVO> listStatByScenic(Long scenicId, Date startTime, Date endTime);
|
||||||
|
int insertStat(Long scenicId, Date date, AppStatisticsFunnelVO data);
|
||||||
|
|
||||||
|
List<HashMap<String, String>> orderChartByDate(CommonQueryReq query);
|
||||||
|
|
||||||
|
List<HashMap<String, String>> orderChartByHour(CommonQueryReq query);
|
||||||
}
|
}
|
||||||
|
@@ -54,4 +54,6 @@ public interface VideoMapper {
|
|||||||
int deleteNotBuyRelations(Long scenicId, Date endDate);
|
int deleteNotBuyRelations(Long scenicId, Date endDate);
|
||||||
|
|
||||||
int deleteNotBuyFaceRelations(Long userId, Long faceId);
|
int deleteNotBuyFaceRelations(Long userId, Long faceId);
|
||||||
|
|
||||||
|
int deleteUselessVideo();
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,35 @@
|
|||||||
|
package com.ycwl.basic.model.aio.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 智能设备横幅实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AioDeviceBannerEntity {
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ID
|
||||||
|
*/
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 横幅URL
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 (0-禁用 1-启用)
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createAt;
|
||||||
|
}
|
@@ -0,0 +1,45 @@
|
|||||||
|
package com.ycwl.basic.model.aio.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 智能设备实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AioDeviceEntity {
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 景区ID
|
||||||
|
*/
|
||||||
|
private Long scenicId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接入密钥
|
||||||
|
*/
|
||||||
|
private String accessKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 (0-离线 1-在线)
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createAt;
|
||||||
|
}
|
@@ -0,0 +1,17 @@
|
|||||||
|
package com.ycwl.basic.model.aio.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AioDevicePriceConfigEntity {
|
||||||
|
/**
|
||||||
|
* 设备ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
private BigDecimal eachPrice;
|
||||||
|
private Integer status;
|
||||||
|
private Date createAt;
|
||||||
|
}
|
@@ -0,0 +1,18 @@
|
|||||||
|
package com.ycwl.basic.model.aio.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AioDeviceCreateOrderReq {
|
||||||
|
private Long faceId;
|
||||||
|
private String payType;
|
||||||
|
private List<AioDeviceOrderItem> items;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class AioDeviceOrderItem {
|
||||||
|
private Long goodsId;
|
||||||
|
private Integer count;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,10 @@
|
|||||||
|
package com.ycwl.basic.model.aio.resp;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AioDeviceCreateOrderResp {
|
||||||
|
private boolean skipPay;
|
||||||
|
private Long orderId;
|
||||||
|
private String payCode;
|
||||||
|
}
|
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ycwl.basic.model.aio.resp;
|
||||||
|
|
||||||
|
import com.ycwl.basic.model.aio.entity.AioDeviceBannerEntity;
|
||||||
|
import com.ycwl.basic.model.aio.entity.AioDeviceEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AioDeviceInfoResp {
|
||||||
|
private AioDeviceEntity info;
|
||||||
|
private List<AioDeviceBannerEntity> banners;
|
||||||
|
}
|
@@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ import java.time.LocalDateTime;
|
|||||||
@ToString
|
@ToString
|
||||||
public class JwtInfo implements Serializable {
|
public class JwtInfo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 5452605590172369563L;
|
private static final long serialVersionUID = 5452605590172369563L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,11 +44,6 @@ public class JwtInfo implements Serializable {
|
|||||||
|
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/**
|
|
||||||
* 景区id
|
|
||||||
*/
|
|
||||||
private Long scenicId;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成 token 的时间
|
* 生成 token 的时间
|
||||||
|
@@ -19,6 +19,8 @@ import java.util.Date;
|
|||||||
public class GoodsDetailVO {
|
public class GoodsDetailVO {
|
||||||
@ApiModelProperty("商品名称")
|
@ApiModelProperty("商品名称")
|
||||||
private String goodsName;
|
private String goodsName;
|
||||||
|
@ApiModelProperty("人脸id")
|
||||||
|
private Long faceId;
|
||||||
@ApiModelProperty("景区id")
|
@ApiModelProperty("景区id")
|
||||||
private Long scenicId;
|
private Long scenicId;
|
||||||
@ApiModelProperty("景区名称")
|
@ApiModelProperty("景区名称")
|
||||||
@@ -41,6 +43,7 @@ public class GoodsDetailVO {
|
|||||||
private Integer isBuy;
|
private Integer isBuy;
|
||||||
private Integer isFree;
|
private Integer isFree;
|
||||||
private Integer parts;
|
private Integer parts;
|
||||||
|
private Integer sort;
|
||||||
public Integer getSourceType() {
|
public Integer getSourceType() {
|
||||||
return goodsType;
|
return goodsType;
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -12,6 +13,7 @@ import java.util.Date;
|
|||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/11/29 16:33
|
* @Date:2024/11/29 16:33
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@ApiModel(value = "移动端订单查询对象")
|
@ApiModel(value = "移动端订单查询对象")
|
||||||
public class OrderAppPageReq extends BaseQueryParameterReq {
|
public class OrderAppPageReq extends BaseQueryParameterReq {
|
||||||
|
@@ -70,7 +70,7 @@ public class ScenicAppVO {
|
|||||||
/**
|
/**
|
||||||
* 距离
|
* 距离
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty("距离")
|
@ApiModelProperty("距离米")
|
||||||
private BigDecimal distance;
|
private BigDecimal distance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -0,0 +1,28 @@
|
|||||||
|
package com.ycwl.basic.model.mobile.scenic.account;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:longbinbin
|
||||||
|
* @Date:2024/12/13 9:44
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("景区账号登录响应类")
|
||||||
|
public class ScenicLoginOldRespVO {
|
||||||
|
private Long id;
|
||||||
|
@ApiModelProperty("景区id")
|
||||||
|
private Long scenicId;
|
||||||
|
@ApiModelProperty("是否是超级管理员")
|
||||||
|
private Integer isSuper;
|
||||||
|
@ApiModelProperty("账号名称")
|
||||||
|
private String name;
|
||||||
|
@ApiModelProperty("账号")
|
||||||
|
private String account;
|
||||||
|
@ApiModelProperty("1启用 0禁用")
|
||||||
|
private Integer status;
|
||||||
|
private String token;
|
||||||
|
}
|
@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/12/13 9:44
|
* @Date:2024/12/13 9:44
|
||||||
@@ -13,7 +15,7 @@ import lombok.Data;
|
|||||||
public class ScenicLoginRespVO {
|
public class ScenicLoginRespVO {
|
||||||
private Long id;
|
private Long id;
|
||||||
@ApiModelProperty("景区id")
|
@ApiModelProperty("景区id")
|
||||||
private Long scenicId;
|
private List<Long> scenicId;
|
||||||
@ApiModelProperty("是否是超级管理员")
|
@ApiModelProperty("是否是超级管理员")
|
||||||
private Integer isSuper;
|
private Integer isSuper;
|
||||||
@ApiModelProperty("账号名称")
|
@ApiModelProperty("账号名称")
|
||||||
|
@@ -34,4 +34,6 @@ public class ContentPageVO {
|
|||||||
private Integer isBuy;
|
private Integer isBuy;
|
||||||
private BigDecimal duration;
|
private BigDecimal duration;
|
||||||
private Integer goodsType;
|
private Integer goodsType;
|
||||||
|
private int freeCount;
|
||||||
|
private Integer sort;
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,7 @@ public class CommonQueryReq {
|
|||||||
private Integer standard;
|
private Integer standard;
|
||||||
@ApiModelProperty(value = "景区id")
|
@ApiModelProperty(value = "景区id")
|
||||||
private Long scenicId;
|
private Long scenicId;
|
||||||
|
private boolean realtime;
|
||||||
private Date startTime;
|
private Date startTime;
|
||||||
private Date endTime;
|
private Date endTime;
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,8 @@ package com.ycwl.basic.model.mobile.statistic.resp;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
@@ -13,49 +15,118 @@ import lombok.Data;
|
|||||||
public class AppStatisticsFunnelVO {
|
public class AppStatisticsFunnelVO {
|
||||||
|
|
||||||
@ApiModelProperty("镜头检测游客数")
|
@ApiModelProperty("镜头检测游客数")
|
||||||
// private Integer cameraShotOfMemberNum;
|
private int cameraShotOfMemberNum; // cs1
|
||||||
private String cameraShotOfMemberNum;
|
|
||||||
@ApiModelProperty("镜头检测游客数_扫码访问人数_转化率")
|
|
||||||
private String csom_scaom;
|
|
||||||
@ApiModelProperty("扫码访问人数")
|
@ApiModelProperty("扫码访问人数")
|
||||||
private Integer scanCodeVisitorOfMemberNum;
|
private int scanCodeVisitorOfMemberNum; // sv1
|
||||||
@ApiModelProperty("扫码访问人数_上传头像人数_转化率")
|
|
||||||
private String scaom_ufom;
|
|
||||||
@ApiModelProperty("上传头像(人脸)人数")
|
@ApiModelProperty("上传头像(人脸)人数")
|
||||||
private Integer uploadFaceOfMemberNum;
|
private int uploadFaceOfMemberNum; // u1
|
||||||
@ApiModelProperty("上传头像人数_推送订阅人数_转化率")
|
|
||||||
private String ufom_pom;
|
|
||||||
@ApiModelProperty("推送订阅人数")
|
@ApiModelProperty("推送订阅人数")
|
||||||
private Integer pushOfMemberNum;
|
private int pushOfMemberNum; // m1
|
||||||
@ApiModelProperty("推送订阅人数_生成视频人数_转化率")
|
|
||||||
private String pom_cvom;
|
|
||||||
@ApiModelProperty("生成视频人数")
|
@ApiModelProperty("生成视频人数")
|
||||||
private Integer completeVideoOfMemberNum;
|
private int completeVideoOfMemberNum; // gv1
|
||||||
@ApiModelProperty("生成视频人数_预览视频人数_转化率")
|
|
||||||
private String cvom_pvom;
|
|
||||||
@ApiModelProperty("预览视频人数")
|
@ApiModelProperty("预览视频人数")
|
||||||
private Integer previewVideoOfMemberNum;
|
private int previewVideoOfMemberNum; // pv1
|
||||||
@ApiModelProperty("预览视频人数_点击购买人数_转化率")
|
|
||||||
private String pvom_cpom;
|
|
||||||
@ApiModelProperty("点击购买人数")
|
@ApiModelProperty("点击购买人数")
|
||||||
private Integer clickOnPayOfMemberNum;
|
private int clickOnPayOfMemberNum; // cp1
|
||||||
@ApiModelProperty("点击购买人数_支付订单人数_转化率")
|
|
||||||
private String cpom_pom;
|
|
||||||
@ApiModelProperty("支付订单人数")
|
@ApiModelProperty("支付订单人数")
|
||||||
private Integer payOfMemberNum;
|
private int payOfMemberNum; // p1
|
||||||
|
|
||||||
@ApiModelProperty("总访问人数")
|
@ApiModelProperty("总访问人数")
|
||||||
private Integer totalVisitorOfMemberNum;
|
private int totalVisitorOfMemberNum; // v1
|
||||||
@ApiModelProperty("生成视频条数")
|
@ApiModelProperty("生成视频条数")
|
||||||
private Integer completeOfVideoNum;
|
private int completeOfVideoNum; // gv2
|
||||||
@ApiModelProperty("预览视频条数")
|
@ApiModelProperty("预览视频条数")
|
||||||
private Integer previewOfVideoNum;
|
private int previewOfVideoNum; // pv2
|
||||||
@ApiModelProperty("支付订单数")
|
@ApiModelProperty("支付订单数")
|
||||||
private Integer payOfOrderNum;
|
private int payOfOrderNum; // p2
|
||||||
@ApiModelProperty("支付订单金额")
|
@ApiModelProperty("支付订单金额")
|
||||||
private String payOfOrderAmount;
|
private BigDecimal payOfOrderAmount; // o3
|
||||||
@ApiModelProperty("退款订单数")
|
@ApiModelProperty("退款订单数")
|
||||||
private Integer refundOfOrderNum;
|
private int refundOfOrderNum; // ro2
|
||||||
@ApiModelProperty("退款订单金额")
|
@ApiModelProperty("退款订单金额")
|
||||||
private String refundOfOrderAmount;
|
private BigDecimal refundOfOrderAmount; // ro3
|
||||||
|
|
||||||
|
@ApiModelProperty("镜头检测游客数_扫码访问人数_转化率")
|
||||||
|
public String getCsom_scaom() {
|
||||||
|
return "-"; // TODO: REAL
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty("扫码访问人数_上传头像人数_转化率")
|
||||||
|
public String getScaom_ufom() {
|
||||||
|
if (uploadFaceOfMemberNum == 0 || scanCodeVisitorOfMemberNum == 0) {
|
||||||
|
return "0.00";
|
||||||
|
}
|
||||||
|
return new BigDecimal(uploadFaceOfMemberNum)
|
||||||
|
.multiply(new BigDecimal(100))
|
||||||
|
.divide(new BigDecimal(scanCodeVisitorOfMemberNum), 2, RoundingMode.HALF_UP)
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
@ApiModelProperty("上传头像人数_推送订阅人数_转化率")
|
||||||
|
public String getUfom_pom() {
|
||||||
|
if (pushOfMemberNum == 0 || uploadFaceOfMemberNum == 0) {
|
||||||
|
return "0.00";
|
||||||
|
}
|
||||||
|
return new BigDecimal(uploadFaceOfMemberNum)
|
||||||
|
.multiply(new BigDecimal(100))
|
||||||
|
.divide(new BigDecimal(pushOfMemberNum), 2, RoundingMode.HALF_UP)
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
@ApiModelProperty("推送订阅人数_生成视频人数_转化率")
|
||||||
|
public String getPom_cvom() {
|
||||||
|
if (completeVideoOfMemberNum == 0 || pushOfMemberNum == 0) {
|
||||||
|
return "0.00";
|
||||||
|
}
|
||||||
|
return new BigDecimal(completeVideoOfMemberNum)
|
||||||
|
.multiply(new BigDecimal(100))
|
||||||
|
.divide(new BigDecimal(pushOfMemberNum), 2, RoundingMode.HALF_UP)
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
@ApiModelProperty("生成视频人数_预览视频人数_转化率")
|
||||||
|
public String getCvom_pvom() {
|
||||||
|
if (previewVideoOfMemberNum == 0 || completeVideoOfMemberNum == 0) {
|
||||||
|
return "0.00";
|
||||||
|
}
|
||||||
|
return new BigDecimal(previewVideoOfMemberNum)
|
||||||
|
.multiply(new BigDecimal(100))
|
||||||
|
.divide(new BigDecimal(completeVideoOfMemberNum), 2, RoundingMode.HALF_UP)
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
@ApiModelProperty("预览视频人数_点击购买人数_转化率")
|
||||||
|
public String getPvom_cpom() {
|
||||||
|
if (clickOnPayOfMemberNum == 0 || previewVideoOfMemberNum == 0) {
|
||||||
|
return "0.00";
|
||||||
|
}
|
||||||
|
return new BigDecimal(clickOnPayOfMemberNum)
|
||||||
|
.multiply(new BigDecimal(100))
|
||||||
|
.divide(new BigDecimal(previewVideoOfMemberNum), 2, RoundingMode.HALF_UP)
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
@ApiModelProperty("点击购买人数_支付订单人数_转化率")
|
||||||
|
public String getCpom_pom() {
|
||||||
|
if (payOfMemberNum == 0 || clickOnPayOfMemberNum == 0) {
|
||||||
|
return "0.00";
|
||||||
|
}
|
||||||
|
return new BigDecimal(payOfMemberNum)
|
||||||
|
.multiply(new BigDecimal(100))
|
||||||
|
.divide(new BigDecimal(clickOnPayOfMemberNum), 2, RoundingMode.HALF_UP)
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
public BigDecimal payOfOrderAmount() {
|
||||||
|
return payOfOrderAmount;
|
||||||
|
}
|
||||||
|
public String getPayOfOrderAmount() {
|
||||||
|
if (payOfOrderAmount == null) {
|
||||||
|
return "0.00";
|
||||||
|
}
|
||||||
|
return payOfOrderAmount.toString();
|
||||||
|
}
|
||||||
|
public BigDecimal refundOfOrderAmount() {
|
||||||
|
return refundOfOrderAmount;
|
||||||
|
}
|
||||||
|
public String getRefundOfOrderAmount() {
|
||||||
|
if (refundOfOrderAmount == null) {
|
||||||
|
return "0.00";
|
||||||
|
}
|
||||||
|
return refundOfOrderAmount.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,12 +2,15 @@ package com.ycwl.basic.model.pc.adminUser.entity;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class LoginEntity {
|
public class LoginEntity {
|
||||||
private Long staffId;
|
private Long staffId;
|
||||||
private String staffName;
|
private String staffName;
|
||||||
private String account;
|
private String account;
|
||||||
private String password;
|
private String password;
|
||||||
private String roleId;
|
private Long roleId;
|
||||||
private String typeName;
|
private String typeName;
|
||||||
|
private Date updateAt;
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,9 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@ApiModel(value = "后台管理人员请求VO")
|
@ApiModel(value = "后台管理人员请求VO")
|
||||||
public class AdminUserListReqVO extends BaseQueryParameterReq {
|
public class AdminUserListReqVO extends BaseQueryParameterReq {
|
||||||
|
@@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ApiModel(value = "")
|
@ApiModel()
|
||||||
public class UpdatePasswordReqVO {
|
public class UpdatePasswordReqVO {
|
||||||
@ApiModelProperty(value = "id",hidden = true)
|
@ApiModelProperty(value = "id",hidden = true)
|
||||||
private String id;
|
private String id;
|
||||||
|
@@ -17,6 +17,5 @@ public class LoginRespVO {
|
|||||||
private String name;
|
private String name;
|
||||||
@ApiModelProperty(value = "角色名")
|
@ApiModelProperty(value = "角色名")
|
||||||
private String typeName;
|
private String typeName;
|
||||||
@ApiModelProperty(value = "菜单列表")
|
private boolean superAdmin;
|
||||||
private List<MenuNode> menuNodeList;
|
|
||||||
}
|
}
|
||||||
|
@@ -6,6 +6,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -13,6 +14,7 @@ import java.util.Date;
|
|||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/12/12 10:00
|
* @Date:2024/12/12 10:00
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("查询推客记录请求参数")
|
@ApiModel("查询推客记录请求参数")
|
||||||
public class BrokerRecordReqQuery extends BaseQueryParameterReq {
|
public class BrokerRecordReqQuery extends BaseQueryParameterReq {
|
||||||
|
@@ -5,6 +5,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ import java.util.Date;
|
|||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/11/29 14:29
|
* @Date:2024/11/29 14:29
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("查询推客列表请求参数")
|
@ApiModel("查询推客列表请求参数")
|
||||||
public class BrokerReqQuery extends BaseQueryParameterReq {
|
public class BrokerReqQuery extends BaseQueryParameterReq {
|
||||||
|
@@ -1,11 +1,15 @@
|
|||||||
package com.ycwl.basic.model.pc.device.entity;
|
package com.ycwl.basic.model.pc.device.entity;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@TableName("device_config")
|
@TableName("device_config")
|
||||||
@@ -61,4 +65,19 @@ public class DeviceConfigEntity {
|
|||||||
private Integer imageFree;
|
private Integer imageFree;
|
||||||
private Integer videoFree;
|
private Integer videoFree;
|
||||||
private Long pairDevice;
|
private Long pairDevice;
|
||||||
|
private String videoCrop;
|
||||||
|
private String cropConfig;
|
||||||
|
|
||||||
|
public List<DeviceCropConfig> _getCropConfig() {
|
||||||
|
if (cropConfig == null || cropConfig.isEmpty()) {
|
||||||
|
return Collections.singletonList(new DeviceCropConfig());
|
||||||
|
}
|
||||||
|
if (StringUtils.startsWith(cropConfig, "{")) {
|
||||||
|
return Collections.singletonList(JSON.parseObject(cropConfig, DeviceCropConfig.class));
|
||||||
|
}
|
||||||
|
if (StringUtils.startsWith(cropConfig, "[")) {
|
||||||
|
return JSON.parseArray(cropConfig, DeviceCropConfig.class);
|
||||||
|
}
|
||||||
|
return Collections.singletonList(new DeviceCropConfig());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.ycwl.basic.model.pc.device.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DeviceCropConfig {
|
||||||
|
// 截图类型 0:无截图 1:固定截图 2:按人脸位置截图
|
||||||
|
private int cropType;
|
||||||
|
private Integer targetWidth;
|
||||||
|
private Integer targetHeight;
|
||||||
|
private Integer targetX;
|
||||||
|
private Integer targetY;
|
||||||
|
}
|
@@ -5,6 +5,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ import java.util.Date;
|
|||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/11/29 14:53
|
* @Date:2024/11/29 14:53
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("设备查询参数")
|
@ApiModel("设备查询参数")
|
||||||
public class DeviceReqQuery extends BaseQueryParameterReq {
|
public class DeviceReqQuery extends BaseQueryParameterReq {
|
||||||
|
@@ -8,6 +8,6 @@ public class DeviceSortRequest {
|
|||||||
@ApiModelProperty(value = "被操作模板的ID", required = true)
|
@ApiModelProperty(value = "被操作模板的ID", required = true)
|
||||||
private Long deviceId;
|
private Long deviceId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排在其后的模板ID", required = false)
|
@ApiModelProperty(value = "排在其后的模板ID")
|
||||||
private Long afterDeviceId;
|
private Long afterDeviceId;
|
||||||
}
|
}
|
@@ -5,6 +5,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -13,6 +14,7 @@ import java.util.Date;
|
|||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/11/29 15:16
|
* @Date:2024/11/29 15:16
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("人脸查询参数")
|
@ApiModel("人脸查询参数")
|
||||||
public class FaceReqQuery extends BaseQueryParameterReq {
|
public class FaceReqQuery extends BaseQueryParameterReq {
|
||||||
|
@@ -7,6 +7,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -14,6 +15,7 @@ import java.util.Date;
|
|||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/11/29 15:40
|
* @Date:2024/11/29 15:40
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("人脸样本查询参数")
|
@ApiModel("人脸样本查询参数")
|
||||||
public class FaceSampleReqQuery extends BaseQueryParameterReq {
|
public class FaceSampleReqQuery extends BaseQueryParameterReq {
|
||||||
@@ -36,4 +38,6 @@ public class FaceSampleReqQuery extends BaseQueryParameterReq {
|
|||||||
private Date startTime;
|
private Date startTime;
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date endTime;
|
private Date endTime;
|
||||||
|
|
||||||
|
private String matchSampleIds;
|
||||||
}
|
}
|
||||||
|
@@ -6,6 +6,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -13,6 +14,7 @@ import java.util.Date;
|
|||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/11/29 15:59
|
* @Date:2024/11/29 15:59
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("查询用户列表请求参数")
|
@ApiModel("查询用户列表请求参数")
|
||||||
public class MemberReqQuery extends BaseQueryParameterReq {
|
public class MemberReqQuery extends BaseQueryParameterReq {
|
||||||
|
@@ -26,5 +26,6 @@ public class OrderItemEntity {
|
|||||||
* 商品ID,goods_type=1关联video.id,=2关联source.id
|
* 商品ID,goods_type=1关联video.id,=2关联source.id
|
||||||
*/
|
*/
|
||||||
private Long goodsId;
|
private Long goodsId;
|
||||||
|
private int count = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -15,6 +16,7 @@ import java.util.Date;
|
|||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/11/29 16:33
|
* @Date:2024/11/29 16:33
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@ApiModel(value = "订单查询对象")
|
@ApiModel(value = "订单查询对象")
|
||||||
public class OrderReqQuery extends BaseQueryParameterReq {
|
public class OrderReqQuery extends BaseQueryParameterReq {
|
||||||
@@ -31,16 +33,6 @@ public class OrderReqQuery extends BaseQueryParameterReq {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty("微信openId")
|
@ApiModelProperty("微信openId")
|
||||||
private Long openId;
|
private Long openId;
|
||||||
/**
|
|
||||||
* 价格
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("价格")
|
|
||||||
private BigDecimal price;
|
|
||||||
/**
|
|
||||||
* 实际支付价格
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("实际支付价格")
|
|
||||||
private BigDecimal payPrice;
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@@ -6,22 +6,26 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@TableName("permission")
|
@TableName("permission")
|
||||||
public class PermissionEntity implements Serializable {
|
public class PermissionEntity implements Serializable {
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@TableField("user_id")
|
@TableField("user_id")
|
||||||
private Long userId; // 确保字段映射
|
private Long userId;
|
||||||
|
|
||||||
@TableField("perm_str")
|
@TableField("perm_str")
|
||||||
private String permString;
|
private String permString;
|
||||||
|
@TableField("menu_str")
|
||||||
|
private String menuString;
|
||||||
|
|
||||||
@TableField("create_time")
|
@TableField("create_time")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
@@ -7,4 +7,5 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
public class PermissionSaveReq {
|
public class PermissionSaveReq {
|
||||||
private List<String> permissions;
|
private List<String> permissions;
|
||||||
|
private List<String> menus;
|
||||||
}
|
}
|
@@ -9,4 +9,5 @@ import java.util.List;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class PermissionResp {
|
public class PermissionResp {
|
||||||
private List<String> permissions;
|
private List<String> permissions;
|
||||||
|
private List<String> menus;
|
||||||
}
|
}
|
||||||
|
@@ -7,4 +7,5 @@ public class PriceConfigListReq {
|
|||||||
private Long scenicId;
|
private Long scenicId;
|
||||||
private Integer type;
|
private Integer type;
|
||||||
private Long goodsId;
|
private Long goodsId;
|
||||||
|
private Integer status;
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user