ticket finish and sampling init
This commit is contained in:
parent
7ffd9a461f
commit
cd834112e2
47
ludu-module-sampling/ludu-module-sampling-api/pom.xml
Normal file
47
ludu-module-sampling/ludu-module-sampling-api/pom.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<artifactId>ludu-module-sampling</artifactId>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ludu-module-sampling-api</artifactId>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
ticket 模块 API,暴露给其它模块调用
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 参数校验 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
152
ludu-module-sampling/ludu-module-sampling-biz/pom.xml
Normal file
152
ludu-module-sampling/ludu-module-sampling-biz/pom.xml
Normal file
@ -0,0 +1,152 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<artifactId>ludu-module-sampling</artifactId>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ludu-module-sampling-biz</artifactId>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
ticket 模块,我们票务业务。
|
||||
例如说:设备管理等等
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 依赖服务 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>ludu-module-sampling-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<!-- Spring Cloud 基础 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-env</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-system-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-infra-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- DB 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-rpc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Registry 注册中心相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Config 配置中心相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 消息队列相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-mq</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test 测试相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-ip</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 监控相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!-- 设置构建的 jar 包名 -->
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<!-- 打包 -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.sampling;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class SamplingServerApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SamplingServerApplication.class, args);
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.sampling.config;
|
||||
|
||||
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
*/
|
||||
@Configuration
|
||||
public class XxlJobConfiguration {
|
||||
@Value("${xxl.job.admin.addresses}")
|
||||
private String adminAddresses;
|
||||
@Value("${xxl.job.executor.appname}")
|
||||
private String appName;
|
||||
@Value("${xxl.job.executor.ip}")
|
||||
private String ip;
|
||||
@Value("${xxl.job.executor.port}")
|
||||
private int port;
|
||||
@Value("${xxl.job.accessToken}")
|
||||
private String accessToken;
|
||||
@Value("${xxl.job.executor.logpath}")
|
||||
private String logPath;
|
||||
@Value("${xxl.job.executor.logretentiondays}")
|
||||
private int logRetentionDays;
|
||||
|
||||
@Bean
|
||||
public XxlJobSpringExecutor xxlJobExecutor() {
|
||||
// 创建 XxlJobSpringExecutor 执行器
|
||||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
|
||||
xxlJobSpringExecutor.setAppname(appName);
|
||||
xxlJobSpringExecutor.setIp(ip);
|
||||
xxlJobSpringExecutor.setPort(port);
|
||||
xxlJobSpringExecutor.setAccessToken(accessToken);
|
||||
xxlJobSpringExecutor.setLogPath(logPath);
|
||||
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
|
||||
// 返回
|
||||
return xxlJobSpringExecutor;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.sampling.framework.security.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
|
||||
|
||||
/**
|
||||
* Demo 模块的 Security 配置
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class SecurityConfiguration {
|
||||
|
||||
@Bean
|
||||
public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
|
||||
return new AuthorizeRequestsCustomizer() {
|
||||
|
||||
@Override
|
||||
public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) {
|
||||
// Swagger 接口文档
|
||||
registry.antMatchers("/v3/api-docs/**").permitAll() // 元数据
|
||||
.antMatchers("/swagger-ui.html").permitAll(); // Swagger UI
|
||||
// Druid 监控
|
||||
registry.antMatchers("/druid/**").anonymous();
|
||||
// Spring Boot Actuator 的安全配置
|
||||
registry.antMatchers("/actuator").anonymous()
|
||||
.antMatchers("/actuator/**").anonymous();
|
||||
// RPC 服务的安全配置
|
||||
registry.antMatchers(ApiConstants.PREFIX + "/**").permitAll();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.sampling.job;
|
||||
|
||||
import com.xxl.job.core.biz.model.ReturnT;
|
||||
import com.xxl.job.core.handler.IJobHandler;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
*/
|
||||
@Component
|
||||
public class DemoJob extends IJobHandler {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final AtomicInteger counts = new AtomicInteger();
|
||||
@XxlJob("demoJob")
|
||||
public ReturnT<String> demoJobHandler(String param) throws Exception {
|
||||
logger.info("XXL-JOB, Hello World.");
|
||||
System.out.println("zxxxx");
|
||||
logger.info("XXL-JOB, Hello World end.");
|
||||
return ReturnT.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
--- #################### 数据库相关配置 ####################
|
||||
spring:
|
||||
# 数据源配置项
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
||||
datasource:
|
||||
druid: # Druid 【监控】相关的全局配置
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
allow: # 设置白名单,不填则允许所有访问
|
||||
url-pattern: /druid/*
|
||||
login-username: # 控制台管理用户名和密码
|
||||
login-password:
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
log-slow-sql: true # 慢 SQL 记录
|
||||
slow-sql-millis: 100
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
dynamic: # 多数据源配置
|
||||
druid: # Druid 【连接池】相关的全局配置
|
||||
initial-size: 5 # 初始连接数
|
||||
min-idle: 10 # 最小连接池数量
|
||||
max-active: 20 # 最大连接池数量
|
||||
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
|
||||
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
|
||||
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒
|
||||
max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒
|
||||
validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
username: root
|
||||
password: 123456
|
||||
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
|
||||
lazy: true # 开启懒加载,保证启动速度
|
||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
username: root
|
||||
password: 123456
|
||||
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
redis:
|
||||
host: 400-infra.server.iocoder.cn # 地址
|
||||
port: 6379 # 端口
|
||||
database: 1 # 数据库索引
|
||||
# password: 123456 # 密码,建议生产环境开启
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
|
||||
|
||||
--- #################### 服务保障相关配置 ####################
|
||||
|
||||
# Lock4j 配置项
|
||||
lock4j:
|
||||
acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒
|
||||
expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒
|
||||
|
||||
--- #################### 监控相关配置 ####################
|
||||
|
||||
# Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
|
||||
exposure:
|
||||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||
|
||||
# Spring Boot Admin 配置项
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
# Spring Boot Admin Client 客户端的相关配置
|
||||
client:
|
||||
instance:
|
||||
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
|
||||
# Spring Boot Admin Server 服务端的相关配置
|
||||
context-path: /admin # 配置 Spring
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
# 芋道配置项,设置当前项目所有自定义的配置
|
||||
yudao:
|
||||
xss:
|
||||
enable: false
|
||||
web:
|
||||
admin-ui:
|
||||
url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址
|
||||
demo: true # 开启演示模式
|
@ -0,0 +1,127 @@
|
||||
--- #################### 数据库相关配置 ####################
|
||||
spring:
|
||||
# 数据源配置项
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
||||
- de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置
|
||||
datasource:
|
||||
druid: # Druid 【监控】相关的全局配置
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
allow: # 设置白名单,不填则允许所有访问
|
||||
url-pattern: /druid/*
|
||||
login-username: # 控制台管理用户名和密码
|
||||
login-password:
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
log-slow-sql: true # 慢 SQL 记录
|
||||
slow-sql-millis: 100
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
dynamic: # 多数据源配置
|
||||
druid: # Druid 【连接池】相关的全局配置
|
||||
initial-size: 1 # 初始连接数
|
||||
min-idle: 1 # 最小连接池数量
|
||||
max-active: 20 # 最大连接池数量
|
||||
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
|
||||
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
|
||||
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒
|
||||
max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒
|
||||
validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://120.46.37.243:3306/ludu_ticket?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ruoyi-vue-pro # SQLServer 连接的示例
|
||||
# url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
|
||||
username: root
|
||||
password: xpower1234
|
||||
# username: sa # SQL Server 连接的示例
|
||||
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # SQL Server 连接的示例
|
||||
# username: SYSDBA # DM 连接的示例
|
||||
# password: SYSDBA # DM 连接的示例
|
||||
slave: # 模拟从库,可根据自己需要修改
|
||||
lazy: true # 开启懒加载,保证启动速度
|
||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
username: root
|
||||
password: 123456
|
||||
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
redis:
|
||||
host: 127.0.0.1 # 地址
|
||||
port: 6379 # 端口
|
||||
database: 0 # 数据库索引
|
||||
# password: 123456 # 密码,建议生产环境开启
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
|
||||
xxl:
|
||||
job:
|
||||
enabled: false # 是否开启调度中心,默认为 true 开启
|
||||
admin:
|
||||
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
|
||||
|
||||
--- #################### 服务保障相关配置 ####################
|
||||
|
||||
# Lock4j 配置项
|
||||
lock4j:
|
||||
acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒
|
||||
expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒
|
||||
|
||||
--- #################### 监控相关配置 ####################
|
||||
|
||||
# Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
|
||||
exposure:
|
||||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||
|
||||
# Spring Boot Admin 配置项
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
# Spring Boot Admin Client 客户端的相关配置
|
||||
client:
|
||||
instance:
|
||||
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
|
||||
|
||||
# 日志文件配置
|
||||
logging:
|
||||
level:
|
||||
# 配置自己写的 MyBatis Mapper 打印日志
|
||||
cn.iocoder.yudao.module.system.dal.mysql: debug
|
||||
cn.iocoder.yudao.module.system.dal.mysql.sensitiveword.SensitiveWordMapper: INFO # 配置 SensitiveWordMapper 的日志级别为 info
|
||||
cn.iocoder.yudao.module.system.dal.mysql.sms.SmsChannelMapper: INFO # 配置 SmsChannelMapper 的日志级别为 info
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
# 芋道配置项,设置当前项目所有自定义的配置
|
||||
yudao:
|
||||
env: # 多环境的配置项
|
||||
tag: ${HOSTNAME}
|
||||
web:
|
||||
admin-ui:
|
||||
url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址
|
||||
security:
|
||||
mock-enable: true
|
||||
xss:
|
||||
enable: false
|
||||
access-log: # 访问日志的配置项
|
||||
enable: false
|
||||
demo: false # 关闭演示模式
|
@ -0,0 +1,114 @@
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
|
||||
allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务
|
||||
|
||||
# Servlet 配置
|
||||
servlet:
|
||||
# 文件上传相关配置项
|
||||
multipart:
|
||||
max-file-size: 16MB # 单个文件大小
|
||||
max-request-size: 32MB # 设置总上传的文件大小
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ANT_PATH_MATCHER # 解决 SpringFox 与 SpringBoot 2.6.x 不兼容的问题,参见 SpringFoxHandlerProviderBeanPostProcessor 类
|
||||
|
||||
# Jackson 配置项
|
||||
jackson:
|
||||
serialization:
|
||||
write-dates-as-timestamps: true # 设置 LocalDateTime 的格式,使用时间戳
|
||||
write-date-timestamps-as-nanoseconds: false # 设置不使用 nanoseconds 的格式。例如说 1611460870.401,而是直接 1611460870401
|
||||
write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳
|
||||
fail-on-empty-beans: false # 允许序列化无属性的 Bean
|
||||
|
||||
# Cache 配置项
|
||||
cache:
|
||||
type: REDIS
|
||||
redis:
|
||||
time-to-live: 1h # 设置过期时间为 1 小时
|
||||
|
||||
--- #################### 接口文档配置 ####################
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
enabled: true # 1. 是否开启 Swagger 接文档的元数据
|
||||
path: /v3/api-docs
|
||||
swagger-ui:
|
||||
enabled: true # 2.1 是否开启 Swagger 文档的官方 UI 界面
|
||||
path: /swagger-ui.html
|
||||
default-flat-param-object: true # 参见 https://doc.xiaominfo.com/docs/faq/v4/knife4j-parameterobject-flat-param 文档
|
||||
|
||||
knife4j:
|
||||
enable: true # 2.2 是否开启 Swagger 文档的 Knife4j UI 界面
|
||||
setting:
|
||||
language: zh_cn
|
||||
|
||||
# MyBatis Plus 的配置项
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。
|
||||
# id-type: AUTO # 自增 ID,适合 MySQL 等直接自增的数据库
|
||||
# id-type: INPUT # 用户输入 ID,适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库
|
||||
# id-type: ASSIGN_ID # 分配 ID,默认使用雪花算法。注意,Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
banner: false # 关闭控制台的 Banner 打印
|
||||
type-aliases-package: ${yudao.info.base-package}.dal.dataobject
|
||||
encryptor:
|
||||
password: XDV71a+xqStEA3WH # 加解密的秘钥,可使用 https://www.imaegoo.com/2020/aes-key-generator/ 网站生成
|
||||
|
||||
mybatis-plus-join:
|
||||
banner: false # 关闭控制台的 Banner 打印
|
||||
|
||||
# Spring Data Redis 配置
|
||||
spring:
|
||||
data:
|
||||
redis:
|
||||
repositories:
|
||||
enabled: false # 项目未使用到 Spring Data Redis 的 Repository,所以直接禁用,保证启动速度
|
||||
|
||||
# VO 转换(数据翻译)相关
|
||||
easy-trans:
|
||||
is-enable-global: true # 启用全局翻译(拦截所有 SpringMVC ResponseBody 进行自动翻译 )。如果对于性能要求很高可关闭此配置,或通过 @IgnoreTrans 忽略某个接口
|
||||
is-enable-cloud: false # 禁用 TransType.RPC 微服务模式
|
||||
|
||||
--- #################### RPC 远程调用相关配置 ####################
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
addresses: http://127.0.0.1:9090/xxl-job-admin
|
||||
executor:
|
||||
appname: ${spring.application.name} # 执行器 AppName
|
||||
ip: # 执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP,该IP不会绑定Host仅作为通讯实用;地址信息用于 "执行器注册" 和 "调度中心请求并触发任务";
|
||||
port: 0 # ### 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口;
|
||||
logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径
|
||||
logretentiondays: 30 # 执行器日志文件保存天数 [选填] : 过期日志自动清理, 限制值大于等于3时生效; 否则, 如-1, 关闭自动清理功能;
|
||||
accessToken: default_token # 执行器通讯TOKEN
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
yudao:
|
||||
info:
|
||||
version: 1.0.0
|
||||
base-package: cn.iocoder.yudao.module.ticket
|
||||
swagger:
|
||||
title: 管理后台
|
||||
description: 提供管理员管理的所有功能
|
||||
version: ${yudao.info.version}
|
||||
base-package: ${yudao.info.base-package}
|
||||
captcha:
|
||||
enable: true # 验证码的开关,默认为 true;
|
||||
tenant: # 多租户相关配置项
|
||||
enable: true
|
||||
ignore-urls:
|
||||
ignore-tables:
|
||||
|
||||
debug: false
|
@ -0,0 +1,23 @@
|
||||
--- #################### 注册中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848
|
||||
discovery:
|
||||
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||
metadata:
|
||||
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
||||
|
||||
--- #################### 配置中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
|
||||
config:
|
||||
server-addr: 127.0.0.1:8848 # Nacos 服务器地址
|
||||
namespace: dev # 命名空间 dev 的ID,不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev,这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId,默认为 spring.application.name
|
||||
file-extension: yaml # 使用的 Nacos 配置集的 dataId 的文件拓展名,同时也是 Nacos 配置集的配置格式,默认为 properties
|
@ -0,0 +1,14 @@
|
||||
spring:
|
||||
application:
|
||||
name: sampling-server
|
||||
|
||||
profiles:
|
||||
active: local
|
||||
|
||||
server:
|
||||
port: 48089
|
||||
|
||||
# 日志文件配置。注意,如果 logging.file.name 不放在 bootstrap.yaml 配置文件,而是放在 application.yaml 中,会导致出现 LOG_FILE_IS_UNDEFINED 文件
|
||||
logging:
|
||||
file:
|
||||
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
|
@ -0,0 +1,76 @@
|
||||
<configuration>
|
||||
<!-- 引用 Spring Boot 的 logback 基础配置 -->
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||
<!-- 变量 yudao.info.base-package,基础业务包 -->
|
||||
<springProperty scope="context" name="yudao.info.base-package" source="yudao.info.base-package"/>
|
||||
<!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 -->
|
||||
<property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
|
||||
|
||||
<!-- 控制台 Appender -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 文件 Appender -->
|
||||
<!-- 参考 Spring Boot 的 file-appender.xml 编写 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
<!-- 日志文件名 -->
|
||||
<file>${LOG_FILE}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!-- 滚动后的日志文件名 -->
|
||||
<fileNamePattern>${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz}</fileNamePattern>
|
||||
<!-- 启动服务时,是否清理历史日志,一般不建议清理 -->
|
||||
<cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart>
|
||||
<!-- 日志文件,到达多少容量,进行滚动 -->
|
||||
<maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize>
|
||||
<!-- 日志文件的总大小,0 表示不限制 -->
|
||||
<totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap>
|
||||
<!-- 日志文件的保留天数 -->
|
||||
<maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<!-- 异步写入日志,提升性能 -->
|
||||
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<!-- 不丢失日志。默认的,如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 -->
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<!-- 更改默认的队列的深度,该值会影响性能。默认值为 256 -->
|
||||
<queueSize>256</queueSize>
|
||||
<appender-ref ref="FILE"/>
|
||||
</appender>
|
||||
|
||||
<!-- SkyWalking GRPC 日志收集,实现日志中心。注意:SkyWalking 8.4.0 版本开始支持 -->
|
||||
<appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 本地环境 -->
|
||||
<springProfile name="local">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 -->
|
||||
<appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 -->
|
||||
</root>
|
||||
</springProfile>
|
||||
<!-- 其它环境 -->
|
||||
<springProfile name="dev,test,stage,prod,default">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="ASYNC"/>
|
||||
<appender-ref ref="GRPC"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
</configuration>
|
25
ludu-module-sampling/pom.xml
Normal file
25
ludu-module-sampling/pom.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<artifactId>yudao</artifactId>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<modules>
|
||||
<module>ludu-module-sampling-api</module>
|
||||
<module>ludu-module-sampling-biz</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>ludu-module-sampling</artifactId>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
sampling 模块,我们放抽数服务。
|
||||
</description>
|
||||
|
||||
</project>
|
@ -0,0 +1,52 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<artifactId>ludu-module-ticket-manager</artifactId>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>ludu-module-ticket-manager-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
ticket 模块 API,暴露给其它模块调用
|
||||
</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 参数校验 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.ticket.api.asset;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.ticket.api.asset.dto.TicketAssetRespDTO;
|
||||
import cn.iocoder.yudao.module.ticket.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 票务设备管理")
|
||||
public interface TicketAssetApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/asset";
|
||||
@GetMapping(PREFIX + "/type")
|
||||
@Operation(summary = "获得所有设备名称和数量")
|
||||
public CommonResult<List<Map<String, String>>> countAsset();
|
||||
|
||||
@GetMapping(PREFIX + "/name/{assettypename}")
|
||||
@Operation(summary = "获取符合设备类型名的所有设备")
|
||||
public CommonResult<List<TicketAssetRespDTO>> nameAsset(@PathVariable("assettypename") String assettypename);
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.ticket.api.asset.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
*/
|
||||
@Schema(description = "RPC 服务 - 设备管理 Response DTO")
|
||||
@Data
|
||||
public class TicketAssetRespDTO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30538")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据ID", example = "15059")
|
||||
private String dataId;
|
||||
|
||||
@Schema(description = "设备名称", example = "芋艿")
|
||||
private String assetname;
|
||||
|
||||
@Schema(description = "设备类型ID", example = "2")
|
||||
private String assettype;
|
||||
|
||||
@Schema(description = "设备类型名称", example = "芋艿")
|
||||
private String assettypename;
|
||||
|
||||
@Schema(description = "设备状态")
|
||||
private String isOnline;
|
||||
|
||||
@Schema(description = "最后一次反馈时间")
|
||||
private Long lastfeedbacktime;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.ticket.api.checkticket;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.ticket.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 检票管理")
|
||||
public interface TicketCheckTicketApi {
|
||||
String PREFIX = ApiConstants.PREFIX + "/checkticket";
|
||||
@GetMapping(PREFIX + "/{day}")
|
||||
@Operation(summary = "获得日期当天的检票人数")
|
||||
public CommonResult<Long> checkTicketTotal(@PathVariable("day") String day);
|
||||
|
||||
@GetMapping(PREFIX + "/qushi/{day}")
|
||||
@Operation(summary = "获取日期当天各个时段的检票人数")
|
||||
public CommonResult<List<Map<String, String>>> findbytimetemp(@PathVariable("day") String day);
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.ticket.api.saledata;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.ticket.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 售票管理")
|
||||
public interface TicketSaleDataApi {
|
||||
String PREFIX = ApiConstants.PREFIX + "/saledata";
|
||||
@GetMapping(PREFIX + "/{day}")
|
||||
@Operation(summary = "获得输入日期的当天总售票数")
|
||||
public CommonResult<Long> checkTicketTotal(@PathVariable("day") String day);
|
||||
@GetMapping(PREFIX + "/thisyear/{startTime}")
|
||||
@Operation(summary = "获得今年日期往前十天内的数据")
|
||||
public CommonResult<List<Map<String, String>>> thisyearNum(@PathVariable("startTime") String startTime);
|
||||
@GetMapping(PREFIX + "/lastyear/{startTime}")
|
||||
@Operation(summary = "获得去年日期往前推十天的数据")
|
||||
public CommonResult<List<Map<String, String>>> lastyearNum(@PathVariable("startTime") String startTime);
|
||||
@GetMapping(PREFIX + "/gender")
|
||||
@Operation(summary = "获得所有数据的男女数量")
|
||||
public CommonResult<List<Map<String, String>>> findByGender();
|
||||
@GetMapping(PREFIX + "/age")
|
||||
@Operation(summary = "获得所有数据的年龄分段和数量")
|
||||
public CommonResult<List<Map<String, String>>> findByage();
|
||||
|
||||
@GetMapping(PREFIX + "/lastyear/region")
|
||||
@Operation(summary = "查询去年各个省份的人数")
|
||||
public CommonResult<List<Map<String, String>>> lastyearfindByregion();
|
||||
@GetMapping(PREFIX + "/thisyear/region")
|
||||
@Operation(summary = "查询今年各个省份的人数")
|
||||
public CommonResult<List<Map<String, String>>> thisyearfindByregion();
|
||||
@GetMapping(PREFIX + "/salemethod")
|
||||
@Operation(summary = "查询各个销售渠道的购票人数")
|
||||
public CommonResult<List<Map<String, String>>> findBysaleMethod();
|
||||
@GetMapping(PREFIX + "/wuyi/{x}")
|
||||
@Operation(summary = "查询最近前几年当年的五一期间的数据")
|
||||
public CommonResult<List<Map<String, String>>> findByWuyi(@PathVariable("x") int x);
|
||||
@GetMapping(PREFIX + "/guoqing/{x}")
|
||||
@Operation(summary = "查询最近前几年当年的国庆期间的数据")
|
||||
public CommonResult<List<Map<String, String>>> findByGuoqing(@PathVariable("x") int x);
|
||||
@GetMapping(PREFIX + "/rijunthisyear/{startTime}")
|
||||
@Operation(summary = "查询今年对应日期的近三十天日均售票数量")
|
||||
public CommonResult<String> findThisyearRijun(@PathVariable("startTime") String startTime);
|
||||
@GetMapping(PREFIX + "/rijunlastyear/{startTime}")
|
||||
@Operation(summary = "查询去年对应日期的近三十天日均售票数量")
|
||||
public CommonResult<String> findLastyearRijun(@PathVariable("startTime") String startTime);
|
||||
@GetMapping(PREFIX + "/thisyear/nianjun")
|
||||
@Operation(summary = "查询今年年度售票平均金额")
|
||||
public CommonResult<BigDecimal> findmoneythisyear();
|
||||
@GetMapping(PREFIX + "/lastyear/nianjun")
|
||||
@Operation(summary = "查询去年年度售票平均金额")
|
||||
public CommonResult<BigDecimal> findmoneylastyear();
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.ticket.enums;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.RpcConstants;
|
||||
|
||||
/**
|
||||
* API 相关的枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public class ApiConstants {
|
||||
|
||||
/**
|
||||
* 服务名
|
||||
*
|
||||
* 注意,需要保证和 spring.application.name 保持一致
|
||||
*/
|
||||
public static final String NAME = "ticket-server";
|
||||
|
||||
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/ticket";
|
||||
|
||||
public static final String VERSION = "1.0.0";
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.ticket.enums;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
ErrorCode ASSET_NOT_EXISTS = new ErrorCode(1_005_001_000, "设备不存在");
|
||||
ErrorCode CHECK_TICKET_NOT_EXISTS = new ErrorCode(1_005_001_001, "检票不存在");
|
||||
ErrorCode SALE_DATA_NOT_EXISTS = new ErrorCode(1_005_001_002, "售票不存在");
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<artifactId>ludu-module-ticket-manager</artifactId>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ludu-module-ticket-manager-biz</artifactId>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
ticket 模块,我们票务业务。
|
||||
例如说:设备管理等等
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 依赖服务 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>ludu-module-ticket-manager-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<!-- Spring Cloud 基础 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-env</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-system-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-infra-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- DB 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-rpc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Registry 注册中心相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Config 配置中心相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 消息队列相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-mq</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test 测试相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-ip</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 监控相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!-- 设置构建的 jar 包名 -->
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<!-- 打包 -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.ticket;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
*/
|
||||
|
||||
@SpringBootApplication
|
||||
public class TicketManagerServerApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(TicketManagerServerApplication.class, args);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.ticket.api.asset;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.ticket.api.asset.dto.TicketAssetRespDTO;
|
||||
import cn.iocoder.yudao.module.ticket.convert.asset.AssetConvert;
|
||||
import cn.iocoder.yudao.module.ticket.service.asset.AssetService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* @Description 票务设备API实现类
|
||||
*/
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class TicketAssetApiImpl implements TicketAssetApi {
|
||||
@Resource
|
||||
private AssetService assetService;
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Map<String, String>>> countAsset() {
|
||||
return success(assetService.countAsset());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<TicketAssetRespDTO>> nameAsset(String assettypename) {
|
||||
return success(AssetConvert.INSTANCE.convertList02(assetService.nameAsset(assettypename)));
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.ticket.api.checkticket;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.ticket.service.checkticket.CheckTicketService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* @Description 票务检票API实现类
|
||||
*/
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class TicketCheckTicketApiImpl implements TicketCheckTicketApi{
|
||||
@Resource
|
||||
private CheckTicketService checkTicketService;
|
||||
@Override
|
||||
public CommonResult<Long> checkTicketTotal(String day) {
|
||||
return success(checkTicketService.checkTicketTotal(day));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Map<String, String>>> findbytimetemp(String day) {
|
||||
return success(checkTicketService.findbytimetemp(day));
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package cn.iocoder.yudao.module.ticket.api.saledata;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.saledata.SaleDataDO;
|
||||
import cn.iocoder.yudao.module.ticket.service.saledata.SaleDataService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
*/
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class TicketSaleDataApiImpl implements TicketSaleDataApi{
|
||||
@Resource
|
||||
private SaleDataService saleDataService;
|
||||
|
||||
@Override
|
||||
public CommonResult<Long> checkTicketTotal(String day) {
|
||||
return success(saleDataService.countBySddate(day));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Map<String, String>>> thisyearNum(String startTime) {
|
||||
return success(saleDataService.findCheckticketcountBytime(startTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Map<String, String>>> lastyearNum(String startTime) {
|
||||
return success(saleDataService.findCheckticketcountBytime(startTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Map<String, String>>> findByGender() {
|
||||
return success(saleDataService.findByGender());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Map<String, String>>> findByage() {
|
||||
return success(saleDataService.findByAge());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Map<String, String>>> lastyearfindByregion() {
|
||||
return success(saleDataService.findByregion(saleDataService.findEventsLastYear()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Map<String, String>>> thisyearfindByregion() {
|
||||
return success(saleDataService.findByregion(saleDataService.findEventsThisYear()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Map<String, String>>> findBysaleMethod() {
|
||||
return success(saleDataService.findBySaleMethod());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Map<String, String>>> findByWuyi(int x) {
|
||||
return success(saleDataService.findWuyi(x));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Map<String, String>>> findByGuoqing(int x) {
|
||||
return success(saleDataService.findGuoqing(x));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<String> findThisyearRijun(String startTime) {
|
||||
return success(saleDataService.findrijun(startTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<String> findLastyearRijun(String startTime) {
|
||||
return success(saleDataService.findrijun(startTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<BigDecimal> findmoneythisyear() {
|
||||
return success(saleDataService.findyearJun(saleDataService.findEventsThisYear()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<BigDecimal> findmoneylastyear() {
|
||||
return success(saleDataService.findyearJun(saleDataService.findEventsLastYear()));
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.asset;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.asset.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.asset.AssetDO;
|
||||
import cn.iocoder.yudao.module.ticket.service.asset.AssetService;
|
||||
|
||||
@Tag(name = "管理后台 - 设备")
|
||||
@RestController
|
||||
@RequestMapping("/ticket/asset")
|
||||
@Validated
|
||||
public class AssetController {
|
||||
|
||||
@Resource
|
||||
private AssetService assetService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建设备")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:asset:create')")
|
||||
public CommonResult<Long> createAsset(@Valid @RequestBody AssetSaveReqVO createReqVO) {
|
||||
return success(assetService.createAsset(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新设备")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:asset:update')")
|
||||
public CommonResult<Boolean> updateAsset(@Valid @RequestBody AssetSaveReqVO updateReqVO) {
|
||||
assetService.updateAsset(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除设备")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('ticket:asset:delete')")
|
||||
public CommonResult<Boolean> deleteAsset(@RequestParam("id") Long id) {
|
||||
assetService.deleteAsset(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得设备")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:asset:query')")
|
||||
public CommonResult<AssetRespVO> getAsset(@RequestParam("id") Long id) {
|
||||
AssetDO asset = assetService.getAsset(id);
|
||||
return success(BeanUtils.toBean(asset, AssetRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得设备分页")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:asset:query')")
|
||||
public CommonResult<PageResult<AssetRespVO>> getAssetPage(@Valid AssetPageReqVO pageReqVO) {
|
||||
PageResult<AssetDO> pageResult = assetService.getAssetPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, AssetRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出设备 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:asset:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportAssetExcel(@Valid AssetPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<AssetDO> list = assetService.getAssetPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "设备.xls", "数据", AssetRespVO.class,
|
||||
BeanUtils.toBean(list, AssetRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.asset.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 设备分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class AssetPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "ID", example = "30538")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据ID", example = "15059")
|
||||
private String dataId;
|
||||
|
||||
@Schema(description = "设备名称", example = "芋艿")
|
||||
private String assetname;
|
||||
|
||||
@Schema(description = "设备类型ID", example = "2")
|
||||
private String assettype;
|
||||
|
||||
@Schema(description = "设备类型名称", example = "芋艿")
|
||||
private String assettypename;
|
||||
|
||||
@Schema(description = "设备状态")
|
||||
private String isOnline;
|
||||
|
||||
@Schema(description = "最后一次反馈时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Long[] lastfeedbacktime;
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.asset.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
|
||||
@Schema(description = "管理后台 - 设备 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class AssetRespVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30538")
|
||||
@ExcelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据ID", example = "15059")
|
||||
@ExcelProperty("数据ID")
|
||||
private String dataId;
|
||||
|
||||
@Schema(description = "设备名称", example = "芋艿")
|
||||
@ExcelProperty("设备名称")
|
||||
private String assetname;
|
||||
|
||||
@Schema(description = "设备类型ID", example = "2")
|
||||
@ExcelProperty("设备类型ID")
|
||||
private String assettype;
|
||||
|
||||
@Schema(description = "设备类型名称", example = "芋艿")
|
||||
@ExcelProperty("设备类型名称")
|
||||
private String assettypename;
|
||||
|
||||
@Schema(description = "设备状态")
|
||||
@ExcelProperty(value = "设备状态", converter = DictConvert.class)
|
||||
@DictFormat("asset_status_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String isOnline;
|
||||
|
||||
@Schema(description = "最后一次反馈时间")
|
||||
@ExcelProperty("最后一次反馈时间")
|
||||
private Long lastfeedbacktime;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.asset.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 设备新增/修改 Request VO")
|
||||
@Data
|
||||
public class AssetSaveReqVO {
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16476")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据ID", example = "15059")
|
||||
private String dataId;
|
||||
|
||||
@Schema(description = "设备名称", example = "芋艿")
|
||||
private String assetname;
|
||||
|
||||
@Schema(description = "设备类型ID", example = "2")
|
||||
private String assettype;
|
||||
|
||||
@Schema(description = "设备类型名称", example = "芋艿")
|
||||
private String assettypename;
|
||||
|
||||
@Schema(description = "设备状态")
|
||||
private String isOnline;
|
||||
|
||||
@Schema(description = "最后一次反馈时间")
|
||||
private Long lastfeedbacktime;
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketPageReqVO;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketRespVO;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.checkticket.CheckTicketDO;
|
||||
import cn.iocoder.yudao.module.ticket.service.checkticket.CheckTicketService;
|
||||
|
||||
@Tag(name = "管理后台 - 检票")
|
||||
@RestController
|
||||
@RequestMapping("/ticket/check-ticket")
|
||||
@Validated
|
||||
public class CheckTicketController {
|
||||
|
||||
@Resource
|
||||
private CheckTicketService checkTicketService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建检票")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:check-ticket:create')")
|
||||
public CommonResult<Long> createCheckTicket(@Valid @RequestBody CheckTicketSaveReqVO createReqVO) {
|
||||
return success(checkTicketService.createCheckTicket(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新检票")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:check-ticket:update')")
|
||||
public CommonResult<Boolean> updateCheckTicket(@Valid @RequestBody CheckTicketSaveReqVO updateReqVO) {
|
||||
checkTicketService.updateCheckTicket(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除检票")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('ticket:check-ticket:delete')")
|
||||
public CommonResult<Boolean> deleteCheckTicket(@RequestParam("id") Long id) {
|
||||
checkTicketService.deleteCheckTicket(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得检票")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:check-ticket:query')")
|
||||
public CommonResult<CheckTicketRespVO> getCheckTicket(@RequestParam("id") Long id) {
|
||||
CheckTicketDO checkTicket = checkTicketService.getCheckTicket(id);
|
||||
return success(BeanUtils.toBean(checkTicket, CheckTicketRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得检票分页")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:check-ticket:query')")
|
||||
public CommonResult<PageResult<CheckTicketRespVO>> getCheckTicketPage(@Valid CheckTicketPageReqVO pageReqVO) {
|
||||
PageResult<CheckTicketDO> pageResult = checkTicketService.getCheckTicketPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, CheckTicketRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出检票 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:check-ticket:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportCheckTicketExcel(@Valid CheckTicketPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<CheckTicketDO> list = checkTicketService.getCheckTicketPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "检票.xls", "数据", CheckTicketRespVO.class,
|
||||
BeanUtils.toBean(list, CheckTicketRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 检票分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class CheckTicketPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "ID", example = "16476")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据ID", example = "15422")
|
||||
private String dataId;
|
||||
|
||||
@Schema(description = "检票点ID")
|
||||
private String checkstation;
|
||||
|
||||
@Schema(description = "检票点名称", example = "李四")
|
||||
private String checkstationname;
|
||||
|
||||
@Schema(description = "检票日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] checkticketdate;
|
||||
|
||||
@Schema(description = "检票时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] checktickettime;
|
||||
|
||||
@Schema(description = "人数", example = "23164")
|
||||
private Integer personcount;
|
||||
|
||||
@Schema(description = "订单明细ID")
|
||||
private String sdshipping;
|
||||
|
||||
@Schema(description = "票ID")
|
||||
private String ticket;
|
||||
|
||||
@Schema(description = "销售特征名称(票种名称)", example = "张三")
|
||||
private String salepropetyvaluename;
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 检票 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class CheckTicketRespVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16476")
|
||||
@ExcelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据ID", example = "15422")
|
||||
@ExcelProperty("数据ID")
|
||||
private String dataId;
|
||||
|
||||
@Schema(description = "检票点ID")
|
||||
@ExcelProperty("检票点ID")
|
||||
private String checkstation;
|
||||
|
||||
@Schema(description = "检票点名称", example = "李四")
|
||||
@ExcelProperty("检票点名称")
|
||||
private String checkstationname;
|
||||
|
||||
@Schema(description = "检票日期")
|
||||
@ExcelProperty("检票日期")
|
||||
private String checkticketdate;
|
||||
|
||||
@Schema(description = "检票时间")
|
||||
@ExcelProperty("检票时间")
|
||||
private String checktickettime;
|
||||
|
||||
@Schema(description = "人数", example = "23164")
|
||||
@ExcelProperty("人数")
|
||||
private Integer personcount;
|
||||
|
||||
@Schema(description = "订单明细ID")
|
||||
@ExcelProperty("订单明细ID")
|
||||
private String sdshipping;
|
||||
|
||||
@Schema(description = "票ID")
|
||||
@ExcelProperty("票ID")
|
||||
private String ticket;
|
||||
|
||||
@Schema(description = "销售特征名称(票种名称)", example = "张三")
|
||||
@ExcelProperty("销售特征名称(票种名称)")
|
||||
private String salepropetyvaluename;
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@Schema(description = "管理后台 - 检票新增/修改 Request VO")
|
||||
@Data
|
||||
public class CheckTicketSaveReqVO {
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16476")
|
||||
private Long id;
|
||||
@Schema(description = "数据ID", example = "15422")
|
||||
private String dataId;
|
||||
|
||||
@Schema(description = "检票点ID")
|
||||
private String checkstation;
|
||||
|
||||
@Schema(description = "检票点名称", example = "李四")
|
||||
private String checkstationname;
|
||||
|
||||
@Schema(description = "检票日期")
|
||||
private String checkticketdate;
|
||||
|
||||
@Schema(description = "检票时间")
|
||||
private String checktickettime;
|
||||
|
||||
@Schema(description = "人数", example = "23164")
|
||||
private Integer personcount;
|
||||
|
||||
@Schema(description = "订单明细ID")
|
||||
private String sdshipping;
|
||||
|
||||
@Schema(description = "票ID")
|
||||
private String ticket;
|
||||
|
||||
@Schema(description = "销售特征名称(票种名称)", example = "张三")
|
||||
private String salepropetyvaluename;
|
||||
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.saledata;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.saledata.SaleDataDO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.saledata.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.service.saledata.SaleDataService;
|
||||
|
||||
@Tag(name = "管理后台 - 售票")
|
||||
@RestController
|
||||
@RequestMapping("/ticket/sale-data")
|
||||
@Validated
|
||||
public class SaleDataController {
|
||||
|
||||
@Resource
|
||||
private SaleDataService saleDataService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建售票")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:sale-data:create')")
|
||||
public CommonResult<Long> createSaleData(@Valid @RequestBody SaleDataSaveReqVO createReqVO) {
|
||||
return success(saleDataService.createSaleData(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新售票")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:sale-data:update')")
|
||||
public CommonResult<Boolean> updateSaleData(@Valid @RequestBody SaleDataSaveReqVO updateReqVO) {
|
||||
saleDataService.updateSaleData(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除售票")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('ticket:sale-data:delete')")
|
||||
public CommonResult<Boolean> deleteSaleData(@RequestParam("id") Long id) {
|
||||
saleDataService.deleteSaleData(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得售票")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:sale-data:query')")
|
||||
public CommonResult<SaleDataRespVO> getSaleData(@RequestParam("id") Long id) {
|
||||
SaleDataDO saleData = saleDataService.getSaleData(id);
|
||||
return success(BeanUtils.toBean(saleData, SaleDataRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得售票分页")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:sale-data:query')")
|
||||
public CommonResult<PageResult<SaleDataRespVO>> getSaleDataPage(@Valid SaleDataPageReqVO pageReqVO) {
|
||||
PageResult<SaleDataDO> pageResult = saleDataService.getSaleDataPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, SaleDataRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出售票 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:sale-data:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportSaleDataExcel(@Valid SaleDataPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<SaleDataDO> list = saleDataService.getSaleDataPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "售票.xls", "数据", SaleDataRespVO.class,
|
||||
BeanUtils.toBean(list, SaleDataRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.saledata.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 售票分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SaleDataPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "ID", example = "20492")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据id", example = "32044")
|
||||
private String dataId;
|
||||
|
||||
@Schema(description = "金额")
|
||||
private Long amount;
|
||||
|
||||
@Schema(description = "证件号")
|
||||
private String certificateno;
|
||||
|
||||
@Schema(description = "证件类别", example = "2")
|
||||
private String certificatetype;
|
||||
|
||||
@Schema(description = "产品ID")
|
||||
private String item;
|
||||
|
||||
@Schema(description = "产品名称", example = "张三")
|
||||
private String itemname;
|
||||
|
||||
@Schema(description = "产品类型ID", example = "2")
|
||||
private String itemtype;
|
||||
|
||||
@Schema(description = "产品类型名称", example = "张三")
|
||||
private String itemtypename;
|
||||
|
||||
@Schema(description = "出游日期")
|
||||
private String productbatchno;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer quantity;
|
||||
|
||||
@Schema(description = "销售日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] sddate;
|
||||
|
||||
@Schema(description = "订单号")
|
||||
private String sdno;
|
||||
|
||||
@Schema(description = "销售时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] sdtime;
|
||||
|
||||
@Schema(description = "交易类别(订单类型)")
|
||||
private String transactiontypeno;
|
||||
|
||||
@Schema(description = "销售特征名称(票种名称)", example = "赵六")
|
||||
private String salepropetyvaluename;
|
||||
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.saledata.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 售票 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class SaleDataRespVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20492")
|
||||
@ExcelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据id", example = "32044")
|
||||
@ExcelProperty("数据id")
|
||||
private String dataId;
|
||||
|
||||
@Schema(description = "金额")
|
||||
@ExcelProperty("金额")
|
||||
private Long amount;
|
||||
|
||||
@Schema(description = "证件号")
|
||||
@ExcelProperty("证件号")
|
||||
private String certificateno;
|
||||
|
||||
@Schema(description = "证件类别", example = "2")
|
||||
@ExcelProperty("证件类别")
|
||||
private String certificatetype;
|
||||
|
||||
@Schema(description = "产品ID")
|
||||
@ExcelProperty("产品ID")
|
||||
private String item;
|
||||
|
||||
@Schema(description = "产品名称", example = "张三")
|
||||
@ExcelProperty("产品名称")
|
||||
private String itemname;
|
||||
|
||||
@Schema(description = "产品类型ID", example = "2")
|
||||
@ExcelProperty("产品类型ID")
|
||||
private String itemtype;
|
||||
|
||||
@Schema(description = "产品类型名称", example = "张三")
|
||||
@ExcelProperty("产品类型名称")
|
||||
private String itemtypename;
|
||||
|
||||
@Schema(description = "出游日期")
|
||||
@ExcelProperty("出游日期")
|
||||
private String productbatchno;
|
||||
|
||||
@Schema(description = "数量")
|
||||
@ExcelProperty("数量")
|
||||
private Integer quantity;
|
||||
|
||||
@Schema(description = "销售日期")
|
||||
@ExcelProperty("销售日期")
|
||||
private String sddate;
|
||||
|
||||
@Schema(description = "订单号")
|
||||
@ExcelProperty("订单号")
|
||||
private String sdno;
|
||||
|
||||
@Schema(description = "销售时间")
|
||||
@ExcelProperty("销售时间")
|
||||
private String sdtime;
|
||||
|
||||
@Schema(description = "交易类别(订单类型)")
|
||||
@ExcelProperty("交易类别(订单类型)")
|
||||
private String transactiontypeno;
|
||||
|
||||
@Schema(description = "销售特征名称(票种名称)", example = "赵六")
|
||||
@ExcelProperty("销售特征名称(票种名称)")
|
||||
private String salepropetyvaluename;
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.saledata.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 售票新增/修改 Request VO")
|
||||
@Data
|
||||
public class SaleDataSaveReqVO {
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16476")
|
||||
private Long id;
|
||||
@Schema(description = "数据id", example = "32044")
|
||||
private String dataId;
|
||||
|
||||
@Schema(description = "金额")
|
||||
private Long amount;
|
||||
|
||||
@Schema(description = "证件号")
|
||||
private String certificateno;
|
||||
|
||||
@Schema(description = "证件类别", example = "2")
|
||||
private String certificatetype;
|
||||
|
||||
@Schema(description = "产品ID")
|
||||
private String item;
|
||||
|
||||
@Schema(description = "产品名称", example = "张三")
|
||||
private String itemname;
|
||||
|
||||
@Schema(description = "产品类型ID", example = "2")
|
||||
private String itemtype;
|
||||
|
||||
@Schema(description = "产品类型名称", example = "张三")
|
||||
private String itemtypename;
|
||||
|
||||
@Schema(description = "出游日期")
|
||||
private String productbatchno;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer quantity;
|
||||
|
||||
@Schema(description = "销售日期")
|
||||
private String sddate;
|
||||
|
||||
@Schema(description = "订单号")
|
||||
private String sdno;
|
||||
|
||||
@Schema(description = "销售时间")
|
||||
private String sdtime;
|
||||
|
||||
@Schema(description = "交易类别(订单类型)")
|
||||
private String transactiontypeno;
|
||||
|
||||
@Schema(description = "销售特征名称(票种名称)", example = "赵六")
|
||||
private String salepropetyvaluename;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.ticket.convert.asset;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.api.asset.dto.TicketAssetRespDTO;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.asset.AssetDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
*/
|
||||
@Mapper
|
||||
public interface AssetConvert {
|
||||
AssetConvert INSTANCE = Mappers.getMapper(AssetConvert.class);
|
||||
TicketAssetRespDTO convert02(AssetDO bean);
|
||||
public List<TicketAssetRespDTO> convertList02(List<AssetDO> list);
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.ticket.convert.asset;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.api.asset.dto.TicketAssetRespDTO;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.asset.AssetDO;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2024-06-26T14:31:50+0800",
|
||||
comments = "version: 1.5.5.Final, compiler: javac, environment: Java 1.8.0_291 (Oracle Corporation)"
|
||||
)
|
||||
public class AssetConvertImpl implements AssetConvert {
|
||||
@Override
|
||||
public TicketAssetRespDTO convert02(AssetDO bean) {
|
||||
if (bean == null) {
|
||||
return null;
|
||||
}
|
||||
TicketAssetRespDTO ticketAssetRespDTO = new TicketAssetRespDTO();
|
||||
ticketAssetRespDTO.setId(bean.getId());
|
||||
ticketAssetRespDTO.setAssettype(bean.getAssettype());
|
||||
ticketAssetRespDTO.setAssetname(bean.getAssetname());
|
||||
ticketAssetRespDTO.setAssettypename(bean.getAssettypename());
|
||||
ticketAssetRespDTO.setDataId(bean.getDataId());
|
||||
ticketAssetRespDTO.setIsOnline(bean.getIsOnline());
|
||||
if (bean.getLastfeedbacktime() != null) {
|
||||
ticketAssetRespDTO.setLastfeedbacktime(bean.getLastfeedbacktime());
|
||||
|
||||
}
|
||||
return ticketAssetRespDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TicketAssetRespDTO> convertList02(List<AssetDO> list) {
|
||||
if ( list == null ) {
|
||||
return null;
|
||||
}
|
||||
List<TicketAssetRespDTO> list1 = new ArrayList<>( list.size() );
|
||||
for ( AssetDO assetDO : list ) {
|
||||
list1.add( convert02( assetDO ) );
|
||||
}
|
||||
return list1;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.ticket.dal.dataobject.asset;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 设备 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("asset")
|
||||
@KeySequence("asset_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AssetDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 数据ID
|
||||
*/
|
||||
private String dataId;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String assetname;
|
||||
/**
|
||||
* 设备类型ID
|
||||
*/
|
||||
private String assettype;
|
||||
/**
|
||||
* 设备类型名称
|
||||
*/
|
||||
private String assettypename;
|
||||
/**
|
||||
* 设备状态
|
||||
*
|
||||
* 枚举 {@link TODO asset_status_type 对应的类}
|
||||
*/
|
||||
private String isOnline;
|
||||
/**
|
||||
* 最后一次反馈时间
|
||||
*/
|
||||
private Long lastfeedbacktime;
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package cn.iocoder.yudao.module.ticket.dal.dataobject.checkticket;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 检票 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("checkticket")
|
||||
@KeySequence("checkticket_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CheckTicketDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 数据ID
|
||||
*/
|
||||
private String dataId;
|
||||
/**
|
||||
* 检票点ID
|
||||
*/
|
||||
private String checkstation;
|
||||
/**
|
||||
* 检票点名称
|
||||
*/
|
||||
private String checkstationname;
|
||||
/**
|
||||
* 检票日期
|
||||
*/
|
||||
private String checkticketdate;
|
||||
/**
|
||||
* 检票时间
|
||||
*/
|
||||
private String checktickettime;
|
||||
/**
|
||||
* 人数
|
||||
*/
|
||||
private Integer personcount;
|
||||
/**
|
||||
* 订单明细ID
|
||||
*/
|
||||
private String sdshipping;
|
||||
/**
|
||||
* 票ID
|
||||
*/
|
||||
private String ticket;
|
||||
/**
|
||||
* 销售特征名称(票种名称)
|
||||
*/
|
||||
private String salepropetyvaluename;
|
||||
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package cn.iocoder.yudao.module.ticket.dal.dataobject.saledata;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 售票 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("saledata")
|
||||
@KeySequence("saledata_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SaleDataDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 数据id
|
||||
*/
|
||||
private String dataId;
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 证件号
|
||||
*/
|
||||
private String certificateno;
|
||||
/**
|
||||
* 证件类别
|
||||
*/
|
||||
private String certificatetype;
|
||||
/**
|
||||
* 产品ID
|
||||
*/
|
||||
private String item;
|
||||
/**
|
||||
* 产品名称
|
||||
*/
|
||||
private String itemname;
|
||||
/**
|
||||
* 产品类型ID
|
||||
*/
|
||||
private String itemtype;
|
||||
/**
|
||||
* 产品类型名称
|
||||
*/
|
||||
private String itemtypename;
|
||||
/**
|
||||
* 出游日期
|
||||
*/
|
||||
private String productbatchno;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 销售日期
|
||||
*/
|
||||
private String sddate;
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String sdno;
|
||||
/**
|
||||
* 销售时间
|
||||
*/
|
||||
private String sdtime;
|
||||
/**
|
||||
* 交易类别(订单类型)
|
||||
*/
|
||||
private String transactiontypeno;
|
||||
/**
|
||||
* 销售特征名称(票种名称)
|
||||
*/
|
||||
private String salepropetyvaluename;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.ticket.dal.mysql.asset;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.asset.AssetDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.asset.vo.*;
|
||||
|
||||
/**
|
||||
* 设备 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface AssetMapper extends BaseMapperX<AssetDO> {
|
||||
|
||||
default PageResult<AssetDO> selectPage(AssetPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<AssetDO>()
|
||||
.eqIfPresent(AssetDO::getId, reqVO.getId())
|
||||
.eqIfPresent(AssetDO::getDataId, reqVO.getDataId())
|
||||
.likeIfPresent(AssetDO::getAssetname, reqVO.getAssetname())
|
||||
.eqIfPresent(AssetDO::getAssettype, reqVO.getAssettype())
|
||||
.likeIfPresent(AssetDO::getAssettypename, reqVO.getAssettypename())
|
||||
.eqIfPresent(AssetDO::getIsOnline, reqVO.getIsOnline())
|
||||
.betweenIfPresent(AssetDO::getLastfeedbacktime, reqVO.getLastfeedbacktime())
|
||||
.orderByDesc(AssetDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.ticket.dal.mysql.checkticket;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketPageReqVO;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.checkticket.CheckTicketDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.*;
|
||||
|
||||
/**
|
||||
* 检票 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface CheckTicketMapper extends BaseMapperX<CheckTicketDO> {
|
||||
|
||||
default PageResult<CheckTicketDO> selectPage(CheckTicketPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CheckTicketDO>()
|
||||
.eqIfPresent(CheckTicketDO::getId, reqVO.getId())
|
||||
.eqIfPresent(CheckTicketDO::getDataId, reqVO.getDataId())
|
||||
.eqIfPresent(CheckTicketDO::getCheckstation, reqVO.getCheckstation())
|
||||
.likeIfPresent(CheckTicketDO::getCheckstationname, reqVO.getCheckstationname())
|
||||
.betweenIfPresent(CheckTicketDO::getCheckticketdate, reqVO.getCheckticketdate())
|
||||
.betweenIfPresent(CheckTicketDO::getChecktickettime, reqVO.getChecktickettime())
|
||||
.eqIfPresent(CheckTicketDO::getPersoncount, reqVO.getPersoncount())
|
||||
.eqIfPresent(CheckTicketDO::getSdshipping, reqVO.getSdshipping())
|
||||
.eqIfPresent(CheckTicketDO::getTicket, reqVO.getTicket())
|
||||
.likeIfPresent(CheckTicketDO::getSalepropetyvaluename, reqVO.getSalepropetyvaluename())
|
||||
.orderByDesc(CheckTicketDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package cn.iocoder.yudao.module.ticket.dal.mysql.saledata;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.saledata.SaleDataDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.saledata.vo.*;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 售票 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface SaleDataMapper extends BaseMapperX<SaleDataDO> {
|
||||
|
||||
default PageResult<SaleDataDO> selectPage(SaleDataPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<SaleDataDO>()
|
||||
.eqIfPresent(SaleDataDO::getId, reqVO.getId())
|
||||
.eqIfPresent(SaleDataDO::getDataId, reqVO.getDataId())
|
||||
.eqIfPresent(SaleDataDO::getAmount, reqVO.getAmount())
|
||||
.eqIfPresent(SaleDataDO::getCertificateno, reqVO.getCertificateno())
|
||||
.eqIfPresent(SaleDataDO::getCertificatetype, reqVO.getCertificatetype())
|
||||
.eqIfPresent(SaleDataDO::getItem, reqVO.getItem())
|
||||
.likeIfPresent(SaleDataDO::getItemname, reqVO.getItemname())
|
||||
.eqIfPresent(SaleDataDO::getItemtype, reqVO.getItemtype())
|
||||
.likeIfPresent(SaleDataDO::getItemtypename, reqVO.getItemtypename())
|
||||
.eqIfPresent(SaleDataDO::getProductbatchno, reqVO.getProductbatchno())
|
||||
.eqIfPresent(SaleDataDO::getQuantity, reqVO.getQuantity())
|
||||
.betweenIfPresent(SaleDataDO::getSddate, reqVO.getSddate())
|
||||
.eqIfPresent(SaleDataDO::getSdno, reqVO.getSdno())
|
||||
.betweenIfPresent(SaleDataDO::getSdtime, reqVO.getSdtime())
|
||||
.eqIfPresent(SaleDataDO::getTransactiontypeno, reqVO.getTransactiontypeno())
|
||||
.likeIfPresent(SaleDataDO::getSalepropetyvaluename, reqVO.getSalepropetyvaluename())
|
||||
.orderByDesc(SaleDataDO::getId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有数据的性别分类和个数
|
||||
*/
|
||||
@Select("SELECT " +
|
||||
"CASE WHEN CAST(SUBSTRING(certificateno, LENGTH(certificateno) - 1, 1) AS SIGNED) % 2 = 1 THEN 'male' ELSE 'female' END AS gender, " +
|
||||
"COUNT(*) AS count " +
|
||||
"FROM saledata " +
|
||||
"GROUP BY gender")
|
||||
@Results({
|
||||
@Result(property = "gender", column = "gender"),
|
||||
@Result(property = "count", column = "count")
|
||||
})
|
||||
List<Map<String, String>> findByGender();
|
||||
|
||||
/**
|
||||
* 查询所有数据的年龄区间和个数
|
||||
*/
|
||||
@Select("SELECT " +
|
||||
" CASE " +
|
||||
" WHEN YEAR(CURDATE()) - YEAR(STR_TO_DATE(SUBSTRING(certificateno, 7, 8), '%Y%m%d')) - " +
|
||||
" (RIGHT(CURDATE(), 5) < RIGHT(SUBSTRING(certificateno, 7, 8), 5)) < 20 THEN 'one' " +
|
||||
" WHEN YEAR(CURDATE()) - YEAR(STR_TO_DATE(SUBSTRING(certificateno, 7, 8), '%Y%m%d')) - " +
|
||||
" (RIGHT(CURDATE(), 5) < RIGHT(SUBSTRING(certificateno, 7, 8), 5)) BETWEEN 20 AND 29 THEN 'two' " +
|
||||
" WHEN YEAR(CURDATE()) - YEAR(STR_TO_DATE(SUBSTRING(certificateno, 7, 8), '%Y%m%d')) - " +
|
||||
" (RIGHT(CURDATE(), 5) < RIGHT(SUBSTRING(certificateno, 7, 8), 5)) BETWEEN 30 AND 39 THEN 'three' " +
|
||||
" WHEN YEAR(CURDATE()) - YEAR(STR_TO_DATE(SUBSTRING(certificateno, 7, 8), '%Y%m%d')) - " +
|
||||
" (RIGHT(CURDATE(), 5) < RIGHT(SUBSTRING(certificateno, 7, 8), 5)) BETWEEN 40 AND 49 THEN 'four' " +
|
||||
" WHEN YEAR(CURDATE()) - YEAR(STR_TO_DATE(SUBSTRING(certificateno, 7, 8), '%Y%m%d')) - " +
|
||||
" (RIGHT(CURDATE(), 5) < RIGHT(SUBSTRING(certificateno, 7, 8), 5)) BETWEEN 50 AND 59 THEN 'five' " +
|
||||
" ELSE 'six' " +
|
||||
" END AS age_group, " +
|
||||
" COUNT(*) AS count " +
|
||||
"FROM saledata " +
|
||||
"WHERE certificateno REGEXP '^.{18}$' " +
|
||||
"GROUP BY age_group")
|
||||
|
||||
List<Map<String, String>> findByAge();
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.ticket.framework.security.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
|
||||
|
||||
/**
|
||||
* Demo 模块的 Security 配置
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class SecurityConfiguration {
|
||||
|
||||
@Bean
|
||||
public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
|
||||
return new AuthorizeRequestsCustomizer() {
|
||||
|
||||
@Override
|
||||
public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) {
|
||||
// Swagger 接口文档
|
||||
registry.antMatchers("/v3/api-docs/**").permitAll() // 元数据
|
||||
.antMatchers("/swagger-ui.html").permitAll(); // Swagger UI
|
||||
// Druid 监控
|
||||
registry.antMatchers("/druid/**").anonymous();
|
||||
// Spring Boot Actuator 的安全配置
|
||||
registry.antMatchers("/actuator").anonymous()
|
||||
.antMatchers("/actuator/**").anonymous();
|
||||
// RPC 服务的安全配置
|
||||
registry.antMatchers(ApiConstants.PREFIX + "/**").permitAll();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.asset;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.asset.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.asset.AssetDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 设备 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface AssetService {
|
||||
|
||||
/**
|
||||
* 创建设备
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createAsset(@Valid AssetSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新设备
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateAsset(@Valid AssetSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除设备
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteAsset(Long id);
|
||||
|
||||
/**
|
||||
* 获得设备
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 设备
|
||||
*/
|
||||
AssetDO getAsset(Long id);
|
||||
|
||||
/**
|
||||
* 获得设备分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 设备分页
|
||||
*/
|
||||
PageResult<AssetDO> getAssetPage(AssetPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 计算不同设备的数量
|
||||
* @param
|
||||
* @return 所有设备名称和数量
|
||||
*/
|
||||
public List<Map<String, String>> countAsset();
|
||||
|
||||
/**
|
||||
* 获取符合设备类型名的所有设备
|
||||
* @param assettypename 设备类型名
|
||||
* @return java.util.List<cn.iocoder.yudao.module.ticket.dal.dataobject.asset.AssetDO>
|
||||
*/
|
||||
public List<AssetDO> nameAsset(String assettypename);
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.asset;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.asset.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.asset.AssetDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.mysql.asset.AssetMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 设备 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class AssetServiceImpl implements AssetService {
|
||||
|
||||
@Resource
|
||||
private AssetMapper assetMapper;
|
||||
|
||||
@Override
|
||||
public Long createAsset(AssetSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
AssetDO asset = BeanUtils.toBean(createReqVO, AssetDO.class);
|
||||
assetMapper.insert(asset);
|
||||
// 返回
|
||||
return asset.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAsset(AssetSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
// validateAssetExists(updateReqVO.getId());
|
||||
// 更新
|
||||
AssetDO updateObj = BeanUtils.toBean(updateReqVO, AssetDO.class);
|
||||
assetMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAsset(Long id) {
|
||||
// 校验存在
|
||||
validateAssetExists(id);
|
||||
// 删除
|
||||
assetMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateAssetExists(Long id) {
|
||||
if (assetMapper.selectById(id) == null) {
|
||||
throw exception(ASSET_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssetDO getAsset(Long id) {
|
||||
return assetMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AssetDO> getAssetPage(AssetPageReqVO pageReqVO) {
|
||||
return assetMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> countAsset() {
|
||||
List<AssetDO> assetList = assetMapper.selectList();
|
||||
int[] assetTypeCounts = new int[3];
|
||||
Map<String, String> map = new LinkedHashMap<>();
|
||||
for (AssetDO asset : assetList) {
|
||||
String assettype = asset.getAssettype();
|
||||
switch (assettype) {
|
||||
case "C":
|
||||
assetTypeCounts[0]++;
|
||||
break;
|
||||
case "D":
|
||||
assetTypeCounts[1]++;
|
||||
break;
|
||||
case "F":
|
||||
assetTypeCounts[2]++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
map.put("其他电子设备", String.valueOf(assetTypeCounts[0]));
|
||||
map.put("运输设备", String.valueOf(assetTypeCounts[1]));
|
||||
map.put("手持机", String.valueOf(assetTypeCounts[2]));
|
||||
List<Map<String,String>>mapList=new ArrayList<>();
|
||||
for (Map.Entry<String, String> stringStringEntry : map.entrySet()) {
|
||||
Map<String, String> map1=new LinkedHashMap();
|
||||
map1.put("assettype",stringStringEntry.getKey());
|
||||
map1.put("count",stringStringEntry.getValue());
|
||||
mapList.add(map1);
|
||||
}
|
||||
return mapList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AssetDO> nameAsset(String assettypename) {
|
||||
LambdaQueryWrapperX<AssetDO> wrapperX = new LambdaQueryWrapperX<>();
|
||||
wrapperX.eq(AssetDO::getAssettypename, assettypename);
|
||||
return assetMapper.selectList(wrapperX);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.checkticket;
|
||||
|
||||
import javax.validation.*;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketPageReqVO;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketSaveReqVO;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.checkticket.CheckTicketDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 检票 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface CheckTicketService {
|
||||
|
||||
/**
|
||||
* 创建检票
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createCheckTicket(@Valid CheckTicketSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新检票
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateCheckTicket(@Valid CheckTicketSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除检票
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteCheckTicket(Long id);
|
||||
|
||||
/**
|
||||
* 获得检票
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 检票
|
||||
*/
|
||||
CheckTicketDO getCheckTicket(Long id);
|
||||
|
||||
/**
|
||||
* 获得检票分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 检票分页
|
||||
*/
|
||||
PageResult<CheckTicketDO> getCheckTicketPage(CheckTicketPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获取日期当天各个时段的检票人数
|
||||
* @param day
|
||||
* @return java.util.List<java.util.Map<java.lang.String,java.lang.String>>
|
||||
*/
|
||||
public List<Map<String, String>> findbytimetemp(String day);
|
||||
|
||||
/**
|
||||
* 获得日期当天的检票人数
|
||||
* @param day 日期
|
||||
* @return long 检票人数
|
||||
*/
|
||||
public long checkTicketTotal(String day);
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.checkticket;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketPageReqVO;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.checkticket.CheckTicketDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.mysql.checkticket.CheckTicketMapper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 检票 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class CheckTicketServiceImpl implements CheckTicketService {
|
||||
|
||||
@Resource
|
||||
private CheckTicketMapper checkTicketMapper;
|
||||
|
||||
@Override
|
||||
public Long createCheckTicket(CheckTicketSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
CheckTicketDO checkTicket = BeanUtils.toBean(createReqVO, CheckTicketDO.class);
|
||||
checkTicketMapper.insert(checkTicket);
|
||||
// 返回
|
||||
return checkTicket.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCheckTicket(CheckTicketSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
// validateCheckTicketExists(updateReqVO.getId());
|
||||
// 更新
|
||||
CheckTicketDO updateObj = BeanUtils.toBean(updateReqVO, CheckTicketDO.class);
|
||||
checkTicketMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCheckTicket(Long id) {
|
||||
// 校验存在
|
||||
validateCheckTicketExists(id);
|
||||
// 删除
|
||||
checkTicketMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateCheckTicketExists(Long id) {
|
||||
if (checkTicketMapper.selectById(id) == null) {
|
||||
throw exception(CHECK_TICKET_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckTicketDO getCheckTicket(Long id) {
|
||||
return checkTicketMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<CheckTicketDO> getCheckTicketPage(CheckTicketPageReqVO pageReqVO) {
|
||||
return checkTicketMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> findbytimetemp(String day) {
|
||||
LocalDateTime startTime = LocalDateTime.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
|
||||
List<Map<String, String>> mapList = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < 24; i++) {
|
||||
Map<String, String> map = new LinkedHashMap<>();
|
||||
LocalDateTime hourStartTime = startTime.withHour(i).withMinute(0).withSecond(0).withNano(0);
|
||||
LocalDateTime hourEndTime = hourStartTime.plusHours(1);
|
||||
String begintime = formatter.format(hourStartTime);
|
||||
String endtime = formatter.format(hourEndTime);
|
||||
map.put("date", begintime + "-" + endtime);
|
||||
LambdaQueryWrapperX<CheckTicketDO> wrapperX = new LambdaQueryWrapperX<>();
|
||||
wrapperX.eq(CheckTicketDO::getCheckticketdate, day).between(CheckTicketDO::getChecktickettime, begintime, endtime);
|
||||
// wrapperX.eq(CheckTicketDO::getCheckticketdate, day).apply("DATE_FORMAT(checktickettime, '%H:%i:%s') BETWEEN {0} AND {1}", begintime, endtime);
|
||||
map.put("count", String.valueOf(checkTicketMapper.selectCount(wrapperX)));
|
||||
mapList.add(map);
|
||||
}
|
||||
|
||||
return mapList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long checkTicketTotal(String day) {
|
||||
LambdaQueryWrapperX<CheckTicketDO> wrapperX = new LambdaQueryWrapperX<>();
|
||||
wrapperX.eq(CheckTicketDO::getCheckticketdate, day);
|
||||
return checkTicketMapper.selectCount(wrapperX);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.saledata;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.saledata.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.saledata.SaleDataDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
/**
|
||||
* 售票 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface SaleDataService {
|
||||
|
||||
/**
|
||||
* 创建售票
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createSaleData(@Valid SaleDataSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新售票
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateSaleData(@Valid SaleDataSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除售票
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteSaleData(Long id);
|
||||
|
||||
/**
|
||||
* 获得售票
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 售票
|
||||
*/
|
||||
SaleDataDO getSaleData(Long id);
|
||||
|
||||
/**
|
||||
* 获得售票分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 售票分页
|
||||
*/
|
||||
PageResult<SaleDataDO> getSaleDataPage(SaleDataPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得输入日期的当天总售票数
|
||||
* @param day 日期
|
||||
* @return 当天总售票数
|
||||
*/
|
||||
public long countBySddate(String day);
|
||||
/**
|
||||
* 日期往前十天内的数据
|
||||
* @param startTime 起始日期
|
||||
* @return java.util.List<java.util.Map>
|
||||
*/
|
||||
|
||||
public List<Map<String,String>> findCheckticketcountBytime(String startTime);
|
||||
|
||||
/**
|
||||
* 查询男女人数
|
||||
* @return 男女人数
|
||||
*/
|
||||
public List<Map<String, String>> findByGender();
|
||||
|
||||
/**
|
||||
* 查询各个年龄段的人数
|
||||
* @return 各个年龄段的人数
|
||||
*/
|
||||
public List<Map<String, String>> findByAge();
|
||||
|
||||
/**
|
||||
* 查询去年1月1日到12月31日的全部数据
|
||||
* @return
|
||||
*/
|
||||
public List<SaleDataDO> findEventsLastYear();
|
||||
/**
|
||||
* 查询今年1月1日到12月31日的全部数据
|
||||
* @return
|
||||
*/
|
||||
public List<SaleDataDO> findEventsThisYear();
|
||||
|
||||
/**
|
||||
* 查询各个省份和人数
|
||||
* @param list 售票数据
|
||||
* @return 各个省份和人数
|
||||
*/
|
||||
public List<Map<String, String>> findByregion(List<SaleDataDO> list);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询销售渠道
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, String>> findBySaleMethod();
|
||||
|
||||
/**
|
||||
* 查询最近前x年五一期间的数据
|
||||
* @param x 前几年
|
||||
*/
|
||||
List<Map<String, String>> findWuyi(int x);
|
||||
/**
|
||||
* 查询最近前x年国庆期间的数据
|
||||
* @param x 前几年
|
||||
*/
|
||||
List<Map<String, String>> findGuoqing(int x);
|
||||
|
||||
/**
|
||||
* 查询今年的近三十天日均
|
||||
* @param startTime 中间时间
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
String findrijun(String startTime);
|
||||
|
||||
/**
|
||||
* 查年度平均
|
||||
* @param list 一年的全部数据
|
||||
* @return java.math.BigDecimal
|
||||
*/
|
||||
BigDecimal findyearJun(List<SaleDataDO> list);
|
||||
}
|
@ -0,0 +1,432 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.saledata;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.ticket.IdCardUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import kotlin.jvm.internal.Lambda;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.saledata.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.saledata.SaleDataDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.mysql.saledata.SaleDataMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 售票 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class SaleDataServiceImpl implements SaleDataService {
|
||||
|
||||
@Resource
|
||||
private SaleDataMapper saleDataMapper;
|
||||
|
||||
@Override
|
||||
public Long createSaleData(SaleDataSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
SaleDataDO saleData = BeanUtils.toBean(createReqVO, SaleDataDO.class);
|
||||
saleDataMapper.insert(saleData);
|
||||
// 返回
|
||||
return saleData.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSaleData(SaleDataSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
// validateSaleDataExists(updateReqVO.getId());
|
||||
// 更新
|
||||
SaleDataDO updateObj = BeanUtils.toBean(updateReqVO, SaleDataDO.class);
|
||||
saleDataMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSaleData(Long id) {
|
||||
// 校验存在
|
||||
validateSaleDataExists(id);
|
||||
// 删除
|
||||
saleDataMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateSaleDataExists(Long id) {
|
||||
if (saleDataMapper.selectById(id) == null) {
|
||||
throw exception(SALE_DATA_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SaleDataDO getSaleData(Long id) {
|
||||
return saleDataMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<SaleDataDO> getSaleDataPage(SaleDataPageReqVO pageReqVO) {
|
||||
return saleDataMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countBySddate(String day) {
|
||||
LambdaQueryWrapperX<SaleDataDO> wrapperX = new LambdaQueryWrapperX<>();
|
||||
wrapperX.eq(SaleDataDO::getSddate, day);
|
||||
return saleDataMapper.selectCount(wrapperX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String,String>> findCheckticketcountBytime(String startTime) {
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
Date date1= null;
|
||||
try {
|
||||
date1 = inputFormat.parse(startTime);
|
||||
} catch (ParseException e) {
|
||||
// throw new RuntimeException(e);
|
||||
System.out.println("抛出日期转换异常");
|
||||
}
|
||||
calendar.setTime(date1);
|
||||
calendar.add(Calendar.DAY_OF_YEAR, -9);
|
||||
List<Map<String,String>>map = new ArrayList<>();
|
||||
while (!calendar.getTime().after(date1)){
|
||||
Map<String,String>map1= new HashMap<>();
|
||||
String date = inputFormat.format(calendar.getTime());
|
||||
map1.put("date",outputFormat.format(calendar.getTime()));
|
||||
map1.put("count", String.valueOf(this.countBySddate(date)));
|
||||
map.add(map1);
|
||||
calendar.add(Calendar.DAY_OF_YEAR, 1);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> findByGender() {
|
||||
List<Map<String, String>> allByCertificateno = saleDataMapper.findByGender();
|
||||
List<Map<String, String>> map = new ArrayList<>();
|
||||
Map<String,String>map1=new HashMap<>();
|
||||
Map<String,String>map2=new HashMap<>();
|
||||
map1.put("sex","女生" );
|
||||
map2.put("sex","男生" );
|
||||
for (Map<String, String> stringMap : allByCertificateno) {
|
||||
if("female".equals(stringMap.get("gender"))){
|
||||
map1.put("count",stringMap.get("count"));
|
||||
}else if ("male".equals(stringMap.get("gender"))){
|
||||
map2.put("count", stringMap.get("count"));
|
||||
}
|
||||
}
|
||||
map.add(map1);
|
||||
map.add(map2);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> findByAge() {
|
||||
List<Map<String, String>> ageRangeList = saleDataMapper.findByAge();
|
||||
List<Map<String,String>>map=new ArrayList<>();
|
||||
Map<String,String>map1=new LinkedHashMap<>();
|
||||
Map<String,String>map2=new LinkedHashMap<>();
|
||||
Map<String,String>map3=new LinkedHashMap<>();
|
||||
Map<String,String>map4=new LinkedHashMap<>();
|
||||
Map<String,String>map5=new LinkedHashMap<>();
|
||||
Map<String,String>map6=new LinkedHashMap<>();
|
||||
|
||||
map1.put("age","20以下"); // (~, 20)
|
||||
map2.put("age","20-30"); // [20, 30)
|
||||
map3.put("age","30-40"); // [30, 40)
|
||||
map4.put("age","40-50"); // [40, 50)
|
||||
map5.put("age","50-60"); // [50, 60)
|
||||
map6.put("age","60以上"); // [60, ~)
|
||||
for (Map<String, String> stringStringMap : ageRangeList) {
|
||||
if ("one".equals(stringStringMap.get("age_group"))){
|
||||
map1.put("count",stringStringMap.get("count"));
|
||||
}else if("two".equals(stringStringMap.get("age_group"))){
|
||||
map2.put("count",stringStringMap.get("count"));
|
||||
}else if("three".equals(stringStringMap.get("age_group"))){
|
||||
map3.put("count",stringStringMap.get("count"));
|
||||
}else if("four".equals(stringStringMap.get("age_group"))){
|
||||
map4.put("count",stringStringMap.get("count"));
|
||||
}else if("five".equals(stringStringMap.get("age_group"))){
|
||||
map5.put("count",stringStringMap.get("count"));
|
||||
}else if("six".equals(stringStringMap.get("age_group"))){
|
||||
map6.put("count",stringStringMap.get("count"));
|
||||
}
|
||||
}
|
||||
map.add(map1);
|
||||
map.add(map2);
|
||||
map.add(map3);
|
||||
map.add(map4);
|
||||
map.add(map5);
|
||||
map.add(map6);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SaleDataDO> findEventsLastYear() {
|
||||
DateTimeFormatter date = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
LocalDate lastYear = LocalDate.now().minusYears(1);
|
||||
LocalDate startOfYear = lastYear.withDayOfYear(1);
|
||||
LocalDate endOfYear = lastYear.withDayOfYear(lastYear.lengthOfYear());
|
||||
String start = date.format(startOfYear);
|
||||
String end = date.format(endOfYear);
|
||||
LambdaQueryWrapperX<SaleDataDO> wrapperX = new LambdaQueryWrapperX<>();
|
||||
wrapperX.between(SaleDataDO::getSddate, start, end).select(SaleDataDO::getCertificateno, SaleDataDO::getAmount);
|
||||
return saleDataMapper.selectList(wrapperX);
|
||||
}
|
||||
@Override
|
||||
public List<SaleDataDO> findEventsThisYear() {
|
||||
DateTimeFormatter date = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
LocalDate thisYear = LocalDate.now().minusYears(0);
|
||||
LocalDate startOfYear = thisYear.withDayOfYear(1);
|
||||
LocalDate endOfYear = thisYear.withDayOfYear(thisYear.lengthOfYear());
|
||||
String start = date.format(startOfYear);
|
||||
String end = date.format(endOfYear);
|
||||
LambdaQueryWrapperX<SaleDataDO> wrapperX = new LambdaQueryWrapperX<>();
|
||||
wrapperX.between(SaleDataDO::getSddate, start, end).select(SaleDataDO::getCertificateno, SaleDataDO::getAmount);
|
||||
return saleDataMapper.selectList(wrapperX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> findByregion(List<SaleDataDO> list) {
|
||||
// 初始化每个省市的计数器
|
||||
Map<String, Integer> regionCounts = new LinkedHashMap<>();
|
||||
String[] regions = {
|
||||
"北京市", "天津市", "河北省", "山西省", "内蒙古自治区", "辽宁省", "吉林省", "黑龙江省",
|
||||
"上海市", "江苏省", "浙江省", "安徽省", "福建省", "江西省", "山东省", "河南省",
|
||||
"湖北省", "湖南省", "广东省", "广西壮族自治区", "海南省", "重庆市", "四川省",
|
||||
"贵州省", "云南省", "西藏自治区", "陕西省", "甘肃省", "青海省", "宁夏回族自治区",
|
||||
"新疆维吾尔自治区", "台湾省", "香港特别行政区", "澳门特别行政区"
|
||||
};
|
||||
for (String region : regions) {
|
||||
regionCounts.put(region, 0);
|
||||
}
|
||||
|
||||
// 遍历销售数据列表
|
||||
for (SaleDataDO saleData : list) {
|
||||
String certificateno = saleData.getCertificateno();
|
||||
if (certificateno.length() != 18) {
|
||||
continue;
|
||||
}
|
||||
String region = IdCardUtil.getRegion(certificateno);
|
||||
if (regionCounts.containsKey(region)) {
|
||||
regionCounts.put(region, regionCounts.get(region) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 构建返回的结果列表
|
||||
List<Map<String, String>> mapList = new ArrayList<>();
|
||||
for (Map.Entry<String, Integer> entry : regionCounts.entrySet()) {
|
||||
Map<String, String> map = new LinkedHashMap<>();
|
||||
map.put("region", entry.getKey());
|
||||
map.put("count", String.valueOf(entry.getValue()));
|
||||
mapList.add(map);
|
||||
}
|
||||
|
||||
return mapList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> findBySaleMethod() {
|
||||
List<SaleDataDO> saleDataList = saleDataMapper.selectList(new LambdaQueryWrapperX<SaleDataDO>().select(SaleDataDO::getTransactiontypeno));
|
||||
int[] saleMethodCounts = new int[5];
|
||||
Map<String,String>map=new LinkedHashMap<>();
|
||||
for (SaleDataDO saleData : saleDataList) {
|
||||
String transactiontypeno = saleData.getTransactiontypeno();
|
||||
switch (transactiontypeno){
|
||||
case "SD01":
|
||||
saleMethodCounts[0]++;
|
||||
break;
|
||||
case "SD02":
|
||||
saleMethodCounts[1]++;
|
||||
break;
|
||||
case "SD03":
|
||||
saleMethodCounts[2]++;
|
||||
break;
|
||||
case "SD04":
|
||||
saleMethodCounts[3]++;
|
||||
break;
|
||||
case "SD05":
|
||||
saleMethodCounts[4]++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
map.put("一般销货", String.valueOf(saleMethodCounts[0]));
|
||||
map.put("网络订单", String.valueOf(saleMethodCounts[1]));
|
||||
map.put("特殊退票", String.valueOf(saleMethodCounts[2]));
|
||||
map.put("预约单", String.valueOf(saleMethodCounts[3]));
|
||||
map.put("快速购票", String.valueOf(saleMethodCounts[4]));
|
||||
List<Map<String,String>>mapList=new ArrayList<>();
|
||||
for (Map.Entry<String, String> stringStringEntry : map.entrySet()) {
|
||||
Map<String, String> map1=new LinkedHashMap<>();
|
||||
map1.put("transactiontypeno",stringStringEntry.getKey());
|
||||
map1.put("count",stringStringEntry.getValue());
|
||||
mapList.add(map1);
|
||||
}
|
||||
return mapList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> findWuyi(int x) {
|
||||
DateTimeFormatter date = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
LocalDate xYear = LocalDate.now().minusYears(x);
|
||||
LocalDate month = xYear.withMonth(5);
|
||||
LocalDate startOfMonth = month.withDayOfMonth(1);
|
||||
LocalDate endOfMonth = month.withDayOfMonth(5);
|
||||
String start = date.format(startOfMonth);
|
||||
String end = date.format(endOfMonth);
|
||||
LambdaQueryWrapperX<SaleDataDO> wrapperX = new LambdaQueryWrapperX<>();
|
||||
wrapperX.between(SaleDataDO::getSddate, start, end).select(SaleDataDO::getCertificateno);
|
||||
List<SaleDataDO> saleDataList = saleDataMapper.selectList(wrapperX);
|
||||
int[] Counts = new int[5];
|
||||
for (SaleDataDO saleData : saleDataList) {
|
||||
String sddate = saleData.getSddate();
|
||||
String substring = sddate.substring(6, 8);
|
||||
switch (substring){
|
||||
case "01":
|
||||
Counts[0]++;
|
||||
break;
|
||||
case "02":
|
||||
Counts[1]++;
|
||||
break;
|
||||
case "03":
|
||||
Counts[2]++;
|
||||
break;
|
||||
case "04":
|
||||
Counts[3]++;
|
||||
break;
|
||||
case "05":
|
||||
Counts[4]++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<Map<String,String>>mapList=new ArrayList<>();
|
||||
Map<String,String> map=new LinkedHashMap<>();
|
||||
map.put("第一天", String.valueOf(Counts[0]));
|
||||
map.put("第二天", String.valueOf(Counts[1]));
|
||||
map.put("第三天", String.valueOf(Counts[2]));
|
||||
map.put("第四天", String.valueOf(Counts[3]));
|
||||
map.put("第五天", String.valueOf(Counts[4]));
|
||||
for (Map.Entry<String, String> stringStringEntry : map.entrySet()) {
|
||||
Map<String, String> map1=new LinkedHashMap<>();
|
||||
map1.put("day", stringStringEntry.getKey());
|
||||
map1.put("count", stringStringEntry.getValue());
|
||||
mapList.add(map1);
|
||||
}
|
||||
return mapList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> findGuoqing(int x) {
|
||||
DateTimeFormatter date = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
LocalDate xYear = LocalDate.now().minusYears(x);
|
||||
LocalDate month = xYear.withMonth(10);
|
||||
LocalDate startOfMonth = month.withDayOfMonth(1);
|
||||
LocalDate endOfMonth = month.withDayOfMonth(7);
|
||||
String start = date.format(startOfMonth);
|
||||
String end = date.format(endOfMonth);
|
||||
LambdaQueryWrapperX<SaleDataDO> wrapperX = new LambdaQueryWrapperX<>();
|
||||
wrapperX.between(SaleDataDO::getSddate, start, end).select(SaleDataDO::getCertificateno);
|
||||
List<SaleDataDO> saleDataList = saleDataMapper.selectList(wrapperX);
|
||||
int[] Counts = new int[7];
|
||||
for (SaleDataDO saleData : saleDataList) {
|
||||
String sddate = saleData.getSddate();
|
||||
String substring = sddate.substring(6, 8);
|
||||
switch (substring){
|
||||
case "01":
|
||||
Counts[0]++;
|
||||
break;
|
||||
case "02":
|
||||
Counts[1]++;
|
||||
break;
|
||||
case "03":
|
||||
Counts[2]++;
|
||||
break;
|
||||
case "04":
|
||||
Counts[3]++;
|
||||
break;
|
||||
case "05":
|
||||
Counts[4]++;
|
||||
break;
|
||||
case "06":
|
||||
Counts[5]++;
|
||||
break;
|
||||
case "07":
|
||||
Counts[6]++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<Map<String,String>>mapList=new ArrayList<>();
|
||||
Map<String,String> map=new LinkedHashMap<>();
|
||||
map.put("第一天", String.valueOf(Counts[0]));
|
||||
map.put("第二天", String.valueOf(Counts[1]));
|
||||
map.put("第三天", String.valueOf(Counts[2]));
|
||||
map.put("第四天", String.valueOf(Counts[3]));
|
||||
map.put("第五天", String.valueOf(Counts[4]));
|
||||
map.put("第六天", String.valueOf(Counts[5]));
|
||||
map.put("第七天", String.valueOf(Counts[6]));
|
||||
for (Map.Entry<String, String> stringStringEntry : map.entrySet()) {
|
||||
Map<String, String> map1=new LinkedHashMap<>();
|
||||
map1.put("day",stringStringEntry.getKey());
|
||||
map1.put("count",stringStringEntry.getValue());
|
||||
mapList.add(map1);
|
||||
}
|
||||
return mapList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findrijun(String startTime) {
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
Date date1 = null;
|
||||
try {
|
||||
date1 = inputFormat.parse(startTime);
|
||||
} catch (ParseException e) {
|
||||
// throw new RuntimeException(e);
|
||||
System.out.println("抛出日期转换异常");
|
||||
}
|
||||
assert date1 != null;
|
||||
calendar.setTime(date1);
|
||||
calendar.add(Calendar.DAY_OF_YEAR, -29);
|
||||
Map<String,String>map = new LinkedHashMap<>();
|
||||
int count = 0;
|
||||
while (!calendar.getTime().after(date1)){
|
||||
String date = inputFormat.format(calendar.getTime());
|
||||
long i = this.countBySddate(date);
|
||||
count+=i;
|
||||
calendar.add(Calendar.DAY_OF_YEAR, 1);
|
||||
}
|
||||
return String.valueOf(count/30);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal findyearJun(List<SaleDataDO> list) {
|
||||
BigDecimal total=new BigDecimal(0);
|
||||
for (SaleDataDO saleData : list) {
|
||||
BigDecimal amount = saleData.getAmount();
|
||||
total=total.add(amount);
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
--- #################### 数据库相关配置 ####################
|
||||
spring:
|
||||
# 数据源配置项
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
||||
datasource:
|
||||
druid: # Druid 【监控】相关的全局配置
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
allow: # 设置白名单,不填则允许所有访问
|
||||
url-pattern: /druid/*
|
||||
login-username: # 控制台管理用户名和密码
|
||||
login-password:
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
log-slow-sql: true # 慢 SQL 记录
|
||||
slow-sql-millis: 100
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
dynamic: # 多数据源配置
|
||||
druid: # Druid 【连接池】相关的全局配置
|
||||
initial-size: 5 # 初始连接数
|
||||
min-idle: 10 # 最小连接池数量
|
||||
max-active: 20 # 最大连接池数量
|
||||
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
|
||||
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
|
||||
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒
|
||||
max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒
|
||||
validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
username: root
|
||||
password: 123456
|
||||
slave: # 模拟从库,可根据自己需要修改 # 模拟从库,可根据自己需要修改
|
||||
lazy: true # 开启懒加载,保证启动速度
|
||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
username: root
|
||||
password: 123456
|
||||
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
redis:
|
||||
host: 400-infra.server.iocoder.cn # 地址
|
||||
port: 6379 # 端口
|
||||
database: 1 # 数据库索引
|
||||
# password: 123456 # 密码,建议生产环境开启
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
|
||||
|
||||
--- #################### 服务保障相关配置 ####################
|
||||
|
||||
# Lock4j 配置项
|
||||
lock4j:
|
||||
acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒
|
||||
expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒
|
||||
|
||||
--- #################### 监控相关配置 ####################
|
||||
|
||||
# Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
|
||||
exposure:
|
||||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||
|
||||
# Spring Boot Admin 配置项
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
# Spring Boot Admin Client 客户端的相关配置
|
||||
client:
|
||||
instance:
|
||||
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
|
||||
# Spring Boot Admin Server 服务端的相关配置
|
||||
context-path: /admin # 配置 Spring
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
# 芋道配置项,设置当前项目所有自定义的配置
|
||||
yudao:
|
||||
xss:
|
||||
enable: false
|
||||
web:
|
||||
admin-ui:
|
||||
url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址
|
||||
demo: true # 开启演示模式
|
@ -0,0 +1,127 @@
|
||||
--- #################### 数据库相关配置 ####################
|
||||
spring:
|
||||
# 数据源配置项
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
||||
- de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置
|
||||
datasource:
|
||||
druid: # Druid 【监控】相关的全局配置
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
allow: # 设置白名单,不填则允许所有访问
|
||||
url-pattern: /druid/*
|
||||
login-username: # 控制台管理用户名和密码
|
||||
login-password:
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
log-slow-sql: true # 慢 SQL 记录
|
||||
slow-sql-millis: 100
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
dynamic: # 多数据源配置
|
||||
druid: # Druid 【连接池】相关的全局配置
|
||||
initial-size: 1 # 初始连接数
|
||||
min-idle: 1 # 最小连接池数量
|
||||
max-active: 20 # 最大连接池数量
|
||||
max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒
|
||||
time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒
|
||||
min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒
|
||||
max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒
|
||||
validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://120.46.37.243:3306/ludu_ticket?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ruoyi-vue-pro # SQLServer 连接的示例
|
||||
# url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
|
||||
username: root
|
||||
password: xpower1234
|
||||
# username: sa # SQL Server 连接的示例
|
||||
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # SQL Server 连接的示例
|
||||
# username: SYSDBA # DM 连接的示例
|
||||
# password: SYSDBA # DM 连接的示例
|
||||
slave: # 模拟从库,可根据自己需要修改
|
||||
lazy: true # 开启懒加载,保证启动速度
|
||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||
username: root
|
||||
password: 123456
|
||||
|
||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||
redis:
|
||||
host: 127.0.0.1 # 地址
|
||||
port: 6379 # 端口
|
||||
database: 0 # 数据库索引
|
||||
# password: 123456 # 密码,建议生产环境开启
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
|
||||
xxl:
|
||||
job:
|
||||
enabled: false # 是否开启调度中心,默认为 true 开启
|
||||
admin:
|
||||
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
|
||||
|
||||
--- #################### 服务保障相关配置 ####################
|
||||
|
||||
# Lock4j 配置项
|
||||
lock4j:
|
||||
acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒
|
||||
expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒
|
||||
|
||||
--- #################### 监控相关配置 ####################
|
||||
|
||||
# Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator
|
||||
exposure:
|
||||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
||||
|
||||
# Spring Boot Admin 配置项
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
# Spring Boot Admin Client 客户端的相关配置
|
||||
client:
|
||||
instance:
|
||||
service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME]
|
||||
|
||||
# 日志文件配置
|
||||
logging:
|
||||
level:
|
||||
# 配置自己写的 MyBatis Mapper 打印日志
|
||||
cn.iocoder.yudao.module.system.dal.mysql: debug
|
||||
cn.iocoder.yudao.module.system.dal.mysql.sensitiveword.SensitiveWordMapper: INFO # 配置 SensitiveWordMapper 的日志级别为 info
|
||||
cn.iocoder.yudao.module.system.dal.mysql.sms.SmsChannelMapper: INFO # 配置 SmsChannelMapper 的日志级别为 info
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
# 芋道配置项,设置当前项目所有自定义的配置
|
||||
yudao:
|
||||
env: # 多环境的配置项
|
||||
tag: ${HOSTNAME}
|
||||
web:
|
||||
admin-ui:
|
||||
url: http://dashboard.yudao.iocoder.cn # Admin 管理后台 UI 的地址
|
||||
security:
|
||||
mock-enable: true
|
||||
xss:
|
||||
enable: false
|
||||
access-log: # 访问日志的配置项
|
||||
enable: false
|
||||
demo: false # 关闭演示模式
|
@ -0,0 +1,109 @@
|
||||
spring:
|
||||
main:
|
||||
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
|
||||
allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务
|
||||
|
||||
# Servlet 配置
|
||||
servlet:
|
||||
# 文件上传相关配置项
|
||||
multipart:
|
||||
max-file-size: 16MB # 单个文件大小
|
||||
max-request-size: 32MB # 设置总上传的文件大小
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ANT_PATH_MATCHER # 解决 SpringFox 与 SpringBoot 2.6.x 不兼容的问题,参见 SpringFoxHandlerProviderBeanPostProcessor 类
|
||||
|
||||
# Jackson 配置项
|
||||
jackson:
|
||||
serialization:
|
||||
write-dates-as-timestamps: true # 设置 LocalDateTime 的格式,使用时间戳
|
||||
write-date-timestamps-as-nanoseconds: false # 设置不使用 nanoseconds 的格式。例如说 1611460870.401,而是直接 1611460870401
|
||||
write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳
|
||||
fail-on-empty-beans: false # 允许序列化无属性的 Bean
|
||||
|
||||
# Cache 配置项
|
||||
cache:
|
||||
type: REDIS
|
||||
redis:
|
||||
time-to-live: 1h # 设置过期时间为 1 小时
|
||||
|
||||
--- #################### 接口文档配置 ####################
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
enabled: true # 1. 是否开启 Swagger 接文档的元数据
|
||||
path: /v3/api-docs
|
||||
swagger-ui:
|
||||
enabled: true # 2.1 是否开启 Swagger 文档的官方 UI 界面
|
||||
path: /swagger-ui.html
|
||||
default-flat-param-object: true # 参见 https://doc.xiaominfo.com/docs/faq/v4/knife4j-parameterobject-flat-param 文档
|
||||
|
||||
knife4j:
|
||||
enable: true # 2.2 是否开启 Swagger 文档的 Knife4j UI 界面
|
||||
setting:
|
||||
language: zh_cn
|
||||
|
||||
# MyBatis Plus 的配置项
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。
|
||||
# id-type: AUTO # 自增 ID,适合 MySQL 等直接自增的数据库
|
||||
# id-type: INPUT # 用户输入 ID,适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库
|
||||
# id-type: ASSIGN_ID # 分配 ID,默认使用雪花算法。注意,Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
banner: false # 关闭控制台的 Banner 打印
|
||||
type-aliases-package: ${yudao.info.base-package}.dal.dataobject
|
||||
encryptor:
|
||||
password: XDV71a+xqStEA3WH # 加解密的秘钥,可使用 https://www.imaegoo.com/2020/aes-key-generator/ 网站生成
|
||||
|
||||
mybatis-plus-join:
|
||||
banner: false # 关闭控制台的 Banner 打印
|
||||
|
||||
# Spring Data Redis 配置
|
||||
spring:
|
||||
data:
|
||||
redis:
|
||||
repositories:
|
||||
enabled: false # 项目未使用到 Spring Data Redis 的 Repository,所以直接禁用,保证启动速度
|
||||
|
||||
# VO 转换(数据翻译)相关
|
||||
easy-trans:
|
||||
is-enable-global: true # 启用全局翻译(拦截所有 SpringMVC ResponseBody 进行自动翻译 )。如果对于性能要求很高可关闭此配置,或通过 @IgnoreTrans 忽略某个接口
|
||||
is-enable-cloud: false # 禁用 TransType.RPC 微服务模式
|
||||
|
||||
--- #################### RPC 远程调用相关配置 ####################
|
||||
|
||||
--- #################### MQ 消息队列相关配置 ####################
|
||||
|
||||
--- #################### 定时任务相关配置 ####################
|
||||
|
||||
xxl:
|
||||
job:
|
||||
executor:
|
||||
appname: ${spring.application.name} # 执行器 AppName
|
||||
logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径
|
||||
accessToken: default_token # 执行器通讯TOKEN
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
yudao:
|
||||
info:
|
||||
version: 1.0.0
|
||||
base-package: cn.iocoder.yudao.module.ticket
|
||||
swagger:
|
||||
title: 管理后台
|
||||
description: 提供管理员管理的所有功能
|
||||
version: ${yudao.info.version}
|
||||
base-package: ${yudao.info.base-package}
|
||||
captcha:
|
||||
enable: true # 验证码的开关,默认为 true;
|
||||
tenant: # 多租户相关配置项
|
||||
enable: true
|
||||
ignore-urls:
|
||||
ignore-tables:
|
||||
|
||||
debug: false
|
@ -0,0 +1,23 @@
|
||||
--- #################### 注册中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848
|
||||
discovery:
|
||||
namespace: dev # 命名空间。这里使用 dev 开发环境
|
||||
metadata:
|
||||
version: 1.0.0 # 服务实例的版本号,可用于灰度发布
|
||||
|
||||
--- #################### 配置中心相关配置 ####################
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
|
||||
config:
|
||||
server-addr: 127.0.0.1:8848 # Nacos 服务器地址
|
||||
namespace: dev # 命名空间 dev 的ID,不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev,这里使用 dev 开发环境
|
||||
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
|
||||
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId,默认为 spring.application.name
|
||||
file-extension: yaml # 使用的 Nacos 配置集的 dataId 的文件拓展名,同时也是 Nacos 配置集的配置格式,默认为 properties
|
@ -0,0 +1,14 @@
|
||||
spring:
|
||||
application:
|
||||
name: ticket-server
|
||||
|
||||
profiles:
|
||||
active: local
|
||||
|
||||
server:
|
||||
port: 48088
|
||||
|
||||
# 日志文件配置。注意,如果 logging.file.name 不放在 bootstrap.yaml 配置文件,而是放在 application.yaml 中,会导致出现 LOG_FILE_IS_UNDEFINED 文件
|
||||
logging:
|
||||
file:
|
||||
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
|
@ -0,0 +1,76 @@
|
||||
<configuration>
|
||||
<!-- 引用 Spring Boot 的 logback 基础配置 -->
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||
<!-- 变量 yudao.info.base-package,基础业务包 -->
|
||||
<springProperty scope="context" name="yudao.info.base-package" source="yudao.info.base-package"/>
|
||||
<!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 -->
|
||||
<property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
|
||||
|
||||
<!-- 控制台 Appender -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 文件 Appender -->
|
||||
<!-- 参考 Spring Boot 的 file-appender.xml 编写 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
<!-- 日志文件名 -->
|
||||
<file>${LOG_FILE}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!-- 滚动后的日志文件名 -->
|
||||
<fileNamePattern>${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz}</fileNamePattern>
|
||||
<!-- 启动服务时,是否清理历史日志,一般不建议清理 -->
|
||||
<cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart>
|
||||
<!-- 日志文件,到达多少容量,进行滚动 -->
|
||||
<maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize>
|
||||
<!-- 日志文件的总大小,0 表示不限制 -->
|
||||
<totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap>
|
||||
<!-- 日志文件的保留天数 -->
|
||||
<maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
<!-- 异步写入日志,提升性能 -->
|
||||
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<!-- 不丢失日志。默认的,如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 -->
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<!-- 更改默认的队列的深度,该值会影响性能。默认值为 256 -->
|
||||
<queueSize>256</queueSize>
|
||||
<appender-ref ref="FILE"/>
|
||||
</appender>
|
||||
|
||||
<!-- SkyWalking GRPC 日志收集,实现日志中心。注意:SkyWalking 8.4.0 版本开始支持 -->
|
||||
<appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||
<pattern>${PATTERN_DEFAULT}</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 本地环境 -->
|
||||
<springProfile name="local">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 -->
|
||||
<appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 -->
|
||||
</root>
|
||||
</springProfile>
|
||||
<!-- 其它环境 -->
|
||||
<springProfile name="dev,test,stage,prod,default">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="ASYNC"/>
|
||||
<appender-ref ref="GRPC"/>
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
</configuration>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.ticket.dal.mysql.asset.AssetMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.ticket.dal.mysql.checkticket.CheckTicketMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.ticket.dal.mysql.saledata.SaleDataMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
@ -0,0 +1,154 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.asset;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.asset.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.asset.AssetDO;
|
||||
import cn.iocoder.yudao.module.ticket.dal.mysql.asset.AssetMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link AssetServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(AssetServiceImpl.class)
|
||||
public class AssetServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private AssetServiceImpl assetService;
|
||||
|
||||
@Resource
|
||||
private AssetMapper assetMapper;
|
||||
|
||||
// @Test
|
||||
// public void testCreateAsset_success() {
|
||||
// // 准备参数
|
||||
// AssetSaveReqVO createReqVO = randomPojo(AssetSaveReqVO.class).setId(null);
|
||||
//
|
||||
// // 调用
|
||||
// Long assetId = assetService.createAsset(createReqVO);
|
||||
// // 断言
|
||||
// assertNotNull(assetId);
|
||||
// // 校验记录的属性是否正确
|
||||
// AssetDO asset = assetMapper.selectById(assetId);
|
||||
// assertPojoEquals(createReqVO, asset, "id");
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void testUpdateAsset_success() {
|
||||
// // mock 数据
|
||||
// AssetDO dbAsset = randomPojo(AssetDO.class);
|
||||
// assetMapper.insert(dbAsset);// @Sql: 先插入出一条存在的数据
|
||||
// // 准备参数
|
||||
// AssetSaveReqVO updateReqVO = randomPojo(AssetSaveReqVO.class, o -> {
|
||||
// o.setId(dbAsset.getId()); // 设置更新的 ID
|
||||
// });
|
||||
//
|
||||
// // 调用
|
||||
// assetService.updateAsset(updateReqVO);
|
||||
// // 校验是否更新正确
|
||||
// AssetDO asset = assetMapper.selectById(updateReqVO.getId()); // 获取最新的
|
||||
// assertPojoEquals(updateReqVO, asset);
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testUpdateAsset_notExists() {
|
||||
// 准备参数
|
||||
AssetSaveReqVO updateReqVO = randomPojo(AssetSaveReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> assetService.updateAsset(updateReqVO), ASSET_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteAsset_success() {
|
||||
// mock 数据
|
||||
AssetDO dbAsset = randomPojo(AssetDO.class);
|
||||
assetMapper.insert(dbAsset);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbAsset.getId();
|
||||
|
||||
// 调用
|
||||
assetService.deleteAsset(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(assetMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteAsset_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> assetService.deleteAsset(id), ASSET_NOT_EXISTS);
|
||||
}
|
||||
|
||||
/*@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetAssetPage() {
|
||||
// mock 数据
|
||||
AssetDO dbAsset = randomPojo(AssetDO.class, o -> { // 等会查询到
|
||||
o.setId(null);
|
||||
o.setDataId(null);
|
||||
o.setAssetname(null);
|
||||
o.setAssettype(null);
|
||||
o.setAssettypename(null);
|
||||
o.setIsOnline(null);
|
||||
o.setLastfeedbacktime(null);
|
||||
});
|
||||
assetMapper.insert(dbAsset);
|
||||
// 测试 id 不匹配
|
||||
assetMapper.insert(cloneIgnoreId(dbAsset, o -> o.setId(null)));
|
||||
// 测试 dataId 不匹配
|
||||
assetMapper.insert(cloneIgnoreId(dbAsset, o -> o.setDataId(null)));
|
||||
// 测试 assetname 不匹配
|
||||
assetMapper.insert(cloneIgnoreId(dbAsset, o -> o.setAssetname(null)));
|
||||
// 测试 assettype 不匹配
|
||||
assetMapper.insert(cloneIgnoreId(dbAsset, o -> o.setAssettype(null)));
|
||||
// 测试 assettypename 不匹配
|
||||
assetMapper.insert(cloneIgnoreId(dbAsset, o -> o.setAssettypename(null)));
|
||||
// 测试 isOnline 不匹配
|
||||
assetMapper.insert(cloneIgnoreId(dbAsset, o -> o.setIsOnline(null)));
|
||||
// 测试 lastfeedbacktime 不匹配
|
||||
assetMapper.insert(cloneIgnoreId(dbAsset, o -> o.setLastfeedbacktime(null)));
|
||||
// 准备参数
|
||||
AssetPageReqVO reqVO = new AssetPageReqVO();
|
||||
reqVO.setId(null);
|
||||
reqVO.setDataId(null);
|
||||
reqVO.setAssetname(null);
|
||||
reqVO.setAssettype(null);
|
||||
reqVO.setAssettypename(null);
|
||||
reqVO.setIsOnline(null);
|
||||
reqVO.setLastfeedbacktime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
PageResult<AssetDO> pageResult = assetService.getAssetPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbAsset, pageResult.getList().get(0));
|
||||
}*/
|
||||
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.checkticket;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketPageReqVO;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketSaveReqVO;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.checkticket.CheckTicketDO;
|
||||
import cn.iocoder.yudao.module.ticket.dal.mysql.checkticket.CheckTicketMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
* {@link CheckTicketServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(CheckTicketServiceImpl.class)
|
||||
public class CheckTicketServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private CheckTicketServiceImpl checkTicketService;
|
||||
|
||||
@Resource
|
||||
private CheckTicketMapper checkTicketMapper;
|
||||
|
||||
// @Test
|
||||
// public void testCreateCheckTicket_success() {
|
||||
// // 准备参数
|
||||
// CheckTicketSaveReqVO createReqVO = randomPojo(CheckTicketSaveReqVO.class).setId(null);
|
||||
//
|
||||
// // 调用
|
||||
// Long checkTicketId = checkTicketService.createCheckTicket(createReqVO);
|
||||
// // 断言
|
||||
// assertNotNull(checkTicketId);
|
||||
// // 校验记录的属性是否正确
|
||||
// CheckTicketDO checkTicket = checkTicketMapper.selectById(checkTicketId);
|
||||
// assertPojoEquals(createReqVO, checkTicket, "id");
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void testUpdateCheckTicket_success() {
|
||||
// // mock 数据
|
||||
// CheckTicketDO dbCheckTicket = randomPojo(CheckTicketDO.class);
|
||||
// checkTicketMapper.insert(dbCheckTicket);// @Sql: 先插入出一条存在的数据
|
||||
// // 准备参数
|
||||
// CheckTicketSaveReqVO updateReqVO = randomPojo(CheckTicketSaveReqVO.class, o -> {
|
||||
// o.setId(dbCheckTicket.getId()); // 设置更新的 ID
|
||||
// });
|
||||
//
|
||||
// // 调用
|
||||
// checkTicketService.updateCheckTicket(updateReqVO);
|
||||
// // 校验是否更新正确
|
||||
// CheckTicketDO checkTicket = checkTicketMapper.selectById(updateReqVO.getId()); // 获取最新的
|
||||
// assertPojoEquals(updateReqVO, checkTicket);
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testUpdateCheckTicket_notExists() {
|
||||
// // 准备参数
|
||||
// CheckTicketSaveReqVO updateReqVO = randomPojo(CheckTicketSaveReqVO.class);
|
||||
//
|
||||
// // 调用, 并断言异常
|
||||
// assertServiceException(() -> checkTicketService.updateCheckTicket(updateReqVO), CHECK_TICKET_NOT_EXISTS);
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testDeleteCheckTicket_success() {
|
||||
// mock 数据
|
||||
CheckTicketDO dbCheckTicket = randomPojo(CheckTicketDO.class);
|
||||
checkTicketMapper.insert(dbCheckTicket);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbCheckTicket.getId();
|
||||
|
||||
// 调用
|
||||
checkTicketService.deleteCheckTicket(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(checkTicketMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteCheckTicket_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> checkTicketService.deleteCheckTicket(id), CHECK_TICKET_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// @Test
|
||||
// @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
// public void testGetCheckTicketPage() {
|
||||
// // mock 数据
|
||||
// CheckTicketDO dbCheckTicket = randomPojo(CheckTicketDO.class, o -> { // 等会查询到
|
||||
// o.setId(null);
|
||||
// o.setDataId(null);
|
||||
// o.setCheckstation(null);
|
||||
// o.setCheckstationname(null);
|
||||
// o.setCheckticketdate(null);
|
||||
// o.setChecktickettime(null);
|
||||
// o.setPersoncount(null);
|
||||
// o.setSdshipping(null);
|
||||
// o.setTicket(null);
|
||||
// o.setSalepropetyvaluename(null);
|
||||
// });
|
||||
// checkTicketMapper.insert(dbCheckTicket);
|
||||
// // 测试 id 不匹配
|
||||
// checkTicketMapper.insert(cloneIgnoreId(dbCheckTicket, o -> o.setId(null)));
|
||||
// // 测试 dataId 不匹配
|
||||
// checkTicketMapper.insert(cloneIgnoreId(dbCheckTicket, o -> o.setDataId(null)));
|
||||
// // 测试 checkstation 不匹配
|
||||
// checkTicketMapper.insert(cloneIgnoreId(dbCheckTicket, o -> o.setCheckstation(null)));
|
||||
// // 测试 checkstationname 不匹配
|
||||
// checkTicketMapper.insert(cloneIgnoreId(dbCheckTicket, o -> o.setCheckstationname(null)));
|
||||
// // 测试 checkticketdate 不匹配
|
||||
// checkTicketMapper.insert(cloneIgnoreId(dbCheckTicket, o -> o.setCheckticketdate(null)));
|
||||
// // 测试 checktickettime 不匹配
|
||||
// checkTicketMapper.insert(cloneIgnoreId(dbCheckTicket, o -> o.setChecktickettime(null)));
|
||||
// // 测试 personcount 不匹配
|
||||
// checkTicketMapper.insert(cloneIgnoreId(dbCheckTicket, o -> o.setPersoncount(null)));
|
||||
// // 测试 sdshipping 不匹配
|
||||
// checkTicketMapper.insert(cloneIgnoreId(dbCheckTicket, o -> o.setSdshipping(null)));
|
||||
// // 测试 ticket 不匹配
|
||||
// checkTicketMapper.insert(cloneIgnoreId(dbCheckTicket, o -> o.setTicket(null)));
|
||||
// // 测试 salepropetyvaluename 不匹配
|
||||
// checkTicketMapper.insert(cloneIgnoreId(dbCheckTicket, o -> o.setSalepropetyvaluename(null)));
|
||||
// // 准备参数
|
||||
// CheckTicketPageReqVO reqVO = new CheckTicketPageReqVO();
|
||||
// reqVO.setId(null);
|
||||
// reqVO.setDataId(null);
|
||||
// reqVO.setCheckstation(null);
|
||||
// reqVO.setCheckstationname(null);
|
||||
// reqVO.setCheckticketdate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
// reqVO.setChecktickettime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
// reqVO.setPersoncount(null);
|
||||
// reqVO.setSdshipping(null);
|
||||
// reqVO.setTicket(null);
|
||||
// reqVO.setSalepropetyvaluename(null);
|
||||
//
|
||||
// // 调用
|
||||
// PageResult<CheckTicketDO> pageResult = checkTicketService.getCheckTicketPage(reqVO);
|
||||
// // 断言
|
||||
// assertEquals(1, pageResult.getTotal());
|
||||
// assertEquals(1, pageResult.getList().size());
|
||||
// assertPojoEquals(dbCheckTicket, pageResult.getList().get(0));
|
||||
// }
|
||||
@Test
|
||||
public void testV(){
|
||||
System.out.println(checkTicketService.checkTicketTotal("20240117"));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,177 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.saledata;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.mysql.saledata.SaleDataMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.saledata.vo.*;
|
||||
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
|
||||
/**
|
||||
* {@link SaleDataServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(SaleDataServiceImpl.class)
|
||||
public class SaleDataServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private SaleDataServiceImpl saleDataService;
|
||||
|
||||
// @Resource
|
||||
// private SaleDataMapper saleDataMapper;
|
||||
|
||||
/*@Test
|
||||
public void testCreateSaleData_success() {
|
||||
// 准备参数
|
||||
SaleDataSaveReqVO createReqVO = randomPojo(SaleDataSaveReqVO.class).setId(null);
|
||||
|
||||
// 调用
|
||||
Long saleDataId = saleDataService.createSaleData(createReqVO);
|
||||
// 断言
|
||||
assertNotNull(saleDataId);
|
||||
// 校验记录的属性是否正确
|
||||
SaleDataDO saleData = saleDataMapper.selectById(saleDataId);
|
||||
assertPojoEquals(createReqVO, saleData, "id");
|
||||
}*/
|
||||
|
||||
/*@Test
|
||||
public void testUpdateSaleData_success() {
|
||||
// mock 数据
|
||||
SaleDataDO dbSaleData = randomPojo(SaleDataDO.class);
|
||||
saleDataMapper.insert(dbSaleData);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
SaleDataSaveReqVO updateReqVO = randomPojo(SaleDataSaveReqVO.class, o -> {
|
||||
o.setId(dbSaleData.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
saleDataService.updateSaleData(updateReqVO);
|
||||
// 校验是否更新正确
|
||||
SaleDataDO saleData = saleDataMapper.selectById(updateReqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(updateReqVO, saleData);
|
||||
}*/
|
||||
|
||||
@Test
|
||||
public void testUpdateSaleData_notExists() {
|
||||
// 准备参数
|
||||
SaleDataSaveReqVO updateReqVO = randomPojo(SaleDataSaveReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> saleDataService.updateSaleData(updateReqVO), SALE_DATA_NOT_EXISTS);
|
||||
}
|
||||
|
||||
/*@Test
|
||||
public void testDeleteSaleData_success() {
|
||||
// mock 数据
|
||||
SaleDataDO dbSaleData = randomPojo(SaleDataDO.class);
|
||||
saleDataMapper.insert(dbSaleData);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbSaleData.getId();
|
||||
|
||||
// 调用
|
||||
saleDataService.deleteSaleData(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(saleDataMapper.selectById(id));
|
||||
}*/
|
||||
|
||||
/*@Test
|
||||
public void testDeleteSaleData_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> saleDataService.deleteSaleData(id), SALE_DATA_NOT_EXISTS);
|
||||
}*/
|
||||
|
||||
/*@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetSaleDataPage() {
|
||||
// mock 数据
|
||||
SaleDataDO dbSaleData = randomPojo(SaleDataDO.class, o -> { // 等会查询到
|
||||
o.setId(null);
|
||||
o.setDataId(null);
|
||||
o.setAmount(null);
|
||||
o.setCertificateno(null);
|
||||
o.setCertificatetype(null);
|
||||
o.setItem(null);
|
||||
o.setItemname(null);
|
||||
o.setItemtype(null);
|
||||
o.setItemtypename(null);
|
||||
o.setProductbatchno(null);
|
||||
o.setQuantity(null);
|
||||
o.setSddate(null);
|
||||
o.setSdno(null);
|
||||
o.setSdtime(null);
|
||||
o.setTransactiontypeno(null);
|
||||
o.setSalepropetyvaluename(null);
|
||||
});
|
||||
saleDataMapper.insert(dbSaleData);
|
||||
// 测试 id 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setId(null)));
|
||||
// 测试 dataId 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setDataId(null)));
|
||||
// 测试 amount 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setAmount(null)));
|
||||
// 测试 certificateno 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setCertificateno(null)));
|
||||
// 测试 certificatetype 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setCertificatetype(null)));
|
||||
// 测试 item 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setItem(null)));
|
||||
// 测试 itemname 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setItemname(null)));
|
||||
// 测试 itemtype 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setItemtype(null)));
|
||||
// 测试 itemtypename 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setItemtypename(null)));
|
||||
// 测试 productbatchno 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setProductbatchno(null)));
|
||||
// 测试 quantity 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setQuantity(null)));
|
||||
// 测试 sddate 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setSddate(null)));
|
||||
// 测试 sdno 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setSdno(null)));
|
||||
// 测试 sdtime 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setSdtime(null)));
|
||||
// 测试 transactiontypeno 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setTransactiontypeno(null)));
|
||||
// 测试 salepropetyvaluename 不匹配
|
||||
saleDataMapper.insert(cloneIgnoreId(dbSaleData, o -> o.setSalepropetyvaluename(null)));
|
||||
// 准备参数
|
||||
SaleDataPageReqVO reqVO = new SaleDataPageReqVO();
|
||||
reqVO.setId(null);
|
||||
reqVO.setDataId(null);
|
||||
reqVO.setAmount(null);
|
||||
reqVO.setCertificateno(null);
|
||||
reqVO.setCertificatetype(null);
|
||||
reqVO.setItem(null);
|
||||
reqVO.setItemname(null);
|
||||
reqVO.setItemtype(null);
|
||||
reqVO.setItemtypename(null);
|
||||
reqVO.setProductbatchno(null);
|
||||
reqVO.setQuantity(null);
|
||||
reqVO.setSddate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setSdno(null);
|
||||
reqVO.setSdtime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setTransactiontypeno(null);
|
||||
reqVO.setSalepropetyvaluename(null);
|
||||
|
||||
// 调用
|
||||
PageResult<SaleDataDO> pageResult = saleDataService.getSaleDataPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbSaleData, pageResult.getList().get(0));
|
||||
}*/
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
DELETE FROM "asset";
|
||||
DELETE FROM "checkticket";
|
||||
DELETE FROM "saledata";
|
@ -0,0 +1,60 @@
|
||||
CREATE TABLE IF NOT EXISTS "asset" (
|
||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||
"data_id" varchar,
|
||||
"assetname" varchar,
|
||||
"assettype" varchar,
|
||||
"assettypename" varchar,
|
||||
"is_online" varchar,
|
||||
"lastfeedbacktime" bigint,
|
||||
"creator" varchar DEFAULT '',
|
||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updater" varchar DEFAULT '',
|
||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||
"tenant_id" bigint NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
) COMMENT '设备';
|
||||
CREATE TABLE IF NOT EXISTS "checkticket" (
|
||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||
"data_id" varchar,
|
||||
"checkstation" varchar,
|
||||
"checkstationname" varchar,
|
||||
"checkticketdate" varchar,
|
||||
"checktickettime" varchar,
|
||||
"personcount" int,
|
||||
"sdshipping" varchar,
|
||||
"ticket" varchar,
|
||||
"salepropetyvaluename" varchar,
|
||||
"creator" varchar DEFAULT '',
|
||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updater" varchar DEFAULT '',
|
||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||
"tenant_id" bigint NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
) COMMENT '检票';
|
||||
CREATE TABLE IF NOT EXISTS "saledata" (
|
||||
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||
"data_id" varchar,
|
||||
"amount" bigint,
|
||||
"certificateno" varchar,
|
||||
"certificatetype" varchar,
|
||||
"item" varchar,
|
||||
"itemname" varchar,
|
||||
"itemtype" varchar,
|
||||
"itemtypename" varchar,
|
||||
"productbatchno" varchar,
|
||||
"quantity" int,
|
||||
"sddate" varchar,
|
||||
"sdno" varchar,
|
||||
"sdtime" varchar,
|
||||
"transactiontypeno" varchar,
|
||||
"salepropetyvaluename" varchar,
|
||||
"creator" varchar DEFAULT '',
|
||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updater" varchar DEFAULT '',
|
||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||
"tenant_id" bigint NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
) COMMENT '售票';
|
24
ludu-module-ticket-manager/pom.xml
Normal file
24
ludu-module-ticket-manager/pom.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<modules>
|
||||
<module>ludu-module-ticket-manager-api</module>
|
||||
<module>ludu-module-ticket-manager-biz</module>
|
||||
</modules>
|
||||
<artifactId>ludu-module-ticket-manager</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
ticket 模块,我们放票务业务。
|
||||
例如:售票管理、检票管理、设备管理、心跳日志
|
||||
</description>
|
||||
|
||||
</project>
|
6
pom.xml
6
pom.xml
@ -15,7 +15,11 @@
|
||||
<module>yudao-module-system</module>
|
||||
<module>yudao-module-infra</module>
|
||||
<module>yudao-module-member</module>
|
||||
<!-- <module>yudao-module-bpm</module>-->
|
||||
<module>ludu-module-ticket-manager</module>
|
||||
<module>ludu-module-sampling</module>
|
||||
<module>ludu-module-sampling/ludu-module-sampling-api</module>
|
||||
<module>ludu-module-sampling/ludu-module-sampling-biz</module>
|
||||
<!-- <module>yudao-module-bpm</module>-->
|
||||
<!-- <module>yudao-module-pay</module>-->
|
||||
<!-- <module>yudao-module-report</module>-->
|
||||
<!-- <module>yudao-module-mp</module>-->
|
||||
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.framework.common.util.ticket;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
//身份证匹配规则
|
||||
public class IdCardUtil {
|
||||
public static String getGender(String idCard) {
|
||||
int genderNum = Integer.parseInt(idCard.substring(16, 17));
|
||||
return (genderNum % 2 == 0) ? "女" : "男";
|
||||
}
|
||||
|
||||
public static int getAge(String idCard) {
|
||||
int year = Integer.parseInt(idCard.substring(6, 10));
|
||||
int month = Integer.parseInt(idCard.substring(10, 12));
|
||||
int day = Integer.parseInt(idCard.substring(12, 14));
|
||||
LocalDate birthDate = LocalDate.of(year, month, day);
|
||||
return Period.between(birthDate, LocalDate.now()).getYears();
|
||||
}
|
||||
|
||||
public static String getRegion(String idCard) {
|
||||
String provinceCode = idCard.substring(0, 2);
|
||||
String cityCode = idCard.substring(2, 4);
|
||||
String districtCode = idCard.substring(4, 6);
|
||||
// 根据省份代码、城市代码和区县代码查询地区信息,这里需要根据实际情况进行查询
|
||||
String nativePlace = NativePlace.getNativePlace(Integer.parseInt(provinceCode));
|
||||
return nativePlace;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -152,6 +152,14 @@ spring:
|
||||
- Path=/admin-api/crm/**
|
||||
filters:
|
||||
- RewritePath=/admin-api/crm/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs
|
||||
## ticket-manager 服务
|
||||
- id: ticket-admin-api # 路由的编号
|
||||
uri: grayLb://ticket-server
|
||||
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
|
||||
- Path=/admin-api/ticket/**
|
||||
filters:
|
||||
- RewritePath=/admin-api/ticket/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs
|
||||
|
||||
x-forwarded:
|
||||
prefix-enabled: false # 避免 Swagger 重复带上额外的 /admin-api/system 前缀
|
||||
|
||||
|
@ -44,14 +44,14 @@ spring:
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
url: jdbc:mysql://120.46.37.243:3306/ludu_db?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ruoyi-vue-pro # SQLServer 连接的示例
|
||||
# url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
|
||||
username: root
|
||||
password: 123456
|
||||
password: xpower1234
|
||||
# username: sa # SQL Server 连接的示例
|
||||
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # SQL Server 连接的示例
|
||||
# username: SYSDBA # DM 连接的示例
|
||||
|
@ -40,14 +40,14 @@ spring:
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
url: jdbc:mysql://120.46.37.243:3306/ludu_db?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ruoyi-vue-pro # SQLServer 连接的示例
|
||||
# url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
|
||||
username: root
|
||||
password: 123456
|
||||
password: xpower1234
|
||||
# username: sa # SQL Server 连接的示例
|
||||
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # SQL Server 连接的示例
|
||||
# username: SYSDBA # DM 连接的示例
|
||||
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.system.job.test;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
||||
import com.xxl.job.core.handler.IJobHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class TestJob extends IJobHandler {
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
|
||||
}
|
||||
}
|
@ -40,14 +40,14 @@ spring:
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
url: jdbc:mysql://120.46.37.243:3306/ludu_db?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
|
||||
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ruoyi-vue-pro # SQLServer 连接的示例
|
||||
# url: jdbc:dm://10.211.55.4:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
|
||||
username: root
|
||||
password: 123456
|
||||
password: xpower1234
|
||||
# username: sa # SQL Server 连接的示例
|
||||
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W # SQL Server 连接的示例
|
||||
# username: SYSDBA # DM 连接的示例
|
||||
|
Loading…
Reference in New Issue
Block a user