feat(平台管理):新增小程序的管理,多个小程序登录unionId管理

This commit is contained in:
2025-05-22 16:31:46 +08:00
parent 52f0f9d54e
commit 5710c79d48
192 changed files with 562 additions and 12350 deletions
-45
View File
@@ -1,45 +0,0 @@
待开发功能:
1. 景区管理
2. 套餐管理
3. 素材管理
-- 订单创建时间 + 状态的联合索引(用于时间范围和状态统计)
CREATE INDEX idx_orders_create_status ON orders(create_time, order_status);
-- 二维码ID + 创建时间的联合索引(用于按二维码统计)
CREATE INDEX idx_orders_qrcode_time ON orders(code_id, create_time);
-- 景区ID + 创建时间的联合索引(用于按景区统计)
CREATE INDEX idx_orders_tourism_time ON orders(tourism_id, create_time);
-- 设备编号 + 创建时间的联合索引(用于按设备统计)
CREATE INDEX idx_orders_device_time ON orders(device_sn, create_time);
-- 软删除标记 + 创建时间的联合索引(用于过滤已删除订单)
CREATE INDEX idx_orders_del_time ON orders(is_del, create_time);
服务号推送消息功能
1. 登录微信公众平台(mp.weixin.qq.com)
2. 配置服务器:
- 进入"设置与开发 -> 基本配置"
- 填写服务器配置
- URL: https://你的域名/wx/message
- Token: 与配置文件中的token一致
- EncodingAESKey: 点击随机生成,复制到配置文件
- 消息加解密方式: 选择安全模式
3. 配置消息模板:
- 进入"功能 -> 模板消息"
- 添加所需的消息模板
- 复制模板ID到配置文件
4. 配置云托管(如果使用):
- 进入"云托管"
- 创建环境
- 部署服务
- 配置域名
-192
View File
@@ -1,192 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.zlt</groupId>
<artifactId>zlt-business</artifactId>
<version>6.0.0</version>
</parent>
<artifactId>edu-center</artifactId>
<description>教育中心</description>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- 公共实体类模块 -->
<dependency>
<groupId>com.zlt</groupId>
<artifactId>zlt-config</artifactId>
</dependency>
<dependency>
<groupId>com.zlt</groupId>
<artifactId>zlt-log-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.zlt</groupId>
<artifactId>zlt-common-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.zlt</groupId>
<artifactId>zlt-db-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.zlt</groupId>
<artifactId>zlt-redis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.zlt</groupId>
<artifactId>zlt-loadbalancer-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.zlt</groupId>
<artifactId>zlt-sentinel-spring-boot-starter</artifactId>
</dependency>
<!-- swagger -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.zlt</groupId>
<artifactId>search-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>com.github.wechatpay-apiv3</groupId>
<artifactId>wechatpay-java</artifactId>
<version>0.2.15</version>
</dependency>
<!-- 微信公众号 SDK -->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
<version>4.5.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.1</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-miniapp</artifactId>
<version>4.6.0</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-common</artifactId>
<version>4.6.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibabacloud-ice20201109</artifactId>
<version>5.0.3</version>
</dependency>
<!-- Spring Retry -->
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<forceTags>true</forceTags>
<baseImage>${docker.baseImage}</baseImage>
<volumes>${docker.volumes}</volumes>
<env>
<JAVA_OPTS>${docker.java.opts}</JAVA_OPTS>
</env>
<entryPoint>["sh","-c","java $JAVA_OPTS ${docker.java.security.egd} -jar /${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</project>
@@ -1,22 +0,0 @@
package com.central.order;
import com.central.common.lb.annotation.EnableFeignInterceptor;
import com.central.search.annotation.EnableSearchClient;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @author 作者 lsl E-mail: 1272745473@qq.com
*/
@EnableDiscoveryClient
@EnableSearchClient
@EnableTransactionManagement
@EnableFeignInterceptor
@SpringBootApplication
public class EduCenterApp {
public static void main(String[] args) {
SpringApplication.run(EduCenterApp.class, args);
}
}
@@ -1,42 +0,0 @@
package com.central.order.config;
import com.aliyun.auth.credentials.Credential;
import com.aliyun.auth.credentials.provider.StaticCredentialProvider;
import com.aliyun.sdk.service.ice20201109.AsyncClient;
import darabonba.core.client.ClientOverrideConfiguration;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Data
@Configuration
@ConfigurationProperties(prefix = "aliyun.ims")
public class AliyunImsConfig {
private String endpoint; // ice.cn-beijing.aliyuncs.com
private String ossEndpoint; // oss-cn-beijing.aliyuncs.com
private String accessKeyId;
private String accessKeySecret;
private String region; // cn-beijing
private String bucket; // goflyapp
private String callbackUrl;
@Bean
public AsyncClient imsClient() {
// 配置凭证
StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder()
.accessKeyId(accessKeyId)
.accessKeySecret(accessKeySecret)
.build());
// 配置客户端
return AsyncClient.builder()
.region(region)
.credentialsProvider(provider)
.overrideConfiguration(
ClientOverrideConfiguration.create()
.setEndpointOverride(endpoint)
)
.build();
}
}
@@ -1,31 +0,0 @@
package com.central.order.config;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
@Configuration
@EnableAsync
public class AsyncConfig implements AsyncConfigurer {
@Override
public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(5);
executor.setMaxPoolSize(10);
executor.setQueueCapacity(25);
executor.setThreadNamePrefix("message-async-");
executor.initialize();
return executor;
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return new SimpleAsyncUncaughtExceptionHandler();
}
}
@@ -1,58 +0,0 @@
package com.central.order.config;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ConfigurationProperties(prefix = "wechat.pay.profit-sharing")
@Component
public class ProfitSharingProperties {
/**
* 是否启用分账功能
*/
@Builder.Default
private boolean enabled = true;
/**
* 最大重试次数
*/
@Builder.Default
private int maxRetryTimes = 3;
/**
* 重试间隔(毫秒)
*/
@Builder.Default
private long retryInterval = 300000; // 5分钟
/**
* 平台分账比例(%)
*/
@Builder.Default
private String platformRate = "30";
/**
* 分账超时时间(毫秒)
*/
@Builder.Default
private long timeout = 1800000; // 30分钟
/**
* 是否启用异步处理
*/
@Builder.Default
private boolean asyncEnabled = true;
/**
* 异步处理线程池大小
*/
@Builder.Default
private int asyncPoolSize = 5;
}
@@ -1,145 +0,0 @@
package com.central.order.config;
import com.wechat.pay.java.core.Config;
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
import com.wechat.pay.java.core.notification.NotificationConfig;
import com.wechat.pay.java.core.notification.NotificationParser;
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
import com.wechat.pay.java.service.payments.jsapi.model.SettleInfo;
import com.wechat.pay.java.service.profitsharing.ProfitsharingService;
import com.wechat.pay.java.service.refund.RefundService;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.beans.factory.annotation.Qualifier;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 支付配置类
*
* @author lsl
* @date 2025-01-14
*
*/
@Getter
@Setter
@Configuration
@ConfigurationProperties(prefix = "tencent")
@EnableConfigurationProperties(ProfitSharingProperties.class)
public class TencentPayConfiguration {
private String merchantId;
private String merchantSerialNumber;
private String apiV3Key;
private String privateKeyPath;
private String appId;
private String appSecret;
private String notifyUrl;
/**
* jsapi支付方式 支持小程序公众号支付
* @return
*/
@Bean
public JsapiServiceExtension initialJsapiServiceExtension() {
// 构建service
return new JsapiServiceExtension.Builder().config(getConfig()).build();
}
@Bean
public RefundService initialRefundService() {
// 构建service
return new RefundService.Builder().config(getConfig()).build();
}
/**
* 微信支付配置获取
* @return
*/
public Config getConfig() {
return new RSAAutoCertificateConfig.Builder()
.merchantId(merchantId)
.privateKeyFromPath(privateKeyPath)
.merchantSerialNumber(merchantSerialNumber)
.apiV3Key(apiV3Key)
.build();
}
@Bean
public NotificationConfig initialNotificationConfig() {
// . 如果你仍在使用微信支付平台证书,则使用 RSAAutoCertificateConfig
return new RSAAutoCertificateConfig.Builder()
.merchantId(merchantId)
.privateKeyFromPath(privateKeyPath)
.merchantSerialNumber(merchantSerialNumber)
.apiV3Key(apiV3Key)
.build();
}
@Bean
public TencentPayProperties initTencentPayProperties() {
TencentPayProperties tencentPayProperties = new TencentPayProperties();
tencentPayProperties.setApiV3Key(apiV3Key);
tencentPayProperties.setMerchantId(merchantId);
tencentPayProperties.setMerchantSerialNumber(merchantSerialNumber);
tencentPayProperties.setAppId(appId);
tencentPayProperties.setAppSecret(appSecret);
tencentPayProperties.setNotifyUrl(notifyUrl);
return tencentPayProperties;
}
@Value("${wechat.pay.profit-sharing.enabled:true}")
private boolean profitSharingEnabled;
@Bean
public SettleInfo defaultSettleInfo() {
SettleInfo settleInfo = new SettleInfo();
settleInfo.setProfitSharing(profitSharingEnabled);
return settleInfo;
}
@Bean
public NotificationParser notificationParser(NotificationConfig config) {
return new NotificationParser(config);
}
@Bean
public ProfitsharingService profitsharingService() {
// 使用已有的配置方法
Config config = getConfig();
return new ProfitsharingService.Builder()
.config(config)
.build();
}
@Bean
public Executor profitSharingExecutor(@Qualifier("wechat.pay.profit-sharing-com.central.order.config.ProfitSharingProperties")
ProfitSharingProperties properties) {
if (!properties.isAsyncEnabled()) {
return null;
}
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(properties.getAsyncPoolSize());
executor.setMaxPoolSize(properties.getAsyncPoolSize());
executor.setQueueCapacity(100);
executor.setThreadNamePrefix("profit-sharing-");
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executor.initialize();
return executor;
}
}
@@ -1,25 +0,0 @@
package com.central.order.config;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class TencentPayProperties {
private String merchantId;
private String merchantSerialNumber;
private String apiV3Key;
private String privateKeyPath;
private String appId;
private String appSecret;
private String notifyUrl;
}
@@ -1,9 +0,0 @@
package com.central.order.config;
import lombok.Data;
@Data
public class WxMaProperties {
private String appId;
private String secret;
}
@@ -1,68 +0,0 @@
package com.central.order.config;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.StandardCharsets;
@Configuration
@RequiredArgsConstructor
public class WxMpConfiguration {
@Bean
@ConfigurationProperties(prefix = "wx.mp")
public WxMpProperties wxMpProperties() {
return new WxMpProperties();
}
@Bean
public WxMpService wxMpService(WxMpProperties wxMpProperties) {
WxMpService service = new WxMpServiceImpl();
WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
config.setAppId(wxMpProperties.getAppId());
config.setSecret(wxMpProperties.getSecret());
service.setWxMpConfigStorage(config);
return service;
}
@Bean
public RestTemplate restTemplate() {
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
return restTemplate;
}
@Bean
public ObjectMapper objectMapper() {
return new ObjectMapper();
}
@Bean
@ConfigurationProperties(prefix = "wx.mini")
public WxMaProperties wxMaProperties() {
return new WxMaProperties();
}
@Bean
public WxMaService wxMaService(WxMaProperties wxMaProperties) {
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
config.setAppid(wxMaProperties.getAppId());
config.setSecret(wxMaProperties.getSecret());
WxMaService service = new WxMaServiceImpl();
service.setWxMaConfig(config);
return service;
}
}
@@ -1,54 +0,0 @@
package com.central.order.config;
import lombok.Data;
@Data
public class WxMpProperties {
/**
* 设置微信公众号的appid
*/
private String appId;
/**
* 设置微信公众号的app secret
*/
private String secret;
/**
* 设置云托管环境ID
*/
private String cloudEnv;
/**
* 设置服务基础URL
*/
private String baseUrl;
/**
* 模板ID配置
*/
private TemplateConfig templateId = new TemplateConfig();
@Data
public static class TemplateConfig {
/**
* 支付成功通知模板ID
* 模板内容:
* 服务名称:{{thing2.DATA}}
* 出行时间:{{time3.DATA}}
* 订单号:{{character_string1.DATA}}
* 支付金额:{{amount4.DATA}}
*/
private String paymentSuccess;
/**
* 视频处理完成通知模板ID
*/
private String videoComplete;
/**
* 视频处理失败通知模板ID
*/
private String videoFail;
}
}
@@ -1,53 +0,0 @@
package com.central.order.constants;
/**
* 编辑任务状态常量
*/
public interface EditTaskStatus {
/**
* 待处理
*/
int PENDING = 0;
/**
* 处理中
*/
int PROCESSING = 1;
/**
* 处理完成
*/
int COMPLETED = 2;
/**
* 处理失败
*/
int FAILED = 3;
/**
* 判断是否为处理中状态
*/
static boolean isProcessing(Integer status) {
return PROCESSING == status;
}
/**
* 判断是否为完成状态
*/
static boolean isCompleted(Integer status) {
return COMPLETED == status;
}
/**
* 获取状态描述
*/
static String getStatusDesc(Integer status) {
switch (status) {
case PENDING: return "待处理";
case PROCESSING: return "处理中";
case COMPLETED: return "已完成";
case FAILED: return "失败";
default: return "未知状态";
}
}
}
@@ -1,21 +0,0 @@
package com.central.order.constants;
import com.central.order.enums.OrderStatus;
public class OrderStatusConstants {
// 已支付状态集合(已支付排队中、正在服务中、设备执行完成、素材上传中、素材上传完成)
public static final String PAID_STATUS = String.format("(%d,%d,%d,%d,%d)",
OrderStatus.PAID.getId(), // 1-已支付排队中
OrderStatus.DOING.getId(), // 4-正在服务中
OrderStatus.COMPLETE.getId(), // 3-设备执行完成
OrderStatus.UPLOADING.getId(), // 5-素材上传中
OrderStatus.UPLOADED.getId() // 6-素材上传完成
);
// 退款状态集合(退款中、已退款)
public static final String REFUND_STATUS = String.format("(%d,%d)",
OrderStatus.REFUNDING.getId(), // 7-退款中
OrderStatus.REFUNDED.getId() // 8-已退款
);
}
@@ -1,16 +0,0 @@
package com.central.order.constants;
public interface ProfitSharingConstants {
String PROFIT_SHARING_PREFIX = "PS";
String PROFIT_SHARING_DESC = "二维码分账";
int MAX_RETRY_TIMES = 3;
long RETRY_INTERVAL = 300000; // 5分钟
interface Status {
int INIT = 0;
int PROCESSING = 1;
int SUCCESS = 2;
int FAILED = 3;
}
}
@@ -1,35 +0,0 @@
package com.central.order.constants;
public class WxConstants {
/**
* Redis key前缀
*/
public static final String REDIS_KEY_PREFIX = "wx:";
/**
* access_token相关
*/
public static class AccessToken {
public static final String CACHE_KEY = REDIS_KEY_PREFIX + "access_token";
public static final String LOCK_KEY = REDIS_KEY_PREFIX + "access_token:lock";
public static final long EXPIRE_TIME = 7000; // 7000秒
public static final long REFRESH_TIME = 5400000; // 1.5小时
}
/**
* 模板消息相关
*/
public static class Template {
public static final String API_SEND = "https://api.weixin.qq.com/cgi-bin/message/template/send";
public static final String API_GET_LIST = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template";
public static final String API_DELETE = "https://api.weixin.qq.com/cgi-bin/template/del_private_template";
}
/**
* 微信接口相关
*/
public static class Api {
public static final String ACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
}
}
@@ -1,266 +0,0 @@
package com.central.order.controller;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.common.model.SysUser;
import com.central.order.constants.EditTaskStatus;
import com.central.order.enums.OrderStatus;
import com.central.order.feign.UserCenterService;
import com.central.order.model.*;
import com.central.order.model.dto.CallbackDTO;
import com.central.order.model.params.EditTaskQueryParams;
import com.central.order.service.*;
import com.central.order.util.DateUtils;
import com.central.order.util.StringUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 一键成片
*
*/
@Slf4j
@RestController
@Tag(name = "剪辑管理")
@RequestMapping("/auto/cut")
@RequiredArgsConstructor
public class AutoCutVideoController {
@Autowired
private IOrderService orderService;
@Autowired
private IEditTaskService editTaskService;
@Autowired
private IOrderFileService orderFileService;
@Autowired
private IVideoEditService videoEditService;
@Autowired
private IQrCodeService qrCodeService;
@Autowired
private WxMiniSubscribeService wxMiniSubscribeService;
@Autowired
private UserCenterService userCenterService;
@Autowired
private ITourismService tourismService;
@Operation(summary = "根据订单号生成视频")
@PostMapping("/generate")
public Result generateVideo(@RequestParam String orderNo) {
try {
// 1. 验证订单状态
Order order = orderService.getOrderByNumber(orderNo);
if (order == null || !OrderStatus.isValidForEdit(order.getOrderStatus())) {
return Result.failed("订单状态不允许生成视频");
}
// 1. 检查是否开启一键成片
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
if (!isVideoEditEnabled(qrCode)) {
log.info("未开启一键成片功能: orderNo={}, codeId={}",
order.getOrderNo(), order.getCodeId());
return Result.failed("未开启一键成片功能");
}
// 2. 检查是否存在进行中的任务
EditTask existingTask = editTaskService.getTaskByOrderSn(orderNo);
if (existingTask != null && EditTaskStatus.isProcessing(existingTask.getStatus())) {
return Result.failed("已存在进行中的编辑任务");
}
// 3. 创建新任务
EditTask task = editTaskService.createTask(orderNo, order.getUserId());
// 4. 获取素材文件
List<OrderFile> orderFiles = orderFileService.getOrderFileByOrderNo(orderNo);
// 5. 提交编辑任务
String jobId = videoEditService.submitEditTask(orderNo, orderFiles);
// 6. 更新任务信息
task.setJobId(jobId);
task.setStatus(EditTaskStatus.PROCESSING);
editTaskService.saveOrUpdateTask(task);
return Result.succeed(jobId);
} catch (Exception e) {
log.error("提交视频编辑任务失败: orderNo={}", orderNo, e);
return Result.failed("提交任务失败:" + e.getMessage());
}
}
@Operation(summary = "智能剪辑回调接口")
@PostMapping("/callback")
public Result handleCallback(@RequestBody CallbackDTO callback) {
log.info("收到视频编辑回调: {}", callback);
try {
// 1. 验证回调信息
if (!isValidCallback(callback)) {
return Result.failed("无效的回调信息");
}
// 2. 获取任务信息
EditTask task = editTaskService.getTaskByJobId(callback.getJobId());
if (task == null) {
return Result.failed("未找到对应的任务");
}
// 3. 处理成功回调
if ("Success".equals(callback.getStatus())) {
// 更新任务状态
editTaskService.updateTaskStatus(
callback.getJobId(),
EditTaskStatus.COMPLETED,
callback.getResult()
);
// 发送通知
notifyUser(task.getUserId().toString(), task.getOrderSn());
}
// 4. 处理失败回调
else {
editTaskService.updateTaskStatus(
callback.getJobId(),
EditTaskStatus.FAILED,
callback.getErrorMessage()
);
// 记录错误日志
log.error("视频编辑失败: jobId={}, error={}",
callback.getJobId(), callback.getErrorMessage());
}
return Result.succeed("回调处理成功");
} catch (Exception e) {
log.error("处理视频编辑回调失败", e);
return Result.failed("处理回调失败:" + e.getMessage());
}
}
@Operation(summary = "获取任务状态")
@GetMapping("/task/status/{orderNo}")
public Result getTaskStatus(@PathVariable String orderNo) {
try {
EditTask task = editTaskService.getTaskByOrderSn(orderNo);
if (task == null) {
return Result.failed("未找到任务记录");
}
return Result.succeed(task);
} catch (Exception e) {
log.error("获取任务状态失败", e);
return Result.failed("获取任务状态失败:" + e.getMessage());
}
}
private boolean isValidCallback(CallbackDTO callback) {
// Implementation of isValidCallback method
return false; // Placeholder return, actual implementation needed
}
private void notifyUser(String userId,String orderNo) {
try {
// 1. 获取用户信息
SysUser user = userCenterService.findUserById(Long.valueOf(userId));
if (user == null || user.getOpenId() == null) {
log.warn("未找到用户或用户未绑定小程序openId,无法发送成片完成通知: userId={}", userId);
return;
}
// 2. 获取任务和订单信息
// 假设 message 里包含订单号或任务名,实际可根据 EditTask 查找
Order order = orderService.getOrderByNumber(orderNo);
if (order == null) {
log.warn("未找到订单信息,无法发送成片完成通知: orderNo={}", orderNo);
return;
}
Tourism tourism = tourismService.getTourismById(order.getTourismId());
String result = "视频已生成请查阅";
wxMiniSubscribeService.sendPaySuccessMsg(
user.getOpenId(),
tourism.getTourismName(),
orderNo,
result,
StringUtils.fenToYuan(order.getOrderAmount()),
DateUtils.sdf.format(order.getPayTime())
);
log.info("已发送一键成片完成通知: userId={}, openId={}, orderNo={}", userId, user.getOpenId(), orderNo);
} catch (Exception e) {
log.error("发送一键成片完成通知失败: userId={}, message={}", userId, orderNo, e);
}
}
@Operation(summary = "获取剪辑任务列表")
@GetMapping("/list")
public Result<PageResult<EditTask>> getTaskList(
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(required = false) String orderSn,
@RequestParam(required = false) String jobId,
@RequestParam(required = false) Integer status) {
try {
EditTaskQueryParams params = EditTaskQueryParams.builder()
.page(page)
.limit(limit)
.orderSn(orderSn)
.jobId(jobId)
.status(status)
.build();
PageResult<EditTask> result = editTaskService.getTaskList(params);
return Result.succeed(result);
} catch (Exception e) {
log.error("查询剪辑任务列表失败", e);
return Result.failed("查询任务列表失败");
}
}
@Operation(summary = "保存或更新剪辑任务")
@PostMapping("/save")
public Result<Boolean> saveOrUpdateTask(@RequestBody EditTask task) {
try {
boolean success = editTaskService.saveOrUpdateTask(task);
return Result.succeed(success);
} catch (Exception e) {
log.error("保存剪辑任务失败: task={}", task, e);
return Result.failed("保存任务失败: " + e.getMessage());
}
}
@Operation(summary = "删除剪辑任务")
@DeleteMapping("/delete/{id}")
public Result<Boolean> deleteTask(@PathVariable Integer id) {
try {
boolean success = editTaskService.deleteTask(id);
return Result.succeed(success);
} catch (Exception e) {
log.error("删除剪辑任务失败: id={}", id, e);
return Result.failed("删除任务失败: " + e.getMessage());
}
}
/**
* 检查是否开启一键成片功能
*/
private boolean isVideoEditEnabled(QrCode qrCode) {
return qrCode != null
&& qrCode.getEnableVideoEdit() != null
&& qrCode.getEnableVideoEdit() == 1
&& qrCode.getTemplateId() != null; // 确保有模板ID
}
}
@@ -1,34 +0,0 @@
package com.central.order.controller;
import com.central.common.model.Result;
import com.central.order.model.vo.DashboardStatisticsVO;
import com.central.order.service.IDashboardService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/dashboard")
@Tag(name = "首页统计", description = "首页统计数据接口")
@RequiredArgsConstructor
public class DashboardController {
private final IDashboardService dashboardService;
@Operation(summary = "获取首页统计数据")
@GetMapping("/statistics")
public Result<DashboardStatisticsVO> getStatistics() {
try {
DashboardStatisticsVO statistics = dashboardService.getDashboardStatistics();
return Result.succeed(statistics, "获取首页统计数据成功");
} catch (Exception e) {
log.error("获取首页统计数据失败", e);
return Result.failed("获取统计数据失败:" + e.getMessage());
}
}
}
@@ -1,90 +0,0 @@
package com.central.order.controller;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.order.feign.FileCenterService;
import com.central.order.model.HomeCarousel;
import com.central.order.service.IHomeCarouselService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* HomeCarousel information
*
* @author lsl
* @date 2025-2-19 17:51:47
*/
@Slf4j
@RestController
@Tag(name = "HomeCarousel管理")
@RequestMapping("/home/carousel")
@RequiredArgsConstructor
public class HomeCarouselController {
@Autowired
private IHomeCarouselService homeCarouselService;
@Autowired
private FileCenterService fileCenterService;
/**
* 列表
*/
@Operation(summary = "查询列表")
@Parameters({
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
})
@GetMapping
public PageResult list(@RequestParam Map<String, Object> params) {
PageResult<HomeCarousel> pageResult = homeCarouselService.findList(params);
if (pageResult.getCount()>0){
for (HomeCarousel homeCarousel: pageResult.getData()){
homeCarousel.setImageUrl(fileCenterService.getViewUrlByPath(homeCarousel.getImageUrl()));
}
}
return pageResult;
}
@GetMapping("/app")
public Result<List<HomeCarousel>> homeList() {
List<HomeCarousel> list = homeCarouselService.list();
if (!list.isEmpty()){
for (HomeCarousel homeCarousel: list){
homeCarousel.setImageUrl(fileCenterService.getViewUrlByPath(homeCarousel.getImageUrl()));
}
}
return Result.succeed(list,"获取成功");
}
@PostMapping()
public Result saveOrUpdate(@RequestBody HomeCarousel homeCarousel) {
return homeCarouselService.saveOrUpdateHomeCarousel(homeCarousel);
}
@Operation(summary = "查询HomeCarousel")
@GetMapping("/{id}")
public Result<HomeCarousel> getHomeCarousel(@PathVariable("id") Long id) {
HomeCarousel homeCarousel = homeCarouselService.getById(id);
if (homeCarousel == null) {
return Result.failed("暂无数据");
}
return Result.succeed(homeCarousel,"获取成功");
}
@DeleteMapping("/{id}")
public Result delete(@PathVariable Long id) {
homeCarouselService.removeById(id);
return Result.succeed("操作成功");
}
}
@@ -1,47 +0,0 @@
package com.central.order.controller;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.order.model.Message;
import com.central.order.service.IMessageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/messages")
@Tag(name = "站内信管理")
@RequiredArgsConstructor
public class MessageController {
private final IMessageService messageService;
@Operation(summary = "获取消息列表")
@GetMapping
public PageResult<Message> getMessages(@RequestParam Map<String, Object> params) {
return messageService.findMessages(params);
}
@Operation(summary = "标记消息已读")
@PutMapping("/{id}/read")
public Result markAsRead(@PathVariable Long id) {
return messageService.markAsRead(id);
}
@Operation(summary = "标记所有消息已读")
@PutMapping("/read/all")
public Result markAllAsRead() {
return messageService.markAllAsRead();
}
@Operation(summary = "删除消息")
@DeleteMapping("/{id}")
public Result deleteMessage(@PathVariable Long id) {
return messageService.deleteMessage(id);
}
}
@@ -1,680 +0,0 @@
package com.central.order.controller;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.central.common.constant.CommonConstant;
import com.central.common.context.LoginUserContextHolder;
import com.central.common.context.TenantContextHolder;
import com.central.common.model.LoginAppUser;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.common.model.SysUser;
import com.central.log.annotation.AuditLog;
import com.central.order.config.TencentPayProperties;
import com.central.order.enums.CommonStatus;
import com.central.order.enums.OrderStatus;
import com.central.order.feign.DeviceCenterService;
import com.central.order.feign.FileCenterService;
import com.central.order.feign.UserCenterService;
import com.central.order.model.*;
import com.central.order.service.*;
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
import com.wechat.pay.java.service.payments.jsapi.model.*;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Order information
*
* @author lsl
* @date 2024-12-19 17:51:47
*/
@Slf4j
@RestController
@Tag(name = "订单管理")
@RequiredArgsConstructor
public class OrderController {
//设备执行任务默认时间长度3分钟
private static final long DEVICE_EXEC_TIME = 4;
@Autowired
private IOrderService orderService;
@Autowired
private IOrderFileService orderFileService;
@Autowired
private ITourismService tourismService;
@Autowired
private ITourismFileService tourismFileService;
@Autowired
private UserCenterService userCenterService;
@Autowired
private FileCenterService fileCenterService;
@Autowired
private JsapiServiceExtension service;
@Autowired
private IQrCodeService qrCodeService;
@Autowired
private TencentPayProperties tencentPayProperties;
@Value("${file.oss-url}")
private String cdnOssUrl;
@Value("${file.cdn-url}")
private String cdnUrl;
@Value("${file.style}")
private String fileStyle;
// 获取当前日期,格式化为 yyyyMMdd
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstant.DATEMINUTE_FORMAT);
@Autowired
private DeviceCenterService deviceCenterService;
@Autowired
private IProfitSharingService profitSharingService;
/**
* 列表
*/
@Operation(summary = "查询全部列表")
@Parameters({
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
})
@GetMapping("/list")
public PageResult list(@RequestParam Map<String, Object> params) {
return orderService.findList(params);
}
/**
* 列表
*/
@Operation(summary = "查询用户订单列表")
@Parameters({
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
})
@GetMapping
public PageResult listByUser(@RequestParam Map<String, Object> params) {
LoginAppUser user = LoginUserContextHolder.getUser();
if (user == null) {
return new PageResult<>();
}
params.put("userId", user.getId());
return orderService.findListByUser(params);
}
/**
* 列表
*/
@Operation(summary = "查询用户订单详情列表")
@Parameters({
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
})
@GetMapping("/user")
public PageResult<Map> listInfoByUser(@RequestParam Map<String, Object> params) {
LoginAppUser user = LoginUserContextHolder.getUser();
params.put("userId", user.getId());
String fileType = MapUtils.getString(params, "fileType");
if (StringUtil.isBlank(fileType)) {
fileType = "image/jpeg";
}
PageResult<Order> result = orderService.findListByUser(params);
if (result.getCount() > 0){
List<Map> page = new ArrayList<>();
Map<String, String> fileMap = new HashMap<>();
fileMap.put("style", fileStyle);
for(Order order : result.getData()){
Map<String,Object> orderFileMap = new HashMap<>();
orderFileMap.put("time", sdf.format(order.getCreateTime()));
orderFileMap.put("addr", tourismService.getTourismById(order.getTourismId()).getTourismAddress());
orderFileMap.put("orderNo", order.getOrderNo());
List<OrderFile> list = orderFileService.getOrderFileByOrderNoAndFileType(order.getOrderNo(),fileType);
List<Map<String,String>> resultList = new ArrayList<>();
if (!list.isEmpty()){
for (OrderFile orderFile : list){
Map<String,String> imgMap = new HashMap<>();
String url = fileCenterService.getViewUrlByPath(orderFile.getFilePath());
imgMap.put("url", url.replace(cdnOssUrl,cdnUrl));
imgMap.put("contentType", orderFile.getFileType());
fileMap.put("path",orderFile.getFilePath());
imgMap.put("viewUrl", fileCenterService.getViewUrlByPathStyle(fileMap));
resultList.add(imgMap);
}
}
orderFileMap.put("imgList", resultList);
page.add(orderFileMap);
}
return PageResult.<Map>builder().data(page).resp_code(0).count(result.getCount()).build();
}
return new PageResult<>();
}
// 创建订单--》
// 返回前端订单信息--》
// 前端发起支付(PUT api-order/{id}/pay)--》
// 等待回调更新订单状态(微信支付回调接口/api-order/pay/notify)--》
// 同时创建支付记录(/api-order/payment)
// 前端进入排队队列中(/api-order/queue)已支付订单列表
// 设备执行完成后更新订单状态已完成(根据设备上报状态触发或者设备直接调用接口进行更新任务状态)
@Operation(summary = "创建订单")
@PostMapping
public Result<Order> createOrder(@RequestBody Order order) {
LoginAppUser user = LoginUserContextHolder.getUser();
order.setUserId(user.getId());
order.setTenantId(TenantContextHolder.getTenant());
List<Order> userOrderList = orderService.getOrderCountByStatusAndUser(user.getId(),OrderStatus.PAID.getId());
if (!userOrderList.isEmpty()){
return Result.succeed("已存在订单");
}
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
if (qrCode != null){
if (qrCode.getStatus().equals(CommonStatus.UNABLE.getId())){
return Result.failed("该二维码已过期");
}
//设置订单所属tenantId
TenantContextHolder.setTenant(qrCode.getTenantId());
order.setTourismId(qrCode.getTourismId());
order.setDeviceSn(qrCode.getDeviceSn());
order.setOrderAmount(qrCode.getPrice());
}else {
Assert.notNull(qrCode,"二维码不存在");
}
boolean result = orderService.createOrder(order);
if (result) {
return Result.succeed(order,"订单创建成功");
} else {
return Result.failed("订单创建失败");
}
}
/**
* 公众号小程序支付
*
* @param orderId 微信公众号对应微信付款用户的唯一标识
* @return 返回jsapi所需参数
*/
@Operation(summary = "生成预支付订单")
@PutMapping("/{orderId}/pay")
public Result<PrepayWithRequestPaymentResponse> payOrder(@PathVariable("orderId") Long orderId) {
try {
// 1. 获取用户和订单信息
SysUser user = userCenterService.findUserById(LoginUserContextHolder.getUser().getId());
Order order = orderService.getById(orderId);
if (order == null) {
return Result.failed("订单数据不存在");
}
// 检查是否需要开启分账
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
if (qrCode == null) {
return Result.failed("二维码不存在");
}
// 3. 创建支付请求
PrepayRequest request = new PrepayRequest();
// 设置基本支付信息
Amount amount = new Amount();
amount.setTotal(Integer.parseInt(order.getOrderAmount()));
request.setAmount(amount);
request.setAppid(tencentPayProperties.getAppId());
request.setMchid(tencentPayProperties.getMerchantId());
request.setDescription(order.getOrderNo());
request.setNotifyUrl(tencentPayProperties.getNotifyUrl());
request.setOutTradeNo(order.getOrderNo());
// 设置支付者信息
Payer payer = new Payer();
payer.setOpenid(user.getOpenId());
request.setPayer(payer);
// 设置分账信息
SettleInfo settleInfo = new SettleInfo();
if (isEnableProfit(qrCode)) {
settleInfo.setProfitSharing(true);
request.setSettleInfo(settleInfo);
// 创建分账记录
ProfitSharing profitSharing = profitSharingService.createProfitSharing(order,qrCode);
} else {
settleInfo.setProfitSharing(false);
request.setSettleInfo(settleInfo);
}
// 5. 调用支付接口
PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request);
// 6. 返回结果
return Result.succeed(response, order.getOrderNo());
} catch (Exception e) {
log.error("创建预支付订单失败", e);
return Result.failed("创建预支付订单失败:" + e.getMessage());
}
}
/**
* 检查是否开启分润
*/
private boolean isEnableProfit(QrCode qrCode) {
return qrCode != null &&
Integer.valueOf(1).equals(qrCode.getEnableProfit()) &&
qrCode.getPayeeStatus() != null &&
qrCode.getPayeeStatus() == 1 && // 确保分账账号已验证
qrCode.getPayeeAccount() != null && // 确保有收款账号
qrCode.getProfitRate() != null; // 确保有分润比例
}
@Operation(summary = "获取排队总览信息")
@GetMapping("/queue/info")
public Result<Map> getQueueInfo(@RequestParam String codeId) {
LoginAppUser user = LoginUserContextHolder.getUser();
QrCode qrCode = qrCodeService.getByCodeId(codeId);
Assert.notNull(qrCode,"二维码CODEID不能为空");
Order order = orderService.getOrderByStatusAndUser(OrderStatus.PAID.getId(), user.getId(),qrCode.getTourismId());
Map<String, Object> map = new HashMap<>();
map.put("price",appendPriceStr(qrCode.getPrice()));
//如果用户存在已支付订单,则查询当前排在第几
if (order != null){
Integer count = orderService.getOrderRankingByOrderId(order.getId(),qrCode.getTourismId());
map.put("count", count == 1 ? -1 : count-1 );
map.put("time",Math.multiplyExact((count-1),DEVICE_EXEC_TIME));
}else {
Long count = orderService.getOrderCountByStatus(OrderStatus.PAID.getId(),qrCode.getTourismId());
map.put("count", count == 0 ? -1 : count);
map.put("time",Math.multiplyExact(count,DEVICE_EXEC_TIME));
}
return Result.succeed(map,"获取成功");
}
@Operation(summary = "获取订单排队总览信息")
@GetMapping("/queue/info/{orderNo}")
public Result<Map> getQueueInfoByOrderNo(@PathVariable("orderNo") String orderNo) {
Order order = orderService.getOrderByNumber(orderNo);
Assert.notNull(order,"订单数据不能为空");
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
Map<String, Object> map = new HashMap<>();
map.put("price",appendPriceStr(qrCode.getPrice()));
Integer count = orderService.getOrderRankingByOrderId(order.getId(),qrCode.getTourismId());
map.put("count", count == 1 ? -1 : count-1 );
map.put("time",Math.multiplyExact((count-1),DEVICE_EXEC_TIME));
return Result.succeed(map,"获取成功");
}
@Operation(summary = "获取用户是否存在排队订单")
@GetMapping("/queue/info/user")
public Result<Map> getOrderInfoByUser() {
LoginAppUser user = LoginUserContextHolder.getUser();
Map<String,Object> res = new HashMap();
List<Order> orders = orderService.getOrderCountByStatusAndUser(user.getId(),OrderStatus.PAID.getId(),OrderStatus.DOING.getId());
if(!orders.isEmpty()){
for (Order order : orders){
order.setCreatedTime(sdf.format(order.getCreateTime()));
if(order.getOrderStatus().equals(OrderStatus.PAID.getId())){
res.put("orderNo",order.getOrderNo());
Integer count = orderService.getOrderRankingByOrderId(order.getId(),order.getTourismId());
res.put("orderStatus",order.getOrderStatus());
res.put("waitCount", count == 1 ? -1 : count-1 );
res.put("waitTime",Math.multiplyExact((count-1),DEVICE_EXEC_TIME));
res.put("createdTime",sdf.format(order.getCreateTime()));
}
if (order.getOrderStatus().equals(OrderStatus.DOING.getId())){
res.put("orderNo",order.getOrderNo());
res.put("createdTime",sdf.format(order.getCreateTime()));
res.put("orderStatus",order.getOrderStatus());
}
}
}
return Result.succeed(res,"获取成功");
}
@Operation(summary = "获取排队中的订单列表")
@GetMapping("/queue")
public Result<List<Order>> getOrdersInQueue() {
List<Order> orders = orderService.getOrdersInQueue();
return Result.succeed(orders,"获取成功");
}
// 获取排队中的订单列表
@Operation(summary = "获取排队中的第一个订单")
@GetMapping("/queue/first")
public Result<Order> getOrdersInQueueFirstOne(@RequestParam String deviceSn) {
Assert.notNull(deviceSn,"设备SN不能为空");
if (orderService.getUnCompleteOrderCount(deviceSn)==0){
List<Order> orders = orderService.getOrdersInQueueByDevice(deviceSn);
if (!orders.isEmpty()){
Order order = orders.get(0);
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
Assert.notNull(qrCode,"二维码数据不能为空");
// 从二维码中获取航线ID
String waylineId = qrCode.getWaylineId();
// 根据航线ID获取对应的文件路径
String waylineFilePath = fileCenterService.getFileViewUrl(waylineId);
Assert.notNull(waylineFilePath,"订单航线数据不能为空");
order.setFileMd5(deviceCenterService.getLineFileSign(waylineId));
order.setWaylineLinkUrl(waylineFilePath);
order.setStreamUrls(deviceCenterService.getStreamUrls(order.getDeviceSn()));
return Result.succeed(order,"获取成功");
}
}
return Result.failed("未存在排队队列");
}
// 处理排队中的订单(模拟消费通知等操作)
@Operation(summary = "通知排队中的订单")
@PutMapping("/queue/process")
public Result<String> processOrdersInQueue() {
orderService.processOrdersInQueue();
return Result.succeed("排队订单处理已启动");
}
@Operation(summary = "更新订单正在服务中状态")
@AuditLog(operation = "'下发任务更新订单正在服务中状态:' + #orderNo")
@PostMapping("/status")
public Result<String> updateOrderStatusDoing(@RequestBody String orderNo) {
Order order = orderService.getOrderByNumber(orderNo);
Assert.notNull(order, "订单数据不能为空");
if (order.getOrderStatus().equals(OrderStatus.PAID.getId())) {
order.setOrderStatus(OrderStatus.DOING.getId());
if (orderService.updateOrder(order)) { // 这里会触发事件
return Result.succeed("更新成功");
}
}
return Result.failed("未查询到订单数据");
}
@Operation(summary = "根据设备状态更新订单正在服务中状态")
@AuditLog(operation = "'下发任务更新订单正在服务中状态:' + #orderNo")
@PutMapping("/device/status")
public Result<String> updateOrderStatusDoingFromDevice(@RequestBody Map payload) {
Order order = orderService.getOrderByNumber(payload.get("orderNo").toString());
Assert.notNull(order,"订单数据不能为空");
if (order.getOrderStatus().equals(OrderStatus.PAID.getId())){
order.setOrderStatus(OrderStatus.DOING.getId());
if (orderService.updateOrder(order)){
return Result.succeed("更新成功");
}
}
return Result.failed("未查询到订单数据");
}
@Operation(summary = "机库更新订单完成状态")
@AuditLog(operation = "'机库更新订单完成状态:' + #payload")
@PutMapping("/update")
public Result<String> updateOrderStatusCompleted(@RequestBody Map payload) {
Order order = orderService.getOrderByNumber(payload.get("orderNo").toString());
Assert.notNull(order,"订单数据不能为空");
if (order.getOrderStatus().equals(OrderStatus.DOING.getId())
|| order.getOrderStatus().equals(OrderStatus.UPLOADED.getId())
|| order.getOrderStatus().equals(OrderStatus.UPLOADING.getId())){
order.setOrderStatus(OrderStatus.COMPLETE.getId());
if (orderService.updateOrder(order)){
return Result.succeed("更新成功");
}
}else {
return Result.failed("已更新");
}
return Result.failed("未查询到订单数据");
}
@Operation(summary = "取消订单")
@PutMapping("/{id}")
public Result cancelOrder(@PathVariable("id") Long id) {
Order order = orderService.getById(id);
order.setOrderStatus(OrderStatus.CANCELED.getId());
boolean res = orderService.updateOrder(order); // 这里会触发事件
if (res) {
return Result.succeed("已取消");
}
return Result.failed("请重试");
}
@Operation(summary = "后台管理更新订单")
@PostMapping("/update/order")
public Result updateOrder(@RequestBody Order order) {
LoginAppUser loginAppUser = LoginUserContextHolder.getUser();
if (loginAppUser.getId() == 1){
boolean res = orderService.updateOrder(order);
if (res){
return Result.succeed("已更新");
}
}
return Result.failed("请重试");
}
@Operation(summary = "机库查询订单执行情况")
@AuditLog(operation = "'机库查询订单执行情况:' + #orderNo")
@GetMapping("/status/{orderNo}")
public Result getOrderExecStatus(@PathVariable("orderNo") String orderNo) {
Order order = orderService.getOrderByNumber(orderNo);
Assert.notNull(order,"订单数据为空");
if (order.getOrderStatus().equals(OrderStatus.COMPLETE.getId())){
return Result.failed("已执行");
}else if (order.getOrderStatus().equals(OrderStatus.PAID.getId())){
return Result.succeed("待执行");
}
return Result.failed("不满足执行条件");
}
@Operation(summary = "获取订单对应的景区素材")
@GetMapping("/resource/tourism/{orderNo}")
public Result<List<TourismFile>> getTourismByOrder(@PathVariable("orderNo") String orderNo) {
Order order = orderService.getOrderByNumber(orderNo);
Assert.notNull(order,"订单数据不存在");
List<TourismFile> tourismFiles = tourismFileService.getByTourismId(order.getTourismId());
if (!tourismFiles.isEmpty()){
for (TourismFile tourismFile : tourismFiles){
tourismFile.setImageUrl(fileCenterService.getViewUrlByPath(tourismFile.getImageUrl()));
}
}
return Result.succeed(tourismFiles,"获取成功");
}
@Operation(summary = "获取订单对应的景区Info")
@GetMapping("/info/tourism/{orderNo}")
public Result<Tourism> getTourismInfoByOrder(@PathVariable("orderNo") String orderNo) {
Order order = orderService.getOrderByNumber(orderNo);
Assert.notNull(order,"订单数据不存在");
Tourism tourism = tourismService.getTourismById(order.getTourismId());
return Result.succeed(tourism,"获取成功");
}
@Operation(summary = "获取订单的设备")
@GetMapping("/device/{orderNo}")
public Result<String> getDeviceByOrder(@PathVariable("orderNo") String orderNo) {
Order order = orderService.getOrderByNumber(orderNo);
Assert.notNull(order,"订单数据不存在");
return Result.succeed(order.getDeviceSn(),"获取成功");
}
@Operation(summary = "获取订单状态")
@GetMapping("/{orderNo}/status")
public String getOrderStatusByOrderNo(@PathVariable("orderNo") String orderNo) {
Order order = orderService.getOrderByNumber(orderNo);
Assert.notNull(order,"订单数据不存在");
return order.getOrderStatus().toString();
}
@Operation(summary = "获取订单详情")
@GetMapping("/detail/{orderNo}")
public Result<Map<String, Object>> getOrderDetail(@PathVariable("orderNo") String orderNo) {
try {
// 获取订单基本信息
Order order = orderService.getOrderByNumber(orderNo);
if (order == null) {
return Result.failed("订单不存在");
}
// 获取景区信息
Tourism tourism = tourismService.getTourismById(order.getTourismId());
if (tourism == null) {
return Result.failed("景区信息不存在");
}
// 获取订单文件信息
List<OrderFile> orderFiles = orderFileService.getOrderFileByOrderNo(orderNo);
// 构建返回数据
Map<String, Object> detailMap = new HashMap<>();
// 订单基本信息
detailMap.put("orderNo", order.getOrderNo());
detailMap.put("orderStatus", order.getOrderStatus());
detailMap.put("orderAmount", appendPriceStr(order.getOrderAmount()));
detailMap.put("createTime", sdf.format(order.getCreateTime()));
detailMap.put("deviceSn", order.getDeviceSn());
detailMap.put("mobile", userCenterService.findUserById(order.getUserId()).getMobile());
// 景区信息
Map<String, Object> tourismMap = new HashMap<>();
tourismMap.put("tourismName", tourism.getTourismName());
tourismMap.put("tourismAddress", tourism.getTourismAddress());
tourismMap.put("tourismDesc", tourism.getTourismDesc());
detailMap.put("tourism", tourismMap);
// 订单文件信息
if (!orderFiles.isEmpty()) {
List<Map<String, String>> fileList = new ArrayList<>();
Map<String, String> fileMap = new HashMap<>();
fileMap.put("style", fileStyle);
for (OrderFile orderFile : orderFiles) {
Map<String, String> fileInfo = new HashMap<>();
String url = fileCenterService.getViewUrlByPath(orderFile.getFilePath());
fileInfo.put("url", url.replace(cdnOssUrl, cdnUrl));
fileInfo.put("contentType", orderFile.getFileType());
fileMap.put("path", orderFile.getFilePath());
fileInfo.put("viewUrl", fileCenterService.getViewUrlByPathStyle(fileMap));
fileList.add(fileInfo);
}
detailMap.put("files", fileList);
}
// 如果是排队中的订单,添加排队信息
if (OrderStatus.PAID.getId().equals(order.getOrderStatus())) {
Integer ranking = orderService.getOrderRankingByOrderId(order.getId(), order.getTourismId());
detailMap.put("queueCount", ranking == 1 ? -1 : ranking - 1);
detailMap.put("estimatedTime", Math.multiplyExact((ranking - 1), DEVICE_EXEC_TIME));
}
return Result.succeed(detailMap, "获取成功");
} catch (Exception e) {
log.error("获取订单详情失败: orderNo={}", orderNo, e);
return Result.failed("获取订单详情失败");
}
}
/**
* 将分的价格转换为元的str,方便前端显示
* @param str
* @return
*/
private String appendPriceStr(String str){
// 获取字符串长度
int length = str.length();
// 获取除了最后两位字符之外的部分
String prefix = str.substring(0, length - 2);
// 获取最后两位字符
String lastTwo = str.substring(length - 2);
// 在最后两位字符前添加小数点
return prefix + "." + lastTwo;
}
/**
* 列表
*/
@Operation(summary = "查询用户订单临时演示")
@Parameters({
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
})
@GetMapping("/user/temp")
public PageResult<Map> listInfoByUserForTemp(@RequestParam Map<String, Object> params) {
params.put("orderNo", "332025051700001");
String fileType = MapUtils.getString(params, "fileType");
if (StringUtil.isBlank(fileType)) {
fileType = "image/jpeg";
}
PageResult<Order> result = orderService.findList(params);
if (result.getCount() > 0){
List<Map> page = new ArrayList<>();
Map<String, String> fileMap = new HashMap<>();
fileMap.put("style", fileStyle);
for(Order order : result.getData()){
Map<String,Object> orderFileMap = new HashMap<>();
orderFileMap.put("time", sdf.format(order.getCreateTime()));
orderFileMap.put("addr", tourismService.getTourismById(order.getTourismId()).getTourismAddress());
orderFileMap.put("orderNo", order.getOrderNo());
// List<OrderFile> list = orderFileService.getOrderFileByOrderNoAndFileType(order.getOrderNo(),fileType);
List<String> list = fileCenterService.getListFiles("temp/332025051700001/Remote-Control/");
List<Map<String,String>> resultList = new ArrayList<>();
if (!list.isEmpty()){
list.remove(0);
for (String orderFile : list){
Map<String,String> imgMap = new HashMap<>();
String url = fileCenterService.getViewUrlByPath(orderFile);
imgMap.put("url", url.replace(cdnOssUrl,cdnUrl));
if (orderFile.endsWith(".jpeg") || orderFile.endsWith(".png")){
imgMap.put("contentType", "image/jpeg");
}
if (orderFile.endsWith(".mp4")){
imgMap.put("contentType", "video/mp4");
}
fileMap.put("path",orderFile);
imgMap.put("viewUrl", fileCenterService.getViewUrlByPathStyle(fileMap));
resultList.add(imgMap);
}
}
orderFileMap.put("imgList", resultList);
page.add(orderFileMap);
}
return PageResult.<Map>builder().data(page).resp_code(0).count(result.getCount()).build();
}
return new PageResult<>();
}
}
@@ -1,187 +0,0 @@
package com.central.order.controller;
import com.central.common.context.LoginUserContextHolder;
import com.central.common.model.FileInfo;
import com.central.common.model.LoginAppUser;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.order.enums.OrderStatus;
import com.central.order.feign.FileCenterService;
import com.central.order.model.Order;
import com.central.order.model.OrderFile;
import com.central.order.service.IOrderFileService;
import com.central.order.service.IOrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Order Files information
*
* @author lsl
* @date 2024-12-19 17:51:47
*/
@Slf4j
@RestController
@Tag(name = "任务资源管理")
@RequestMapping("/files")
@RequiredArgsConstructor
public class OrderFileController {
@Autowired
private IOrderFileService orderFileService;
@Autowired
private FileCenterService fileCenterService;
@Autowired
private IOrderService orderService;
@Value("${file.style}")
private String fileStyle;
/**
* 列表
*/
@Operation(summary = "查询列表")
@Parameters({
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
})
@GetMapping
public PageResult list(@RequestParam Map<String, Object> params) {
PageResult<OrderFile> pageResult = orderFileService.findList(params);
Map<String, String> fileMap = new HashMap<>();
fileMap.put("style", fileStyle);
if (pageResult.getResp_code() == 0){
for (OrderFile orderFile: pageResult.getData()){
orderFile.setViewUrl(fileCenterService.getViewUrlByPath(orderFile.getFilePath()));
fileMap.put("path", orderFile.getFilePath());
orderFile.setZipViewUrl(fileCenterService.getViewUrlByPathStyle(fileMap));
}
}
return pageResult;
}
/**
* 列表
*/
@Operation(summary = "查询用户列表")
@Parameters({
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
})
@GetMapping("/user")
public PageResult listByUser(@RequestParam Map<String, Object> params) {
LoginAppUser user = LoginUserContextHolder.getUser();
params.put("userId", user.getId());
return orderFileService.findListByUser(params);
}
@Operation(summary = "创建订单资源")
@PostMapping
public Result<OrderFile> createOrderFile(@RequestBody OrderFile orderFile) {
LoginAppUser user = LoginUserContextHolder.getUser();
orderFile.setFileType(fileCenterService.getFileContentType(orderFile.getFileId()));
orderFile.setUserId(user.getId());
boolean result = orderFileService.createOrderFile(orderFile);
if (result) {
return Result.succeed(orderFile,"文件资源创建成功");
} else {
return Result.failed("文件资源创建失败");
}
}
public Result<OrderFile> getOrderFile(@PathVariable("fileId") String fileId) {
OrderFile orderFile = orderFileService.getOrderFileByFileId(fileId);
if (orderFile == null) {
return Result.failed("暂无数据");
}
return Result.succeed(orderFile,"获取成功");
}
@Operation(summary = "查询订单资源列表")
@GetMapping("/order/{orderNo}")
public Result<List<OrderFile>> getOrderFiles(@PathVariable("orderNo") String orderNo) {
List<OrderFile> orderFiles = orderFileService.getOrderFileByOrderNo(orderNo);
if (!CollectionUtils.isEmpty(orderFiles)) {
for (OrderFile orderFile : orderFiles) {
String viewUrl = fileCenterService.getFileViewUrl(orderFile.getFileId());
orderFile.setViewUrl(viewUrl);
}
}else {
return Result.failed("暂无数据");
}
return Result.succeed(orderFiles);
}
@Operation(summary = "查询用户订单资源列表")
@GetMapping("/user/{userId}")
public Result<Map<String,Object>> getUserOrderFiles(@PathVariable("userId") Long userId) {
List<OrderFile> orderFiles = orderFileService.getOrderFileByUserId(userId);
if (!CollectionUtils.isEmpty(orderFiles)) {
for (OrderFile orderFile : orderFiles) {
String viewUrl = fileCenterService.getFileViewUrl(orderFile.getFileId());
orderFile.setViewUrl(viewUrl);
}
}else {
return Result.failed("暂无数据");
}
return null;
}
@Operation(summary = "设备回传照片path记录创建")
@PostMapping("/path")
public Result createOrderFileForPath(@RequestBody OrderFile orderFile) {
if (orderFile != null && orderFile.getOrderNo() != null) {
Order order = orderService.getOrderByNumber(orderFile.getOrderNo());
orderFile.setOrderNo(order.getOrderNo());
orderFile.setUserId(order.getUserId());
if (orderFile.getFilePath() != null) {
FileInfo fileInfo = fileCenterService.creatFileInfo(orderFile.getFilePath());
orderFile.setFileId(fileInfo.getId());
orderFile.setFilePath(fileInfo.getPath());
orderFile.setFileType(fileInfo.getContentType());
orderFile.setTourismId(order.getTourismId());
}
if (orderFileService.save(orderFile)){
// 机库上报订单素材,更新订单状态为素材上传中,如果订单为设备执行中则更新,否则说明状态已更新
if (order.getOrderStatus().equals(OrderStatus.DOING.getId())
|| order.getOrderStatus().equals(OrderStatus.PAID.getId())) {
order.setOrderStatus(OrderStatus.UPLOADING.getId());
orderService.updateOrder(order);
}
return Result.succeed(order,"更新成功");
}
}
return Result.failed("素材内容为空");
}
@Operation(summary = "删除文件")
@DeleteMapping( "/{id}")
public Result delete(@PathVariable Long id) {
if (orderFileService.delete(id) > 0){
return Result.succeed("删除成功");
}
return Result.failed("删除失败");
}
}
@@ -1,102 +0,0 @@
package com.central.order.controller;
import com.central.common.model.Result;
import com.central.order.service.IOrderStatisticsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/statistics")
@Tag(name = "订单统计", description = "订单多维度统计接口")
@RequiredArgsConstructor
public class OrderStatisticsController {
private final IOrderStatisticsService orderStatisticsService;
@Operation(summary = "生成统计数据", description = "根据时间范围生成订单统计数据")
@Parameters({
@Parameter(name = "startTime", description = "开始时间 (格式:yyyy-MM-dd HH:mm:ss)", required = true),
@Parameter(name = "endTime", description = "结束时间 (格式:yyyy-MM-dd HH:mm:ss)", required = true)
})
@PostMapping("/generate")
public Result<String> generateStatistics(
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") String startTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") String endTime) {
try {
boolean result = orderStatisticsService.generateStatistics(startTime, endTime);
return result ? Result.succeed("统计数据生成成功") : Result.failed("统计数据生成失败");
} catch (Exception e) {
log.error("生成统计数据失败", e);
return Result.failed("生成统计数据时发生错误:" + e.getMessage());
}
}
@Operation(summary = "按时间维度统计", description = "统计指定二维码在时间范围内的订单数据")
@Parameters({
@Parameter(name = "qrcodeId", description = "二维码ID", required = true),
@Parameter(name = "startTime", description = "开始时间 (格式:yyyy-MM-dd HH:mm:ss)", required = true),
@Parameter(name = "endTime", description = "结束时间 (格式:yyyy-MM-dd HH:mm:ss)", required = true),
@Parameter(name = "timeType", description = "时间维度类型(hour/day/month)", required = false)
})
@GetMapping("/time")
public Result<List<Map<String, Object>>> statisticsByTime(
@RequestParam String qrcodeId,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") String startTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") String endTime,
@RequestParam(defaultValue = "day") String timeType) {
try {
List<Map<String, Object>> result = orderStatisticsService.statisticsByTime(
qrcodeId, startTime, endTime, timeType);
return Result.succeed(result, "获取时间维度统计数据成功");
} catch (Exception e) {
log.error("获取时间维度统计数据失败", e);
return Result.failed("获取统计数据时发生错误:" + e.getMessage());
}
}
@Operation(summary = "按景区维度统计", description = "统计时间范围内各景区的订单数据")
@Parameters({
@Parameter(name = "startTime", description = "开始时间 (格式:yyyy-MM-dd HH:mm:ss)", required = true),
@Parameter(name = "endTime", description = "结束时间 (格式:yyyy-MM-dd HH:mm:ss)", required = true)
})
@GetMapping("/tourism")
public Result<List<Map<String, Object>>> statisticsByTourism(
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") String startTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") String endTime) {
try {
List<Map<String, Object>> result = orderStatisticsService.statisticsByTourism(startTime, endTime);
return Result.succeed(result, "获取景区维度统计数据成功");
} catch (Exception e) {
log.error("获取景区维度统计数据失败", e);
return Result.failed("获取统计数据时发生错误:" + e.getMessage());
}
}
@Operation(summary = "按设备维度统计", description = "统计时间范围内各设备的订单数据")
@Parameters({
@Parameter(name = "startTime", description = "开始时间 (格式:yyyy-MM-dd HH:mm:ss)", required = true),
@Parameter(name = "endTime", description = "结束时间 (格式:yyyy-MM-dd HH:mm:ss)", required = true)
})
@GetMapping("/device")
public Result<List<Map<String, Object>>> statisticsByDevice(
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") String startTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") String endTime) {
try {
List<Map<String, Object>> result = orderStatisticsService.statisticsByDevice(startTime, endTime);
return Result.succeed(result, "获取设备维度统计数据成功");
} catch (Exception e) {
log.error("获取设备维度统计数据失败", e);
return Result.failed("获取统计数据时发生错误:" + e.getMessage());
}
}
}
@@ -1,57 +0,0 @@
package com.central.order.controller;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.order.service.IPaymentRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* Payment information
*
* @author lsl
* @date 2024-12-19 17:51:47
*/
@Slf4j
@RestController
@Tag(name = "支付记录管理")
@RequestMapping("/payment")
@RequiredArgsConstructor
public class PaymentRecordController {
@Autowired
private IPaymentRecordService paymentRecordService;
/**
* 列表
*/
@Operation(summary = "查询列表")
@Parameters({
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
})
@GetMapping
public PageResult list(@RequestParam Map<String, Object> params) {
return paymentRecordService.findList(params);
}
// 接收前端传来的订单编号和支付金额,处理订单支付
@PostMapping
public Result<String> processPayment(@RequestParam String orderNumber, @RequestParam Double paymentAmount) {
boolean result = paymentRecordService.processPayment(orderNumber, paymentAmount);
if (result) {
return Result.succeed("订单支付成功");
} else {
return Result.failed("订单支付失败");
}
}
}
@@ -1,62 +0,0 @@
package com.central.order.controller;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.order.model.ProfitSharing;
import com.central.order.model.vo.ProfitSharingStatisticsVO;
import com.central.order.service.IProfitSharingService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/profitSharing")
@Tag(name = "分账管理")
@RequiredArgsConstructor
public class ProfitSharingController {
private final IProfitSharingService profitSharingService;
@Operation(summary = "分页查询分账记录")
@GetMapping("/list")
public PageResult<ProfitSharing> list(@RequestParam Map<String, Object> params) {
return profitSharingService.findList(params);
}
@Operation(summary = "获取分账记录详情")
@GetMapping("/{orderNo}")
public Result<ProfitSharing> detail(@PathVariable String orderNo) {
ProfitSharing profitSharing = profitSharingService.getByOrderNo(orderNo);
return Result.succeed(profitSharing);
}
@Operation(summary = "手动触发分账")
@PostMapping("/execute/{orderNo}")
public Result<String> executeProfitSharing(@PathVariable String orderNo) {
try {
profitSharingService.executeProfitSharing(orderNo);
return Result.succeed("分账执行成功");
} catch (Exception e) {
log.error("手动触发分账失败", e);
return Result.failed("分账执行失败:" + e.getMessage());
}
}
@Operation(summary = "获取分账统计数据")
@GetMapping("/statistics")
public Result<ProfitSharingStatisticsVO> getStatistics() {
try {
ProfitSharingStatisticsVO statistics = profitSharingService.getStatistics();
return Result.succeed(statistics);
} catch (Exception e) {
log.error("获取分账统计数据失败", e);
return Result.failed("获取统计数据失败");
}
}
}
@@ -1,149 +0,0 @@
package com.central.order.controller;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.order.feign.FileCenterService;
import com.central.order.model.*;
import com.central.order.service.IOrderService;
import com.central.order.service.IQrCodeService;
import com.central.order.service.ITourismFileService;
import com.central.order.service.ITourismService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* qrcode information
*
* @author lsl
* @date 2024-12-19 17:51:47
*/
@Slf4j
@RestController
@Tag(name = "二维码管理")
@RequestMapping("/qrcode")
@RequiredArgsConstructor
public class QrCodeController {
@Autowired
private IQrCodeService qrCodeService;
@Autowired
private FileCenterService fileCenterService;
@Autowired
private ITourismService tourismService;
@Autowired
private ITourismFileService tourismFileService;
@Autowired
private IOrderService orderService;
/**
* 列表
*/
@Operation(summary = "查询列表")
@Parameters({
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
})
@GetMapping
public PageResult list(@RequestParam Map<String, Object> params) {
PageResult<QrCode> pageResult = qrCodeService.findList(params);
if (pageResult.getResp_code() == 0){
for (QrCode qrCode: pageResult.getData()){
qrCode.setViewUrl(fileCenterService.getViewUrlByPath(qrCode.getFilePath()));
}
}
return pageResult;
}
@Operation(summary = "生成景区二维码")
@PostMapping
public Result<QrCode> saveOrUpdateQrcode(@RequestBody QrCode qrCode) throws Exception {
if (qrCode.getId() == null){
String codeId = UUID.randomUUID().toString();
Result<Map> result = fileCenterService.uploadQrCodeFile(codeId);
if (result.getResp_code() == 0){
qrCode.setCodeId(codeId);
qrCode.setFilePath(result.getData().get("filePath").toString());
qrCode.setFileId(result.getData().get("fileId").toString());
if (qrCodeService.saveOrUpdate(qrCode)) {
return Result.succeed(qrCode,"qrcode创建成功");
} else {
return Result.failed("qrcode创建失败");
}
}
}else {
qrCodeService.saveOrUpdate(qrCode);
return Result.succeed(qrCode,"qrcode修改成功");
}
return Result.failed("创建失败");
}
@Operation(summary = "根据code查询二维码信息")
@GetMapping("/{codeId}")
public Result<QrCode> getQrCode(@PathVariable("codeId") String codeId) {
QrCode qrCode = qrCodeService.getByCodeId(codeId);
if (qrCode == null) {
return Result.failed("暂无数据");
}
return Result.succeed(qrCode,"获取成功");
}
@Operation(summary = "根据code查询二维码信息")
@GetMapping("/info/{codeId}")
public Result<QrCodeVO> getQrCodeInfo(@PathVariable("codeId") String codeId) {
QrCode qrCode = qrCodeService.getByCodeId(codeId);
Assert.notNull(qrCode,"QRCODE不能为空");
Tourism tourism = tourismService.getTourismById(qrCode.getTourismId());
Assert.notNull(tourism,"TOURISM数据不能为空");
List<TourismFile> tourismFiles = tourismFileService.getByTourismId(qrCode.getTourismId());
if (!CollectionUtils.isEmpty(tourismFiles)) {
for (TourismFile tourismFile: tourismFiles) {
tourismFile.setImageUrl(fileCenterService.getViewUrlByPath(tourismFile.getImageUrl()));
}
}
QrCodeVO qrCodeVO = new QrCodeVO();
qrCodeVO.setCodeId(codeId);
qrCodeVO.setTourism(tourism);
qrCodeVO.setTourismFiles(tourismFiles);
return Result.succeed(qrCodeVO,"获取成功");
}
@DeleteMapping("/{id}")
public Result delete(@PathVariable Long id) {
qrCodeService.removeById(id);
return Result.succeed("操作成功");
}
@GetMapping("/wayline/{orderNo}")
public Map<String,Object> getWaylineByOrderNo(@PathVariable("orderNo") String orderNo){
Order order = orderService.getOrderByNumber(orderNo);
Assert.notNull(order,"订单No不能为空");
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
Assert.notNull(qrCode,"二维码数据不能为空");
String waylineFilePath = fileCenterService.getFileViewUrl(qrCode.getWaylineId());
Map<String,Object> map = new HashMap<>();
map.put("waylineFilePath",waylineFilePath);
map.put("waylineId",qrCode.getWaylineId());
return map;
}
}
@@ -1,146 +0,0 @@
package com.central.order.controller;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.order.enums.OrderStatus;
import com.central.order.enums.RefundState;
import com.central.order.model.Order;
import com.central.order.service.IOrderService;
import com.central.order.service.IRefundService;
import com.wechat.pay.java.service.refund.RefundService;
import com.wechat.pay.java.service.refund.model.AmountReq;
import com.wechat.pay.java.service.refund.model.CreateRequest;
import com.wechat.pay.java.service.refund.model.Refund;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/refund")
public class RefundController {
@Autowired
private RefundService service;
@Autowired
private IOrderService orderService;
@Autowired
private IRefundService refundService;
@Value("${tencent.refund-notify-url}")
private String refundNotifyUrl;
/**
* 列表
*/
@Operation(summary = "查询全部列表")
@Parameters({
@Parameter(name = "page",description = "分页起始位置",required = true,in= ParameterIn.QUERY),
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
})
@GetMapping()
public PageResult list(@RequestParam Map<String, Object> params) {
return refundService.findList(params);
}
@Operation(summary = "创建退款单")
@PostMapping("/{orderNo}")
public Result<com.central.order.model.Refund> createRefundOrder(@PathVariable String orderNo,@RequestBody com.central.order.model.Refund refundBody) {
Order order = orderService.getOrderByNumber(orderNo);
Assert.notNull(order,"ORDER DATA不存在");
if (order.getOrderStatus().equals(OrderStatus.PAID.getId())
|| order.getOrderStatus().equals(OrderStatus.COMPLETE.getId())
|| order.getOrderStatus().equals(OrderStatus.DOING.getId())) {
// 创建退款订单
com.central.order.model.Refund refund = new com.central.order.model.Refund();
refund.setRefundNo("RF" + order.getOrderNo());
com.central.order.model.Refund existRefund = refundService.getRefundByNo(refund.getRefundNo());
if (existRefund != null){
return Result.succeed("已提交");
}
refund.setOrderNo(order.getOrderNo());
refund.setUserId(order.getUserId());
refund.setOrderAmount(order.getOrderAmount());
refund.setRefundAmount(order.getOrderAmount());
refund.setStatus(OrderStatus.REFUNDING.getId());
refund.setState(RefundState.APPROVING.getId());
refund.setRefundReason(refundBody.getRefundReason());
refund.setRefundImgs(refundBody.getRefundImgs());
boolean res = refundService.createRefund(refund);
if (res) {
order.setOrderStatus(OrderStatus.REFUNDING.getId());
orderService.updateOrder(order);
return Result.succeed("退款成功");
}
return Result.failed("请重试");
}else {
return Result.failed("该订单不支持退款操作");
}
}
@Operation(summary = "微信支付退款")
@PostMapping("/approve")
@Transactional(rollbackFor = Exception.class)
public Result<com.central.order.model.Refund> approveOrder(@RequestBody com.central.order.model.Refund refund) {
// 检查订单是否存在
Order order = orderService.getOrderByNumber(refund.getOrderNo());
Assert.notNull(order, "ORDER DATA不存在");
if (!order.getOrderStatus().equals(OrderStatus.REFUNDING.getId())){
return Result.failed("请重试");
}
if (! refund.getStatus().equals(OrderStatus.REFUNDING.getId())){
return Result.failed("该状态不支持审核");
}
if (refund.getState().equals(RefundState.APPROVED.getId())){
dealRefundRequest(order);
return Result.succeed("已处理退款");
}
if (refund.getState().equals(RefundState.REFUSED.getId())){
order.setOrderStatus(OrderStatus.REFUND_FAILED.getId());
refund.setStatus(OrderStatus.REFUND_FAILED.getId());
orderService.updateOrder(order);
refundService.updateById(refund);
return Result.succeed("处理成功");
}
return Result.failed("处理退款失败");
}
private void dealRefundRequest(Order order) {
try {
// 创建微信退款请求
CreateRequest request = new CreateRequest();
request.setOutTradeNo(order.getOrderNo());
request.setOutRefundNo("RF" + order.getOrderNo());
request.setReason("用户申请退款");
// 从配置文件中获取退款结果回调通知地址
request.setNotifyUrl(refundNotifyUrl);
// 设置退款金额
AmountReq amount = new AmountReq();
// 订单总金额,单位为分
amount.setTotal(Long.valueOf(order.getOrderAmount()));
// 退款金额,单位为分
amount.setRefund(Long.valueOf(order.getOrderAmount()));
amount.setCurrency("CNY");
request.setAmount(amount);
// 发起退款请求
Refund response = service.create(request);
Assert.notNull(response, "退款失败");
} catch (Exception e) {
// 记录异常信息
e.printStackTrace();
}
}
}
@@ -1,69 +0,0 @@
package com.central.order.controller;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.order.model.Tourism;
import com.central.order.service.ITourismService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* Tourism information
*
* @author lsl
* @date 2024-12-19 17:51:47
*/
@Slf4j
@RestController
@Tag(name = "Tourism管理")
@RequestMapping("/tourism")
@RequiredArgsConstructor
public class TourismController {
@Autowired
private ITourismService tourismService;
/**
* 列表
*/
@Operation(summary = "查询列表")
@Parameters({
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
})
@GetMapping
public PageResult list(@RequestParam Map<String, Object> params) {
return tourismService.findList(params);
}
@PostMapping()
public Result saveOrUpdate(@RequestBody Tourism tourism) {
return tourismService.saveOrUpdateTourism(tourism);
}
@Operation(summary = "查询Tourism")
@GetMapping("/{id}")
public Result<Tourism> getTourism(@PathVariable("id") Long id) {
Tourism tourism = tourismService.getTourismById(id);
if (tourism == null) {
return Result.failed("暂无数据");
}
return Result.succeed(tourism,"获取成功");
}
@DeleteMapping()
// @AuditLog(operation = "'新增或更新用户:' + #sysUser.username")
public Result delete(@RequestBody Tourism tourism) {
boolean result = tourismService.removeById(tourism);
return result ? Result.succeed(tourism, "操作成功") : Result.failed("操作失败");
}
}
@@ -1,78 +0,0 @@
package com.central.order.controller;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.order.feign.FileCenterService;
import com.central.order.model.TourismFile;
import com.central.order.service.ITourismFileService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* Tourism File information
*
* @author lsl
* @date 2025-2-19 17:51:47
*/
@Slf4j
@RestController
@Tag(name = "TourismFile管理")
@RequestMapping("/tourism/files")
@RequiredArgsConstructor
public class TourismFileController {
@Autowired
private ITourismFileService tourismFileService;
@Autowired
private FileCenterService fileCenterService;
/**
* 列表
*/
@Operation(summary = "查询列表")
@Parameters({
@Parameter(name = "page",description = "分页起始位置",required = true,in=ParameterIn.QUERY),
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
})
@GetMapping
public PageResult list(@RequestParam Map<String, Object> params) {
PageResult<TourismFile> pageResult = tourismFileService.findList(params);
if (pageResult.getCount()>0){
for (TourismFile tourismFile: pageResult.getData()){
tourismFile.setImageUrl(fileCenterService.getViewUrlByPath(tourismFile.getImageUrl()));
}
}
return pageResult;
}
@PostMapping()
public Result saveOrUpdate(@RequestBody TourismFile tourismFile) {
return tourismFileService.saveOrUpdateTourismFile(tourismFile);
}
@Operation(summary = "查询TourismFile")
@GetMapping("/{id}")
public Result<TourismFile> getTourismFile(@PathVariable("id") Long id) {
TourismFile tourismFile = tourismFileService.getById(id);
if (tourismFile == null) {
return Result.failed("暂无数据");
}
return Result.succeed(tourismFile,"获取成功");
}
@DeleteMapping("/{id}")
public Result delete(@PathVariable Long id) {
tourismFileService.removeById(id);
return Result.succeed( "操作成功");
}
}
@@ -1,95 +0,0 @@
package com.central.order.controller;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.order.model.VideoTemplate;
import com.central.order.service.IVideoTemplateService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/video/template")
@Tag(name = "视频模板管理")
public class VideoTemplateController {
private final IVideoTemplateService videoTemplateService;
@Operation(summary = "分页查询模板")
@GetMapping("/list")
public Result<PageResult<VideoTemplate>> list(@RequestParam Map<String, Object> params) {
try {
PageResult<VideoTemplate> result = videoTemplateService.findList(params);
return Result.succeed(result);
} catch (Exception e) {
log.error("查询模板列表失败", e);
return Result.failed("查询失败");
}
}
@Operation(summary = "添加模板")
@PostMapping
public Result<Boolean> save(@RequestBody VideoTemplate template) {
try {
boolean result = videoTemplateService.saveTemplate(template);
return Result.succeed(result);
} catch (Exception e) {
log.error("添加模板失败", e);
return Result.failed("添加失败");
}
}
@Operation(summary = "更新模板")
@PutMapping
public Result<Boolean> update(@RequestBody VideoTemplate template) {
try {
boolean result = videoTemplateService.updateTemplate(template);
return Result.succeed(result);
} catch (Exception e) {
log.error("更新模板失败", e);
return Result.failed("更新失败");
}
}
@Operation(summary = "删除模板")
@DeleteMapping("/{id}")
public Result<Boolean> delete(@PathVariable Long id) {
try {
boolean result = videoTemplateService.deleteTemplate(id);
return Result.succeed(result);
} catch (Exception e) {
log.error("删除模板失败", e);
return Result.failed("删除失败");
}
}
@Operation(summary = "更新模板状态")
@PutMapping("/{id}/status/{status}")
public Result<Boolean> updateStatus(@PathVariable Long id, @PathVariable Integer status) {
try {
boolean result = videoTemplateService.updateStatus(id, status);
return Result.succeed(result);
} catch (Exception e) {
log.error("更新模板状态失败", e);
return Result.failed("更新状态失败");
}
}
@Operation(summary = "获取可用模板")
@GetMapping("/active")
public Result<VideoTemplate> getActiveTemplate() {
try {
VideoTemplate template = videoTemplateService.getActiveTemplate();
return Result.succeed(template);
} catch (Exception e) {
log.error("获取可用模板失败", e);
return Result.failed("获取失败");
}
}
}
@@ -1,58 +0,0 @@
package com.central.order.controller;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.security.MessageDigest;
import java.util.Arrays;
/**
*
* 服务号调用API
* @author lsl
* @date 2025-04-24
*
*/
@Slf4j
@RestController
@RequestMapping("/token/callback")
@RequiredArgsConstructor
public class WxCallbackController {
private static final String TOKEN = "codechangetheworld2025"; //MIUFvX040zDQtUHUGEFjpzDwgNLmPe6gWPVsnQMW3nL
@GetMapping()
public String verify(
@RequestParam("signature") String signature,
@RequestParam("timestamp") String timestamp,
@RequestParam("nonce") String nonce,
@RequestParam("echostr") String echostr) throws Exception {
log.info("开始验证微信token请求:{}", signature);
// 1. 字典序排序并拼接
String[] arr = {TOKEN, timestamp, nonce};
Arrays.sort(arr);
String rawStr = String.join("", arr);
// 2. SHA1 加密
MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] digest = md.digest(rawStr.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
String hash = sb.toString();
// 3. 校验签名
if (hash.equals(signature)) {
return echostr;
} else {
return "Invalid signature";
}
}
}
@@ -1,54 +0,0 @@
package com.central.order.controller;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.order.model.WxMessageRecord;
import com.central.order.service.IWxMessageRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.util.Map;
@Slf4j
@RestController
@Tag(name = "微信消息记录管理")
@RequestMapping("/wx/message")
public class WxMessageRecordController {
@Autowired
private IWxMessageRecordService messageRecordService;
@Operation(summary = "分页查询消息记录")
@GetMapping("/records")
public PageResult<WxMessageRecord> records(@RequestParam Map<String, Object> params) {
return messageRecordService.findRecords(params);
}
@Operation(summary = "获取消息统计")
@GetMapping("/statistics")
public Result<Map<String, Object>> statistics(
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
if (startTime == null) {
startTime = LocalDateTime.now().minusDays(7);
}
if (endTime == null) {
endTime = LocalDateTime.now();
}
return Result.succeed(messageRecordService.getStatistics(startTime, endTime));
}
@Operation(summary = "获取失败消息记录")
@GetMapping("/failed")
public Result getFailedRecords() {
return Result.succeed(messageRecordService.getFailedRecords());
}
}
@@ -1,467 +0,0 @@
package com.central.order.controller;
import com.central.order.constants.ProfitSharingConstants;
import com.central.order.enums.OrderStatus;
import com.central.order.enums.RefundState;
import com.central.order.model.Order;
import com.central.order.model.ProfitSharing;
import com.central.order.model.QrCode;
import com.central.order.service.IOrderService;
import com.central.order.service.IProfitSharingService;
import com.central.order.service.IQrCodeService;
import com.central.order.service.IRefundService;
import com.wechat.pay.java.core.notification.NotificationConfig;
import com.wechat.pay.java.core.notification.NotificationParser;
import com.wechat.pay.java.core.notification.RequestParam;
import com.wechat.pay.java.service.payments.model.Transaction;
import com.wechat.pay.java.service.refund.model.RefundNotification;
import com.wechat.pay.java.service.refund.model.Status;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController
@Tag(name = "支付管理")
@RequestMapping("/wechat")
public class WxPayController {
@Autowired
private IOrderService orderService;
@Autowired
private IRefundService refundService;
@Autowired
private IQrCodeService qrCodeService;
@Autowired
private IProfitSharingService profitSharingService;
@Autowired
private NotificationConfig config;
@PostMapping("/pay/notify")
public String handleCallback(@RequestHeader("Wechatpay-Signature") String signature,
@RequestHeader("Wechatpay-Timestamp") String timestamp,
@RequestHeader("Wechatpay-Nonce") String nonce,
@RequestHeader("Wechatpay-Serial") String serial,
@RequestBody String body) {
try {
// 构建请求参数
RequestParam requestParam = new RequestParam
.Builder()
.body(body)
.nonce(nonce)
.signature(signature)
.serialNumber(serial)
.timestamp(timestamp)
.build();
NotificationParser notificationParser = new NotificationParser(config);
// 解析通知
Transaction transaction = notificationParser.parse(requestParam,Transaction.class);
// 处理支付结果
handlePaymentResult(transaction);
// 返回成功响应
return "{\"code\":\"SUCCESS\",\"message\":\"成功\"}";
} catch (Exception e) {
// 处理异常,记录日志等
e.printStackTrace();
return "{\"code\":\"FAIL\",\"message\":\"失败\"}";
}
}
private void handlePaymentResult(Transaction transaction) {
String outTradeNo = transaction.getOutTradeNo();
String tradeState = transaction.getTradeState().toString();
try {
if ("SUCCESS".equals(tradeState)) {
// 1. 获取订单和二维码信息
Order order = orderService.getOrderByNumber(outTradeNo);
if (order == null) {
log.error("订单不存在: {}", outTradeNo);
return;
}
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
if (qrCode == null) {
log.error("二维码不存在: {}", order.getCodeId());
return;
}
// 2. 更新订单状态
order.setOrderStatus(OrderStatus.PAID.getId());
order.setPayTime(new Date());
orderService.updateOrder(order);
// 3. 处理分账
if (isEnableProfit(qrCode)) {
try {
// 更新分账记录的微信支付订单号
profitSharingService.updateTransactionId(
outTradeNo,
transaction.getTransactionId()
);
// 发起分账
profitSharingService.executeProfitSharing(outTradeNo);
} catch (Exception e) {
log.error("处理分账失败: orderNo={}", outTradeNo, e);
// 分账失败不影响支付结果,但需要记录并告警
sendProfitSharingAlert(order, e.getMessage());
}
}
} else {
log.info("支付未成功: orderNo={}, state={}", outTradeNo, tradeState);
}
} catch (Exception e) {
log.error("处理支付结果异常: orderNo={}", outTradeNo, e);
throw e;
}
}
/**
* 检查是否开启分润
*/
private boolean isEnableProfit(QrCode qrCode) {
return qrCode != null &&
Integer.valueOf(1).equals(qrCode.getEnableProfit()) &&
qrCode.getPayeeStatus() != null &&
qrCode.getPayeeStatus() == 1 && // 确保分账账号已验证
qrCode.getPayeeAccount() != null && // 确保有收款账号
qrCode.getProfitRate() != null; // 确保有分润比例
}
/**
* 发送分账异常告警
*/
private void sendProfitSharingAlert(Order order, String errorMessage) {
try {
String alertMessage = String.format(
"分账处理异常告警\n" +
"订单号:%s\n" +
"异常信息:%s\n" +
"时间:%s",
order.getOrderNo(),
errorMessage,
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())
);
log.error(alertMessage);
// TODO: 实现具体的告警通知逻辑
} catch (Exception e) {
log.error("发送分账异常告警失败", e);
}
}
@PostMapping("/refund/notify")
public String refundCallback(@RequestHeader("Wechatpay-Signature") String signature,
@RequestHeader("Wechatpay-Timestamp") String timestamp,
@RequestHeader("Wechatpay-Nonce") String nonce,
@RequestHeader("Wechatpay-Serial") String serial,
@RequestBody String body) {
log.info("------收到微信退款回调通知------");
try {
// 构建请求参数
RequestParam requestParam = new RequestParam
.Builder()
.body(body)
.nonce(nonce)
.signature(signature)
.serialNumber(serial)
.timestamp(timestamp)
.build();
NotificationParser notificationParser = new NotificationParser(config);
// 解析通知
RefundNotification notification = notificationParser.parse(requestParam, RefundNotification.class);
// 处理退款结果
handleRefundResult(notification);
// 返回成功响应
return buildSuccessResponse();
} catch (Exception e) {
// 处理异常,记录日志等
e.printStackTrace();
return buildErrorResponse();
}
}
/**
* 构建请求参数
*/
private RequestParam buildRequestParam(Map<String, String> headers, String body) {
return new RequestParam.Builder()
.serialNumber(headers.get("Wechatpay-Serial"))
.nonce(headers.get("Wechatpay-Nonce"))
.signature(headers.get("Wechatpay-Signature"))
.timestamp(headers.get("Wechatpay-Timestamp"))
.body(body)
.build();
}
/**
* 解析通知数据
*/
private ProfitSharingNotification parseNotification(RequestParam requestParam) {
try {
NotificationParser parser = new NotificationParser(config);
// 解析为Map后转换为ProfitSharingNotification对象
Map<String, Object> result = parser.parse(requestParam, Map.class);
ProfitSharingNotification notification = new ProfitSharingNotification();
notification.setMchid((String) result.get("mchid"));
notification.setTransactionId((String) result.get("transaction_id"));
notification.setOutOrderNo((String) result.get("out_order_no"));
notification.setState((String) result.get("state"));
notification.setFailReason((String) result.get("fail_reason"));
// 处理接收方列表
if (result.containsKey("receivers")) {
List<Map<String, Object>> receiversMap = (List<Map<String, Object>>) result.get("receivers");
List<ProfitSharingNotification.Receiver> receivers = new ArrayList<>();
for (Map<String, Object> receiverMap : receiversMap) {
ProfitSharingNotification.Receiver receiver = new ProfitSharingNotification.Receiver();
receiver.setType((String) receiverMap.get("type"));
receiver.setAccount((String) receiverMap.get("account"));
receiver.setAmount(Long.valueOf(receiverMap.get("amount").toString()));
receiver.setDescription((String) receiverMap.get("description"));
receiver.setResult((String) receiverMap.get("result"));
receiver.setFailReason((String) receiverMap.get("fail_reason"));
receiver.setDetailId((String) receiverMap.get("detail_id"));
receivers.add(receiver);
}
notification.setReceivers(receivers);
}
return notification;
} catch (Exception e) {
log.error("解析分账回调通知失败", e);
throw new RuntimeException("解析分账回调通知失败", e);
}
}
/**
* 优化后的分账回调处理方法
*/
@PostMapping("/profitsharing/notify")
public String handleProfitSharingNotify(@RequestHeader Map<String, String> headers,
@RequestBody String body) {
log.info("收到分账回调通知: headers={}, body={}", headers, body);
try {
// 1. 验证通知签名
RequestParam requestParam = buildRequestParam(headers, body);
// 2. 解析通知数据
ProfitSharingNotification notification = parseNotification(requestParam);
// 3. 处理分账结果
handleProfitSharingNotification(notification);
// 4. 返回成功响应
return buildSuccessResponse();
} catch (Exception e) {
log.error("处理分账回调失败", e);
return buildErrorResponse();
}
}
private void handleProfitSharingNotification(ProfitSharingNotification notification) {
String orderNo = notification.getOutOrderNo();
String state = notification.getState();
try {
// 1. 获取分账记录
ProfitSharing profitSharing = profitSharingService.getByOrderNo(orderNo);
if (profitSharing == null) {
log.error("分账记录不存在: {}", orderNo);
return;
}
// 2. 根据状态处理
switch (state) {
case "FINISHED":
// 分账成功
handleProfitSharingSuccess(profitSharing, notification);
break;
case "FAILED":
// 分账失败
handleProfitSharingFailure(profitSharing, notification);
break;
default:
log.warn("未知的分账状态: orderNo={}, state={}", orderNo, state);
}
} catch (Exception e) {
log.error("处理分账回调异常: orderNo={}", orderNo, e);
// 确保更新状态
profitSharingService.updateProfitSharingStatus(
orderNo,
ProfitSharingConstants.Status.FAILED
);
}
}
/**
* 处理分账成功
*/
private void handleProfitSharingSuccess(ProfitSharing profitSharing,
ProfitSharingNotification notification) {
// 1. 更新分账状态
profitSharing.setStatus(ProfitSharingConstants.Status.SUCCESS);
profitSharing.setFinishTime(new Date());
// 2. 如果有接收方信息,更新接收方结果
if (notification.getReceivers() != null && !notification.getReceivers().isEmpty()) {
ProfitSharingNotification.Receiver receiver = notification.getReceivers().get(0);
profitSharing.setReceiverAmount(receiver.getAmount());
profitSharing.setProfitSharingId(receiver.getDetailId());
}
// 3. 保存更新
profitSharingService.updateById(profitSharing);
log.info("分账成功: orderNo={}", profitSharing.getOrderNo());
}
/**
* 处理分账失败
*/
private void handleProfitSharingFailure(ProfitSharing profitSharing,
ProfitSharingNotification notification) {
// 1. 更新分账状态和失败原因
profitSharing.setStatus(ProfitSharingConstants.Status.FAILED);
profitSharing.setFailReason(notification.getFailReason());
profitSharing.setUpdateTime(new Date());
// 2. 判断是否需要重试
if (profitSharing.canRetry()) {
log.info("准备重试分账: orderNo={}, retryTimes={}",
profitSharing.getOrderNo(), profitSharing.getRetryTimes());
// 更新重试信息
profitSharing.setRetryTimes(profitSharing.getRetryTimes() + 1);
profitSharing.setLastRetryTime(new Date());
profitSharingService.updateById(profitSharing);
// 发起重试
profitSharingService.retryFailedProfitSharing(profitSharing.getOrderNo());
} else {
log.warn("分账失败且不再重试: orderNo={}, retryTimes={}",
profitSharing.getOrderNo(), profitSharing.getRetryTimes());
// 发送告警
sendFailureAlert(profitSharing);
// 保存最终状态
profitSharingService.updateById(profitSharing);
}
}
/**
* 发送失败告警
*/
private void sendFailureAlert(ProfitSharing profitSharing) {
try {
String alertMessage = String.format(
"分账失败告警\n" +
"订单号:%s\n" +
"交易号:%s\n" +
"失败原因:%s\n" +
"重试次数:%d\n" +
"分账金额:%d分\n" +
"失败时间:%s",
profitSharing.getOrderNo(),
profitSharing.getTransactionId(),
profitSharing.getFailReason(),
profitSharing.getRetryTimes(),
profitSharing.getQrCodeAmount(),
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())
);
log.error(alertMessage);
// TODO: 实现具体的告警通知逻辑,如发送邮件、钉钉消息等
} catch (Exception e) {
log.error("发送分账失败告警异常", e);
}
}
/**
* 退款订单结果处理逻辑
* @param notification
*/
private void handleRefundResult(RefundNotification notification) {
// 获取退款通知中的关键信息
String outRefundNo = notification.getOutRefundNo();
log.info("回调返回结果"+notification);
// 根据退款状态进行相应处理
if (Status.SUCCESS.equals(notification.getRefundStatus())) {
// 退款成功,更新订单状态等操作
com.central.order.model.Refund refund = refundService.getRefundByNo(outRefundNo);
Assert.notNull(refund,"退款订单数据不存在");
refund.setStatus(OrderStatus.REFUNDED.getId());
refund.setState(RefundState.APPROVED.getId());
refund.setRefundTime(new Date());
refundService.updateById(refund);
Order order = orderService.getOrderByNumber(refund.getOrderNo());
Assert.notNull(order,"订单数据不存在");
order.setOrderStatus(OrderStatus.REFUNDED.getId());
orderService.updateOrder(order);
} else if ("CLOSED".equals(notification.getRefundStatus())) {
// 退款关闭,处理退款关闭逻辑
} else {
// 其他退款状态,如退款中、失败等
}
}
private String buildSuccessResponse() {
return "{\"code\":\"SUCCESS\",\"message\":\"成功\"}";
}
private String buildErrorResponse() {
return "{\"code\":\"FAIL\",\"message\":\"失败\"}";
}
}
/**
* 分账通知解析实体类
*/
@Data
class ProfitSharingNotification {
private String mchid; // 商户号
private String transactionId; // 微信订单号
private String outOrderNo; // 商户分账单号
private String state; // 分账状态
private String failReason; // 失败原因
private List<Receiver> receivers; // 分账接收方列表
@Data
public static class Receiver {
private String type; // 分账接收方类型
private String account; // 分账接收方账号
private Long amount; // 分账金额
private String description; // 分账描述
private String result; // 分账结果
private String failReason; // 分账失败原因
private String detailId; // 分账明细单号
}
}
@@ -1,39 +0,0 @@
package com.central.order.controller;
import com.central.common.model.Result;
import com.central.order.service.IWxTemplateMessageService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/wx/test")
@RequiredArgsConstructor
public class WxTestController {
private final IWxTemplateMessageService templateMessageService;
@GetMapping("/template/send")
public Result<String> testSendTemplate(
@RequestParam String openId,
@RequestParam String orderNo,
@RequestParam String serviceName,
@RequestParam Integer rank) {
try {
// 发送消息
templateMessageService.sendPaymentSuccessNotice(
openId, orderNo, serviceName, rank);
return Result.succeed("发送成功");
} catch (Exception e) {
log.error("发送模板消息失败", e);
return Result.failed("发送失败:" + e.getMessage());
}
}
}
@@ -1,46 +0,0 @@
1. 待支付
说明:用户成功提交订单,但尚未完成支付操作。此状态下,订单处于暂挂状态,可能因为用户还在选择支付方式、支付过程中出现问题等原因导致未支付。
操作:用户可选择支付、取消订单;商家可设置订单自动取消时间,超时未支付则订单自动取消。
2. 已取消
说明:订单在支付前被用户主动取消,或者因超过规定的支付时间而被系统自动取消。
操作:一般无后续操作,订单流程结束。
3. 支付成功
说明:用户成功完成支付,订单进入待处理排队(此时的状态也称作排队中)阶段。
操作:商家开始处理订单,如确认设备状态;系统可发送支付成功通知给用户。
4. 设备执行中
说明:商家正在对订单进行处理调度设备作业,包括但不限于确认订单信息、设备作业状态、设备素材上传等操作。
操作:商家完成处理后,可将订单状态更新为素材上传完成或素材上传中(对于多素材订单)。
5. 素材上传中
说明:商家已将照片上传。用户可以通过订单号查询订单对应素材。
操作:商家上传照片中,用户可查询上传进度。
6. 素材上传完成
说明:订单上传素材完成,处于用户下载状态。
操作:用户可查询素材信息并进行下载操作;若出现上传异常,商家需及时处理。
7. 用户已下载完成
说明:用户确认订单素材并下载完成且可能已完成评价,整个订单流程结束。
操作:无后续主要操作,可作为历史订单进行存档和统计分析。
8. 退款中
说明:用户发起退款申请,商家或平台正在处理该申请。
操作:商家需审核退款申请,根据情况决定是否同意退款;若同意,需进行退款操作。
9. 退款成功
说明:商家或平台已同意退款申请,并完成退款操作,款项已返还给用户。
操作:订单流程结束,可记录退款相关信息。
10. 退款失败
说明:退款申请因各种原因未能成功处理,如支付渠道问题、用户账户异常等。
操作:商家或平台需与用户沟通,解决问题后重新发起退款操作。
状态流转图示例
注意:(括号中的为订单状态),发起支付、用户支付中等为处理逻辑
(待支付) ── 发起支付 ── 用户支付中 ── 支付回调成功或者主动查询支付成功状态 ──> (支付成功) ── 排队中 ──> (设备执行中)── 飞机拍照 ── 飞机返航 ──> (素材上传中) ──> (素材上传完成) ── 用户下载 ──> (用户下载完成)
└─ 长时间未支付自动取消 ──> (已取消)
└─ 退款 ──> (退款中) ── 同意 ──> (退款成功)
└─ 拒绝并填写原因 ──> (退款失败)
@@ -1,24 +0,0 @@
package com.central.order.enums;
import com.central.common.enums.ZltEnum;
import lombok.Getter;
/**
* 数据状态枚举类型
*
* @author lsl create by 2025/1/10
*/
@Getter
public enum CommonStatus implements ZltEnum {
ENABLE(0,"启用"),
UNABLE(1, "未启用");
CommonStatus(Integer id, String content) {
this.id = id;
this.content = content;
}
private Integer id;
private String content;
}
@@ -1,41 +0,0 @@
package com.central.order.enums;
public enum FileType {
JPEG("image/jpeg", ".jpeg", ".jpg"),
PNG("image/png", ".png"),
GIF("image/gif", ".gif"),
MP4("video/mp4", ".mp4");
private final String contentType;
private final String[] extensions;
FileType(String contentType, String... extensions) {
this.contentType = contentType;
this.extensions = extensions;
}
public String getContentType() {
return contentType;
}
public String[] getExtensions() {
return extensions;
}
/**
* 根据文件扩展名获取对应的 FileType
*
* @param extension 文件扩展名
* @return 对应的 FileType,如果不支持则返回 null
*/
public static FileType fromExtension(String extension) {
for (FileType type : values()) {
for (String ext : type.getExtensions()) {
if (ext.equalsIgnoreCase(extension)) {
return type;
}
}
}
return null;
}
}
@@ -1,26 +0,0 @@
package com.central.order.enums;
import com.central.common.enums.ZltEnum;
import lombok.Getter;
/**
* 轮播类型枚举类型
*
* @author lsl create by 2025/2/19
*/
@Getter
public enum HomeCarouselType implements ZltEnum {
HOME(0,"首页轮播"),
ACTIVITY(1, "活动"),
SHOOTING_ANGLE(2,"拍照角度"),
GUIDANCE(3,"引导"),
BIG_PICTURE(4,"大图");
private Integer id;
private String content;
HomeCarouselType(Integer i, String content) {
this.id = i;
this.content = content;
}
}
@@ -1,67 +0,0 @@
package com.central.order.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum MessageTemplateEnum {
// 基础订单状态
ORDER_CREATED(1, "新订单提醒", "您有一个新的订单 #{orderNo} 已创建"),
ORDER_PAID(2, "支付成功提醒", "订单 #{orderNo} 已支付成功,正在排队中"),
ORDER_CANCELLED(3, "订单取消提醒", "订单 #{orderNo} 已取消"),
// 服务状态
SERVICE_START(4, "服务开始提醒", "订单 #{orderNo} 已开始服务"),
SERVICE_COMPLETE(5, "服务完成提醒", "订单 #{orderNo} 服务已完成"),
// 素材上传状态
MATERIAL_UPLOADING(6, "素材上传提醒", "订单 #{orderNo} 正在上传素材"),
MATERIAL_UPLOADED(7, "素材上传完成提醒", "订单 #{orderNo} 素材已上传完成"),
// 退款相关状态
REFUND_APPLYING(8, "退款申请提醒", "订单 #{orderNo} 正在申请退款"),
REFUND_SUCCESS(9, "退款成功提醒", "订单 #{orderNo} 已退款成功"),
REFUND_FAILED(10, "退款失败提醒", "订单 #{orderNo} 退款失败"),
REFUND_RETRYING(11, "重新退款提醒", "订单 #{orderNo} 正在重新申请退款");
private final Integer type;
private final String title;
private final String contentTemplate;
public static MessageTemplateEnum getByOrderStatus(Integer orderStatus) {
if (orderStatus == null) {
return null;
}
switch (orderStatus) {
case 0: return ORDER_CREATED; // 待支付
case 1: return ORDER_PAID; // 已支付排队中
case 2: return ORDER_CANCELLED; // 已取消
case 3: return SERVICE_COMPLETE; // 设备执行完成
case 4: return SERVICE_START; // 正在服务中
case 5: return MATERIAL_UPLOADING; // 素材上传中
case 6: return MATERIAL_UPLOADED; // 素材上传完成
case 7: return REFUND_APPLYING; // 退款中
case 8: return REFUND_SUCCESS; // 已退款
case 9: return REFUND_FAILED; // 退款失败
default: return null;
}
}
/**
* 根据状态变更获取消息模板
*/
public static MessageTemplateEnum getByStatusChange(Integer oldStatus, Integer newStatus) {
if (oldStatus == null || newStatus == null) {
return getByOrderStatus(newStatus);
}
// 特殊状态变更处理
if (oldStatus == 9 && newStatus == 7) { // 从退款失败到退款中
return REFUND_RETRYING;
}
return getByOrderStatus(newStatus);
}
}
@@ -1,86 +0,0 @@
package com.central.order.enums;
import com.central.common.enums.ZltEnum;
import lombok.Getter;
/**
* 订单状态枚举类型
*
* @author lsl create by 2025/1/10
*/
@Getter
public enum OrderStatus implements ZltEnum {
UNPAID(0,"待支付"),
PAID(1, "已支付排队中"),
CANCELED(2, "已取消"),
DOING(4,"正在服务中"),
COMPLETE(3,"设备执行完成"),
UPLOADING(5,"素材上传中"),
UPLOADED(6,"素材上传完成(任务完成)"),
REFUNDING(7,"退款中"),
REFUNDED(8,"已退款"),
REFUND_FAILED(9,"退款失败");
OrderStatus(Integer id, String content) {
this.id = id;
this.content = content;
}
private Integer id;
private String content;
/**
* 判断订单状态是否允许编辑视频
* 只有设备执行完成的订单才能进行视频编辑
*/
public static boolean isValidForEdit(Integer status) {
return status != null && status.equals(COMPLETE.getId());
}
/**
* 根据ID获取状态枚举
*/
public static OrderStatus fromId(Integer id) {
if (id == null) {
return null;
}
for (OrderStatus status : values()) {
if (status.getId().equals(id)) {
return status;
}
}
return null;
}
/**
* 获取状态描述
*/
public static String getDesc(Integer id) {
OrderStatus status = fromId(id);
return status != null ? status.getContent() : "未知状态";
}
/**
* 判断是否为最终状态
*/
public static boolean isFinalStatus(Integer status) {
return status != null && (
status.equals(CANCELED.getId()) ||
status.equals(UPLOADED.getId()) ||
status.equals(REFUNDED.getId()) ||
status.equals(REFUND_FAILED.getId())
);
}
/**
* 判断是否可以退款
*/
public static boolean canRefund(Integer status) {
return status != null && (
status.equals(PAID.getId()) ||
status.equals(DOING.getId()) ||
status.equals(COMPLETE.getId()) ||
status.equals(UPLOADING.getId()) ||
status.equals(UPLOADED.getId())
);
}
}
@@ -1,64 +0,0 @@
package com.central.order.enums;
import lombok.Getter;
@Getter
public enum OrderStatusChangeEnum {
// 支付相关
PAID(OrderStatus.UNPAID.getId(), OrderStatus.PAID.getId(),
"订单支付成功通知", "您的订单 #{orderNo} 已支付成功,正在排队中"),
// 取消相关
CANCELED(null, OrderStatus.CANCELED.getId(),
"订单取消通知", "您的订单 #{orderNo} 已取消"),
// 服务状态相关
SERVICE_START(OrderStatus.PAID.getId(), OrderStatus.DOING.getId(),
"服务开始通知", "您的订单 #{orderNo} 已开始服务"),
SERVICE_COMPLETE(OrderStatus.DOING.getId(), OrderStatus.COMPLETE.getId(),
"服务完成通知", "您的订单 #{orderNo} 服务已完成"),
// 素材上传相关
UPLOADING(OrderStatus.DOING.getId(), OrderStatus.UPLOADING.getId(),
"素材上传通知", "您的订单 #{orderNo} 正在上传素材"),
UPLOADED(OrderStatus.UPLOADING.getId(), OrderStatus.COMPLETE.getId(),
"素材上传完成通知", "您的订单 #{orderNo} 素材已上传完成"),
// 退款相关
REFUNDING(null, OrderStatus.REFUNDING.getId(),
"退款申请通知", "您的订单 #{orderNo} 正在申请退款"),
REFUND_SUCCESS(OrderStatus.REFUNDING.getId(), OrderStatus.REFUNDED.getId(),
"退款成功通知", "您的订单 #{orderNo} 已退款成功"),
REFUND_FAILED(OrderStatus.REFUNDING.getId(), OrderStatus.REFUND_FAILED.getId(),
"退款失败通知", "您的订单 #{orderNo} 退款失败"),
RETRY_REFUND(OrderStatus.REFUND_FAILED.getId(), OrderStatus.REFUNDING.getId(),
"重新退款通知", "您的订单 #{orderNo} 正在重新申请退款");
private final Integer oldStatus;
private final Integer newStatus;
private final String title;
private final String contentTemplate;
OrderStatusChangeEnum(Integer oldStatus, Integer newStatus, String title, String contentTemplate) {
this.oldStatus = oldStatus;
this.newStatus = newStatus;
this.title = title;
this.contentTemplate = contentTemplate;
}
public static OrderStatusChangeEnum getByStatusChange(Integer oldStatus, Integer newStatus) {
for (OrderStatusChangeEnum changeEnum : values()) {
// 如果oldStatus为null,则只匹配newStatus
if (changeEnum.oldStatus == null) {
if (changeEnum.newStatus.equals(newStatus)) {
return changeEnum;
}
}
// 否则匹配两个状态
else if (changeEnum.oldStatus.equals(oldStatus) && changeEnum.newStatus.equals(newStatus)) {
return changeEnum;
}
}
return null;
}
}
@@ -1,26 +0,0 @@
package com.central.order.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum PayeeTypeEnum {
MERCHANT_ID("MERCHANT_ID", "商户ID"),
PERSONAL_OPENID("PERSONAL_OPENID", "个人openid");
private final String code;
private final String desc;
public static String getDesc(String code) {
if (code == null) {
return "";
}
for (PayeeTypeEnum type : values()) {
if (type.getCode().equals(code)) {
return type.getDesc();
}
}
return "未知类型";
}
}
@@ -1,28 +0,0 @@
package com.central.order.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ProfitSharingStatusEnum {
INIT(0, "待分账"),
PROCESSING(1, "分账中"),
SUCCESS(2, "分账成功"),
FAILED(3, "分账失败");
private final int code;
private final String desc;
public static String getDesc(Integer code) {
if (code == null) {
return "";
}
for (ProfitSharingStatusEnum status : values()) {
if (status.getCode() == code) {
return status.getDesc();
}
}
return "未知状态";
}
}
@@ -1,4 +0,0 @@
package com.central.order.enums;
public enum QrcodeStatus {
}
@@ -1,26 +0,0 @@
package com.central.order.enums;
import com.central.common.enums.ZltEnum;
import lombok.Getter;
/**
* 订单状态枚举类型
*
* @author lsl create by 2025/1/10
*/
@Getter
public enum RefundState implements ZltEnum {
APPROVING(0,"审核中"),
APPROVED(1, "已通过"),
REFUSED(2,"已拒绝");
RefundState(Integer id, String content) {
this.id = id;
this.content = content;
}
private Integer id;
private String content;
}
@@ -1,23 +0,0 @@
package com.central.order.event;
import lombok.Getter;
import org.springframework.context.ApplicationEvent;
@Getter
public class OrderStatusChangeEvent extends ApplicationEvent {
private String orderNo;
private Integer oldStatus;
private Integer newStatus;
private Long userId;
private String orderInfo;
public OrderStatusChangeEvent(Object source, String orderNo, Integer oldStatus,
Integer newStatus, Long userId, String orderInfo) {
super(source);
this.orderNo = orderNo;
this.oldStatus = oldStatus;
this.newStatus = newStatus;
this.userId = userId;
this.orderInfo = orderInfo;
}
}
@@ -1,33 +0,0 @@
package com.central.order.feign;
import com.alibaba.fastjson.JSONObject;
import com.central.common.constant.ServiceNameConstants;
import com.central.order.feign.fallback.DeviceCenterServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
/**
* device-center模块远程调用
*
* @author lsl
* @version 1.0
* @description user-center模块远程调用
* @create 2025/1/13
**/
@FeignClient(name = ServiceNameConstants.DEVICE_SERVICE, fallbackFactory = DeviceCenterServiceFallbackFactory.class, dismiss404 = true)
public interface DeviceCenterService {
/**
* 通过ID查询文件sign
*
* @param id 文件ID
* @return
*/
@GetMapping("/wayline/sign/{id}")
String getLineFileSign(@PathVariable("id") String id);
@GetMapping("/live/stream-urls")
JSONObject getStreamUrls(@RequestParam("deviceId") String deviceId) ;
}
@@ -1,50 +0,0 @@
package com.central.order.feign;
import com.central.common.constant.ServiceNameConstants;
import com.central.common.model.FileInfo;
import com.central.common.model.Result;
import com.central.order.feign.fallback.FileCenterServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* user-center模块远程调用
*
* @author lsl
* @version 1.0
* @description user-center模块远程调用
* @create 2025/1/13
**/
@FeignClient(name = ServiceNameConstants.FILE_SERVICE, fallbackFactory = FileCenterServiceFallbackFactory.class, dismiss404 = true)
public interface FileCenterService {
/**
* 通过ID查询预览地址
*
* @param id 文件ID
* @return
*/
@GetMapping("/file/{id}")
String getFileViewUrl(@PathVariable("id") String id);
@GetMapping("/type/{id}")
String getFileContentType(@PathVariable("id") String id);
@GetMapping("/qrcode/{codeId}")
Result<Map> uploadQrCodeFile(@PathVariable("codeId") String codeId) throws Exception;
@PostMapping("/path")
FileInfo creatFileInfo(@RequestBody String path);
@GetMapping("/files/path")
String getViewUrlByPath(@RequestParam("path") String path) ;
@GetMapping("/files/path/style")
String getViewUrlByPathStyle(@RequestParam("params") Map<String,String> params) ;
@GetMapping("/list/files")
List<String> getListFiles(@RequestParam("prefix") String prefix) ;
}
@@ -1,29 +0,0 @@
package com.central.order.feign;
import com.central.common.constant.ServiceNameConstants;
import com.central.common.model.SysUser;
import com.central.order.feign.fallback.UserCenterServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
* user-center模块远程调用
*
* @author lsl
* @version 1.0
* @description user-center模块远程调用
* @create 2025/1/13
**/
@FeignClient(name = ServiceNameConstants.USER_SERVICE, fallbackFactory = UserCenterServiceFallbackFactory.class, dismiss404 = true)
public interface UserCenterService {
/**
* 通过ID查询用户信息
*
* @param id 用户ID
* @return
*/
@GetMapping("/users/{id}")
SysUser findUserById(@PathVariable("id") Long id);
}
@@ -1,36 +0,0 @@
package com.central.order.feign.fallback;
import com.alibaba.fastjson.JSONObject;
import com.central.order.feign.DeviceCenterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
* 文件中心调用失败回调
*
* @author lsl
* @version 1.0
* @description 设备中心调用失败回调
* @create 2025/1/17 11:33
**/
@Slf4j
@Component
public class DeviceCenterServiceFallbackFactory implements FallbackFactory<DeviceCenterService> {
@Override
public DeviceCenterService create(Throwable cause) {
return new DeviceCenterService() {
@Override
public String getLineFileSign(String id) {
return "";
}
@Override
public JSONObject getStreamUrls(String deviceId) {
return null;
}
};
}
}
@@ -1,66 +0,0 @@
package com.central.order.feign.fallback;
import com.central.common.model.FileInfo;
import com.central.common.model.Result;
import com.central.order.feign.FileCenterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* 文件中心调用失败回调
*
* @author lsl
* @version 1.0
* @description 用户中心调用失败回调
* @create 2025/1/17 11:33
**/
@Slf4j
@Component
public class FileCenterServiceFallbackFactory implements FallbackFactory<FileCenterService> {
@Override
public FileCenterService create(Throwable cause) {
return new FileCenterService() {
@Override
public String getFileViewUrl(String id) {
return "";
}
@Override
public String getFileContentType(String id) {
return "";
}
@Override
public Result<Map> uploadQrCodeFile(String codeId) throws Exception {
return null;
}
@Override
public FileInfo creatFileInfo(String path) {
return null;
}
@Override
public String getViewUrlByPath(String path) {
return "";
}
@Override
public String getViewUrlByPathStyle(Map<String, String> params) {
return "";
}
@Override
public List<String> getListFiles(String prefix) {
return List.of();
}
};
}
}
@@ -1,31 +0,0 @@
package com.central.order.feign.fallback;
import com.central.common.model.SysUser;
import com.central.order.feign.UserCenterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
* 用户中心调用失败回调
*
* @author caiji
* @version 1.0
* @description 用户中心调用失败回调
* @create 2024/8/6 11:33
**/
@Slf4j
@Component
public class UserCenterServiceFallbackFactory implements FallbackFactory<UserCenterService> {
@Override
public UserCenterService create(Throwable cause) {
return new UserCenterService() {
@Override
public SysUser findUserById(Long id) {
return null;
}
};
}
}
@@ -1,134 +0,0 @@
package com.central.order.handler;
import com.central.order.model.WxMessageRecord;
import com.central.order.model.WxUserSubscribe;
import com.central.order.service.IWxTemplateMessageService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
@Slf4j
@Component
@RequiredArgsConstructor
public class WxMessageHandler {
private final WxMpService wxMpService;
private final IWxTemplateMessageService templateMessageService;
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage) {
try {
String msgType = wxMessage.getMsgType();
if (WxConsts.XmlMsgType.EVENT.equals(msgType)) {
return handleEventMessage(wxMessage);
}
return null;
} catch (Exception e) {
log.error("处理微信消息失败", e);
return null;
}
}
private WxMpXmlOutMessage handleEventMessage(WxMpXmlMessage wxMessage) {
String event = wxMessage.getEvent();
switch (event) {
case WxConsts.EventType.TEMPLATE_SEND_JOB_FINISH:
return handleTemplateSendJobFinish(wxMessage);
case WxConsts.EventType.SUBSCRIBE:
return handleSubscribeEvent(wxMessage);
case WxConsts.EventType.UNSUBSCRIBE:
return handleUnsubscribeEvent(wxMessage);
default:
log.info("未处理的事件类型:{}", event);
return null;
}
}
/**
* 处理模板消息发送完成事件
*/
private WxMpXmlOutMessage handleTemplateSendJobFinish(WxMpXmlMessage wxMessage) {
try {
String openId = wxMessage.getFromUser();
String msgId = wxMessage.getMsgId().toString();
String status = wxMessage.getStatus();
log.info("模板消息发送结果:openId={}, msgId={}, status={}",
openId, msgId, status);
// 更新消息发送状态
updateMessageStatus(openId, msgId, status.equals("SUCCESS")?1:0);
} catch (Exception e) {
log.error("处理模板消息发送结果事件失败", e);
}
return null;
}
private WxMpXmlOutMessage handleSubscribeEvent(WxMpXmlMessage wxMessage) {
String openId = wxMessage.getFromUser();
log.info("用户关注:openId={}", openId);
// 保存用户关注状态
saveUserSubscribeStatus(openId, true);
return WxMpXmlOutMessage.TEXT()
.content("感谢关注!")
.fromUser(wxMessage.getToUser())
.toUser(openId)
.build();
}
private WxMpXmlOutMessage handleUnsubscribeEvent(WxMpXmlMessage wxMessage) {
String openId = wxMessage.getFromUser();
log.info("用户取消关注:openId={}", openId);
// 更新用户关注状态
saveUserSubscribeStatus(openId, false);
return null;
}
/**
* 更新消息发送状态
*/
private void updateMessageStatus(String openId, String msgId, Integer status) {
try {
WxMessageRecord record = WxMessageRecord.builder()
.openId(openId)
.msgId(msgId)
.status(status)
.build();
// TODO: 调用消息记录服务更新状态
// messageRecordService.updateStatus(record);
} catch (Exception e) {
log.error("更新消息状态失败:openId={}, msgId={}", openId, msgId, e);
}
}
/**
* 保存用户关注状态
*/
private void saveUserSubscribeStatus(String openId, boolean isSubscribe) {
try {
WxUserSubscribe userSubscribe = WxUserSubscribe.builder()
.openId(openId)
.subscribed(isSubscribe)
.updateTime(LocalDateTime.now())
.build();
// TODO: 调用用户服务更新关注状态
// userSubscribeService.updateStatus(userSubscribe);
} catch (Exception e) {
log.error("更新用户关注状态失败:openId={}", openId, e);
}
}
}
@@ -1,258 +0,0 @@
package com.central.order.listener;
import com.alibaba.fastjson.JSON;
import com.central.common.model.SysUser;
import com.central.order.constants.EditTaskStatus;
import com.central.order.enums.MessageTemplateEnum;
import com.central.order.enums.OrderStatus;
import com.central.order.enums.OrderStatusChangeEnum;
import com.central.order.event.OrderStatusChangeEvent;
import com.central.order.feign.UserCenterService;
import com.central.order.model.*;
import com.central.order.service.*;
import com.central.order.util.DateUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Component
@RequiredArgsConstructor
public class OrderStatusChangeListener {
@Autowired
private IMessageService messageService;
@Autowired
private ITourismService tourismService;
@Autowired
private IOrderService orderService;
@Autowired
private IQrCodeService qrCodeService;
@Autowired
private IVideoEditService videoEditService;
@Autowired
private IOrderFileService orderFileService;
@Autowired
private IWxTemplateMessageService wxTemplateMessageService;
@Autowired
private UserCenterService userCenterService;
@Autowired
private IEditTaskService editTaskService;
@Autowired
private WxMiniSubscribeService wxMiniSubscribeService;
@EventListener
@Async
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void handleOrderStatusChange(OrderStatusChangeEvent event) {
try {
log.info("开始处理订单状态变更事件: orderId={}, oldStatus={}, newStatus={}",
event.getOrderNo(), event.getOldStatus(), event.getNewStatus());
// 参数校验
if (event.getOrderNo() == null) {
log.error("订单号为空,无法处理状态变更事件");
return;
}
// 获取状态变更类型
OrderStatusChangeEnum changeEnum = OrderStatusChangeEnum
.getByStatusChange(event.getOldStatus(), event.getNewStatus());
if (changeEnum == null) {
log.warn("未找到对应的状态变更类型: oldStatus={}, newStatus={}",
event.getOldStatus(), event.getNewStatus());
return;
}
// 获取订单信息
Order order = orderService.getOrderByNumber(event.getOrderNo());
if (order == null) {
log.error("未找到订单信息: orderId={}", event.getOrderNo());
return;
}
// 获取景区信息
Tourism tourism = tourismService.getTourismById(order.getTourismId());
if (tourism == null) {
log.error("未找到景区信息: tourismId={}", order.getTourismId());
return;
}
// 处理支付成功状态
if (isPaymentSuccess(event.getOldStatus(), event.getNewStatus())) {
handlePaymentSuccess(order, tourism);
}
// 构建消息内容
String content = changeEnum.getContentTemplate()
.replace("#{orderNo}", event.getOrderNo())
+ "\n景区名称:" + tourism.getTourismName()
+ "\n" + event.getOrderInfo();
// 获取消息模板
MessageTemplateEnum template = MessageTemplateEnum.getByStatusChange(event.getOldStatus(), event.getNewStatus());
if (template == null) {
log.warn("未找到对应的消息模板: oldStatus={}, newStatus={}",
event.getOldStatus(), event.getNewStatus());
return;
}
// 创建站内信
Message message = new Message();
message.setTitle(changeEnum.getTitle());
message.setContent(content);
message.setType(template.getType()); // 使用模板中的类型
message.setUserId(event.getUserId());
message.setRelatedId(event.getOrderNo());
// 设置额外信息
Map<String, Object> extra = new HashMap<>();
extra.put("oldStatus", event.getOldStatus());
extra.put("newStatus", event.getNewStatus());
extra.put("tourismId", order.getTourismId());
extra.put("tourismName", tourism.getTourismName());
message.setExtra(JSON.toJSONString(extra)); // Fastjson不会抛出受检异常
log.info("准备保存站内信: title={}, userId={}, content={}",
message.getTitle(), message.getUserId(), message.getContent());
// 保存消息
messageService.createMessage(message);
log.info("站内信创建成功: userId={}", message.getUserId());
// 订单完成时,检查是否需要触发一键成片
if (OrderStatus.COMPLETE.getId().equals(event.getNewStatus())) {
handleOrderComplete(order);
}
} catch (Exception e) {
log.error("处理订单状态变更事件失败", e);
throw new RuntimeException("处理订单状态变更事件失败", e);
}
}
/**
* 判断是否为支付成功状态变更
*/
private boolean isPaymentSuccess(Integer oldStatus, Integer newStatus) {
return OrderStatus.UNPAID.getId()
.equals(oldStatus) && OrderStatus.PAID.getId().equals(newStatus);
}
/**
* 处理支付成功逻辑
*/
private void handlePaymentSuccess(Order order, Tourism tourism) {
try {
// 1. 发送微信通知
SysUser sysUser = userCenterService.findUserById(order.getUserId());
// 2. 查询订单排队信息
Integer queue = orderService.getOrderRankingByOrderId(order.getId(),tourism.getId());
// 发送小程序订阅消息
if (sysUser.getOpenId() != null) {
String tip = "支付成功,当前排第"+queue+"位";
String orderName = tourism.getTourismName();
String pageUrl = "pages/task/task";
wxMiniSubscribeService.sendServiceProcessMsg(
sysUser.getOpenId(),
orderName,
tip,
order.getOrderNo(),
DateUtils.sdf.format(order.getPayTime()),
"",
pageUrl
);
}
// 2. 记录支付成功日志
log.info("订单支付成功: orderNo={}, amount={}, tourismName={}",
order.getOrderNo(), order.getOrderAmount(), tourism.getTourismName());
} catch (Exception e) {
// 通知失败不影响主流程
log.error("处理支付成功通知失败: orderNo={}", order.getOrderNo(), e);
}
}
/**
* 处理订单完成逻辑
*/
private void handleOrderComplete(Order order) {
try {
// 1. 检查是否开启一键成片
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
if (!isVideoEditEnabled(qrCode)) {
log.info("未开启一键成片功能: orderNo={}, codeId={}",
order.getOrderNo(), order.getCodeId());
return;
}
// 3. 创建新任务
EditTask task = editTaskService.createTask(order.getOrderNo(), order.getUserId());
// 4. 获取素材文件
List<OrderFile> orderFiles = orderFileService.getOrderFileByOrderNo(order.getOrderNo());
// 5. 提交编辑任务
String jobId = videoEditService.submitEditTask(order.getOrderNo(), orderFiles);
log.info("提交一键成片任务成功: orderNo={}, jobId={}, totalMediaFiles={}",
order.getOrderNo(), jobId, orderFiles.size());
// 6. 更新任务信息
task.setJobId(jobId);
task.setStatus(EditTaskStatus.PROCESSING);
editTaskService.saveOrUpdateTask(task);
// 新增:查找下一个排队用户
Order nextOrder = orderService.getNextQueueOrder(order.getTourismId(), order.getId());
if (nextOrder != null) {
SysUser nextUser = userCenterService.findUserById(nextOrder.getUserId());
Tourism tourism = tourismService.getTourismById(nextOrder.getTourismId());
if (nextUser != null && nextUser.getOpenId() != null && tourism != null) {
String activityName = tourism.getTourismName(); // 活动名称
String remark = "即将为您进行拍摄服务";
String activityNo = nextOrder.getOrderNo(); // 活动编号
String pageUrl = "pages/task/task";
wxMiniSubscribeService.sendServiceProcessMsg(
nextUser.getOpenId(),
activityName,
remark,
activityNo,
DateUtils.sdf.format(nextOrder.getPayTime()),
"",
pageUrl
);
log.info("已通知下一个排队用户: userId={}, openId={}, orderNo={}", nextUser.getId(), nextUser.getOpenId(), activityNo);
}
}
} catch (Exception e) {
log.error("触发一键成片或排队通知失败: orderNo={}", order.getOrderNo(), e);
}
}
/**
* 检查是否开启一键成片功能
*/
private boolean isVideoEditEnabled(QrCode qrCode) {
return qrCode != null
&& qrCode.getEnableVideoEdit() != null
&& qrCode.getEnableVideoEdit() == 1
&& qrCode.getTemplateId() != null; // 确保有模板ID
}
}
@@ -1,91 +0,0 @@
package com.central.order.mapper;
import com.central.order.model.vo.IncomeDataVO;
import com.central.order.model.vo.TourismRankingVO;
import com.central.order.model.vo.TrendDataVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface DashboardMapper {
@Select("SELECT COUNT(*) FROM orders WHERE is_del = 0")
Long getTotalOrders();
@Select("SELECT COUNT(*) FROM orders WHERE is_del = 0 AND DATE(create_time) = CURDATE()")
Long getTodayOrders();
@Select("SELECT COUNT(*) FROM orders WHERE is_del = 0 AND DATE(create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)")
Long getYesterdayOrders();
@Select("SELECT COUNT(*) FROM orders WHERE is_del = 0 AND order_status = #{completeStatus}")
Long getCompletedOrders();
@Select({
"<script>",
"SELECT COALESCE(SUM(order_amount), 0)",
"FROM orders",
"WHERE is_del = 0",
"AND order_status IN ${@com.central.order.constants.OrderStatusConstants@PAID_STATUS}",
"</script>"
})
Long getTotalIncome();
@Select({
"<script>",
"SELECT COALESCE(SUM(order_amount), 0)",
"FROM orders",
"WHERE is_del = 0",
"AND order_status IN ${@com.central.order.constants.OrderStatusConstants@PAID_STATUS}",
"AND DATE(create_time) = CURDATE()",
"</script>"
})
Long getTodayIncome();
@Select({
"SELECT",
" DATE_FORMAT(create_time, '%Y-%m-%d') as date,",
" 'orders' as type,",
" COUNT(*) as value",
"FROM orders",
"WHERE is_del = 0",
" AND create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)",
"GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d')"
})
List<TrendDataVO> getOrderTrend();
@Select({
"SELECT",
" 'platform' as type,",
" SUM(platform_amount) as value",
"FROM order_statistics",
"WHERE DATE(create_time) = CURDATE()",
"UNION ALL",
"SELECT",
" 'tourism' as type,",
" SUM(tourism_amount) as value",
"FROM order_statistics",
"WHERE DATE(create_time) = CURDATE()"
})
List<IncomeDataVO> getIncomeData();
@Select({
"SELECT",
" t.id,",
" t.tourism_name as name,",
" COUNT(o.id) as value",
"FROM tourisms t",
"LEFT JOIN orders o ON t.id = o.tourism_id",
"WHERE t.is_del = 0",
" AND o.is_del = 0",
" AND o.create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)",
"GROUP BY t.id, t.tourism_name",
"ORDER BY value DESC",
"LIMIT 10"
})
List<TourismRankingVO> getTourismRanking();
}
@@ -1,12 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.central.order.model.EditTask;
import org.apache.ibatis.annotations.Mapper;
/**
* 视频编辑任务Mapper接口
*/
@Mapper
public interface EditTaskMapper extends BaseMapper<EditTask> {
}
@@ -1,29 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.central.db.mapper.SuperMapper;
import com.central.order.model.HomeCarousel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* HomeCarousel information
*
* @author lsl
* @date 2025-2-19 17:52:54
*/
@Mapper
public interface HomeCarouselMapper extends SuperMapper<HomeCarousel> {
/**
* 分页查询用户列表
*
* @param page
* @param params
* @return
*/
List<HomeCarousel> findList(Page<HomeCarousel> page, @Param("p") Map<String, Object> params);
}
@@ -1,77 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.central.db.mapper.SuperMapper;
import com.central.order.model.Message;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Mapper
public interface MessageMapper extends SuperMapper<Message> {
List<Message> findList(Page<Message> page,
@Param("tenantId") String tenantId);
@Update("UPDATE sys_message SET status = 1, read_time = #{readTime} " +
"WHERE id = #{id}")
int markAsRead(@Param("id") Long id,
@Param("readTime") Date readTime);
@Update("UPDATE sys_message SET status = 1, read_time = #{readTime} " +
"WHERE status = 0")
int markAllAsRead( @Param("readTime") Date readTime);
/**
* 查询消息列表
* 使用@Param注解明确指定参数名
*/
List<Message> findList(Page<Message> page,
@Param("userId") Long userId,
@Param("tenantId") String tenantId,
@Param("params") Map<String, Object> params);
/**
* 批量插入消息
*/
int batchInsert(@Param("list") List<Message> messages);
/**
* 批量更新消息状态
*/
int batchUpdateStatus(@Param("ids") List<Long> ids,
@Param("status") Integer status,
@Param("readTime") Date readTime,
@Param("userId") Long userId);
/**
* 获取未读消息数量
*/
int getUnreadCount(@Param("userId") Long userId,
@Param("tenantId") String tenantId);
/**
* 按类型获取未读消息数量
*/
List<Map<String, Object>> getUnreadCountByType(@Param("userId") Long userId,
@Param("tenantId") String tenantId);
/**
* 删除指定时间之前的已读消息
*/
int deleteReadMessages(@Param("beforeTime") Date beforeTime,
@Param("userId") Long userId,
@Param("tenantId") String tenantId);
/**
* 根据关联ID查询消息
*/
List<Message> findByRelatedId(@Param("relatedId") String relatedId,
@Param("userId") Long userId,
@Param("tenantId") String tenantId);
}
@@ -1,49 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.central.db.mapper.SuperMapper;
import com.central.order.model.OrderFile;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
* Order File information
*
* @author lsl
* @date 2024-12-19 17:52:54
*/
@Mapper
public interface OrderFileMapper extends SuperMapper<OrderFile> {
/**
* 分页查询用户列表
*
* @param page
* @param params
* @return
*/
List<OrderFile> findList(Page<OrderFile> page, @Param("params") Map<String, Object> params);
// 新增订单资源
int insertOrderFile(OrderFile orderFile);
// 根据订单编号查询文件资源信息
List<OrderFile> getOrderFileByOrderNo(@Param("orderNo") String orderNo);
List<OrderFile> getOrderFileByOrderNoAndFileType(@Param("orderNo") String orderNo, @Param("fileType") String contentType);
// 文件ID查询文件
OrderFile getFileByFileId(@Param("fileId") String fileId);
// 查询所有处于排队状态的订单,用于后续按顺序处理(可根据业务需求添加排序等逻辑)
List<OrderFile> getOrderFilesByUserId(@Param("userId") Long userId);
List<OrderFile> findListByUser(Page<OrderFile> page, @Param("p") Map<String, Object> params);
/**
* 获取订单的视频文件
*/
@Select("SELECT * FROM order_files WHERE order_no = #{orderNo} AND file_type = 'video/mp4' ORDER BY create_time ASC")
List<OrderFile> getOrderVideoFiles(@Param("orderNo") String orderNo);
}
@@ -1,61 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.central.db.mapper.SuperMapper;
import com.central.order.model.Order;
import com.central.order.model.OrderRanking;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Order information
*
* @author lsl
* @date 2024-12-19 17:52:54
*/
@Mapper
public interface OrderMapper extends SuperMapper<Order> {
/**
* 分页查询用户列表
* @param page
* @param params
* @return
*/
List<Order> findList(Page<Order> page, @Param("p") Map<String, Object> params);
// 根据订单状态查询订单列表
List<Order> getOrdersByStatus(@Param("status") Integer status);
// 新增订单
int insertOrder(Order order);
// 根据订单编号查询订单信息
Order getOrderById(@Param("orderId") Long orderId);
// 更新订单状态
int updateOrderStatus(@Param("orderId") Long orderId, @Param("newStatus") Integer newStatus);
// 查询所有处于排队状态的订单,用于后续按顺序处理(可根据业务需求添加排序等逻辑)
List<Order> getOrdersInQueue();
// 根据店铺编号和创建时间(当天)查询订单数量
List<Order> findByShopIdAndCreateTimeGreaterThanEqualAndCreateTimeLessThanEqual(@Param("tourismId") Long tourismId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
// 根据订单编号查询订单信息
Order getOrderByNumber(@Param("orderNumber") String orderNumber);
List<Order> findListByUser(Page<Order> page, @Param("p") Map<String, Object> params);
@Select("SELECT \n" +
" id,\n" +
" @rank := @rank + 1 as ranking\n" +
"FROM \n" +
" orders,\n" +
" (SELECT @rank := 0) r\n" +
"WHERE \n" +
" order_status in(1,4,5,6) and tourism_id = #{tourismId} \n" +
"ORDER BY \n" +
" pay_time;")
List<OrderRanking> getOrderRanking1(@Param("tourismId") Long tourismId);
}
@@ -1,66 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.central.order.model.OrderStatistics;
import com.central.order.model.OrderStatisticsQuery;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@Mapper
public interface OrderStatisticsMapper extends BaseMapper<OrderStatistics> {
@Select({
"<script>",
"SELECT",
" o.code_id as qrcodeId,",
" o.tourism_id as tourismId,",
" t.tourism_name as tourismName,",
" o.device_sn as deviceSn,",
" COUNT(o.id) as totalOrders,",
" SUM(CASE WHEN o.order_status IN ${paidStatus} THEN 1 ELSE 0 END) as paidOrders,",
" SUM(CASE WHEN o.order_status = #{completeStatus} THEN 1 ELSE 0 END) as completedOrders,",
" SUM(CASE WHEN o.order_status = #{cancelStatus} THEN 1 ELSE 0 END) as canceledOrders,",
" SUM(CAST(o.order_amount AS SIGNED)) as totalAmount,",
" SUM(CASE WHEN o.order_status IN ${paidStatus} THEN CAST(o.order_amount AS SIGNED) ELSE 0 END) as paidAmount,",
" SUM(CASE WHEN o.order_status IN ${refundStatus} THEN CAST(o.order_amount AS SIGNED) ELSE 0 END) as refundAmount",
"FROM orders o",
"LEFT JOIN tourisms t ON o.tourism_id = t.id",
"WHERE o.create_time BETWEEN #{startTime} AND #{endTime}",
" AND o.is_del = 0",
"<if test='qrcodeId != null'>",
" AND o.code_id = #{qrcodeId}",
"</if>",
"<if test='tourismId != null'>",
" AND o.tourism_id = #{tourismId}",
"</if>",
"GROUP BY o.code_id, o.tourism_id, t.tourism_name, o.device_sn",
"</script>"
})
List<Map<String, Object>> getOrderStatistics(OrderStatisticsQuery query);
@Select({
"<script>",
"SELECT",
" ${groupField} as groupKey,",
" COUNT(o.id) as totalOrders,",
" SUM(CASE WHEN o.order_status IN ${paidStatus} THEN 1 ELSE 0 END) as paidOrders,",
" SUM(CASE WHEN o.order_status = #{completeStatus} THEN 1 ELSE 0 END) as completedOrders,",
" SUM(CASE WHEN o.order_status = #{cancelStatus} THEN 1 ELSE 0 END) as canceledOrders,",
" SUM(CAST(o.order_amount AS SIGNED)) as totalAmount,",
" SUM(CASE WHEN o.order_status IN ${paidStatus} THEN CAST(o.order_amount AS SIGNED) ELSE 0 END) as paidAmount,",
" SUM(CASE WHEN o.order_status IN ${refundStatus} THEN CAST(o.order_amount AS SIGNED) ELSE 0 END) as refundAmount",
"FROM orders o",
"WHERE o.create_time BETWEEN #{startTime} AND #{endTime}",
" AND o.is_del = 0",
"<if test='qrcodeId != null'>",
" AND o.code_id = #{qrcodeId}",
"</if>",
"GROUP BY ${groupField}",
"ORDER BY o.create_time ASC",
"</script>"
})
List<Map<String, Object>> getOrderStatisticsByGroup(OrderStatisticsQuery query);
}
@@ -1,33 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.central.db.mapper.SuperMapper;
import com.central.order.model.PaymentRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Order information
*
* @author lsl
* @date 2024-12-19 17:52:54
*/
@Mapper
public interface PaymentRecordMapper extends SuperMapper<PaymentRecord> {
/**
* 分页查询用户列表
* @param page
* @param params
* @return
*/
List<PaymentRecord> findList(Page<PaymentRecord> page, @Param("p") Map<String, Object> params);
// 插入支付记录
int insertPaymentRecord(PaymentRecord paymentRecord);
// 根据支付流水号查询支付记录(用于幂等性判断)
PaymentRecord getPaymentRecordByNumber(@Param("paymentNumber") String paymentNumber);
}
@@ -1,43 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.central.order.model.ProfitSharing;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Mapper
public interface ProfitSharingMapper extends BaseMapper<ProfitSharing> {
// 获取总体统计
@Select("SELECT " +
"COUNT(*) as total_count, " +
"SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) as success_count, " +
"SUM(CASE WHEN status = 3 THEN 1 ELSE 0 END) as fail_count, " +
"SUM(qrcode_amount) as total_amount " +
"FROM profit_sharing")
Map<String, Object> getTotalStatistics();
// 获取每日金额趋势
@Select("SELECT " +
"DATE_FORMAT(create_time, '%Y-%m-%d') as date, " +
"'DAY' as type, " +
"SUM(qrcode_amount) as amount " +
"FROM profit_sharing " +
"WHERE create_time >= #{startTime} " +
"GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d')")
List<Map<String, Object>> getDailyAmountTrend(@Param("startTime") Date startTime);
// 获取每日成功率
@Select("SELECT " +
"DATE_FORMAT(create_time, '%Y-%m-%d') as date, " +
"'DAY' as type, " +
"ROUND(SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2) as value " +
"FROM profit_sharing " +
"WHERE create_time >= #{startTime} " +
"GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d')")
List<Map<String, Object>> getDailySuccessRate(@Param("startTime") Date startTime);
}
@@ -1,35 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.central.db.mapper.SuperMapper;
import com.central.order.model.QrCode;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Qrcode information
*
* @author lsl
* @date 2024-12-19 17:52:54
*/
@Mapper
public interface QrCodeMapper extends SuperMapper<QrCode> {
/**
* 分页查询用户列表
*
* @param page
* @param params
* @return
*/
List<QrCode> findList(Page<QrCode> page, @Param("p") Map<String, Object> params);
// 新增二维码资源
int insertQrCode(QrCode qrCode);
// ID查询
QrCode getByCodeId(@Param("codeId") String codeId);
}
@@ -1,27 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.central.db.mapper.SuperMapper;
import com.central.order.model.Refund;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Order information
*
* @author lsl
* @date 2024-12-19 17:52:54
*/
@Mapper
public interface RefundMapper extends SuperMapper<Refund> {
/**
* 分页查询用户列表
* @param page
* @param params
* @return
*/
List<Refund> findList(Page<Refund> page, @Param("p") Map<String, Object> params);
}
@@ -1,32 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.central.db.mapper.SuperMapper;
import com.central.order.model.TourismFile;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Tourism File information
*
* @author lsl
* @date 2025-2-17 17:52:54
*/
@Mapper
public interface TourismFileMapper extends SuperMapper<TourismFile> {
/**
* 分页查询用户列表
*
* @param page
* @param params
* @return
*/
List<TourismFile> findList(Page<TourismFile> page, @Param("p") Map<String, Object> params);
// ID查询
List<TourismFile> getByTourismId(@Param("tourismId") Long tourismId);
}
@@ -1,35 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.central.db.mapper.SuperMapper;
import com.central.order.model.Tourism;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Tourism information
*
* @author lsl
* @date 2024-12-19 17:52:54
*/
@Mapper
public interface TourismMapper extends SuperMapper<Tourism> {
/**
* 分页查询用户列表
*
* @param page
* @param params
* @return
*/
List<Tourism> findList(Page<Tourism> page, @Param("p") Map<String, Object> params);
// 新增订单资源
int insertTourism(Tourism tourism);
// ID查询
Tourism getTourismById(@Param("id") Long id);
}
@@ -1,9 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.central.order.model.VideoTemplate;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface VideoTemplateMapper extends BaseMapper<VideoTemplate> {
}
@@ -1,9 +0,0 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.central.order.model.WxMessageRecord;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WxMessageRecordMapper extends BaseMapper<WxMessageRecord> {
}
@@ -1,38 +0,0 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("edit_task")
public class EditTask {
@TableId(type = IdType.AUTO)
private Integer id;
private Long userId;
private String orderSn;
private String jobId;
private String result;
@Schema(description = "状态:0-待处理 1-处理中 2-处理完成 3-处理失败")
private Integer status;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
//租户ID
private Long tenantId;
private String remark;
}
@@ -1,47 +0,0 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.central.common.model.SuperEntity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* HomeCarousel File information
*
* @author lsl
* @date 2025-2-17 17:51:47
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
@TableName("home_carousel")
public class HomeCarousel extends SuperEntity {
private static final long serialVersionUID=1L;
private String imageUrl;
private String redirectUrl;
private int type;
private Integer status;
private String title;
private String description;
private int sortOrder;
private Date startTime;
private Date endTime;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
//租户ID
private String tenantId;
private String company;
private Integer isDel;
}
@@ -1,58 +0,0 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.central.common.model.SuperEntity;
import lombok.Data;
import java.util.Date;
@Data
@TableName("sys_message")
public class Message extends SuperEntity {
private static final long serialVersionUID = 1L;
/**
* 消息标题
*/
private String title;
/**
* 消息内容
*/
private String content;
/**
* 消息类型:1-退款订单 2-新增订单
*/
private Integer type;
/**
* 消息状态:0-未读 1-已读
*/
private Integer status;
/**
* 阅读时间
*/
private Date readTime;
/**
* 关联ID
*/
private String relatedId;
/**
* 额外信息(JSON格式)
*/
private String extra;
/**
* 接收用户ID
*/
private Long userId;
/**
* 租户ID
*/
private String tenantId;
}
@@ -1,58 +0,0 @@
package com.central.order.model;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.central.common.model.SuperEntity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* Device information
*
* @author lsl
* @date 2024-12-19 17:51:47
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
@TableName("orders")
public class Order extends SuperEntity {
private static final long serialVersionUID=1L;
private String orderNo;
private String deviceSn;
private Long userId;
private Long tourismId;
private transient String tourismName;
private String workspaceId;
private String orderAmount;
private Integer orderStatus;
private Date payTime;
private transient String createdTime;
private transient String fileMd5;
private transient String mobile;
private String codeId;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
private String tenantId;
private String company;
private Integer isDel;
private transient String waylineLinkUrl;
private transient JSONObject streamUrls;
}
@@ -1,49 +0,0 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.central.common.model.SuperEntity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* order files information
*
* @author lsl
* @date 2024-12-19 17:51:47
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
@TableName("order_files")
public class OrderFile extends SuperEntity {
private static final long serialVersionUID=1L;
private String orderNo;
private String fileId;
private Long userId;
private transient String viewUrl;
//文件缩略图
private transient String zipViewUrl;
// 景区ID
private Long tourismId;
private String fileType;
//该Path不包含bucketName
private String filePath;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
//租户ID
private String tenantId;
private Integer isDel;
}
@@ -1,13 +0,0 @@
package com.central.order.model;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class OrderRanking {
private Integer ranking;
private Long id;
}
@@ -1,44 +0,0 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@TableName("order_statistics")
public class OrderStatistics {
private Long id;
// 统计维度
private String qrcodeId; // 二维码ID
private Long tourismId; // 景区ID
private String tourismName; // 景区名称
private String deviceSn; // 设备编号
private String tenantId; // 租户ID
// 订单统计
private Integer totalOrders; // 总订单数
private Integer paidOrders; // 已支付订单数
private Integer completedOrders;// 已完成订单数
private Integer canceledOrders; // 已取消订单数
// 金额统计(单位:分)
private Long totalAmount; // 总金额
private Long paidAmount; // 已支付金额
private Long refundAmount; // 退款金额
// 分账金额
private BigDecimal platformRate = BigDecimal.ZERO;
private BigDecimal tourismRate = BigDecimal.ZERO;
private Long platformAmount = 0L;
private Long tourismAmount = 0L;
// 时间维度
private Date startTime; // 统计开始时间
private Date endTime; // 统计结束时间
private String statisticsDate; // 统计日期(yyyy-MM-dd)
private Integer statisticsHour; // 统计小时(0-23)
private Date createTime; // 创建时间
}
@@ -1,28 +0,0 @@
package com.central.order.model;
import com.central.order.constants.OrderStatusConstants;
import com.central.order.enums.OrderStatus;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class OrderStatisticsQuery {
private String startTime;
private String endTime;
private String qrcodeId;
private Long tourismId;
private String deviceSn;
private String groupField; // 分组字段
@Builder.Default
private Integer completeStatus = OrderStatus.COMPLETE.getId();
@Builder.Default
private Integer cancelStatus = OrderStatus.CANCELED.getId();
// 添加状态集合字符串
@Builder.Default
private String paidStatus = OrderStatusConstants.PAID_STATUS;
@Builder.Default
private String refundStatus = OrderStatusConstants.REFUND_STATUS;
}
@@ -1,43 +0,0 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* PaymentRecord information
*
* @author lsl
* @date 2024-12-19 17:51:47
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
@TableName("payment_records")
public class PaymentRecord {
private static final long serialVersionUID = 1L;
@TableId
private Long id;
private Long orderId;
private String orderNo;
private String paymentNumber;
private Double paymentAmount;
private Date paymentTime;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
private Long createId;
private String company;
private Integer isDel;
}
@@ -1,163 +0,0 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.central.order.enums.PayeeTypeEnum;
import com.central.order.enums.ProfitSharingStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("profit_sharing")
@Schema(description = "分账记录")
public class ProfitSharing {
@TableId
@Schema(description = "主键ID")
private Long id;
@NotNull(message = "订单ID不能为空")
@Length(max = 64, message = "订单ID长度不能超过64")
@Schema(description = "订单ID")
private String orderId;
@NotNull(message = "订单编号不能为空")
@Length(max = 64, message = "订单编号长度不能超过64")
@Schema(description = "订单编号")
private String orderNo;
@Length(max = 64, message = "微信支付订单号长度不能超过64")
@Schema(description = "微信支付订单号")
private String transactionId;
@Length(max = 64, message = "微信分账单号长度不能超过64")
@Schema(description = "微信分账单号")
@TableField("profit_sharing_id")
private String profitSharingId;
@NotNull(message = "订单总金额不能为空")
@Min(value = 1, message = "订单总金额必须大于0")
@Schema(description = "订单总金额(分)")
private Long totalAmount;
@NotNull(message = "平台分账金额不能为空")
@Min(value = 0, message = "平台分账金额不能小于0")
@Schema(description = "平台分账金额(分)")
private Long platformAmount;
@NotNull(message = "二维码分账金额不能为空")
@Min(value = 1, message = "二维码分账金额必须大于0")
@Schema(description = "二维码分账金额(分)")
@TableField("qrcode_amount")
private Long qrCodeAmount;
@Schema(description = "分账状态:0-待分账 1-分账中 2-分账成功 3-分账失败")
private Integer status;
@NotNull(message = "二维码ID不能为空")
@Schema(description = "二维码ID")
private String codeId;
@NotNull(message = "分账接收账号不能为空")
@Schema(description = "分账接收账号")
@TableField("payee_account")
private String payeeAccount;
@NotNull(message = "分账账号类型不能为空")
@Schema(description = "分账账号类型:MERCHANT_ID-商户ID,PERSONAL_OPENID-个人openid")
@TableField("payee_type")
private String payeeType;
@Length(max = 256, message = "分账描述长度不能超过256")
@Schema(description = "分账描述")
@TableField("description")
private String description;
@Length(max = 256, message = "分账失败原因长度不能超过256")
@Schema(description = "分账失败原因")
@TableField("fail_reason")
private String failReason;
@Schema(description = "实际分账金额(分)")
@TableField("receiver_amount")
private Long receiverAmount;
@Schema(description = "分账完成时间")
@TableField("finish_time")
private Date finishTime;
@Length(max = 64, message = "分账请求号长度不能超过64")
@Schema(description = "分账请求号")
@TableField("out_order_no")
private String outOrderNo;
@Schema(description = "重试次数")
@TableField("retry_times")
private Integer retryTimes;
@Schema(description = "最后重试时间")
@TableField("last_retry_time")
private Date lastRetryTime;
@Schema(description = "创建时间")
private Date createTime;
@Schema(description = "更新时间")
private Date updateTime;
/**
* 获取状态描述
*/
public String getStatusDesc() {
return ProfitSharingStatusEnum.getDesc(status);
}
/**
* 获取分账账号类型描述
*/
public String getPayeeTypeDesc() {
return PayeeTypeEnum.getDesc(payeeType);
}
/**
* 判断是否可以重试
* 条件:
* 1. 状态为失败
* 2. 重试次数小于3次
* 3. 距离上次重试时间超过5分钟
*/
public boolean canRetry() {
return status == ProfitSharingStatusEnum.FAILED.getCode()
&& (retryTimes == null || retryTimes < 3)
&& (lastRetryTime == null || System.currentTimeMillis() - lastRetryTime.getTime() > 300000);
}
/**
* 更新重试信息
*/
public void updateRetryInfo() {
this.retryTimes = (this.retryTimes == null ? 0 : this.retryTimes) + 1;
this.lastRetryTime = new Date();
}
/**
* 检查金额是否合法
*/
public boolean isAmountValid() {
return totalAmount != null && totalAmount > 0
&& platformAmount != null && platformAmount >= 0
&& qrCodeAmount != null && qrCodeAmount > 0
&& (platformAmount + qrCodeAmount == totalAmount);
}
}
@@ -1,104 +0,0 @@
package com.central.order.model;
import com.central.order.enums.ProfitSharingStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "分账结果")
public class ProfitSharingResult {
@Schema(description = "订单号")
private String orderNo;
@Schema(description = "微信支付订单号")
private String transactionId;
@Schema(description = "分账单号")
private String profitSharingId;
@Schema(description = "分账状态")
private Integer status;
@Schema(description = "分账状态描述")
private String statusDesc;
@Schema(description = "分账总金额(分)")
private Long totalAmount;
@Schema(description = "实际分账金额(分)")
private Long receiverAmount;
@Schema(description = "分账完成时间")
private Date finishTime;
@Schema(description = "失败原因")
private String failReason;
@Schema(description = "分账接收方列表")
private List<ReceiverResult> receivers;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ReceiverResult {
@Schema(description = "接收方类型")
private String type;
@Schema(description = "接收方账号")
private String account;
@Schema(description = "分账金额(分)")
private Long amount;
@Schema(description = "分账描述")
private String description;
@Schema(description = "分账结果")
private String result;
@Schema(description = "失败原因")
private String failReason;
@Schema(description = "分账明细单号")
private String detailId;
}
/**
* 获取状态描述
*/
public String getStatusDesc() {
return ProfitSharingStatusEnum.getDesc(status);
}
/**
* 判断分账是否成功
*/
public boolean isSuccess() {
return ProfitSharingStatusEnum.SUCCESS.getCode() == status;
}
/**
* 判断分账是否失败
*/
public boolean isFailed() {
return ProfitSharingStatusEnum.FAILED.getCode() == status;
}
/**
* 判断分账是否处理中
*/
public boolean isProcessing() {
return ProfitSharingStatusEnum.PROCESSING.getCode() == status;
}
}
@@ -1,96 +0,0 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.central.common.model.SuperEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.math.BigDecimal;
import java.util.Date;
/**
* qrcodes information
*
* @author lsl
* @date 2024-12-19 17:51:47
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("qrcodes")
public class QrCode extends SuperEntity {
private static final long serialVersionUID=1L;
private String codeId;
private Long tourismId;
// 新增二维码名称字段
private String name;
private String templateId;
private String filePath;
private transient String viewUrl;
private String fileId;
private Integer status;
private String waylineId;
private String price;
private String deviceSn;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
//租户ID
private String tenantId;
private String company;
private Integer isDel;
/**
* 分账接收账号
*/
private String payeeAccount;
/**
* 分账比例(百分比,例如:30.00 表示 30%)
*/
private BigDecimal profitRate;
/**
* 分账账号类型(MERCHANT_ID:商户ID,PERSONAL_OPENID:个人openid)
*/
private String payeeType;
/**
* 分账账号状态(0:未验证,1:已验证,2:验证失败)
*/
private Integer payeeStatus;
@Schema(description = "分账失败原因")
private String payeeFailReason;
/**
* 是否开启分润(0:否,1:是)
*/
@Schema(description = "是否开启分润")
private Integer enableProfit;
/**
* 是否开启一键成片(0:否,1:是)
*/
@Schema(description = "是否开启一键成片")
private Integer enableVideoEdit;
}
@@ -1,26 +0,0 @@
package com.central.order.model;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* qrcodes information
*
* @author lsl
* @date 2024-12-19 17:51:47
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public class QrCodeVO {
private static final long serialVersionUID=1L;
private String codeId;
private Tourism tourism;
private List<TourismFile> tourismFiles;
}
@@ -1,51 +0,0 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.central.common.model.SuperEntity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* Refund information
*
* @author lsl
* @date 2025-2-19 17:51:47
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
@TableName("orders_refund")
public class Refund extends SuperEntity {
private static final long serialVersionUID=1L;
private String orderNo;
private String refundNo;
private Long userId;
private String orderAmount;
private String refundAmount;
private String refundReason;
private String refundImgs;
private Integer status;
private Integer state;
private String approveReason;
private Date refundTime;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
private String tenantId;
private String company;
private Integer isDel;
}
@@ -1,38 +0,0 @@
package com.central.order.model;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
/**
* 一键成片请求参数实体类
* @author lsl
*
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RequestParamsEntity {
@Schema(description = "应用ID")
@NotBlank(message = "应用ID不能为空")
private String appId;
@Schema(description = "任务ID")
@NotBlank(message = "任务ID不能为空")
private String taskId;
@Schema(description = "回调地址")
@NotBlank(message = "回调地址不能为空")
private String callbackUrl;
@Schema(description = "素材来源")
@NotNull(message = "素材来源不能为空")
private SourceDTO source;
}
@@ -1,35 +0,0 @@
package com.central.order.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.Data;
import lombok.Builder;
import lombok.NoArgsConstructor;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
/**
* 定义请求参数中的sourceDTO类
* @author lsl
*
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SourceDTO {
@Schema(description = "文本列表")
private List<String> textList;
@Schema(description = "视频列表")
private List<String> videoList;
@Schema(description = "音频列表")
private List<String> audioList;
@Schema(description = "图片列表")
private List<String> imageList;
}
@@ -1,46 +0,0 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.central.common.model.SuperEntity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* Device information
*
* @author lsl
* @date 2024-12-19 17:51:47
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
@TableName("tourisms")
public class Tourism extends SuperEntity {
private static final long serialVersionUID=1L;
private String tourismName;
private String tourismDesc;
private Integer type;
private Integer status;
private String tourismNo;
private String tourismAddress;
private String tourismPhone;
private String tourismEmail;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
//租户ID
private String tenantId;
private String company;
private Integer isDel;
}
@@ -1,43 +0,0 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.central.common.model.SuperEntity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* Tourism File information
*
* @author lsl
* @date 2025-2-17 17:51:47
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
@TableName("tourisms_files")
public class TourismFile extends SuperEntity {
private static final long serialVersionUID=1L;
private Long tourismId;
private String imageUrl;
private int type;
private Integer status;
private String linkUrl;
private String description;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
//租户ID
private String tenantId;
private String company;
private Integer isDel;
}
@@ -1,52 +0,0 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.*;
import com.central.common.model.SuperEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("video_template")
@Schema(description = "视频模板")
public class VideoTemplate extends SuperEntity {
@TableId(type = IdType.AUTO)
@Schema(description = "主键ID")
private Long id;
@Schema(description = "模板ID")
private String templateId;
@Schema(description = "模板名称")
private String templateName;
@Schema(description = "模板描述")
private String description;
@Schema(description = "状态:0-禁用 1-启用")
private Integer status;
@Schema(description = "模板配置JSON")
private String config;
@Schema(description = "创建时间")
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@Schema(description = "更新时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
@Schema(description = "租户ID")
private Long tenantId;
@Schema(description = "所属公司")
private String company;
@Schema(description = "是否删除:0-否 1-是")
private Integer isDel;
}
@@ -1,32 +0,0 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("wx_message_record")
public class WxMessageRecord {
@TableId(type = IdType.AUTO)
private Long id;
private String openId;
private String templateId;
private String msgId;
private String content;
private Integer status;
private String errorMsg;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
//租户ID
private Long tenantId;
}
@@ -1,44 +0,0 @@
package com.central.order.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxTemplateInfo {
/**
* 模板ID
*/
private String priTmplId;
/**
* 模板标题
*/
private String title;
/**
* 模板内容
*/
private String content;
/**
* 模板示例
*/
private String example;
/**
* 类型
*/
private Integer type;
/**
* 创建时间
*/
private Date createTime;
}
@@ -1,20 +0,0 @@
package com.central.order.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxUserSubscribe {
private Long id;
private String openId;
private Boolean subscribed;
private LocalDateTime createTime;
private LocalDateTime updateTime;
}
@@ -1,18 +0,0 @@
package com.central.order.model.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CallbackDTO {
private String jobId;
private String status; // SUCCESS, FAILED
private String result; // 处理结果,可能包含视频URL或错误信息
private String errorCode;
private String errorMessage;
}
@@ -1,36 +0,0 @@
package com.central.order.model.dto;
import lombok.Builder;
import lombok.Data;
import java.util.List;
@Data
@Builder
public class VideoEditRequest {
private List<MediaInfo> sources;
private OutputInfo output;
private String templateId;
private String projectName;
private String pipelineName;
private String callbackUrl;
@Data
@Builder
public static class MediaInfo {
private String mediaUrl;
private String mediaType; // VIDEO, IMAGE, AUDIO
private Integer duration; // 持续时间(毫秒)
private String text; // 文本内容
}
@Data
@Builder
public static class OutputInfo {
private String outputName;
private String outputType; // MP4, MOV等
private Integer width;
private Integer height;
private String quality; // HD, SD等
}
}
@@ -1,32 +0,0 @@
package com.central.order.model.dto;
import lombok.Getter;
/**
* 视频编辑状态枚举
*/
@Getter
public enum VideoEditStatus {
QUEUED("Queued", "排队中"),
RUNNING("Running", "处理中"),
SUCCESS("Success", "处理成功"),
FAIL("Fail", "处理失败"),
UNKNOWN("Unknown", "未知状态");
private final String code;
private final String desc;
VideoEditStatus(String code, String desc) {
this.code = code;
this.desc = desc;
}
public static VideoEditStatus fromCode(String code) {
for (VideoEditStatus status : values()) {
if (status.getCode().equals(code)) {
return status;
}
}
return UNKNOWN;
}
}
@@ -1,18 +0,0 @@
package com.central.order.model.params;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EditTaskQueryParams {
private Integer page = 1;
private Integer limit = 10;
private String orderSn;
private String jobId;
private Integer status;
}
@@ -1,19 +0,0 @@
package com.central.order.model.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
@Schema(description = "图表统计数据")
public class ChartStatistics {
@Schema(description = "订单趋势")
private List<TrendDataVO> orderTrend;
@Schema(description = "设备分布")
private List<DistributionDataVO> deviceDistribution;
@Schema(description = "收入构成")
private List<IncomeDataVO> incomeData;
}
@@ -1,28 +0,0 @@
package com.central.order.model.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
@Schema(description = "首页统计数据VO")
public class DashboardStatisticsVO {
@Schema(description = "订单统计")
private OrderStatistics orderStats;
@Schema(description = "收入统计")
private IncomeStatistics incomeStats;
@Schema(description = "航线统计")
private WaylineStatistics waylineStats;
@Schema(description = "设备统计")
private DeviceStatistics deviceStats;
@Schema(description = "图表统计")
private ChartStatistics chartStats;
@Schema(description = "景区排行")
private List<TourismRankingVO> tourismRanking;
}
@@ -1,19 +0,0 @@
package com.central.order.model.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
@Schema(description = "设备统计数据")
public class DeviceStatistics {
@Schema(description = "设备总数")
private Long totalDevices;
@Schema(description = "在线设备数")
private Long onlineDevices;
@Schema(description = "设备在线率")
private BigDecimal deviceOnlineRate;
}
@@ -1,16 +0,0 @@
package com.central.order.model.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
@Schema(description = "分布数据")
public class DistributionDataVO {
@Schema(description = "类型")
private String type;
@Schema(description = "数值")
private BigDecimal value;
}
@@ -1,16 +0,0 @@
package com.central.order.model.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
@Schema(description = "收入数据")
public class IncomeDataVO {
@Schema(description = "类型")
private String type;
@Schema(description = "数值")
private BigDecimal value;
}
@@ -1,19 +0,0 @@
package com.central.order.model.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
@Schema(description = "收入统计数据")
public class IncomeStatistics {
@Schema(description = "总收入(分)")
private Long totalAmount;
@Schema(description = "今日收入(分)")
private Long todayAmount;
@Schema(description = "目标完成率")
private BigDecimal targetCompletion;
}

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