feat: correct initial code
This commit is contained in:
commit
970fb1152a
42
.gitignore
vendored
Normal file
42
.gitignore
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### log ###
|
||||
yzt_log
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
133
fightwine-admin/pom.xml
Normal file
133
fightwine-admin/pom.xml
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.yzt.fightwine</groupId>
|
||||
<artifactId>yzt-fightwine</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>fightwine-admin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yzt.fightwine</groupId>
|
||||
<artifactId>fightwine-service</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!--quartz定时调度依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-quartz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 此版本明确支持jdk8 oshi -->
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
<artifactId>oshi-core</artifactId>
|
||||
<version>5.8.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
<version>5.13.0</version> <!-- 与 OSHI 5.8.6 兼容 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna-platform</artifactId>
|
||||
<version>5.13.0</version> <!-- 必须与 jna 版本一致 -->
|
||||
</dependency>
|
||||
|
||||
<!--代码自动生成工具-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!--打包配置-->
|
||||
<finalName>fightwine-admin</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.7.13</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- 使用默认的变量标记方法即${*} -->
|
||||
<useDefaultDelimiters>true</useDefaultDelimiters>
|
||||
<nonFilteredFileExtensions>
|
||||
<nonFilteredFileExtension>woff</nonFilteredFileExtension>
|
||||
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
|
||||
<nonFilteredFileExtension>eot</nonFilteredFileExtension>
|
||||
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
|
||||
<nonFilteredFileExtension>svg</nonFilteredFileExtension>
|
||||
</nonFilteredFileExtensions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<resources>
|
||||
<!-- <resource>-->
|
||||
<!-- <directory>src/main/resources</directory>-->
|
||||
<!-- <!– 处理文件时替换文件中的变量 –>-->
|
||||
<!-- <filtering>true</filtering>-->
|
||||
<!-- <excludes>-->
|
||||
<!-- <!– 打包时排除文件 –>-->
|
||||
<!--<!– <exclude>application.yml</exclude>–>-->
|
||||
<!-- <exclude>application-{profile}.yml</exclude>-->
|
||||
<!--<!– <exclude>application-beta.yml</exclude>–>-->
|
||||
<!--<!– <exclude>application-prod.yml</exclude>–>-->
|
||||
<!-- </excludes>-->
|
||||
<!-- </resource>-->
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<!-- <resource>-->
|
||||
<!-- <directory>src/main/resources.${spring.profiles.active}</directory>-->
|
||||
<!-- <filtering>false</filtering>-->
|
||||
<!-- </resource>-->
|
||||
<!--这个元素描述了项目相关的所有资源路径列表,例如和项目相关的属性文件,这些资源被包含在最终的打包文件里。-->
|
||||
<resource>
|
||||
<!-- 描述存放资源的目录,该路径相对POM路径-->
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.woff</exclude>
|
||||
<exclude>**/*.ttf</exclude>
|
||||
<exclude>**/*.eot</exclude>
|
||||
<exclude>**/*.svg</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
@ -0,0 +1,30 @@
|
||||
package com.yzt.admin;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* 程序主入口
|
||||
*
|
||||
*/
|
||||
@EnableAsync //开启异步调用
|
||||
@EnableSwagger2
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) //去掉数据源
|
||||
@ComponentScan(basePackages = {"com.yzt"})
|
||||
@MapperScan(basePackages = {"com.yzt.**.mapper"})
|
||||
public class YztAdminApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(YztAdminApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.yzt.admin.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
/** 跨域配置
|
||||
* fw_
|
||||
*/
|
||||
@Configuration
|
||||
public class CorsConfig{
|
||||
private CorsConfiguration buildConfig() {
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
corsConfiguration.addAllowedOrigin("*"); //允许任何域名
|
||||
corsConfiguration.addAllowedHeader("*"); //允许任何头
|
||||
corsConfiguration.addAllowedMethod("*"); //允许任何方法
|
||||
return corsConfiguration;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**", buildConfig()); //注册
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.yzt.admin.config;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.support.http.StatViewServlet;
|
||||
import com.alibaba.druid.support.http.WebStatFilter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* Druid数据源配置
|
||||
*/
|
||||
@Configuration
|
||||
public class DruidConfig {
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean druidServlet() { // 主要实现WEB监控的配置处理
|
||||
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*"); // 进行druid监控的配置处理操作
|
||||
// servletRegistrationBean.addInitParameter("allow",
|
||||
// "127.0.0.1,192.168.1.159"); // 白名单
|
||||
// servletRegistrationBean.addInitParameter("deny", "192.168.1.200"); // 黑名单
|
||||
servletRegistrationBean.addInitParameter("loginUsername", "kf"); // 用户名
|
||||
servletRegistrationBean.addInitParameter("loginPassword", "654321"); // 密码
|
||||
servletRegistrationBean.addInitParameter("resetEnable", "true"); // 是否可以重置数据源
|
||||
return servletRegistrationBean;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean filterRegistrationBean() {
|
||||
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
|
||||
filterRegistrationBean.setFilter(new WebStatFilter());
|
||||
|
||||
filterRegistrationBean.addUrlPatterns("/*"); // 所有请求进行监控处理
|
||||
//不必监控的请求
|
||||
filterRegistrationBean.addInitParameter("exclusions", "*.html,*.png,*.ico,*.js,*.gif,*.jpg,*.css,/druid/*");
|
||||
return filterRegistrationBean;
|
||||
}
|
||||
|
||||
@Bean("dataSource")
|
||||
@ConfigurationProperties(prefix = "spring.datasource")
|
||||
public DataSource druidDataSource() {
|
||||
return new DruidDataSource();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
package com.yzt.admin.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Jackjson配置组件
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class JacksonConfig {
|
||||
|
||||
/**
|
||||
* Jackson全局转化BigDecimal类型为String,解决jackson序列化时BigDecimal类型缺失精度问题
|
||||
*
|
||||
* @return Jackson2ObjectMapperBuilderCustomizer 注入的对象
|
||||
*/
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
|
||||
|
||||
return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.serializerByType(BigDecimal.class, ToStringSerializer.instance);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.yzt.admin.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* RestTemplate配置组件
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class RestTemplateConfig {
|
||||
@Bean
|
||||
public RestTemplate restTemplate(ClientHttpRequestFactory factory) {
|
||||
RestTemplate restTemplate = new RestTemplate(factory);
|
||||
restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
|
||||
restTemplate.getMessageConverters().add(new WxMappingJackson2HttpMessageConverter());
|
||||
return restTemplate;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientHttpRequestFactory httpRequestFactory() {
|
||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||
factory.setReadTimeout(10000);//ms
|
||||
factory.setConnectTimeout(15000);//ms
|
||||
return factory;
|
||||
}
|
||||
|
||||
//解决微信返回json Content-Type 值却是 text/plain 的问题
|
||||
public class WxMappingJackson2HttpMessageConverter extends MappingJackson2HttpMessageConverter {
|
||||
public WxMappingJackson2HttpMessageConverter(){
|
||||
List<MediaType> mediaTypes = new ArrayList<>();
|
||||
mediaTypes.add(MediaType.TEXT_PLAIN);
|
||||
mediaTypes.add(MediaType.TEXT_HTML);
|
||||
setSupportedMediaTypes(mediaTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.yzt.admin.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
|
||||
/**
|
||||
* Spring 定时任务配置
|
||||
* fw_
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
public class SchedulerConfig implements SchedulingConfigurer {
|
||||
private final int poolSize = 30;
|
||||
|
||||
@Override
|
||||
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
|
||||
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
|
||||
|
||||
threadPoolTaskScheduler.setPoolSize(getPoolSize());
|
||||
threadPoolTaskScheduler.setThreadNamePrefix("yzt-scheduled-task-pool-");
|
||||
threadPoolTaskScheduler.initialize();
|
||||
|
||||
scheduledTaskRegistrar.setTaskScheduler(threadPoolTaskScheduler);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,124 @@
|
||||
package com.yzt.admin.config;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.yzt.common.constants.Constants;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.ApiKey;
|
||||
import springfox.documentation.service.AuthorizationScope;
|
||||
import springfox.documentation.service.SecurityReference;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.google.common.collect.Lists.newArrayList;
|
||||
|
||||
/**
|
||||
* Swagger配置组件
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
@ConfigurationProperties(prefix = "api.doc")
|
||||
public class SwaggerConfig{
|
||||
|
||||
//是否开启swagger,正式环境一般是需要关闭的,可根据springboot的多环境配置进行设置
|
||||
Boolean swaggerEnabled = true;
|
||||
|
||||
@Value("${server.port}")
|
||||
private String port;
|
||||
|
||||
@Value("${yzt.domain}")
|
||||
private String domain;
|
||||
|
||||
@Bean("admin")
|
||||
public Docket createRestApis() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.groupName("admin")
|
||||
.host(domain)
|
||||
.apiInfo(apiInfo())
|
||||
// 是否开启
|
||||
.enable(swaggerEnabled)
|
||||
.select()
|
||||
// 扫描的路径包
|
||||
.apis(RequestHandlerSelectors.basePackage("com.yzt.admin"))
|
||||
// 指定路径处理PathSelectors.any()代表所有的路径
|
||||
.paths(adminPathsAnt())
|
||||
.build()
|
||||
.securitySchemes(security())
|
||||
.securityContexts(securityContexts())
|
||||
// .globalOperationParameters(pars) // 针对单个url的验证 如果需要的话
|
||||
.pathMapping("/");
|
||||
}
|
||||
|
||||
@Bean("public")
|
||||
public Docket create2RestApis() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.groupName("public")
|
||||
.host(domain)
|
||||
.apiInfo(apiInfo())
|
||||
// 是否开启
|
||||
.enable(swaggerEnabled)
|
||||
.select()
|
||||
// 扫描的路径包
|
||||
.apis(RequestHandlerSelectors.basePackage("com.yzt.admin"))
|
||||
// 指定路径处理PathSelectors.any()代表所有的路径
|
||||
.paths(publicPathsAnt()) //只监听
|
||||
.build()
|
||||
.securitySchemes(security())
|
||||
.securityContexts(securityContexts())
|
||||
// .globalOperationParameters(pars) // 针对单个url的验证 如果需要的话
|
||||
.pathMapping("/");
|
||||
}
|
||||
|
||||
private Predicate<String> adminPathsAnt() {
|
||||
return PathSelectors.ant("/api/admin/**");
|
||||
}
|
||||
|
||||
private Predicate<String> publicPathsAnt() {
|
||||
return PathSelectors.ant("/api/public/**");
|
||||
}
|
||||
|
||||
private List<ApiKey> security() {
|
||||
return newArrayList(
|
||||
new ApiKey(Constants.HEADER_AUTHORIZATION_KEY, Constants.HEADER_AUTHORIZATION_KEY, "header")
|
||||
);
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("Yzt Java")
|
||||
.description("Yzt")
|
||||
.termsOfServiceUrl("http://host:port")
|
||||
.version("1.0.0").build();
|
||||
}
|
||||
|
||||
|
||||
private List<SecurityContext> securityContexts() {
|
||||
List<SecurityContext> res = new ArrayList<>();
|
||||
res.add(SecurityContext.builder()
|
||||
.securityReferences(defaultAuth())
|
||||
.forPaths(PathSelectors.regex("/.*"))
|
||||
.build());
|
||||
return res;
|
||||
}
|
||||
|
||||
private List<SecurityReference> defaultAuth() {
|
||||
List<SecurityReference> res = new ArrayList<>();
|
||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", Constants.HEADER_AUTHORIZATION_KEY);
|
||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||
authorizationScopes[0] = authorizationScope;
|
||||
res.add(new SecurityReference(Constants.HEADER_AUTHORIZATION_KEY, authorizationScopes));
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
package com.yzt.admin.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/**
|
||||
* Task类的线程配置
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
public class TaskExecutorConfig {
|
||||
|
||||
//普通模式
|
||||
private final int taskCorePoolSize = 20; //核心线程池数量
|
||||
private final int taskMaxPoolSize = 100; //最大线程
|
||||
private final int taskQueueCapacity = 200; //缓存队列条数
|
||||
private final int taskKeepAliveSecond = 10; //允许的空闲时间
|
||||
private final String taskNamePrefix = "task-executor-"; //线程名称前缀
|
||||
|
||||
//发布订阅模式
|
||||
// private final int listenerCorePoolSize = 3;
|
||||
// private final int listenerMaxPoolSize = 20;
|
||||
// private final int listenerQueueCapacity = 200;
|
||||
// private final int listenerKeepAliveSecond = 10;
|
||||
// private final String listenerNamePrefix = "listener-executor-";
|
||||
|
||||
//普通模式
|
||||
@Bean("taskExecutor")
|
||||
public ThreadPoolTaskExecutor taskExecutor(){
|
||||
return initTaskExecutor(
|
||||
getTaskCorePoolSize(),
|
||||
getTaskMaxPoolSize(),
|
||||
getTaskQueueCapacity(),
|
||||
getTaskKeepAliveSecond(),
|
||||
getTaskNamePrefix()
|
||||
);
|
||||
}
|
||||
|
||||
// //针对发布订阅(pub listener) 的线程池
|
||||
// @Bean("listenerTaskExecutor")
|
||||
// public ThreadPoolTaskExecutor listenerTaskExecutor(){
|
||||
// return initTaskExecutor(getListenerCorePoolSize(), getListenerMaxPoolSize(),
|
||||
// getListenerQueueCapacity(), getListenerKeepAliveSecond(), getListenerNamePrefix());
|
||||
// }
|
||||
|
||||
/**
|
||||
*
|
||||
* 初始化TaskExecutor
|
||||
* @param corePoolSize int 默认线程数
|
||||
* @param maxPoolSize int 最大线程数
|
||||
* @param queueCapacity int 缓冲队列长度
|
||||
* @param keepAliveSecond int 允许空闲时间
|
||||
* @param namePrefix String 名称的前缀
|
||||
*
|
||||
* @return ThreadPoolTaskExecutor
|
||||
*/
|
||||
private ThreadPoolTaskExecutor initTaskExecutor(int corePoolSize, int maxPoolSize,
|
||||
int queueCapacity, int keepAliveSecond, String namePrefix){
|
||||
//callrunspolicy:由调度线程(提交任务的线程)处理该任务CallerRunsPolicy
|
||||
return initTaskExecutor(corePoolSize, maxPoolSize, queueCapacity, keepAliveSecond, namePrefix,
|
||||
new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化TaskExecutor
|
||||
* @param corePoolSize int 默认线程数
|
||||
* @param maxPoolSize int 最大线程数
|
||||
* @param queueCapacity int 缓冲队列长度
|
||||
* @param keepAliveSecond int 允许空闲时间
|
||||
* @param namePrefix String 名称的前缀
|
||||
* @param rejectedExecutionHandler 线程池满的时候如何处理
|
||||
* @return ThreadPoolTaskExecutor
|
||||
*/
|
||||
private ThreadPoolTaskExecutor initTaskExecutor(int corePoolSize, int maxPoolSize,
|
||||
int queueCapacity, int keepAliveSecond, String namePrefix,
|
||||
RejectedExecutionHandler rejectedExecutionHandler){
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(corePoolSize);//核心线程数(默认线程数)
|
||||
executor.setMaxPoolSize(maxPoolSize);//最大线程数
|
||||
executor.setQueueCapacity(queueCapacity);//缓冲队列数
|
||||
executor.setKeepAliveSeconds(keepAliveSecond);//允许线程空闲时间(单位默认为秒)
|
||||
executor.setThreadNamePrefix(namePrefix);//线程名前缀
|
||||
|
||||
//线程池对拒绝任务的处理策略,
|
||||
executor.setRejectedExecutionHandler(rejectedExecutionHandler);
|
||||
|
||||
//初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
package com.yzt.admin.config;
|
||||
|
||||
import com.yzt.admin.filter.ResponseFilter;
|
||||
import com.yzt.common.config.YztConfig;
|
||||
import com.yzt.common.constants.UploadConstants;
|
||||
import com.yzt.common.interceptor.SwaggerInterceptor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.handler.MappedInterceptor;
|
||||
|
||||
/**
|
||||
* token验证拦截器
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
// 这里使用一个Bean为的是可以在拦截器中自由注入,也可以在拦截器中使用SpringUtil.getBean 获取
|
||||
// 但是觉得这样更优雅
|
||||
|
||||
@Autowired
|
||||
YztConfig yztConfig;
|
||||
|
||||
@Bean
|
||||
public ResponseFilter responseFilter(){ return new ResponseFilter(); }
|
||||
|
||||
@Value("${swagger.basic.username}")
|
||||
private String username;
|
||||
@Value("${swagger.basic.password}")
|
||||
private String password;
|
||||
@Value("${swagger.basic.check}")
|
||||
private Boolean check;
|
||||
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
//添加token拦截器
|
||||
//addPathPatterns添加需要拦截的命名空间;
|
||||
//excludePathPatterns添加排除拦截命名空间
|
||||
|
||||
|
||||
// //后台token拦截
|
||||
// registry.addInterceptor(adminTokenInterceptor()).
|
||||
// addPathPatterns("/api/admin/**").
|
||||
// excludePathPatterns("/api/admin/validate/**").
|
||||
// excludePathPatterns("/api/admin/login").
|
||||
// excludePathPatterns("/api/admin/logout").
|
||||
// excludePathPatterns("/api/admin/getLoginPic").
|
||||
// excludePathPatterns("/api/admin/wechat/config").
|
||||
// excludePathPatterns("/api/admin/authorize/login").
|
||||
// excludePathPatterns("/api/admin/payment/callback/**").
|
||||
//// excludePathPatterns("/api/admin/system/role/menu").
|
||||
// excludePathPatterns("/api/admin/system/role/info").
|
||||
// excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
|
||||
//
|
||||
// //后台权限规则
|
||||
// registry.addInterceptor(adminAuthInterceptor()).
|
||||
// addPathPatterns("/api/admin/**").
|
||||
// excludePathPatterns("/api/admin/validate/**").
|
||||
// excludePathPatterns("/api/admin/login").
|
||||
// excludePathPatterns("/api/admin/logout").
|
||||
// excludePathPatterns("/api/admin/getLoginPic").
|
||||
// excludePathPatterns("/api/admin/payment/callback/**").
|
||||
// excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/**")
|
||||
.addResourceLocations("classpath:/static/");
|
||||
registry.addResourceHandler("doc.html")
|
||||
.addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**")
|
||||
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
|
||||
/** 本地文件上传路径 */
|
||||
registry.addResourceHandler(UploadConstants.UPLOAD_FILE_KEYWORD + "/**")
|
||||
.addResourceLocations("file:" + yztConfig.getImagePath() + "/" + UploadConstants.UPLOAD_FILE_KEYWORD + "/");
|
||||
|
||||
registry.addResourceHandler(UploadConstants.UPLOAD_AFTER_FILE_KEYWORD + "/**")
|
||||
.addResourceLocations("file:" +yztConfig.getImagePath() + "/" + UploadConstants.UPLOAD_AFTER_FILE_KEYWORD + "/" );
|
||||
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean filterRegister()
|
||||
{
|
||||
//注册过滤器
|
||||
FilterRegistrationBean registration = new FilterRegistrationBean(responseFilter());
|
||||
// 仅仅api前缀的请求才会拦截
|
||||
registration.addUrlPatterns("/api/*");
|
||||
return registration;
|
||||
}
|
||||
|
||||
/* 必须在此处配置拦截器,要不然拦不到swagger的静态资源 */
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "swagger.basic.enable", havingValue = "true")
|
||||
public MappedInterceptor getMappedInterceptor() {
|
||||
return new MappedInterceptor(new String[]{"/doc.html", "/webjars/**"}, new SwaggerInterceptor(username, password, check));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,153 @@
|
||||
package com.yzt.admin.config;
|
||||
|
||||
import com.yzt.admin.filter.JwtAuthenticationTokenFilter;
|
||||
import com.yzt.admin.manager.AuthenticationEntryPointImpl;
|
||||
import com.yzt.admin.manager.CustomAccessDeniedHandler;
|
||||
import com.yzt.admin.manager.CustomAuthenticationProvider;
|
||||
import com.yzt.common.constants.Constants;
|
||||
import com.yzt.common.constants.UploadConstants;
|
||||
import com.yzt.service.service.impl.UserDetailServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
import org.springframework.security.web.authentication.logout.LogoutFilter;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
/**
|
||||
* Security配置
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
|
||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
/**
|
||||
* 跨域过滤器
|
||||
*/
|
||||
@Autowired
|
||||
private CorsFilter corsFilter;
|
||||
|
||||
/**
|
||||
* token认证过滤器
|
||||
*/
|
||||
@Bean
|
||||
public JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter() {
|
||||
return new JwtAuthenticationTokenFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* 认证失败处理类
|
||||
*/
|
||||
@Bean
|
||||
public AuthenticationEntryPointImpl unauthorizedHandler() {
|
||||
return new AuthenticationEntryPointImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
* 鉴权失败处理类
|
||||
*/
|
||||
@Bean
|
||||
public CustomAccessDeniedHandler accessDeniedHandler() {
|
||||
return new CustomAccessDeniedHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* 这里将Spring Security自带的authenticationManager声明成Bean,声明它的作用是用它帮我们进行认证操作,
|
||||
* 调用这个Bean的authenticate方法会由Spring Security自动帮我们做认证。
|
||||
*/
|
||||
// @Bean
|
||||
// public AuthenticationManager authenticationManager() throws Exception {
|
||||
// return new CusAuthenticationManager(customAuthenticationProvider);
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.authenticationProvider(new CustomAuthenticationProvider(new UserDetailServiceImpl()));
|
||||
}
|
||||
|
||||
/**
|
||||
* anyRequest | 匹配所有请求路径
|
||||
* access | SpringEl表达式结果为true时可以访问
|
||||
* anonymous | 匿名可以访问
|
||||
* denyAll | 用户不能访问
|
||||
* fullyAuthenticated | 用户完全认证可以访问(非remember-me下自动登录)
|
||||
* hasAnyAuthority | 如果有参数,参数表示权限,则其中任何一个权限可以访问
|
||||
* hasAnyRole | 如果有参数,参数表示角色,则其中任何一个角色可以访问
|
||||
* hasAuthority | 如果有参数,参数表示权限,则其权限可以访问
|
||||
* hasIpAddress | 如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问
|
||||
* hasRole | 如果有参数,参数表示角色,则其角色可以访问
|
||||
* permitAll | 用户可以任意访问
|
||||
* rememberMe | 允许通过remember-me登录的用户访问
|
||||
* authenticated | 用户登录后可访问
|
||||
*/
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
|
||||
// CRSF禁用,因为不使用session
|
||||
http.cors().and().csrf().disable()
|
||||
// 认证失败处理类
|
||||
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler())
|
||||
.accessDeniedHandler(accessDeniedHandler()).and()
|
||||
// 基于token,所以不需要session
|
||||
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
|
||||
// 过滤请求
|
||||
.authorizeRequests()
|
||||
// 跨域预检请求
|
||||
// .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
||||
// 对于登录login 验证码captchaImage 和其他放行的目录 允许匿名访问"/citylife/front/**"
|
||||
.antMatchers("/api/admin/login", "/api/admin/validate/code/get").permitAll()
|
||||
.antMatchers("/api/admin/getLoginPic").permitAll()
|
||||
.antMatchers("/api/admin/login/account/detection").permitAll()
|
||||
.antMatchers("/api/admin/validate/code/getcaptchaconfig").permitAll()
|
||||
// 放行资源路径
|
||||
.antMatchers("/"+ UploadConstants.UPLOAD_FILE_KEYWORD +"/**").permitAll()
|
||||
.antMatchers("/"+ UploadConstants.DOWNLOAD_FILE_KEYWORD +"/**").permitAll()
|
||||
.antMatchers("/"+ UploadConstants.UPLOAD_AFTER_FILE_KEYWORD +"/**").permitAll()
|
||||
// 放行图片、文件上传
|
||||
.antMatchers("/api/admin/upload/image").permitAll()
|
||||
.antMatchers("/api/admin/upload/file").permitAll()
|
||||
// .antMatchers("/wx/user/*/login","/citylife/nocheck/**").anonymous()
|
||||
.antMatchers(
|
||||
HttpMethod.GET,
|
||||
"/*.html",
|
||||
"/**/*.html",
|
||||
"/**/*.css",
|
||||
"/**/*.js",
|
||||
"/**/*.png"
|
||||
).permitAll()
|
||||
.antMatchers("/profile/**").anonymous()
|
||||
.antMatchers("/common/download**").anonymous()
|
||||
.antMatchers("/common/download/resource**").anonymous()
|
||||
.antMatchers("/doc.html").permitAll()
|
||||
.antMatchers("/swagger-resources/**").permitAll()
|
||||
.antMatchers("/webjars/**").permitAll()
|
||||
.antMatchers("/v2/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html/**").permitAll()
|
||||
.antMatchers("/*/api-docs").anonymous()
|
||||
.antMatchers("/druid/**").anonymous()
|
||||
.antMatchers("/captcha/get", "/captcha/check").anonymous()
|
||||
.antMatchers("/api/admin/payment/callback/**").anonymous()
|
||||
.antMatchers("/api/public/**").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
.headers().frameOptions().disable();// 防止iframe 造成跨域
|
||||
// http.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);
|
||||
// 添加JWT filter
|
||||
// 开启登录认证流程过滤器
|
||||
http.addFilterBefore(jwtAuthenticationTokenFilter(), UsernamePasswordAuthenticationFilter.class);
|
||||
// 添加CORS filter
|
||||
http.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class);
|
||||
http.addFilterBefore(corsFilter, LogoutFilter.class);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.ActivityEnrollSearchRequest;
|
||||
import com.yzt.common.request.EnrollSearchRequest;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.response.ActivityEnrollResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.vo.VirtualRemarkVo;
|
||||
import com.yzt.service.service.StoreOrderInfoService;
|
||||
import com.yzt.service.service.StoreProductService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
|
||||
/**
|
||||
* @Author: pengsz
|
||||
* @Date: 2025/12/02
|
||||
* @Description:
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/activityenroll")
|
||||
@Api(tags = "活动报名") //配合swagger使用
|
||||
@Slf4j
|
||||
public class ActivityEnrollController {
|
||||
@Autowired
|
||||
StoreProductService storeProductService;
|
||||
|
||||
@Autowired
|
||||
StoreOrderInfoService storeOrderInfoService;
|
||||
/**
|
||||
* 分页显示
|
||||
*
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@ApiOperation(value = "活动报名分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ActivityEnrollResponse>> getList(@Validated ActivityEnrollSearchRequest request,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
CommonPage<ActivityEnrollResponse> activityEnrollCommonPage = CommonPage.restPage(storeProductService.getActivityList(request, pageParamRequest));
|
||||
return CommonResult.success(activityEnrollCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页显示
|
||||
*
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@ApiOperation(value = "客户报名分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/customers", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<VirtualRemarkVo>> getEnrollmentListByActivity(@Validated EnrollSearchRequest request,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
CommonPage<VirtualRemarkVo> enrollCommonPage = CommonPage.restPage(storeOrderInfoService.getEnrollmentListByActivity(request.getId(), pageParamRequest));
|
||||
return CommonResult.success(enrollCommonPage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,132 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.yzt.common.constants.DateConstants;
|
||||
import com.yzt.common.model.acticitystyle.ActivityStyle;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.ActivityStyleRequest;
|
||||
import com.yzt.common.request.ActivityStyleSearchRequest;
|
||||
import com.yzt.common.request.ActivityStyleUpdateStatusRequest;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.response.ActivityStyleResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.utils.YztDateUtil;
|
||||
import com.yzt.service.service.ActivityStyleService;
|
||||
import com.yzt.service.service.SystemAttachmentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 活动样式 前端控制器
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/activitystyle")
|
||||
@Api(tags = "活动样式") //配合swagger使用
|
||||
public class ActivityStyleController {
|
||||
|
||||
@Autowired
|
||||
private ActivityStyleService activityStyleService;
|
||||
@Autowired
|
||||
private SystemAttachmentService systemAttachmentService;
|
||||
|
||||
/**
|
||||
* 分页显示
|
||||
*
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:activitystyle:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ActivityStyleResponse>> getList(@Validated ActivityStyleSearchRequest request,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
CommonPage<ActivityStyleResponse> activityStyleCommonPage = CommonPage.restPage(activityStyleService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(activityStyleCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param activityStyleRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:activitystyle:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated ActivityStyleRequest activityStyleRequest) {
|
||||
ActivityStyle activityStyle = new ActivityStyle();
|
||||
BeanUtils.copyProperties(activityStyleRequest, activityStyle);
|
||||
activityStyle.setStarttime(YztDateUtil.strToDate(activityStyleRequest.getStarttime(), DateConstants.DATE_FORMAT));
|
||||
activityStyle.setEndtime(YztDateUtil.strToDate(activityStyleRequest.getEndtime(), DateConstants.DATE_FORMAT));
|
||||
activityStyle.setStyle(systemAttachmentService.clearPrefix(activityStyle.getStyle()));
|
||||
if (activityStyleService.save(activityStyle)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:activitystyle:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (activityStyleService.removeById(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param activityStyleRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:activitystyle:edite')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated ActivityStyleRequest activityStyleRequest) {
|
||||
ActivityStyle activityStyle = new ActivityStyle();
|
||||
BeanUtils.copyProperties(activityStyleRequest, activityStyle);
|
||||
activityStyle.setId(activityStyleRequest.getId());
|
||||
activityStyle.setStyle(systemAttachmentService.clearPrefix(activityStyle.getStyle()));
|
||||
activityStyle.setStarttime(YztDateUtil.strToDate(activityStyleRequest.getStarttime(), DateConstants.DATE_FORMAT));
|
||||
activityStyle.setEndtime(YztDateUtil.strToDate(activityStyleRequest.getEndtime(), DateConstants.DATE_FORMAT));
|
||||
activityStyle.setUpdatetime(DateUtil.date());
|
||||
if (activityStyleService.updateById(activityStyle)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:activitystyle:updatestatus')")
|
||||
@ApiOperation(value = "更新状态")
|
||||
@RequestMapping(value = "/status", method = RequestMethod.POST)
|
||||
public CommonResult<String> updateStatus(@RequestBody @Validated ActivityStyleUpdateStatusRequest activityStyleUpdateStatusRequest) {
|
||||
boolean result = activityStyleService.updateStatus(activityStyleUpdateStatusRequest.getId(), activityStyleUpdateStatusRequest.getStatus());
|
||||
if (result) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,107 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.admin.service.AdminLoginService;
|
||||
import com.yzt.common.request.AdminAccountDetectionRequest;
|
||||
import com.yzt.common.request.LoginAdminUpdatePasswordRequest;
|
||||
import com.yzt.common.request.LoginAdminUpdateRequest;
|
||||
import com.yzt.common.request.SystemAdminLoginRequest;
|
||||
import com.yzt.common.response.MenusResponse;
|
||||
import com.yzt.common.response.SystemAdminResponse;
|
||||
import com.yzt.common.response.SystemLoginResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.utils.YztUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 管理端登录服务
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin")
|
||||
@Api(tags = "管理端登录服务")
|
||||
public class AdminLoginController {
|
||||
|
||||
@Autowired
|
||||
private AdminLoginService adminLoginService;
|
||||
|
||||
@ApiOperation(value="PC登录")
|
||||
@PostMapping(value = "/login", produces = "application/json")
|
||||
public CommonResult<SystemLoginResponse> SystemAdminLogin(@RequestBody @Validated SystemAdminLoginRequest systemAdminLoginRequest, HttpServletRequest request) {
|
||||
String ip = YztUtil.getClientIp(request);
|
||||
SystemLoginResponse systemAdminResponse = adminLoginService.login(systemAdminLoginRequest, ip);
|
||||
return CommonResult.success(systemAdminResponse);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:logout')")
|
||||
@ApiOperation(value="PC登出")
|
||||
@GetMapping(value = "/logout")
|
||||
public CommonResult<SystemAdminResponse> SystemAdminLogout() {
|
||||
adminLoginService.logout();
|
||||
return CommonResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:info')")
|
||||
@ApiOperation(value="获取用户详情")
|
||||
@GetMapping(value = "/getAdminInfoByToken")
|
||||
public CommonResult<SystemAdminResponse> getAdminInfo() {
|
||||
return CommonResult.success(adminLoginService.getInfoByToken());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录页图片
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
@ApiOperation(value = "获取登录页图片")
|
||||
@RequestMapping(value = "/getLoginPic", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> getLoginPic() {
|
||||
return CommonResult.success(adminLoginService.getLoginPic());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取管理员可访问目录
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:login:menus')")
|
||||
@ApiOperation(value = "获取管理员可访问目录")
|
||||
@RequestMapping(value = "/getMenus", method = RequestMethod.GET)
|
||||
public CommonResult<List<MenusResponse>> getMenus() {
|
||||
return CommonResult.success(adminLoginService.getMenus());
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value="账号登录检测")
|
||||
@RequestMapping(value = "/login/account/detection", method = RequestMethod.POST)
|
||||
public CommonResult<Integer> accountDetection(@RequestBody @Validated AdminAccountDetectionRequest request) {
|
||||
return CommonResult.success(adminLoginService.accountDetection(request.getAccount()));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:update:name')")
|
||||
@ApiOperation(value="修改登录用户信息")
|
||||
@RequestMapping(value = "/login/admin/update", method = RequestMethod.POST)
|
||||
public CommonResult<SystemLoginResponse> loginAdminUpdate(@RequestBody @Validated LoginAdminUpdateRequest request) {
|
||||
if (adminLoginService.loginAdminUpdate(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:update:password')")
|
||||
@ApiOperation(value="修改登录用户密码")
|
||||
@RequestMapping(value = "/login/update/password", method = RequestMethod.POST)
|
||||
public CommonResult<SystemLoginResponse> loginAdminUpdatePwd(@RequestBody @Validated LoginAdminUpdatePasswordRequest request) {
|
||||
if (adminLoginService.loginAdminUpdatePwd(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,110 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.article.Article;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.ArticleRequest;
|
||||
import com.yzt.common.request.ArticleSearchRequest;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.vo.ArticleVo;
|
||||
import com.yzt.service.service.ArticleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 文章管理表 前端控制器
|
||||
* fw_
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/article")
|
||||
@Api(tags = "文章管理")
|
||||
public class ArticleController {
|
||||
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
|
||||
/**
|
||||
* 分页显示文章管理表
|
||||
* @param request ArticleSearchRequest 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:article:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="keywords", value="搜索关键字")
|
||||
public CommonResult<CommonPage<ArticleVo>> getList(@Validated ArticleSearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(articleService.getAdminList(request, pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文章管理表
|
||||
* @param articleRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:article:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated ArticleRequest articleRequest) {
|
||||
if (articleService.create(articleRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文章管理表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:article:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="文章ID")
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (articleService.deleteById(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文章管理表
|
||||
* @param id integer id
|
||||
* @param articleRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:article:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
@ApiImplicitParam(name="id", value="文章ID")
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated ArticleRequest articleRequest) {
|
||||
if (articleService.updateArticle(id, articleRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文章管理表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:article:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="文章ID")
|
||||
public CommonResult<Article> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(articleService.getDetail(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.service.service.CallbackService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 支付回调
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/payment/callback")
|
||||
@Api(tags = "支付回调")
|
||||
public class CallbackController {
|
||||
|
||||
@Autowired
|
||||
private CallbackService callbackService;
|
||||
|
||||
/**
|
||||
* 微信支付回调
|
||||
*/
|
||||
@ApiOperation(value = "微信支付回调")
|
||||
@RequestMapping(value = "/wechat", method = RequestMethod.POST)
|
||||
public String weChat(@RequestBody String request) {
|
||||
System.out.println("微信支付回调 request ===> " + request);
|
||||
String response = callbackService.weChat(request);
|
||||
System.out.println("微信支付回调 response ===> " + response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信退款回调
|
||||
*/
|
||||
@ApiOperation(value = "微信退款回调")
|
||||
@RequestMapping(value = "/wechat/refund", method = RequestMethod.POST)
|
||||
public String weChatRefund(@RequestBody String request) {
|
||||
System.out.println("微信退款回调 request ===> " + request);
|
||||
String response = callbackService.weChatRefund(request);
|
||||
System.out.println("微信退款回调 response ===> " + response);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,167 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.exception.YztException;
|
||||
import com.yzt.common.model.category.Category;
|
||||
import com.yzt.common.request.CategoryRequest;
|
||||
import com.yzt.common.request.CategorySearchRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.utils.YztUtil;
|
||||
import com.yzt.common.vo.CategoryTreeVo;
|
||||
import com.yzt.service.service.CategoryService;
|
||||
import com.yzt.service.service.SystemAttachmentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 分类表 前端控制器
|
||||
* fw_
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/category")
|
||||
@Api(tags = "分类服务")
|
||||
public class CategoryController {
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
@Autowired
|
||||
private SystemAttachmentService systemAttachmentService;
|
||||
|
||||
/**
|
||||
* 显示分类表
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:list')")
|
||||
@ApiOperation(value = "分类列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<Category>> getList(@ModelAttribute CategorySearchRequest request) {
|
||||
return CommonResult.success(categoryService.getList(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增分类表
|
||||
* @param categoryRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@Validated CategoryRequest categoryRequest) {
|
||||
if (categoryService.create(categoryRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分类表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="分类ID")
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (categoryService.delete(id) > 0) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改分类表
|
||||
* @param id integer id
|
||||
* @param categoryRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
@ApiImplicitParam(name="id", value="分类ID")
|
||||
public CommonResult<String> update(@RequestParam Integer id, @ModelAttribute CategoryRequest categoryRequest) {
|
||||
if (null == id || id <= 0) throw new YztException("id 参数不合法");
|
||||
categoryRequest.setExtra(systemAttachmentService.clearPrefix(categoryRequest.getExtra()));
|
||||
if (categoryService.update(categoryRequest, id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分类表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:info')")
|
||||
@ApiOperation(value = "分类详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="分类ID")
|
||||
public CommonResult<Category> info(@RequestParam(value = "id") Integer id) {
|
||||
Category category = categoryService.getById(id);
|
||||
return CommonResult.success(category);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询分类表信息
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:list:tree')")
|
||||
@ApiOperation(value = "获取tree结构的列表")
|
||||
@RequestMapping(value = "/list/tree", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="type", value="类型ID | 类型,1 产品分类,2 附件分类,3 文章分类, 4 设置分类, 5 菜单分类, 6 配置分类, 7 秒杀配置", example = "1"),
|
||||
@ApiImplicitParam(name="status", value="-1=全部,0=未生效,1=已生效", example = "1"),
|
||||
@ApiImplicitParam(name="name", value="模糊搜索", example = "电视")
|
||||
})
|
||||
public CommonResult<List<CategoryTreeVo>> getListTree(@RequestParam(name = "type") Integer type,
|
||||
@RequestParam(name = "status") Integer status,
|
||||
@RequestParam(name = "name", required = false) String name) {
|
||||
List<CategoryTreeVo> listTree = categoryService.getListTree(type,status,name);
|
||||
return CommonResult.success(listTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分类id集合获取分类数据
|
||||
* @param ids String id集合字符串
|
||||
* @since 2020-04-16
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:list:ids')")
|
||||
@ApiOperation(value = "根据id集合获取分类列表")
|
||||
@RequestMapping(value = "/list/ids", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "ids", value="分类id集合")
|
||||
public CommonResult<List<Category>> getByIds(@Validated @RequestParam(name = "ids") String ids) {
|
||||
return CommonResult.success(categoryService.getByIds(YztUtil.stringToArray(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改分类状态
|
||||
* @param id Integer 分类id
|
||||
* @since 2020-04-16
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:category:update:status')")
|
||||
@ApiOperation(value = "更改分类状态")
|
||||
@RequestMapping(value = "/updateStatus/{id}", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "id", value="分类id")
|
||||
public CommonResult<Object> getByIds(@Validated @PathVariable(name = "id") Integer id) {
|
||||
if (categoryService.updateStatus(id)) {
|
||||
return CommonResult.success("修改成功");
|
||||
} else {
|
||||
return CommonResult.failed("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.admin.copyright.CopyrightInfoResponse;
|
||||
import com.yzt.admin.service.CopyrightService;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 版权控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/copyright")
|
||||
@Api(tags = "版权控制器")
|
||||
public class CopyrightController {
|
||||
|
||||
@Autowired
|
||||
private CopyrightService copyrightService;
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:copyright:get:info')")
|
||||
@ApiOperation(value = "获取版权信息")
|
||||
@RequestMapping(value = "/get/info", method = RequestMethod.GET)
|
||||
public CommonResult<CopyrightInfoResponse> getInfo() {
|
||||
return CommonResult.success(copyrightService.getInfo());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.yzt.common.request.*;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.ExcelService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
/**
|
||||
* Excel导出 前端控制器
|
||||
* fw_
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/export/excel")
|
||||
@Api(tags = "导出 -- Excel")
|
||||
public class ExcelController {
|
||||
|
||||
@Autowired
|
||||
private ExcelService excelService;
|
||||
|
||||
/**
|
||||
* 商品导出
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:export:excel:product')")
|
||||
@ApiOperation(value = "产品")
|
||||
@RequestMapping(value = "/product", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, String>> export(@Validated StoreProductSearchRequest request) {
|
||||
String fileName = excelService.exportProduct(request);
|
||||
HashMap<String, String> map = CollUtil.newHashMap();
|
||||
map.put("fileName", fileName);
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价商品导出
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:export:excel:bargain')")
|
||||
@ApiOperation(value = "砍价商品导出")
|
||||
@RequestMapping(value = "/bargain/product", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, String>> exportBargainProduct(@Validated StoreBargainSearchRequest request) {
|
||||
String fileName = excelService.exportBargainProduct(request);
|
||||
HashMap<String, String> map = CollUtil.newHashMap();
|
||||
map.put("fileName", fileName);
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团商品导出
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:export:excel:combiantion')")
|
||||
@ApiOperation(value = "拼团商品导出")
|
||||
@RequestMapping(value = "/combiantion/product", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, String>> exportCombinationProduct(@Validated StoreCombinationSearchRequest request) {
|
||||
String fileName = excelService.exportCombinationProduct(request);
|
||||
HashMap<String, String> map = CollUtil.newHashMap();
|
||||
map.put("fileName", fileName);
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单导出
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:export:excel:order')")
|
||||
@ApiOperation(value = "订单导出")
|
||||
@RequestMapping(value = "/order", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, String>> exportOrder(@Validated StoreOrderSearchRequest request){
|
||||
String fileName = excelService.exportOrder(request);
|
||||
HashMap<String, String> map = CollUtil.newHashMap();
|
||||
map.put("fileName", fileName);
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动报名客户列表导出
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@ApiOperation(value = "活动报名客户列表导出")
|
||||
@RequestMapping(value = "/customer", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, String>> exportCustomer(@Validated EnrollSearchRequest request){
|
||||
String fileName = excelService.exportCustomer(request.getId());
|
||||
HashMap<String, String> map = CollUtil.newHashMap();
|
||||
map.put("fileName", fileName);
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,140 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yzt.common.model.express.Express;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.ExpressSearchRequest;
|
||||
import com.yzt.common.request.ExpressUpdateRequest;
|
||||
import com.yzt.common.request.ExpressUpdateShowRequest;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.ExpressService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 快递公司表 前端控制器
|
||||
* fw_
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/express")
|
||||
@Api(tags = "设置 -- 物流 -- 公司")
|
||||
public class ExpressController {
|
||||
|
||||
@Autowired
|
||||
private ExpressService expressService;
|
||||
|
||||
/**
|
||||
* 分页显示快递公司表
|
||||
* @param request ExpressSearchRequest 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="keywords", value="搜索关键字")
|
||||
public CommonResult<CommonPage<Express>> getList(@Validated ExpressSearchRequest request,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
CommonPage<Express> expressCommonPage = CommonPage.restPage(expressService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(expressCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑快递公司
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:update')")
|
||||
@ApiOperation(value = "编辑")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated ExpressUpdateRequest expressRequest) {
|
||||
if (expressService.updateExpress(expressRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
*修改显示状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:update:show')")
|
||||
@ApiOperation(value = "修改显示状态")
|
||||
@RequestMapping(value = "/update/show", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated ExpressUpdateShowRequest expressRequest) {
|
||||
if (expressService.updateExpressShow(expressRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步物流公司
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:sync')")
|
||||
@ApiOperation(value = "同步物流公司")
|
||||
@RequestMapping(value = "/sync/express", method = RequestMethod.POST)
|
||||
public CommonResult<String> syncExpress() {
|
||||
if (expressService.syncExpress()) {
|
||||
CommonResult<String> success = CommonResult.success();
|
||||
success.setMessage("同步物流公司成功");
|
||||
return success;
|
||||
}
|
||||
return CommonResult.failed("同步物流公司失败");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询快递公司表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="快递公司ID", required = true)
|
||||
public CommonResult<Express> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(expressService.getInfo(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部物流公司
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:all')")
|
||||
@ApiOperation(value = "查询全部物流公司")
|
||||
@RequestMapping(value = "/all", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="type", value="类型:normal-普通,elec-电子面单")
|
||||
public CommonResult<List<Express>> all(@RequestParam(value = "type") String type) {
|
||||
return CommonResult.success(expressService.findAll(type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物流公司面单模板
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:express:template')")
|
||||
@ApiOperation(value = "查询物流公司面单模板")
|
||||
@RequestMapping(value = "/template", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="com", value="快递公司编号", required = true)
|
||||
public CommonResult<JSONObject> template(@RequestParam(value = "com") String com) {
|
||||
return CommonResult.success(expressService.template(com));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 获取电子面单模版
|
||||
// */
|
||||
// @ApiOperation(value = "查询 电子面单 模版列表")
|
||||
// @RequestMapping(value = "/templatedianzi", method = RequestMethod.GET)
|
||||
// @ApiImplicitParam(name="com", value="快递公司编号", required = true)
|
||||
// public CommonResult<JSONObject> templateDZ(@RequestParam(value = "com") String com) {
|
||||
// return CommonResult.success(expressService.templateFor(com));
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,102 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.user.UserBrokerageRecord;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.BrokerageRecordRequest;
|
||||
import com.yzt.common.request.FundsMonitorRequest;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.response.MonitorResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.UserBillService;
|
||||
import com.yzt.service.service.UserFundsMonitorService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 用户提现表 前端控制器
|
||||
* fw_
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/finance/founds/monitor")
|
||||
@Api(tags = "财务 -- 资金监控")
|
||||
public class FundsMonitorController {
|
||||
|
||||
@Autowired
|
||||
private UserBillService userBillService;
|
||||
|
||||
@Autowired
|
||||
private UserFundsMonitorService userFundsMonitorService;
|
||||
|
||||
/**
|
||||
* 分页显示资金监控
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:monitor:list')")
|
||||
@ApiOperation(value = "资金监控")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<MonitorResponse>> getList(@Validated FundsMonitorRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<MonitorResponse> userExtractCommonPage = CommonPage.restPage(userBillService.fundMonitoring(request, pageParamRequest));
|
||||
return CommonResult.success(userExtractCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 佣金记录
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:monitor:brokerage:record')")
|
||||
@ApiOperation(value = "佣金记录")
|
||||
@RequestMapping(value = "/brokerage/record", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserBrokerageRecord>> brokerageRecord(@Validated BrokerageRecordRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(CommonPage.restPage(userFundsMonitorService.getBrokerageRecord(request, pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 佣金收益类型枚举
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:monitor:brokerage:record')")
|
||||
@ApiOperation(value = "佣金收益类型枚举")
|
||||
@RequestMapping(value = "/brokerage/linkType/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<Map<String, String>>> getBrokerageLinkTypeList() {
|
||||
Map<String, String> saleReward = new HashMap<>();
|
||||
saleReward.put("value", "sale_reward");
|
||||
saleReward.put("label", "销售奖励");
|
||||
|
||||
Map<String, String> queue = new HashMap<>();
|
||||
queue.put("value", "queue");
|
||||
queue.put("label", "免单奖");
|
||||
|
||||
Map<String, String> incubatorAll = new HashMap<>();
|
||||
incubatorAll.put("value", "incubator_all");
|
||||
incubatorAll.put("label", "孵化奖");
|
||||
|
||||
Map<String, String> manageReward = new HashMap<>();
|
||||
manageReward.put("value", "manage_reward");
|
||||
manageReward.put("label", "管理奖");
|
||||
|
||||
Map<String, String> subsidyReward = new HashMap<>();
|
||||
subsidyReward.put("value", "subsidy_reward");
|
||||
subsidyReward.put("label", "补贴奖励");
|
||||
|
||||
List<Map<String, String>> list = Arrays.asList(saleReward, queue, incubatorAll, manageReward, subsidyReward);
|
||||
return CommonResult.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,111 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.response.HomeOperatingDataResponse;
|
||||
import com.yzt.common.response.HomeRateResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.HomeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 统计 -- 主页 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/statistics/home")
|
||||
@Api(tags = "统计 -- 主页")
|
||||
public class HomeController {
|
||||
|
||||
@Autowired
|
||||
private HomeService homeService;
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:index')")
|
||||
@ApiOperation(value = "首页数据")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
public CommonResult<HomeRateResponse> indexDate() {
|
||||
return CommonResult.success(homeService.indexDate());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户曲线图
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:chart:user')")
|
||||
@ApiOperation(value = "用户曲线图")
|
||||
@RequestMapping(value = "/chart/user", method = RequestMethod.GET)
|
||||
public CommonResult<Map<Object, Object>> chartUser() {
|
||||
return CommonResult.success(homeService.chartUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户购买统计
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:chart:user:buy')")
|
||||
@ApiOperation(value = "用户购买统计")
|
||||
@RequestMapping(value = "/chart/user/buy", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Integer>> chartUserBuy() {
|
||||
return CommonResult.success(homeService.chartUserBuy());
|
||||
}
|
||||
|
||||
/**
|
||||
* 30天订单量趋势
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:chart:order')")
|
||||
@ApiOperation(value = "30天订单量趋势")
|
||||
@RequestMapping(value = "/chart/order", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> chartOrder() {
|
||||
return CommonResult.success(homeService.chartOrder());
|
||||
}
|
||||
|
||||
/**
|
||||
* 周订单量趋势
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:chart:order:week')")
|
||||
@ApiOperation(value = "周订单量趋势")
|
||||
@RequestMapping(value = "/chart/order/week", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> chartOrderInWeek() {
|
||||
return CommonResult.success(homeService.chartOrderInWeek());
|
||||
}
|
||||
|
||||
/**
|
||||
* 月订单量趋势
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:chart:order:month')")
|
||||
@ApiOperation(value = "月订单量趋势")
|
||||
@RequestMapping(value = "/chart/order/month", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> chartOrderInMonth() {
|
||||
return CommonResult.success(homeService.chartOrderInMonth());
|
||||
}
|
||||
|
||||
/**
|
||||
* 年订单量趋势
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:chart:order:year')")
|
||||
@ApiOperation(value = "年订单量趋势")
|
||||
@RequestMapping(value = "/chart/order/year", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> chartOrderInYear() {
|
||||
return CommonResult.success(homeService.chartOrderInYear());
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页经营数据
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:operating:data')")
|
||||
@ApiOperation(value = "经营数据")
|
||||
@RequestMapping(value = "/operating/data", method = RequestMethod.GET)
|
||||
public CommonResult<HomeOperatingDataResponse> operatingData() {
|
||||
return CommonResult.success(homeService.operatingData());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yzt.common.request.onepass.OnePassLoginRequest;
|
||||
import com.yzt.common.request.onepass.OnePassShipmentCancelOrderRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.OnePassService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 一号通控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/pass")
|
||||
@Api(tags = "一号通服务")
|
||||
public class OnePassController {
|
||||
|
||||
@Autowired
|
||||
private OnePassService onePassService;
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:pass:appsave')")
|
||||
@ApiOperation(value = "一号通 应用保存")
|
||||
@RequestMapping(value = "/appsave", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> saveOnePassApplication(@Validated @RequestBody OnePassLoginRequest request) {
|
||||
return CommonResult.success(onePassService.saveOnePassApplicationInfo(request));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:pass:appget')")
|
||||
@ApiOperation(value = "一号通 应用详情获取")
|
||||
@RequestMapping(value = "/appget", method = RequestMethod.GET)
|
||||
public CommonResult<OnePassLoginRequest> getOnePassApplication() {
|
||||
return CommonResult.success(onePassService.getOnePassApplicationInfo());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:pass:shipment:cancel')")
|
||||
@ApiOperation(value = "一号通 取消商家寄件")
|
||||
@RequestMapping(value = "/shipment/cancel", method = RequestMethod.POST)
|
||||
public CommonResult<JSONObject> onePassShipmentCancel(OnePassShipmentCancelOrderRequest request) {
|
||||
return CommonResult.success(onePassService.shipmentCancelOrder(request));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:pass:shipment:express')")
|
||||
@ApiOperation(value = "一号通 商家寄件 快递列表")
|
||||
@RequestMapping(value = "/shipment/express", method = RequestMethod.GET)
|
||||
public CommonResult<JSONObject> onePassShipmentExpress() {
|
||||
return CommonResult.success(onePassService.shipmentComs());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:pass:shipment:callback')")
|
||||
@ApiOperation(value = "一号通 商家寄件 回调地址")
|
||||
@RequestMapping(value = "/shipment/callback", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> onePassShipmentCallBack(String type, String data) {
|
||||
return CommonResult.success(onePassService.shipmentCallBackMethod(type, data));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,132 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yzt.common.constants.InvoiceConstants;
|
||||
import com.yzt.common.model.order.StoreOrderInvoice;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.StoreOrderInvoiceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 订单发票后台管理控制器
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/order/invoice")
|
||||
@Api(tags = "后台-订单发票管理")
|
||||
public class OrderInvoiceController {
|
||||
|
||||
@Autowired
|
||||
private StoreOrderInvoiceService storeOrderInvoiceService;
|
||||
|
||||
/**
|
||||
* 分页查询发票列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("分页查询发票列表")
|
||||
public CommonResult<CommonPage<StoreOrderInvoice>> getList(
|
||||
@ApiParam("订单号") @RequestParam(required = false) String orderId,
|
||||
@ApiParam("发票抬头类型") @RequestParam(required = false) Integer invoiceType,
|
||||
@ApiParam("开票状态") @RequestParam(required = false) Integer invoiceStatus,
|
||||
PageParamRequest pageParamRequest) {
|
||||
|
||||
LambdaQueryWrapper<StoreOrderInvoice> wrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if (orderId != null && !orderId.trim().isEmpty()) {
|
||||
wrapper.like(StoreOrderInvoice::getOrderId, orderId);
|
||||
}
|
||||
if (invoiceType != null) {
|
||||
wrapper.eq(StoreOrderInvoice::getInvoiceType, invoiceType);
|
||||
}
|
||||
if (invoiceStatus != null) {
|
||||
wrapper.eq(StoreOrderInvoice::getInvoiceStatus, invoiceStatus);
|
||||
}
|
||||
|
||||
wrapper.orderByDesc(StoreOrderInvoice::getCreateTime);
|
||||
|
||||
Page<StoreOrderInvoice> page = new Page<>(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
Page<StoreOrderInvoice> pageResult = storeOrderInvoiceService.page(page, wrapper);
|
||||
|
||||
// 手动构建分页结果
|
||||
CommonPage<StoreOrderInvoice> result = new CommonPage<>();
|
||||
result.setPage(pageParamRequest.getPage());
|
||||
result.setLimit(pageParamRequest.getLimit());
|
||||
result.setTotal(pageResult.getTotal());
|
||||
result.setTotalPage((int) pageResult.getPages());
|
||||
result.setList(pageResult.getRecords());
|
||||
|
||||
return CommonResult.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单发票详情
|
||||
*/
|
||||
@GetMapping("/detail/{orderId}")
|
||||
@ApiOperation("查询订单发票详情")
|
||||
public CommonResult<StoreOrderInvoice> getInvoiceDetail(@PathVariable String orderId) {
|
||||
StoreOrderInvoice invoice = storeOrderInvoiceService.getByOrderId(orderId);
|
||||
if (invoice == null) {
|
||||
return CommonResult.failed("该订单暂无发票信息");
|
||||
}
|
||||
return CommonResult.success(invoice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新发票状态(开票)
|
||||
*/
|
||||
@PostMapping("/issue")
|
||||
@ApiOperation("更新发票状态为已开票")
|
||||
public CommonResult<Boolean> issueInvoice(
|
||||
@ApiParam("订单号") @RequestParam String orderId,
|
||||
@ApiParam("发票代码") @RequestParam(required = false) String invoiceCode,
|
||||
@ApiParam("发票号码") @RequestParam(required = false) String invoiceNumber,
|
||||
@ApiParam("电子发票URL") @RequestParam(required = false) String invoiceUrl) {
|
||||
|
||||
boolean result = storeOrderInvoiceService.updateInvoiceStatus(
|
||||
orderId,
|
||||
InvoiceConstants.INVOICE_STATUS_ISSUED,
|
||||
invoiceCode,
|
||||
invoiceNumber,
|
||||
invoiceUrl
|
||||
);
|
||||
|
||||
if (result) {
|
||||
return CommonResult.success(true);
|
||||
} else {
|
||||
return CommonResult.failed("开票失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新发票状态为开票失败
|
||||
*/
|
||||
@PostMapping("/fail")
|
||||
@ApiOperation("更新发票状态为开票失败")
|
||||
public CommonResult<Boolean> failInvoice(
|
||||
@ApiParam("订单号") @RequestParam String orderId,
|
||||
@ApiParam("失败原因") @RequestParam String remark) {
|
||||
|
||||
StoreOrderInvoice invoice = storeOrderInvoiceService.getByOrderId(orderId);
|
||||
if (invoice == null) {
|
||||
return CommonResult.failed("该订单暂无发票信息");
|
||||
}
|
||||
|
||||
invoice.setInvoiceStatus(InvoiceConstants.INVOICE_STATUS_FAILED);
|
||||
invoice.setRemark(remark);
|
||||
boolean result = storeOrderInvoiceService.updateById(invoice);
|
||||
|
||||
if (result) {
|
||||
return CommonResult.success(true);
|
||||
} else {
|
||||
return CommonResult.failed("操作失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,161 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yzt.common.exception.YztException;
|
||||
import com.yzt.common.model.page.PageDiy;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.page.PageDiyEditNameRequest;
|
||||
import com.yzt.common.request.page.PageDiyRequest;
|
||||
import com.yzt.common.response.page.PageDiyResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.PageDiyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* DIY数据表 前端控制器
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/pagediy")
|
||||
@Api(tags = "DIY 控制器") //配合swagger使用
|
||||
|
||||
public class PageDiyController {
|
||||
|
||||
@Autowired
|
||||
private PageDiyService pageDiyService;
|
||||
|
||||
/**
|
||||
* 分页显示DIY数据表
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pagediy:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "name", value = "搜索关键子", dataType = "String")
|
||||
})
|
||||
public CommonResult<CommonPage<PageDiy>> getList(@RequestParam String name,PageParamRequest pageParamRequest){
|
||||
CommonPage<PageDiy> pageDiyCommonPage = CommonPage.restPage(pageDiyService.getList(name, pageParamRequest));
|
||||
return CommonResult.success(pageDiyCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置首页
|
||||
* @param id 待设置的首页id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pagediy:setdefault')")
|
||||
@ApiOperation(value = "设置商城首页")
|
||||
@RequestMapping(value = "/setdefault/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> setDefault(@PathVariable(value = "id") Integer id ){
|
||||
if(pageDiyService.setDiyPageHome(id)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已经设置的首页模版数据
|
||||
* @return 首页模版id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pagediy:getdefault')")
|
||||
@ApiOperation(value = "获取商城首页")
|
||||
@RequestMapping(value = "/getdefault", method = RequestMethod.GET)
|
||||
public CommonResult<Integer> getDefault(){
|
||||
return CommonResult.success(pageDiyService.getDiyPageHome(Boolean.TRUE).getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增DIY数据表
|
||||
* @param pageDiyRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pagediy:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<PageDiy> save(@RequestBody @Validated PageDiyRequest pageDiyRequest){
|
||||
PageDiy pageDiy = new PageDiy();
|
||||
BeanUtils.copyProperties(pageDiyRequest, pageDiy);
|
||||
pageDiy.setValue(JSON.toJSONString(pageDiyRequest.getValue()));
|
||||
return CommonResult.success(pageDiyService.savePageDiy(pageDiy));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除DIY数据表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pagediy:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id){
|
||||
if(pageDiyService.removeById(id)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改DIY数据表
|
||||
* @param pageDiyRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pagediy:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated PageDiyRequest pageDiyRequest){
|
||||
PageDiy pageDiy = new PageDiy();
|
||||
BeanUtils.copyProperties(pageDiyRequest, pageDiy);
|
||||
pageDiy.setValue(JSON.toJSONString(pageDiyRequest.getValue()));
|
||||
if(pageDiyService.editPageDiy(pageDiy)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DIY 模版名称更新
|
||||
* @param pageDiyEditNameRequest 更新模版名称对象
|
||||
* @return 更新结果
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pagediy:updatename')")
|
||||
@ApiOperation(value = "DIY 模版名称更新")
|
||||
@RequestMapping(value = "/updatename", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated PageDiyEditNameRequest pageDiyEditNameRequest){
|
||||
if(pageDiyService.editPageDiyName(pageDiyEditNameRequest)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询DIY数据表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:pagediy:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<PageDiyResponse> info(@PathVariable(value = "id") Integer id){
|
||||
PageDiy pageDiy = pageDiyService.getDiyPageByPageIdForAdmin(id);
|
||||
if(ObjectUtil.isNull(pageDiy)) throw new YztException("未找到对应模版信息");
|
||||
PageDiyResponse response = new PageDiyResponse();
|
||||
BeanUtils.copyProperties(pageDiy, response);
|
||||
response.setValue(JSON.parseObject(pageDiy.getValue()));
|
||||
return CommonResult.success(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,149 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yzt.common.response.pagelayout.PageLayoutBottomNavigationResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.PageLayoutService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 页面布局 前端控制器
|
||||
* fw_
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/page/layout")
|
||||
@Api(tags = "页面布局管理")
|
||||
public class PageLayoutController {
|
||||
|
||||
@Autowired
|
||||
private PageLayoutService pageLayoutService;
|
||||
|
||||
/**
|
||||
* 页面首页
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:page:layout:index')")
|
||||
@ApiOperation(value = "页面首页")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, Object>> index() {
|
||||
return CommonResult.success(pageLayoutService.index());
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面首页保存
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:page:layout:save')")
|
||||
@ApiOperation(value = "页面首页保存(不建议调用)")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<Object> save(@RequestBody JSONObject jsonObject) {
|
||||
if (pageLayoutService.save(jsonObject)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面首页banner保存
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:page:layout:index:banner:save')")
|
||||
@ApiOperation(value = "页面首页banner保存")
|
||||
@RequestMapping(value = "/index/banner/save", method = RequestMethod.POST)
|
||||
public CommonResult<Object> indexBannerSave(@RequestBody JSONObject jsonObject) {
|
||||
if (pageLayoutService.indexBannerSave(jsonObject)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面首页menu保存
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:page:layout:index:menu:save')")
|
||||
@ApiOperation(value = "页面首页menu保存")
|
||||
@RequestMapping(value = "/index/menu/save", method = RequestMethod.POST)
|
||||
public CommonResult<Object> indexMenuSave(@RequestBody JSONObject jsonObject) {
|
||||
if (pageLayoutService.indexMenuSave(jsonObject)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面首页新闻保存
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:page:layout:index:news:save')")
|
||||
@ApiOperation(value = "页面首页新闻保存")
|
||||
@RequestMapping(value = "/index/news/save", method = RequestMethod.POST)
|
||||
public CommonResult<Object> indexNewsSave(@RequestBody JSONObject jsonObject) {
|
||||
if (pageLayoutService.indexNewsSave(jsonObject)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面用户中心banner保存
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:page:layout:index:banner:save')")
|
||||
@ApiOperation(value = "页面用户中心banner保存")
|
||||
@RequestMapping(value = "/user/banner/save", method = RequestMethod.POST)
|
||||
public CommonResult<Object> userBannerSave(@RequestBody JSONObject jsonObject) {
|
||||
if (pageLayoutService.userBannerSave(jsonObject)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面用户中心导航保存
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:page:layout:user:menu:save')")
|
||||
@ApiOperation(value = "页面用户中心导航保存")
|
||||
@RequestMapping(value = "/user/menu/save", method = RequestMethod.POST)
|
||||
public CommonResult<Object> userMenuSave(@RequestBody JSONObject jsonObject) {
|
||||
if (pageLayoutService.userMenuSave(jsonObject)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面用户中心商品table保存
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:page:layout:index:table:save')")
|
||||
@ApiOperation(value = "页面用户中心商品table保存")
|
||||
@RequestMapping(value = "/index/table/save", method = RequestMethod.POST)
|
||||
public CommonResult<Object> indexTableSave(@RequestBody JSONObject jsonObject) {
|
||||
if (pageLayoutService.indexTableSave(jsonObject)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:page:layout:bottom:navigation')")
|
||||
@ApiOperation(value = "页面底部导航")
|
||||
@RequestMapping(value = "/bottom/navigation/get", method = RequestMethod.GET)
|
||||
public CommonResult<PageLayoutBottomNavigationResponse> getBottomNavigation() {
|
||||
return CommonResult.success(pageLayoutService.getBottomNavigation());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:page:layout:bottom:navigation:save')")
|
||||
@ApiOperation(value = "底部导航保存")
|
||||
@RequestMapping(value = "/bottom/navigation/save", method = RequestMethod.POST)
|
||||
public CommonResult<Object> bottomNavigationSave(@RequestBody JSONObject jsonObject) {
|
||||
if (pageLayoutService.bottomNavigationSave(jsonObject)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,121 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.user.User;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.RetailShopRequest;
|
||||
import com.yzt.common.request.RetailShopStairUserRequest;
|
||||
import com.yzt.common.response.SpreadOrderResponse;
|
||||
import com.yzt.common.response.SpreadUserResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.RetailShopService;
|
||||
import com.yzt.service.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 分销模块
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/retail")
|
||||
@Api(tags = "分销")
|
||||
public class RetailShopController {
|
||||
|
||||
@Autowired
|
||||
private RetailShopService retailShopService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 分销员列表
|
||||
* @param keywords 搜索参数
|
||||
* @param dateLimit 时间参数
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:retail:list')")
|
||||
@ApiOperation(value = "分销员列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "keywords", value = "搜索关键字[姓名、电话、uid]"),
|
||||
@ApiImplicitParam(name = "dateLimit", value = "today,yesterday,lately7,lately30,month,year,/yyyy-MM-dd hh:mm:ss,yyyy-MM-dd hh:mm:ss/")
|
||||
})
|
||||
public CommonResult<CommonPage<SpreadUserResponse>> getList(@RequestParam(required = false) String keywords,
|
||||
@RequestParam(required = false) String dateLimit,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(retailShopService.getSpreadPeopleList(keywords, dateLimit, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户参数获取推广人列表
|
||||
* @param request 查询参数
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return 查询结果推广人列表
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:retail:spread:list')")
|
||||
@ApiOperation(value = "根据条件获取推广人列表")
|
||||
@RequestMapping(value = "/spread/userlist", method = RequestMethod.POST)
|
||||
public CommonResult<CommonPage<User>> getUserListBySpreadLevel(@RequestBody @Validated RetailShopStairUserRequest request,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(userService.getUserListBySpreadLevel(request, pageParamRequest)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据参数获取推广订单列表
|
||||
* @param request 查询参数
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return 查询结果推广人订单列表
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:retail:spread:order:list')")
|
||||
@ApiOperation(value = "根据条件获取推广人订单")
|
||||
@RequestMapping(value = "/spread/orderlist", method = RequestMethod.POST)
|
||||
public CommonResult<CommonPage<SpreadOrderResponse>> getOrdersBySpreadLevel(@RequestBody @Validated RetailShopStairUserRequest request,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(userService.getOrderListBySpreadLevel(request, pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除上级推广人
|
||||
* @param id 当前被清理的用户id
|
||||
* @return 推广关系清理后的结果
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:retail:spread:clean')")
|
||||
@ApiOperation(value = "清除上级推广人")
|
||||
@RequestMapping(value = "/spread/clean/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<Object> clearSpread(@PathVariable Integer id) {
|
||||
return CommonResult.success(userService.clearSpread(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销设置获取
|
||||
* @return 保存分销设置
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:retail:spread:manage:get')")
|
||||
@ApiOperation(value = "分销配置信息获取")
|
||||
@RequestMapping(value = "/spread/manage/get", method = RequestMethod.GET)
|
||||
public CommonResult<Object> getSpreadInfo() {
|
||||
return CommonResult.success(retailShopService.getManageInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销管理信息保存
|
||||
* @param retailShopRequest 分销管理对象
|
||||
* @return 保存结果
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:retail:spread:manage:set')")
|
||||
@ApiOperation(value = "分销管理信息保存")
|
||||
@RequestMapping(value = "/spread/manage/set", method = RequestMethod.POST)
|
||||
public CommonResult<Object> setSpreadInfo(@RequestBody @Validated RetailShopRequest retailShopRequest) {
|
||||
return CommonResult.success(retailShopService.setManageInfo(retailShopRequest));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,115 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.admin.model.ScheduleJob;
|
||||
import com.yzt.admin.model.ScheduleJobLog;
|
||||
import com.yzt.admin.service.ScheduleJobLogService;
|
||||
import com.yzt.admin.service.ScheduleJobService;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.ScheduleJobLogSearchRequest;
|
||||
import com.yzt.common.request.ScheduleJobRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 定时任务控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/schedule/job")
|
||||
@Api(tags = "定时任务控制器")
|
||||
public class ScheduleJobController {
|
||||
|
||||
@Autowired
|
||||
private ScheduleJobService scheduleJobService;
|
||||
@Autowired
|
||||
private ScheduleJobLogService scheduleJobLogService;
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:schedule:job:list')")
|
||||
@ApiOperation(value = "定时任务列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<ScheduleJob>> getList() {
|
||||
return CommonResult.success(scheduleJobService.getAll());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:schedule:job:add')")
|
||||
@ApiOperation(value = "添加定时任务")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public CommonResult<String> add(@RequestBody @Validated ScheduleJobRequest request) {
|
||||
if (scheduleJobService.add(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:schedule:job:update')")
|
||||
@ApiOperation(value = "定时任务编辑")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated ScheduleJobRequest request) {
|
||||
if (scheduleJobService.edit(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:schedule:job:suspend')")
|
||||
@ApiOperation(value = "暂停定时任务")
|
||||
@RequestMapping(value = "/suspend/{jobId}", method = RequestMethod.POST)
|
||||
public CommonResult<String> suspend(@PathVariable(value = "jobId") Integer jobId) {
|
||||
if (scheduleJobService.suspend(jobId)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:schedule:job:start')")
|
||||
@ApiOperation(value = "启动定时任务")
|
||||
@RequestMapping(value = "/start/{jobId}", method = RequestMethod.POST)
|
||||
public CommonResult<String> start(@PathVariable(value = "jobId") Integer jobId) {
|
||||
if (scheduleJobService.start(jobId)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:schedule:job:delete')")
|
||||
@ApiOperation(value = "删除定时任务")
|
||||
@RequestMapping(value = "/delete/{jobId}", method = RequestMethod.POST)
|
||||
public CommonResult<String> delete(@PathVariable(value = "jobId") Integer jobId) {
|
||||
if (scheduleJobService.delete(jobId)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:schedule:job:trig')")
|
||||
@ApiOperation(value = "立即执行定时任务(一次)")
|
||||
@RequestMapping(value = "/trig/{jobId}", method = RequestMethod.POST)
|
||||
public CommonResult<String> trig(@PathVariable(value = "jobId") Integer jobId) {
|
||||
if (scheduleJobService.trig(jobId)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:schedule:job:log:list')")
|
||||
@ApiOperation(value = "定时任务日志分页列表")
|
||||
@RequestMapping(value = "/log/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ScheduleJobLog>> getLogList(@Validated ScheduleJobLogSearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(scheduleJobLogService.findLogPageList(request, pageParamRequest)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,110 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.express.ShippingTemplates;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.ShippingTemplatesRequest;
|
||||
import com.yzt.common.request.ShippingTemplatesSearchRequest;
|
||||
import com.yzt.common.response.ShippingTemplatesInfoResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.ShippingTemplatesService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 物流-模板控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/express/shipping/templates")
|
||||
@Api(tags = "设置 -- 物流 -- 模板")
|
||||
public class ShippingTemplatesController {
|
||||
|
||||
@Autowired
|
||||
private ShippingTemplatesService shippingTemplatesService;
|
||||
|
||||
/**
|
||||
* 分页显示
|
||||
*
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ShippingTemplates>> getList(@Validated ShippingTemplatesSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<ShippingTemplates> shippingTemplatesCommonPage = CommonPage.restPage(shippingTemplatesService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(shippingTemplatesCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param request 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated ShippingTemplatesRequest request) {
|
||||
if (shippingTemplatesService.create(request)) {
|
||||
return CommonResult.success("新增运费模板成功");
|
||||
}
|
||||
return CommonResult.failed("新增运费模板失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "id", value = "模板ID", required = true)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (shippingTemplatesService.remove(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param id integer id
|
||||
* @param request ShippingTemplatesRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated ShippingTemplatesRequest request) {
|
||||
if (shippingTemplatesService.update(id, request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询信息
|
||||
*
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "id", value = "模板ID", required = true)
|
||||
public CommonResult<ShippingTemplatesInfoResponse> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(shippingTemplatesService.getInfo(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.response.ShippingTemplatesFreeResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.ShippingTemplatesFreeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物流控制器
|
||||
* fw_
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/express/shipping/free")
|
||||
@Api(tags = "设置 -- 物流 -- 免费")
|
||||
public class ShippingTemplatesFreeController {
|
||||
|
||||
@Autowired
|
||||
private ShippingTemplatesFreeService shippingTemplatesFreeService;
|
||||
|
||||
/**
|
||||
* 根据模板id查询数据
|
||||
* @param tempId Integer 模板id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:free:list')")
|
||||
@ApiOperation(value = "根据模板id查询数据")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<ShippingTemplatesFreeResponse>> getList(@RequestParam Integer tempId){
|
||||
return CommonResult.success(shippingTemplatesFreeService.getListGroup(tempId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.response.ShippingTemplatesRegionResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.ShippingTemplatesRegionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物流付费前端控制器
|
||||
* fw_
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/express/shipping/region")
|
||||
@Api(tags = "设置 -- 物流 -- 付费")
|
||||
public class ShippingTemplatesRegionController {
|
||||
|
||||
@Autowired
|
||||
private ShippingTemplatesRegionService shippingTemplatesRegionService;
|
||||
|
||||
/**
|
||||
* 根据模板id查询数据
|
||||
* @param tempId Integer 模板id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:shipping:templates:region:list')")
|
||||
@ApiOperation(value = "根据模板id查询数据")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<ShippingTemplatesRegionResponse>> getList(@RequestParam Integer tempId){
|
||||
return CommonResult.success(shippingTemplatesRegionService.getListGroup(tempId));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.SmsApplyTempRequest;
|
||||
import com.yzt.common.request.SmsModifySignRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.vo.MyRecord;
|
||||
import com.yzt.service.service.SmsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 短信发送记录表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/sms")
|
||||
@Api(tags = "短信服务")
|
||||
public class SmsRecordController {
|
||||
|
||||
@Autowired
|
||||
private SmsService smsService;
|
||||
|
||||
/**
|
||||
* 修改签名
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:sms:modify:sign')")
|
||||
@ApiOperation(value = "修改签名")
|
||||
@RequestMapping(value = "/modify/sign", method = RequestMethod.POST)
|
||||
public CommonResult<JSONObject> modifySign(@RequestBody @Validated SmsModifySignRequest request) {
|
||||
if (smsService.modifySign(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 短信模板
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:sms:temps')")
|
||||
@ApiOperation(value = "短信模板")
|
||||
@RequestMapping(value = "/temps", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> temps(@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
MyRecord myRecord = smsService.temps(pageParamRequest);
|
||||
return CommonResult.success(myRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请短信模板
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:sms:temp:apply')")
|
||||
@ApiOperation(value = "申请短信模板")
|
||||
@RequestMapping(value = "/temp/apply", method = RequestMethod.POST)
|
||||
public CommonResult<JSONObject> applyTempMessage(@RequestBody @Validated SmsApplyTempRequest request) {
|
||||
if (smsService.applyTempMessage(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板申请记录
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:sms:applys')")
|
||||
@ApiOperation(value = "模板申请记录")
|
||||
@RequestMapping(value = "/applys", method = RequestMethod.POST)
|
||||
@ApiImplicitParam(name="type", value="type (1=验证码 2=通知 3=推广)")
|
||||
public CommonResult<Map<String, Object>> applys(@RequestParam(name = "type", required = false) Integer type, @ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(smsService.applys(type, pageParamRequest));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,161 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.StoreBargainRequest;
|
||||
import com.yzt.common.request.StoreBargainSearchRequest;
|
||||
import com.yzt.common.request.StoreBargainUserSearchRequest;
|
||||
import com.yzt.common.response.StoreBargainResponse;
|
||||
import com.yzt.common.response.StoreBargainUserHelpResponse;
|
||||
import com.yzt.common.response.StoreBargainUserResponse;
|
||||
import com.yzt.common.response.StoreProductInfoResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.StoreBargainService;
|
||||
import com.yzt.service.service.StoreBargainUserHelpService;
|
||||
import com.yzt.service.service.StoreBargainUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 砍价表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/bargain")
|
||||
@Api(tags = "商品 -- 砍价 -- 商品") //配合swagger使用
|
||||
public class StoreBargainController {
|
||||
|
||||
@Autowired
|
||||
private StoreBargainService storeBargainService;
|
||||
|
||||
@Autowired
|
||||
private StoreBargainUserService storeBargainUserService;
|
||||
|
||||
@Autowired
|
||||
private StoreBargainUserHelpService storeBargainUserHelpService;
|
||||
|
||||
/**
|
||||
* 分页显示砍价商品列表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:list')")
|
||||
@ApiOperation(value = "分页显示砍价商品列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreBargainResponse>> getList(@Validated StoreBargainSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<StoreBargainResponse> storeBargainCommonPage = CommonPage.restPage(storeBargainService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeBargainCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增砍价商品
|
||||
* @param storeBargainRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:save')")
|
||||
@ApiOperation(value = "新增砍价商品")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreBargainRequest storeBargainRequest){
|
||||
if(storeBargainService.saveBargain(storeBargainRequest)){
|
||||
return CommonResult.success("添加砍价商品成功");
|
||||
}else{
|
||||
return CommonResult.failed("添加砍价商品失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除砍价商品
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:delete')")
|
||||
@ApiOperation(value = "删除砍价商品")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id){
|
||||
if(storeBargainService.deleteById(id)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改砍价商品
|
||||
* @param storeBargainRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:update')")
|
||||
@ApiOperation(value = "修改砍价商品")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated StoreBargainRequest storeBargainRequest){
|
||||
if (storeBargainService.updateBargain(storeBargainRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询砍价商品详情
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:info')")
|
||||
@ApiOperation(value = "查询砍价商品详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductInfoResponse> info(@RequestParam(value = "id") Integer id){
|
||||
StoreProductInfoResponse storeBargainResponse = storeBargainService.getAdminDetail(id);
|
||||
return CommonResult.success(storeBargainResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 修改砍价商品状态
|
||||
* @param id 商品id
|
||||
* @param status 商品状态
|
||||
* @return {@link CommonResult<String>}
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:update:status')")
|
||||
@ApiOperation(value = "修改砍价商品状态")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
|
||||
public CommonResult<String> updateStatus(@RequestParam @Validated Integer id, @RequestParam @Validated boolean status){
|
||||
if(storeBargainService.updateBargainStatus(id,status)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页显示砍价列表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:user:list')")
|
||||
@ApiOperation(value = "分页显示砍价列表") //配合swagger使用
|
||||
@RequestMapping(value = "/bargain_list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreBargainUserResponse>> getBargainUserList(@Validated StoreBargainUserSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<StoreBargainUserResponse> bargainUserCommonPage = CommonPage.restPage(storeBargainUserService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(bargainUserCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取砍价参与详情列表
|
||||
* @param id StoreBargainUser 砍价参与用户编号
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:bargain:user:help:list')")
|
||||
@ApiOperation(value = "获取砍价参与详情列表") //配合swagger使用
|
||||
@RequestMapping(value = "/bargain_list/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<List<StoreBargainUserHelpResponse>> getBargainUserHelpDetail(@PathVariable(value = "id") Integer id){
|
||||
List<StoreBargainUserHelpResponse> list = storeBargainUserHelpService.getList(id);
|
||||
return CommonResult.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,161 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.StoreCombinationRequest;
|
||||
import com.yzt.common.request.StoreCombinationSearchRequest;
|
||||
import com.yzt.common.request.StorePinkSearchRequest;
|
||||
import com.yzt.common.response.StoreCombinationResponse;
|
||||
import com.yzt.common.response.StorePinkAdminListResponse;
|
||||
import com.yzt.common.response.StorePinkDetailResponse;
|
||||
import com.yzt.common.response.StoreProductInfoResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.StoreCombinationService;
|
||||
import com.yzt.service.service.StorePinkService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 拼团商品表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/combination")
|
||||
@Api(tags = "商品——拼团——商品") //配合swagger使用
|
||||
public class StoreCombinationController {
|
||||
|
||||
@Autowired
|
||||
private StoreCombinationService storeCombinationService;
|
||||
|
||||
@Autowired
|
||||
private StorePinkService storePinkService;
|
||||
|
||||
/**
|
||||
* 分页显示拼团商品表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:list')")
|
||||
@ApiOperation(value = "分页显示拼团商品表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreCombinationResponse>> getList(@Validated StoreCombinationSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<StoreCombinationResponse> commonPage = CommonPage.restPage(storeCombinationService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(commonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增拼团商品表
|
||||
* @param request 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:save')")
|
||||
@ApiOperation(value = "新增拼团商品")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreCombinationRequest request){
|
||||
if(storeCombinationService.saveCombination(request)){
|
||||
return CommonResult.success("新增拼团商品成功");
|
||||
}else{
|
||||
return CommonResult.failed("新增拼团商品失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除拼团商品表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:delete')")
|
||||
@ApiOperation(value = "删除拼团商品")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id){
|
||||
if(storeCombinationService.deleteById(id)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改拼团商品表
|
||||
* @param storeCombinationRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:update')")
|
||||
@ApiOperation(value = "修改拼团商品")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated StoreCombinationRequest storeCombinationRequest){
|
||||
if(storeCombinationService.updateCombination(storeCombinationRequest)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询拼团商品信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:info')")
|
||||
@ApiOperation(value = "拼团商品详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductInfoResponse> info(@RequestParam(value = "id") Integer id){
|
||||
StoreProductInfoResponse detail = storeCombinationService.getAdminDetail(id);
|
||||
return CommonResult.success(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改拼团商品状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:update:status')")
|
||||
@ApiOperation(value = "修改拼团商品状态")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
|
||||
public CommonResult<Object> updateStatus(@RequestParam(value = "id") Integer id, @RequestParam @Validated boolean isShow){
|
||||
if(storeCombinationService.updateCombinationShow(id, isShow)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团统计
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:statistics')")
|
||||
@ApiOperation(value = "拼团统计")
|
||||
@RequestMapping(value = "/statistics", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> statistics() {
|
||||
Map<String, Object> map = storeCombinationService.getAdminStatistics();
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团列表
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:combine:list')")
|
||||
@ApiOperation(value = "拼团列表")
|
||||
@RequestMapping(value = "/combine/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StorePinkAdminListResponse>> getCombineList(@Validated StorePinkSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<StorePinkAdminListResponse> responseCommonPage = CommonPage.restPage(storePinkService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(responseCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团订单列表
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:combination:order:pink')")
|
||||
@ApiOperation(value = "拼团订单列表")
|
||||
@RequestMapping(value = "/order_pink/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<List<StorePinkDetailResponse>> getPinkList(@PathVariable(value = "id") Integer id) {
|
||||
return CommonResult.success(storePinkService.getAdminList(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,119 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.coupon.StoreCoupon;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.SearchAndPageRequest;
|
||||
import com.yzt.common.request.StoreCouponRequest;
|
||||
import com.yzt.common.request.StoreCouponSearchRequest;
|
||||
import com.yzt.common.response.StoreCouponInfoResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.StoreCouponService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券表 前端控制器
|
||||
* fw_
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/marketing/coupon")
|
||||
@Api(tags = "营销 -- 优惠券")
|
||||
public class StoreCouponController {
|
||||
|
||||
@Autowired
|
||||
private StoreCouponService storeCouponService;
|
||||
|
||||
/**
|
||||
* 分页显示优惠券表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreCoupon>> getList(@Validated StoreCouponSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<StoreCoupon> storeCouponCommonPage = CommonPage.restPage(storeCouponService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeCouponCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存优惠券表
|
||||
* @param request StoreCouponRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreCouponRequest request) {
|
||||
if (storeCouponService.create(request)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有效
|
||||
* @param id integer id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:update:status')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
|
||||
public CommonResult<String> updateStatus(@RequestParam Integer id, @RequestParam Boolean status) {
|
||||
if (storeCouponService.updateStatus(id, status)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* @param id integer id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.POST)
|
||||
@ApiImplicitParam(name="id", value="优惠券ID", required = true)
|
||||
public CommonResult<StoreCouponInfoResponse> info(@RequestParam Integer id) {
|
||||
return CommonResult.success(storeCouponService.info(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送优惠券列表
|
||||
* @param searchAndPageRequest 搜索分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:send:list')")
|
||||
@ApiOperation(value = "发送优惠券列表")
|
||||
@RequestMapping(value = "/send/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreCoupon>> getSendList(@Validated SearchAndPageRequest searchAndPageRequest) {
|
||||
CommonPage<StoreCoupon> storeCouponCommonPage = CommonPage.restPage(storeCouponService.getSendList(searchAndPageRequest));
|
||||
return CommonResult.success(storeCouponCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除优惠券
|
||||
* @param id 优惠券id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:delete')")
|
||||
@ApiOperation(value = "删除优惠券")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
public CommonResult<StoreCouponInfoResponse> delete(@RequestParam Integer id) {
|
||||
if (storeCouponService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed("删除失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.StoreCouponUserRequest;
|
||||
import com.yzt.common.request.StoreCouponUserSearchRequest;
|
||||
import com.yzt.common.response.StoreCouponUserResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.StoreCouponUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券发放记录表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/marketing/coupon/user")
|
||||
@Api(tags = "营销 -- 优惠券 -- 领取记录")
|
||||
public class StoreCouponUserController {
|
||||
|
||||
@Autowired
|
||||
private StoreCouponUserService storeCouponUserService;
|
||||
|
||||
/**
|
||||
* 分页显示优惠券发放记录表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:user:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreCouponUserResponse>> getList(@Validated StoreCouponUserSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<StoreCouponUserResponse> storeCouponUserCommonPage = CommonPage.restPage(storeCouponUserService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeCouponUserCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 领券
|
||||
* @param storeCouponUserRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:coupon:user:receive')")
|
||||
@ApiOperation(value = "领券")
|
||||
@RequestMapping(value = "/receive", method = RequestMethod.POST)
|
||||
public CommonResult<String> receive(@Validated StoreCouponUserRequest storeCouponUserRequest) {
|
||||
if(storeCouponUserService.receive(storeCouponUserRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,267 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.*;
|
||||
import com.yzt.common.response.*;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.vo.ExpressSheetVo;
|
||||
import com.yzt.common.vo.LogisticsResultVo;
|
||||
import com.yzt.service.service.StoreOrderService;
|
||||
import com.yzt.service.service.StoreOrderVerification;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/order")
|
||||
@Api(tags = "订单") //配合swagger使用
|
||||
public class StoreOrderController {
|
||||
|
||||
@Autowired
|
||||
private StoreOrderService storeOrderService;
|
||||
|
||||
@Autowired
|
||||
private StoreOrderVerification storeOrderVerification;
|
||||
|
||||
/**
|
||||
* 分页显示订单表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreOrderDetailResponse>> getList(@Validated StoreOrderSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(storeOrderService.getAdminList(request, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单各状态数量
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:status:num')")
|
||||
@ApiOperation(value = "获取订单各状态数量")
|
||||
@RequestMapping(value = "/status/num", method = RequestMethod.GET)
|
||||
public CommonResult<StoreOrderCountItemResponse> getOrderStatusNum(
|
||||
@RequestParam(value = "dateLimit", defaultValue = "") String dateLimit,
|
||||
@RequestParam(value = "type", defaultValue = "3") @Range(min = 0, max = 5, message = "未知的订单类型") Integer type,
|
||||
@RequestParam(value = "orderId", defaultValue = "") String orderNo) {
|
||||
return CommonResult.success(storeOrderService.getOrderStatusNum(dateLimit, type, orderNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单统计数据
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:list:data')")
|
||||
@ApiOperation(value = "获取订单统计数据")
|
||||
@RequestMapping(value = "/list/data", method = RequestMethod.GET)
|
||||
public CommonResult<StoreOrderTopItemResponse> getOrderData(@RequestParam(value = "dateLimit", defaultValue = "")String dateLimit) {
|
||||
return CommonResult.success(storeOrderService.getOrderData(dateLimit));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 订单删除
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:delete')")
|
||||
@ApiOperation(value = "订单删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "orderNo") String orderNo) {
|
||||
if (storeOrderService.delete(orderNo)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 备注订单
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:mark')")
|
||||
@ApiOperation(value = "备注")
|
||||
@RequestMapping(value = "/mark", method = RequestMethod.POST)
|
||||
public CommonResult<String> mark(@RequestParam String orderNo, @RequestParam String mark) {
|
||||
if (storeOrderService.mark(orderNo, mark)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单(改价)
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:update:price')")
|
||||
@ApiOperation(value = "修改订单(改价)")
|
||||
@RequestMapping(value = "/update/price", method = RequestMethod.POST)
|
||||
public CommonResult<String> updatePrice(@RequestBody @Validated StoreOrderUpdatePriceRequest request) {
|
||||
if (storeOrderService.updatePrice(request)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<StoreOrderInfoResponse> info(@RequestParam(value = "orderNo") String orderNo) {
|
||||
return CommonResult.success(storeOrderService.info(orderNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送货
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:send')")
|
||||
@ApiOperation(value = "发送货")
|
||||
@RequestMapping(value = "/send", method = RequestMethod.POST)
|
||||
public CommonResult<String> send(@RequestBody @Validated StoreOrderSendRequest request) {
|
||||
return CommonResult.success(storeOrderService.send(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:refund')")
|
||||
@ApiOperation(value = "退款")
|
||||
@RequestMapping(value = "/refund", method = RequestMethod.GET)
|
||||
public CommonResult<Boolean> refund(@Validated StoreOrderRefundRequest request) {
|
||||
return CommonResult.success(storeOrderService.refund(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒绝退款
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:refund:refuse')")
|
||||
@ApiOperation(value = "拒绝退款")
|
||||
@RequestMapping(value = "/refund/refuse", method = RequestMethod.GET)
|
||||
public CommonResult<Object> refundRefuse(@RequestParam String orderNo, @RequestParam String reason) {
|
||||
if (storeOrderService.refundRefuse(orderNo, reason)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 快递查询
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:logistics:info')")
|
||||
@ApiOperation(value = "快递查询")
|
||||
@RequestMapping(value = "/getLogisticsInfo", method = RequestMethod.GET)
|
||||
public CommonResult<LogisticsResultVo> getLogisticsInfo(@RequestParam(value = "orderNo") String orderNo) {
|
||||
return CommonResult.success(storeOrderService.getLogisticsInfo(orderNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 核销订单头部数据
|
||||
*
|
||||
* @author stivepeim
|
||||
* @since 2020-08-29
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:statistics')")
|
||||
@ApiOperation(value = "核销订单头部数据")
|
||||
@RequestMapping(value = "/statistics", method = RequestMethod.GET)
|
||||
public CommonResult<StoreStaffTopDetail> getStatistics() {
|
||||
return CommonResult.success(storeOrderVerification.getOrderVerificationData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 核销订单 月列表数据
|
||||
*
|
||||
* @author stivepeim
|
||||
* @since 2020-08-29
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:statistics:data')")
|
||||
@ApiOperation(value = "核销订单 月列表数据")
|
||||
@RequestMapping(value = "/statisticsData", method = RequestMethod.GET)
|
||||
public CommonResult<List<StoreStaffDetail>> getStaffDetail(StoreOrderStaticsticsRequest request) {
|
||||
return CommonResult.success(storeOrderVerification.getOrderVerificationDetail(request));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 核销码核销订单
|
||||
*
|
||||
* @author stivepeim
|
||||
* @since 2020-09-01
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:write:update')")
|
||||
@ApiOperation(value = "核销码核销订单")
|
||||
@RequestMapping(value = "/writeUpdate/{vCode}", method = RequestMethod.GET)
|
||||
public CommonResult<Object> verificationOrder(@PathVariable String vCode) {
|
||||
return CommonResult.success(storeOrderVerification.verificationOrderByCode(vCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 核销码查询待核销订单
|
||||
*
|
||||
* @author stivepeim
|
||||
* @since 2020-09-01
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:write:confirm')")
|
||||
@ApiOperation(value = "核销码查询待核销订单")
|
||||
@RequestMapping(value = "/writeConfirm/{vCode}", method = RequestMethod.GET)
|
||||
public CommonResult<Object> verificationConfirmOrder(
|
||||
@PathVariable String vCode) {
|
||||
return CommonResult.success(storeOrderVerification.getVerificationOrderByCode(vCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单统计详情
|
||||
*
|
||||
* @author stivepeim
|
||||
* @since 2020-09-01
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:time')")
|
||||
@ApiOperation(value = "订单统计详情")
|
||||
@RequestMapping(value = "/time", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "dateLimit", value = "today,yesterday,lately7,lately30,month,year,/yyyy-MM-dd hh:mm:ss,yyyy-MM-dd hh:mm:ss/",
|
||||
dataType = "String", required = true),
|
||||
@ApiImplicitParam(name = "type", value = "1=price 2=order", required = true)
|
||||
})
|
||||
public CommonResult<Object> statisticsOrderTime(@RequestParam String dateLimit,
|
||||
@RequestParam Integer type) {
|
||||
return CommonResult.success(storeOrderService.orderStatisticsByTime(dateLimit, type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取面单默认配置信息
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:sheet:info')")
|
||||
@ApiOperation(value = "获取面单默认配置信息")
|
||||
@RequestMapping(value = "/sheet/info", method = RequestMethod.GET)
|
||||
public CommonResult<ExpressSheetVo> getDeliveryInfo() {
|
||||
return CommonResult.success(storeOrderService.getDeliveryInfo());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:order:tracking:number:update')")
|
||||
@ApiOperation(value = "更改订单运单号")
|
||||
@RequestMapping(value = "/update/tracking/number", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> updateTrackingNumber(@RequestBody @Validated StoreOrderSendRequest request) {
|
||||
if (storeOrderService.updateTrackingNumber(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.order.StoreOrderStatus;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.StoreOrderStatusSearchRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.StoreOrderStatusService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 订单操作记录表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/order/status")
|
||||
@Api(tags = "订单 -- 操作记录") //配合swagger使用
|
||||
|
||||
public class StoreOrderStatusController {
|
||||
|
||||
@Autowired
|
||||
private StoreOrderStatusService storeOrderStatusService;
|
||||
|
||||
/**
|
||||
* 分页显示订单操作记录表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:order:status:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreOrderStatus>> getList(@Validated StoreOrderStatusSearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<StoreOrderStatus> storeOrderStatusCommonPage = CommonPage.restPage(storeOrderStatusService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeOrderStatusCommonPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,224 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.product.StoreProduct;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.*;
|
||||
import com.yzt.common.response.StoreProductInfoResponse;
|
||||
import com.yzt.common.response.StoreProductResponse;
|
||||
import com.yzt.common.response.StoreProductTabsHeader;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.StoreCartService;
|
||||
import com.yzt.service.service.StoreProductService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 商品表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/product")
|
||||
@Api(tags = "商品") //配合swagger使用
|
||||
public class StoreProductController {
|
||||
|
||||
@Autowired
|
||||
private StoreProductService storeProductService;
|
||||
|
||||
@Autowired
|
||||
private StoreCartService storeCartService;
|
||||
|
||||
/**
|
||||
* 分页显示商品表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreProductResponse>> getList(@Validated StoreProductSearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(storeProductService.getAdminList(request, pageParamRequest)));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:product:listbyids')")
|
||||
@ApiOperation(value = "根据id集合获取商品列表") //配合swagger使用
|
||||
@RequestMapping(value = "/listids/{ids}", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreProduct>> getListByIds(@PathVariable(value = "ids") List<Integer> ids) {
|
||||
return CommonResult.success(CommonPage.restPage(storeProductService.getListInIds(ids)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品
|
||||
* @param request 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:save')")
|
||||
@ApiOperation(value = "新增商品")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreProductAddRequest request) {
|
||||
if (storeProductService.save(request)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestBody @PathVariable Integer id, @RequestParam(value = "type", required = false, defaultValue = "recycle")String type) {
|
||||
if (storeProductService.deleteProduct(id, type)) {
|
||||
if (type.equals("recycle")) {
|
||||
storeCartService.productStatusNotEnable(id);
|
||||
} else {
|
||||
storeCartService.productDelete(id);
|
||||
}
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复已删除商品表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:restore')")
|
||||
@ApiOperation(value = "恢复商品")
|
||||
@RequestMapping(value = "/restore/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> restore(@RequestBody @PathVariable Integer id) {
|
||||
if (storeProductService.reStoreProduct(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品修改
|
||||
* @param storeProductRequest 商品参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:update')")
|
||||
@ApiOperation(value = "商品修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated StoreProductAddRequest storeProductRequest) {
|
||||
if (storeProductService.update(storeProductRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品详情
|
||||
* @param id 商品id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:info')")
|
||||
@ApiOperation(value = "商品详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductInfoResponse> info(@PathVariable Integer id) {
|
||||
return CommonResult.success(storeProductService.getInfo(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品tabs表头数据
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:tabs:headers')")
|
||||
@ApiOperation(value = "商品表头数量")
|
||||
@RequestMapping(value = "/tabs/headers", method = RequestMethod.GET)
|
||||
public CommonResult<List<StoreProductTabsHeader>> getTabsHeader(@Validated StoreProductHeaderRequest request) {
|
||||
return CommonResult.success(storeProductService.getTabsHeader(request));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上架
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:up')")
|
||||
@ApiOperation(value = "上架")
|
||||
@RequestMapping(value = "/putOnShell/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> putOn(@PathVariable Integer id) {
|
||||
if (storeProductService.putOnShelf(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下架
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:down')")
|
||||
@ApiOperation(value = "下架")
|
||||
@RequestMapping(value = "/offShell/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> offShell(@PathVariable Integer id) {
|
||||
if (storeProductService.offShelf(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:product:import:product')")
|
||||
@ApiOperation(value = "导入99Api商品")
|
||||
@RequestMapping(value = "/importProduct", method = RequestMethod.POST)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "form", value = "导入平台1=淘宝,2=京东,3=苏宁,4=拼多多, 5=天猫", dataType = "int", required = true),
|
||||
@ApiImplicitParam(name = "url", value = "URL", dataType = "String", required = true),
|
||||
})
|
||||
public CommonResult<StoreProductRequest> importProduct(
|
||||
@RequestParam @Valid int form,
|
||||
@RequestParam @Valid String url) throws IOException, JSONException {
|
||||
StoreProductRequest productRequest = storeProductService.importProductFromUrl(url, form);
|
||||
return CommonResult.success(productRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取复制商品配置
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:copy:config')")
|
||||
@ApiOperation(value = "获取复制商品配置")
|
||||
@RequestMapping(value = "/copy/config", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> copyConfig() {
|
||||
return CommonResult.success(storeProductService.copyConfig());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:product:copy:product')")
|
||||
@ApiOperation(value = "复制平台商品")
|
||||
@RequestMapping(value = "/copy/product", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> copyProduct(@RequestBody @Valid StoreCopyProductRequest request) {
|
||||
return CommonResult.success(storeProductService.copyProduct(request.getUrl()));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:product:quick:stock:add')")
|
||||
@ApiOperation(value = "快捷添加库存")
|
||||
@RequestMapping(value = "/quick/stock/add", method = RequestMethod.POST)
|
||||
public CommonResult<String> quickAddStock(@RequestBody @Validated ProductAddStockRequest request) {
|
||||
if (storeProductService.quickAddStock(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,107 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.product.StoreProductReply;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.StoreProductReplyAddRequest;
|
||||
import com.yzt.common.request.StoreProductReplyCommentRequest;
|
||||
import com.yzt.common.request.StoreProductReplySearchRequest;
|
||||
import com.yzt.common.response.StoreProductReplyResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.StoreProductReplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 评论表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/product/reply")
|
||||
@Api(tags = "商品 -- 评论") //配合swagger使用
|
||||
public class StoreProductReplyController {
|
||||
|
||||
@Autowired
|
||||
private StoreProductReplyService storeProductReplyService;
|
||||
|
||||
/**
|
||||
* 分页显示评论表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:reply:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreProductReplyResponse>> getList(@Validated StoreProductReplySearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<StoreProductReplyResponse> storeProductReplyCommonPage =
|
||||
CommonPage.restPage(storeProductReplyService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeProductReplyCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增评论表
|
||||
* @param request 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:reply:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreProductReplyAddRequest request) {
|
||||
if (storeProductReplyService.virtualCreate(request)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除评论表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:reply:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@PathVariable Integer id) {
|
||||
if (storeProductReplyService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询评论表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:reply:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductReply> info(@PathVariable Integer id) {
|
||||
StoreProductReply storeProductReply = storeProductReplyService.getById(id);
|
||||
return CommonResult.success(storeProductReply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 回复商品评论
|
||||
* @param request StoreProductReplyCommentRequest 回复参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:reply:comment')")
|
||||
@ApiOperation(value = "回复")
|
||||
@RequestMapping(value = "/comment", method = RequestMethod.POST)
|
||||
public CommonResult<String> comment(@RequestBody StoreProductReplyCommentRequest request) {
|
||||
if (storeProductReplyService.comment(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,107 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.product.StoreProductRule;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.StoreProductRuleRequest;
|
||||
import com.yzt.common.request.StoreProductRuleSearchRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.utils.YztUtil;
|
||||
import com.yzt.service.service.StoreProductRuleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 商品规则值(规格)表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/product/rule")
|
||||
@Api(tags = "商品 -- 规则值(规格)") //配合swagger使用
|
||||
public class StoreProductRuleController {
|
||||
|
||||
@Autowired
|
||||
private StoreProductRuleService storeProductRuleService;
|
||||
|
||||
/**
|
||||
* 分页显示商品规则值(规格)表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:rule:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreProductRule>> getList(
|
||||
@Validated StoreProductRuleSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<StoreProductRule> storeProductRuleCommonPage =
|
||||
CommonPage.restPage(storeProductRuleService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeProductRuleCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品规则值(规格)表
|
||||
* @param storeProductRuleRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:rule:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreProductRuleRequest storeProductRuleRequest) {
|
||||
if (storeProductRuleService.save(storeProductRuleRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品规则值(规格)表
|
||||
* @param ids Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:rule:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete/{ids}", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@PathVariable String ids) {
|
||||
if (storeProductRuleService.removeByIds(YztUtil.stringToArray(ids))) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品规则值(规格)表
|
||||
* @param storeProductRuleRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:rule:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated StoreProductRuleRequest storeProductRuleRequest) {
|
||||
if (storeProductRuleService.updateRule(storeProductRuleRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品规则值(规格)表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:product:rule:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductRule> info(@PathVariable Integer id) {
|
||||
StoreProductRule storeProductRule = storeProductRuleService.getById(id);
|
||||
return CommonResult.success(storeProductRule);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,117 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.StoreSeckillAddRequest;
|
||||
import com.yzt.common.request.StoreSeckillSearchRequest;
|
||||
import com.yzt.common.response.StoreProductInfoResponse;
|
||||
import com.yzt.common.response.StoreSeckillResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.StoreSeckillService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 商品秒杀产品表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/seckill")
|
||||
@Api(tags = "商品 -- 秒杀 -- 商品") //配合swagger使用
|
||||
public class StoreSeckillController {
|
||||
|
||||
@Autowired
|
||||
private StoreSeckillService storeSeckillService;
|
||||
|
||||
/**
|
||||
* 分页显示商品秒杀产品表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreSeckillResponse>> getList(@Validated StoreSeckillSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<StoreSeckillResponse> storeSeckillCommonPage =
|
||||
CommonPage.restPage(storeSeckillService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(storeSeckillCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品秒杀产品表
|
||||
* @param storeSeckillRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreSeckillAddRequest storeSeckillRequest) {
|
||||
if (storeSeckillService.saveSeckill(storeSeckillRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品秒杀产品表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (storeSeckillService.deleteById(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品秒杀产品表
|
||||
* @param storeSeckillRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated StoreSeckillAddRequest storeSeckillRequest) {
|
||||
if (storeSeckillService.updateSeckill(storeSeckillRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:seckill:update:status')")
|
||||
@ApiOperation(value = "修改秒杀商品状态")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
|
||||
public CommonResult<String> updateStatus(@RequestParam @Validated Integer id, @RequestParam @Validated boolean status) {
|
||||
if (storeSeckillService.updateSecKillStatus(id,status)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品秒杀产品表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductInfoResponse> info(@RequestParam(value = "id") Integer id) {
|
||||
StoreProductInfoResponse storeSeckill = storeSeckillService.getDetailAdmin(id);
|
||||
return CommonResult.success(storeSeckill);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,122 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.StoreSeckillMangerRequest;
|
||||
import com.yzt.common.request.StoreSeckillMangerSearchRequest;
|
||||
import com.yzt.common.response.StoreSeckillManagerResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.StoreSeckillMangerService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 秒杀配置 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/store/seckill/manger")
|
||||
@Api(tags = "商品 -- 秒杀 -- 配置") //配合swagger使用
|
||||
public class StoreSeckillMangerController {
|
||||
|
||||
@Autowired
|
||||
private StoreSeckillMangerService storeSeckillMangerService;
|
||||
|
||||
/**
|
||||
* 分页显示
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:manger:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreSeckillManagerResponse>> getList(
|
||||
@Validated StoreSeckillMangerSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(storeSeckillMangerService.getList(request, pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param storeSeckillMangerRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:manger:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated StoreSeckillMangerRequest storeSeckillMangerRequest) {
|
||||
if (storeSeckillMangerService.saveManger(storeSeckillMangerRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:manger:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (storeSeckillMangerService.deleteLogicById(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param id integer id
|
||||
* @param storeSeckillMangerRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:manger:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated StoreSeckillMangerRequest storeSeckillMangerRequest) {
|
||||
return storeSeckillMangerService.update(id, storeSeckillMangerRequest) ? CommonResult.success() : CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:manger:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<StoreSeckillManagerResponse> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(storeSeckillMangerService.detail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新秒杀配置状态
|
||||
* @param id 配置id
|
||||
* @param status 待更新配置状态
|
||||
* @return 更新结果
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:seckill:manger:update:status')")
|
||||
@ApiOperation(value = "秒杀配置状态更新")
|
||||
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "商品id", dataType = "int", required = true),
|
||||
@ApiImplicitParam(name = "status", value = "状态", dataType = "string", required = true)
|
||||
})
|
||||
public CommonResult<Object> updateStatus(@PathVariable(value = "id") Integer id, String status) {
|
||||
return CommonResult.success(storeSeckillMangerService.updateStatus(id,status));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,134 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.system.SystemAdmin;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.SystemAdminAddRequest;
|
||||
import com.yzt.common.request.SystemAdminRequest;
|
||||
import com.yzt.common.request.SystemAdminUpdateRequest;
|
||||
import com.yzt.common.response.SystemAdminResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.SystemAdminService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
|
||||
/**
|
||||
* 后台管理员表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/admin")
|
||||
@Api(tags = "后台用户服务")
|
||||
public class SystemAdminController {
|
||||
|
||||
@Autowired
|
||||
private SystemAdminService systemAdminService;
|
||||
|
||||
/**
|
||||
* 分页显示后台管理员表
|
||||
* @param systemAdminRequest 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<CommonPage<SystemAdminResponse>> getList(@Validated SystemAdminRequest systemAdminRequest, PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemAdminResponse> systemAdminCommonPage = CommonPage.restPage(systemAdminService.getList(systemAdminRequest, pageParamRequest));
|
||||
return CommonResult.success(systemAdminCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增后台管理员
|
||||
* @param systemAdminAddRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:save')")
|
||||
@ApiOperation(value = "新增后台管理员")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<SystemAdminResponse> save(@RequestBody SystemAdminAddRequest systemAdminAddRequest) {
|
||||
if (systemAdminService.saveAdmin(systemAdminAddRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed("添加管理员失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除后台管理员表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemAdminService.removeById(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改后台管理员表
|
||||
* @param systemAdminRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody SystemAdminUpdateRequest systemAdminRequest) {
|
||||
if (systemAdminService.updateAdmin(systemAdminRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台管理员详情
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:info')")
|
||||
@ApiOperation(value = "后台管理员详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemAdmin> info(@RequestParam(value = "id") @Valid Integer id) {
|
||||
return CommonResult.success(systemAdminService.getDetail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改后台管理员状态
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:update:status')")
|
||||
@ApiOperation(value = "修改后台管理员状态")
|
||||
@RequestMapping(value = "/updateStatus", method = RequestMethod.GET)
|
||||
public CommonResult<Object> updateStatus(@RequestParam(value = "id") @Valid Integer id, @RequestParam(value = "status") @Valid Boolean status) {
|
||||
if (systemAdminService.updateStatus(id, status)) {
|
||||
return CommonResult.success("修改成功");
|
||||
}
|
||||
return CommonResult.failed("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改后台管理员是否接收状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:admin:update:sms')")
|
||||
@ApiOperation(value = "修改后台管理员是否接收状态")
|
||||
@RequestMapping(value = "/update/isSms", method = RequestMethod.GET)
|
||||
public CommonResult<Object> updateIsSms(@RequestParam(value = "id") @Valid Integer id) {
|
||||
if (systemAdminService.updateIsSms(id)) {
|
||||
return CommonResult.success("修改成功");
|
||||
}
|
||||
return CommonResult.failed("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,123 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.system.SystemAttachment;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.SystemAttachmentMoveRequest;
|
||||
import com.yzt.common.request.SystemAttachmentRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.utils.YztUtil;
|
||||
import com.yzt.service.service.SystemAttachmentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 附件管理表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/attachment")
|
||||
@Api(tags = "附件管理") //配合swagger使用
|
||||
public class SystemAttachmentController {
|
||||
|
||||
@Autowired
|
||||
private SystemAttachmentService systemAttachmentService;
|
||||
|
||||
/**
|
||||
* 分页显示附件管理表
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:attachment:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemAttachment>> getList(
|
||||
@RequestParam @Validated Integer pid,
|
||||
@RequestParam(
|
||||
value = "attType",
|
||||
defaultValue = "png,jpeg,jpg,audio/mpeg,text/plain,video/mp4,gif",
|
||||
required = false) String attType,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemAttachment> systemAttachmentCommonPage =
|
||||
CommonPage.restPage(systemAttachmentService.getList(pid, attType, pageParamRequest));
|
||||
return CommonResult.success(systemAttachmentCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增附件管理表 TODO:未使用的话删除此接口
|
||||
* @param systemAttachmentRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:attachment:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated SystemAttachmentRequest systemAttachmentRequest) {
|
||||
if (systemAttachmentService.add(systemAttachmentRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除附件管理表
|
||||
* @param ids String
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:attachment:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete/{ids}", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@PathVariable String ids) {
|
||||
if (systemAttachmentService.removeByIds(YztUtil.stringToArray(ids))) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改附件管理表
|
||||
* @param id integer id
|
||||
* @param systemAttachmentRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:attachment:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id,
|
||||
@RequestBody @Validated SystemAttachmentRequest systemAttachmentRequest) {
|
||||
systemAttachmentRequest.setAttId(id);
|
||||
if (systemAttachmentService.edit(systemAttachmentRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询附件管理表信息
|
||||
* @param move SystemAttachmentMoveRequest
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:attachment:move')")
|
||||
@ApiOperation(value = "更改图片目录")
|
||||
@RequestMapping(value = "/move", method = RequestMethod.POST)
|
||||
public CommonResult<String> updateAttrId(@RequestBody @Validated SystemAttachmentMoveRequest move) {
|
||||
if (systemAttachmentService.updateAttrId(move)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 附件详情
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:attachment:info')")
|
||||
@ApiOperation(value = "附件详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<SystemAttachment> info(@PathVariable Integer id) {
|
||||
return CommonResult.success(systemAttachmentService.getById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,100 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.system.SystemCity;
|
||||
import com.yzt.common.request.SystemCityRequest;
|
||||
import com.yzt.common.request.SystemCitySearchRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.vo.SystemCityTreeVo;
|
||||
import com.yzt.service.service.SystemCityService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 城市表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/city")
|
||||
@Api(tags = "城市管理")
|
||||
public class SystemCityController {
|
||||
|
||||
@Autowired
|
||||
private SystemCityService systemCityService;
|
||||
|
||||
/**
|
||||
* 分页城市列表
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:city:list')")
|
||||
@ApiOperation(value = "分页城市列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<Object> getList(@Validated SystemCitySearchRequest request) {
|
||||
return CommonResult.success(systemCityService.getList(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改城市
|
||||
* @param id 城市id
|
||||
* @param request 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:city:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @Validated SystemCityRequest request) {
|
||||
if (systemCityService.update(id, request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* @param id 城市id
|
||||
* @param status 状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:city:update:status')")
|
||||
@ApiOperation(value = "修改状态")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.POST)
|
||||
public CommonResult<String> updateStatus(@RequestParam Integer id, @RequestParam Boolean status) {
|
||||
if (systemCityService.updateStatus(id, status)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 城市详情
|
||||
* @param id 城市id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:city:info')")
|
||||
@ApiOperation(value = "城市详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemCity> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(systemCityService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取tree结构的列表
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:city:list:tree')")
|
||||
@ApiOperation(value = "获取tree结构的列表")
|
||||
@RequestMapping(value = "/list/tree", method = RequestMethod.GET)
|
||||
public CommonResult<List<SystemCityTreeVo>> getListTree() {
|
||||
return CommonResult.success(systemCityService.getListTree());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,124 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.system.SystemConfig;
|
||||
import com.yzt.common.request.SaveConfigRequest;
|
||||
import com.yzt.common.request.SystemFormCheckRequest;
|
||||
import com.yzt.common.response.AdminSiteLogoResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.SystemConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
/**
|
||||
* 配置表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/config")
|
||||
@Api(tags = "设置 -- Config")
|
||||
public class SystemConfigController {
|
||||
|
||||
@Autowired
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:system:config:info')")
|
||||
@ApiOperation(value = "表单详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, String>> info(@RequestParam(value = "formId") Integer formId) {
|
||||
return CommonResult.success(systemConfigService.info(formId));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:system:config:save:form')")
|
||||
@ApiOperation(value = "整体保存表单数据")
|
||||
@RequestMapping(value = "/save/form", method = RequestMethod.POST)
|
||||
public CommonResult<String> saveFrom(@RequestBody @Validated SystemFormCheckRequest systemFormCheckRequest) {
|
||||
if (systemConfigService.saveForm(systemFormCheckRequest)) {
|
||||
return CommonResult.success("表单保存成功");
|
||||
}
|
||||
return CommonResult.failed("表单保存失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:system:config:upload:type')")
|
||||
@ApiOperation(value = "获取文件存储类型")
|
||||
@RequestMapping(value = "/get/upload/type", method = RequestMethod.GET)
|
||||
public CommonResult<SystemConfig> getFileUploadType() {
|
||||
return CommonResult.success(systemConfigService.getFileUploadType());
|
||||
}
|
||||
|
||||
// @PreAuthorize("hasAuthority('admin:system:config:site:logo')")
|
||||
@ApiOperation(value = "获取管理端logo")
|
||||
@RequestMapping(value = "/get/site/logo", method = RequestMethod.GET)
|
||||
public CommonResult<AdminSiteLogoResponse> getSiteLogo() {
|
||||
return CommonResult.success(systemConfigService.getSiteLogo());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:system:config:tx:map:key')")
|
||||
@ApiOperation(value = "获取腾讯地图key")
|
||||
@RequestMapping(value = "/get/tx/map/key", method = RequestMethod.GET)
|
||||
public CommonResult<SystemConfig> getTxMapKey() {
|
||||
return CommonResult.success(systemConfigService.getTxMapKey());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:system:config:home:page:list:style')")
|
||||
@ApiOperation(value = "获取移动端首页列表样式")
|
||||
@RequestMapping(value = "/get/home/page/list/style", method = RequestMethod.GET)
|
||||
public CommonResult<SystemConfig> getHomePageSaleListStyle() {
|
||||
return CommonResult.success(systemConfigService.getHomePageSaleListStyle());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:system:config:home:page:list:style:save')")
|
||||
@ApiOperation(value = "保存移动端首页列表样式")
|
||||
@RequestMapping(value = "/save/home/page/list/style", method = RequestMethod.POST)
|
||||
public CommonResult<String> saveHomePageSaleListStyle(@RequestBody SaveConfigRequest request) {
|
||||
if (systemConfigService.saveHomePageSaleListStyle(request)) {
|
||||
return CommonResult.success("保存成功");
|
||||
}
|
||||
return CommonResult.failed("保存失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:system:config:auth:host:get')")
|
||||
@ApiOperation(value = "获取授权地址")
|
||||
@RequestMapping(value = "/get/auth/host", method = RequestMethod.GET)
|
||||
public CommonResult<SystemConfig> getAuthHost() {
|
||||
return CommonResult.success(systemConfigService.getAuthHost());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:system:config:change:color:get')")
|
||||
@ApiOperation(value = "获取主题色")
|
||||
@RequestMapping(value = "/get/change/color", method = RequestMethod.GET)
|
||||
public CommonResult<SystemConfig> getChangeColor() {
|
||||
return CommonResult.success(systemConfigService.getChangeColor());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:system:config:change:color:save')")
|
||||
@ApiOperation(value = "保存主题色")
|
||||
@RequestMapping(value = "/save/change/color", method = RequestMethod.POST)
|
||||
public CommonResult<String> saveChangeColor(@RequestBody SaveConfigRequest request) {
|
||||
if (systemConfigService.saveChangeColor(request)) {
|
||||
return CommonResult.success("保存成功");
|
||||
}
|
||||
return CommonResult.failed("保存失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:system:config:clear:cache')")
|
||||
@ApiOperation(value = "清除config缓存")
|
||||
@RequestMapping(value = "/clear/cache", method = RequestMethod.POST)
|
||||
public CommonResult<String> clearCache() {
|
||||
if (systemConfigService.clearCache()) {
|
||||
return CommonResult.success("清除成功");
|
||||
}
|
||||
return CommonResult.failed("清除失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.system.SystemFormTemp;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.SystemFormTempRequest;
|
||||
import com.yzt.common.request.SystemFormTempSearchRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.SystemFormTempService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 表单模板 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/form/temp")
|
||||
@Api(tags = "设置 -- 表单模板")
|
||||
public class SystemFormTempController {
|
||||
|
||||
@Autowired
|
||||
private SystemFormTempService systemFormTempService;
|
||||
|
||||
/**
|
||||
* 分页显示表单模板
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:form:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemFormTemp>> getList(@Validated SystemFormTempSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemFormTemp> systemFormTempCommonPage = CommonPage.restPage(systemFormTempService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(systemFormTempCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增表单模板
|
||||
* @param systemFormTempRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:form:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated SystemFormTempRequest systemFormTempRequest) {
|
||||
if (systemFormTempService.add(systemFormTempRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改表单模板
|
||||
* @param id integer id
|
||||
* @param systemFormTempRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:form:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated SystemFormTempRequest systemFormTempRequest) {
|
||||
if (systemFormTempService.edit(id, systemFormTempRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询表单模板信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:form:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemFormTemp> info(@RequestParam(value = "id") Integer id) {
|
||||
SystemFormTemp systemFormTemp = systemFormTempService.getById(id);
|
||||
return CommonResult.success(systemFormTemp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,104 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.system.SystemGroup;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.SystemGroupRequest;
|
||||
import com.yzt.common.request.SystemGroupSearchRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.SystemGroupService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 组合数据表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/group")
|
||||
@Api(tags = "设置 -- 组合数据")
|
||||
public class SystemGroupController {
|
||||
|
||||
@Autowired
|
||||
private SystemGroupService systemGroupService;
|
||||
|
||||
/**
|
||||
* 分页显示组合数据表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemGroup>> getList(@Validated SystemGroupSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemGroup> systemGroupCommonPage = CommonPage.restPage(systemGroupService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(systemGroupCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组合数据
|
||||
* @param systemGroupRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@Validated SystemGroupRequest systemGroupRequest) {
|
||||
if (systemGroupService.add(systemGroupRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组合数据表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemGroupService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组合数据表
|
||||
* @param id integer id
|
||||
* @param systemGroupRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @Validated SystemGroupRequest systemGroupRequest) {
|
||||
if (systemGroupService.edit(id, systemGroupRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询组合数据表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemGroup> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(systemGroupService.getById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,102 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.system.SystemGroupData;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.SystemGroupDataRequest;
|
||||
import com.yzt.common.request.SystemGroupDataSearchRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.SystemGroupDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 组合数据详情表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/group/data")
|
||||
@Api(tags = "设置 -- 组合数据 -- 详情")
|
||||
public class SystemGroupDataController {
|
||||
|
||||
@Autowired
|
||||
private SystemGroupDataService systemGroupDataService;
|
||||
|
||||
/**
|
||||
* 分页组合数据详情
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:data:list')")
|
||||
@ApiOperation(value = "分页组合数据详情")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemGroupData>> getList(@Validated SystemGroupDataSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemGroupData> systemGroupDataCommonPage = CommonPage.restPage(systemGroupDataService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(systemGroupDataCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增组合数据详情
|
||||
* @param systemGroupDataRequest SystemFormCheckRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:data:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated SystemGroupDataRequest systemGroupDataRequest) {
|
||||
if (systemGroupDataService.create(systemGroupDataRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除组合数据详情表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:data:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemGroupDataService.removeById(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改组合数据详情表
|
||||
* @param id integer id
|
||||
* @param request 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:data:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated SystemGroupDataRequest request) {
|
||||
if (systemGroupDataService.update(id, request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 组合数据详情信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:group:data:info')")
|
||||
@ApiOperation(value = "组合数据详情信息")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemGroupData> info(@RequestParam(value = "id") Integer id) {
|
||||
SystemGroupData systemGroupData = systemGroupDataService.getById(id);
|
||||
return CommonResult.success(systemGroupData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,121 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
|
||||
import com.yzt.common.model.system.SystemMenu;
|
||||
import com.yzt.common.request.SystemMenuRequest;
|
||||
import com.yzt.common.request.SystemMenuSearchRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.vo.MenuCheckVo;
|
||||
import com.yzt.service.service.SystemMenuService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 系统菜单管理 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/menu")
|
||||
@Api(tags = "系统菜单管理")
|
||||
public class SystemMenuController {
|
||||
|
||||
@Autowired
|
||||
private SystemMenuService systemMenuService;
|
||||
|
||||
/**
|
||||
* 菜单列表
|
||||
* @param request 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:list')")
|
||||
@ApiOperation(value = "菜单列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<SystemMenu>> getList(@Validated SystemMenuSearchRequest request) {
|
||||
return CommonResult.success(systemMenuService.getAdminList(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
* @param systemMenuRequest 新增菜单
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:add')")
|
||||
@ApiOperation(value = "新增菜单")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public CommonResult<String> add(@RequestBody @Validated SystemMenuRequest systemMenuRequest) {
|
||||
if (systemMenuService.add(systemMenuRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:delete')")
|
||||
@ApiOperation(value = "删除菜单")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<String> delete(@PathVariable(value = "id") Integer id) {
|
||||
if (systemMenuService.deleteById(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:update')")
|
||||
@ApiOperation(value = "修改菜单")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated SystemMenuRequest systemMenuRequest) {
|
||||
if (systemMenuService.edit(systemMenuRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单详情
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:info')")
|
||||
@ApiOperation(value = "菜单详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<SystemMenu> info(@PathVariable(value = "id") Integer id) {
|
||||
return CommonResult.success(systemMenuService.getInfo(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单显示状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:show:status')")
|
||||
@ApiOperation(value = "修改菜单显示状态")
|
||||
@RequestMapping(value = "/updateShowStatus/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<Object> updateShowStatus(@PathVariable(value = "id") Integer id) {
|
||||
if (systemMenuService.updateShowStatus(id)) {
|
||||
return CommonResult.success("修改成功");
|
||||
}
|
||||
return CommonResult.failed("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单缓存树
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:menu:cache:tree')")
|
||||
@ApiOperation(value = "菜单缓存树")
|
||||
@RequestMapping(value = "/cache/tree", method = RequestMethod.GET)
|
||||
public CommonResult<List<MenuCheckVo>> getCacheTree() {
|
||||
return CommonResult.success(systemMenuService.getCacheTree());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,108 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.system.SystemNotification;
|
||||
import com.yzt.common.request.NotificationInfoRequest;
|
||||
import com.yzt.common.request.NotificationSearchRequest;
|
||||
import com.yzt.common.request.NotificationUpdateRequest;
|
||||
import com.yzt.common.response.NotificationInfoResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.SystemNotificationService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通知设置 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/notification")
|
||||
@Api(tags = "通知设置-前端控制器") //配合swagger使用
|
||||
public class SystemNotificationController {
|
||||
|
||||
@Autowired
|
||||
private SystemNotificationService systemNotificationService;
|
||||
|
||||
/**
|
||||
* 系统通知列表
|
||||
* @param request ExpressSearchRequest 搜索条件
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:notification:list')")
|
||||
@ApiOperation(value = "系统通知列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<SystemNotification>> getList(@Validated NotificationSearchRequest request) {
|
||||
return CommonResult.success(systemNotificationService.getList(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 公众号模板开关
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:notification:wechat:switch')")
|
||||
@ApiOperation(value = "公众号模板开关")
|
||||
@RequestMapping(value = "/wechat/switch/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<Object> wechatSwitch(@PathVariable Integer id) {
|
||||
if (systemNotificationService.wechatSwitch(id)) {
|
||||
return CommonResult.success("更改成功");
|
||||
}
|
||||
return CommonResult.failed("更改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序订阅模板开关
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:notification:routine:switch')")
|
||||
@ApiOperation(value = "小程序订阅模板开关")
|
||||
@RequestMapping(value = "/routine/switch/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<Object> routineSwitch(@PathVariable Integer id) {
|
||||
if (systemNotificationService.routineSwitch(id)) {
|
||||
return CommonResult.success("更改成功");
|
||||
}
|
||||
return CommonResult.failed("更改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信开关
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:notification:sms:switch')")
|
||||
@ApiOperation(value = "发送短信开关")
|
||||
@RequestMapping(value = "/sms/switch/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<Object> smsSwitch(@PathVariable Integer id) {
|
||||
if (systemNotificationService.smsSwitch(id)) {
|
||||
return CommonResult.success("更改成功");
|
||||
}
|
||||
return CommonResult.failed("更改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知详情
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:notification:detail')")
|
||||
@ApiOperation(value = "通知详情")
|
||||
@RequestMapping(value = "/detail", method = RequestMethod.GET)
|
||||
public CommonResult<NotificationInfoResponse> info(@Validated NotificationInfoRequest request) {
|
||||
return CommonResult.success(systemNotificationService.getDetail(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改通知
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:notification:update')")
|
||||
@ApiOperation(value = "修改通知")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<Object> update(@Validated @RequestBody NotificationUpdateRequest request) {
|
||||
if (systemNotificationService.modify(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,114 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.system.SystemRole;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.SystemRoleRequest;
|
||||
import com.yzt.common.request.SystemRoleSearchRequest;
|
||||
import com.yzt.common.response.RoleInfoResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.SystemRoleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 身份管理表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/role")
|
||||
@Api(tags = "设置 -- 权限管理 -- 身份管理")
|
||||
public class SystemRoleController {
|
||||
|
||||
@Autowired
|
||||
private SystemRoleService systemRoleService;
|
||||
|
||||
/**
|
||||
* 分页显示身份管理表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:role:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemRole>> getList(@Validated SystemRoleSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemRole> systemRoleCommonPage = CommonPage.restPage(systemRoleService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(systemRoleCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增身份
|
||||
* @param systemRoleRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:role:save')")
|
||||
@ApiOperation(value = "新增身份")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated SystemRoleRequest systemRoleRequest) {
|
||||
if (systemRoleService.add(systemRoleRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除身份管理表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:role:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemRoleService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改身份管理表
|
||||
* @param systemRoleRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:role:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated SystemRoleRequest systemRoleRequest) {
|
||||
if (systemRoleService.edit(systemRoleRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询身份详情
|
||||
* @param id String
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:role:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<RoleInfoResponse> info(@PathVariable Integer id) {
|
||||
return CommonResult.success(systemRoleService.getInfo(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改身份状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:role:update:status')")
|
||||
@ApiOperation(value = "修改身份状态")
|
||||
@RequestMapping(value = "/updateStatus", method = RequestMethod.GET)
|
||||
public CommonResult<Object> updateStatus(@Validated @RequestParam(value = "id") Integer id, @Validated @RequestParam(value = "status") Boolean status) {
|
||||
if (systemRoleService.updateStatus(id, status)) {
|
||||
return CommonResult.success("修改成功");
|
||||
}
|
||||
return CommonResult.failed("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,155 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.system.SystemStore;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.SystemStoreRequest;
|
||||
import com.yzt.common.request.SystemStoreSearchRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.SystemStoreService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
/**
|
||||
* 门店自提 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/store")
|
||||
@Api(tags = "设置 -- 提货点 -- 提货点")
|
||||
public class SystemStoreController {
|
||||
|
||||
@Autowired
|
||||
private SystemStoreService systemStoreService;
|
||||
|
||||
/**
|
||||
* 分页显示门店自提
|
||||
* @param request SystemStoreSearchRequest 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:list')")
|
||||
@ApiOperation(value = "门店自提分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemStore>> getList(@Validated SystemStoreSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemStore> expressCommonPage = CommonPage.restPage(systemStoreService.getList(request.getKeywords(), request.getStatus(), pageParamRequest));
|
||||
return CommonResult.success(expressCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:count')")
|
||||
@ApiOperation(value = "数量")
|
||||
@RequestMapping(value = "/getCount", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, Integer>> getCount( @RequestParam(value = "keywords", defaultValue = "") String keywords) {
|
||||
return CommonResult.success(systemStoreService.getCount(keywords));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增门店自提
|
||||
* @param request SystemStoreRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated SystemStoreRequest request) {
|
||||
if (systemStoreService.create(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除门店自提
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemStoreService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门店自提
|
||||
* @param id integer id
|
||||
* @param request 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated SystemStoreRequest request) {
|
||||
if (systemStoreService.update(id, request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门店显示状态
|
||||
* @param id integer id
|
||||
* @param status 状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:update:status')")
|
||||
@ApiOperation(value = "修改门店显示状态")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.GET)
|
||||
public CommonResult<String> updateStatus(@RequestParam Integer id, @RequestParam Boolean status) {
|
||||
if (systemStoreService.updateStatus(id, status)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店自提详情
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemStore> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(systemStoreService.getInfo(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 彻底删除
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:completely:delete')")
|
||||
@ApiOperation(value = "彻底删除")
|
||||
@RequestMapping(value = "/completely/delete", method = RequestMethod.GET)
|
||||
public CommonResult<Object> completeLyDelete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemStoreService.completeLyDelete(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:store:recovery')")
|
||||
@ApiOperation(value = "提货点恢复")
|
||||
@RequestMapping(value = "/recovery", method = RequestMethod.GET)
|
||||
public CommonResult<Object> recovery(@RequestParam(value = "id") Integer id) {
|
||||
if (systemStoreService.recovery(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,117 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.system.SystemStoreStaff;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.SystemStoreStaffRequest;
|
||||
import com.yzt.common.response.SystemStoreStaffResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.SystemStoreStaffService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 门店店员表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/store/staff")
|
||||
@Api(tags = "设置 -- 提货点 -- 核销员")
|
||||
public class SystemStoreStaffController {
|
||||
|
||||
@Autowired
|
||||
private SystemStoreStaffService systemStoreStaffService;
|
||||
|
||||
/**
|
||||
* 分页显示门店核销员列表
|
||||
* @param storeId 门店id
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:staff:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemStoreStaffResponse>> getList(@RequestParam(name = "storeId", required = false, defaultValue = "0") Integer storeId,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemStoreStaffResponse> systemStoreStaffCommonPage =
|
||||
CommonPage.restPage(systemStoreStaffService.getList(storeId, pageParamRequest));
|
||||
return CommonResult.success(systemStoreStaffCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增门店店员表
|
||||
* @param systemStoreStaffRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:staff:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @ModelAttribute SystemStoreStaffRequest systemStoreStaffRequest) {
|
||||
if (systemStoreStaffService.saveUnique(systemStoreStaffRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除门店店员表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:staff:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (systemStoreStaffService.removeById(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门店店员表
|
||||
* @param id integer id
|
||||
* @param systemStoreStaffRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:staff:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @ModelAttribute SystemStoreStaffRequest systemStoreStaffRequest) {
|
||||
if (systemStoreStaffService.edit(id, systemStoreStaffRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改门店店员表
|
||||
* @param id integer id
|
||||
* @param status 状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:staff:update:status')")
|
||||
@ApiOperation(value = "修改状态")
|
||||
@RequestMapping(value = "/update/status", method = RequestMethod.GET)
|
||||
public CommonResult<String> updateStatus(@RequestParam Integer id, @RequestParam Integer status) {
|
||||
if (systemStoreStaffService.updateStatus(id, status)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询门店店员表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:staff:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<SystemStoreStaff> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(systemStoreStaffService.getById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,99 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
|
||||
import com.yzt.common.model.system.SystemUserLevel;
|
||||
import com.yzt.common.request.SystemUserLevelRequest;
|
||||
import com.yzt.common.request.SystemUserLevelUpdateShowRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.SystemUserLevelService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 设置用户等级表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/user/level")
|
||||
@Api(tags = "设置 -- 会员等级")
|
||||
public class SystemUserLevelController {
|
||||
|
||||
@Autowired
|
||||
private SystemUserLevelService systemUserLevelService;
|
||||
|
||||
/**
|
||||
* 分页显示设置用户等级表
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:user:level:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<SystemUserLevel>> getList() {
|
||||
return CommonResult.success(systemUserLevelService.getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增等级
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:user:level:save')")
|
||||
@ApiOperation(value = "新增等级")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<Object> save(@RequestBody @Validated SystemUserLevelRequest request) {
|
||||
if (systemUserLevelService.create(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除等级
|
||||
* @param id 等级id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:user:level:delete')")
|
||||
@ApiOperation(value = "删除等级")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<Object> delete(@PathVariable(value = "id") Integer id) {
|
||||
if (systemUserLevelService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新等级
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:user:level:update')")
|
||||
@ApiOperation(value = "更新等级")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
public CommonResult<Object> update(@PathVariable(value = "id") Integer id,
|
||||
@RequestBody @Validated SystemUserLevelRequest request) {
|
||||
if (systemUserLevelService.update(id, request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用/禁用
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:user:level:use')")
|
||||
@ApiOperation(value = "使用/禁用")
|
||||
@RequestMapping(value = "/use", method = RequestMethod.POST)
|
||||
public CommonResult<Object> use(@RequestBody @Validated SystemUserLevelUpdateShowRequest request) {
|
||||
if (systemUserLevelService.updateShow(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.SystemWriteOffOrderSearchRequest;
|
||||
import com.yzt.common.response.SystemWriteOffOrderResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.StoreOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 订单表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/store/order")
|
||||
@Api(tags = "设置 -- 提货点 -- 核销订单") //配合swagger使用
|
||||
public class SystemWriteOffOrderController {
|
||||
|
||||
@Autowired
|
||||
private StoreOrderService storeOrderService;
|
||||
|
||||
/**
|
||||
* 分页显示订单表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:system:order:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
||||
public CommonResult<SystemWriteOffOrderResponse> getList(
|
||||
@Validated SystemWriteOffOrderSearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(storeOrderService.getWriteOffList(request, pageParamRequest));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.TemplateMessageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 微信模板 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/wechat/template")
|
||||
@Api(tags = "微信 -- 消息模版") //配合swagger使用
|
||||
public class TemplateMessageController {
|
||||
|
||||
@Autowired
|
||||
private TemplateMessageService templateMessageService;
|
||||
|
||||
/**
|
||||
* 公众号模板消息同步
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:whcbqhn:sync')")
|
||||
@ApiOperation(value = "公众号模板消息同步")
|
||||
@RequestMapping(value = "/whcbqhn/sync", method = RequestMethod.POST)
|
||||
public CommonResult<String> whcbqhnSync() {
|
||||
if (templateMessageService.whcbqhnSync()) {
|
||||
return CommonResult.success("公众号模板消息同步成功");
|
||||
}
|
||||
return CommonResult.failed("公众号模板消息同步失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序订阅消息同步
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:routine:sync')")
|
||||
@ApiOperation(value = "小程序订阅消息同步")
|
||||
@RequestMapping(value = "/routine/sync", method = RequestMethod.POST)
|
||||
public CommonResult<String> routineSync() {
|
||||
if (templateMessageService.routineSync()) {
|
||||
return CommonResult.success("小程序订阅消息同步成功");
|
||||
}
|
||||
return CommonResult.failed("小程序订阅消息同步失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.TenantPageRequest;
|
||||
import com.yzt.common.request.TenantSaveRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.vo.TenantVo;
|
||||
import com.yzt.common.vo.WechatMerchantConfigVo;
|
||||
import com.yzt.service.service.TenantService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: pengsz
|
||||
* @Date: 2025/11/07
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/system/tenant")
|
||||
@Api(tags = "租户服务")
|
||||
public class TenantController {
|
||||
|
||||
@Autowired
|
||||
private TenantService tenantService;
|
||||
|
||||
@ApiOperation(value = "保存租户")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<Long> save(@RequestBody TenantSaveRequest tenantSaveRequest) {
|
||||
return CommonResult.success(tenantService.saveTenant(tenantSaveRequest));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/my-tenants")
|
||||
public CommonResult<List<TenantVo>> getCurrentAdminTenants() {
|
||||
return CommonResult.success(tenantService.getTenantsByCurrentAdmin());
|
||||
}
|
||||
/**
|
||||
* 分页显示后台管理员表
|
||||
* @param tenantRequest 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<CommonPage<TenantVo>> getList(@Validated TenantPageRequest tenantRequest, PageParamRequest pageParamRequest) {
|
||||
CommonPage<TenantVo> tenantCommonPage = CommonPage.restPage(tenantService.getList(tenantRequest, pageParamRequest));
|
||||
return CommonResult.success(tenantCommonPage);
|
||||
}
|
||||
|
||||
@ApiOperation("获取租户详情")
|
||||
@GetMapping("/info/{tenantId}")
|
||||
public CommonResult<TenantVo> info(@PathVariable(value = "tenantId") Long tenantId) {
|
||||
return CommonResult.success(tenantService.getInfo(tenantId));
|
||||
}
|
||||
|
||||
@ApiOperation("启用/禁用租户")
|
||||
@PostMapping("/setStatus")
|
||||
public CommonResult<Boolean> setStatus(@RequestBody @Validated Integer status ,Long tenantId) {
|
||||
return CommonResult.success(tenantService.setStatus(status,tenantId));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "物理删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (tenantService.removeById(id)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.vo.FileResultVo;
|
||||
import com.yzt.service.service.UploadService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
/**
|
||||
* 上传文件 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/upload")
|
||||
@Api(tags = "上传文件")
|
||||
public class UploadController {
|
||||
|
||||
@Autowired
|
||||
private UploadService uploadService;
|
||||
|
||||
/**
|
||||
* 图片上传
|
||||
*/
|
||||
// @PreAuthorize("hasAuthority('admin:upload:image')")
|
||||
@ApiOperation(value = "图片上传")
|
||||
@RequestMapping(value = "/image", method = RequestMethod.POST)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "model", value = "模块 用户user,商品product,微信wechat,news文章"),
|
||||
@ApiImplicitParam(name = "pid", value = "分类ID 0编辑器,1商品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图,7前台用户,8微信系列 ", allowableValues = "range[0,1,2,3,4,5,6,7,8]")
|
||||
})
|
||||
public CommonResult<FileResultVo> image(MultipartFile multipart,
|
||||
@RequestParam(value = "model") String model,
|
||||
@RequestParam(value = "pid") Integer pid) throws IOException {
|
||||
return CommonResult.success(uploadService.imageUpload(multipart, model, pid));
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*/
|
||||
// @PreAuthorize("hasAuthority('admin:upload:file')")
|
||||
@ApiOperation(value = "文件上传")
|
||||
@RequestMapping(value = "/file", method = RequestMethod.POST)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "model", value = "模块 用户user,商品product,微信wechat,news文章"),
|
||||
@ApiImplicitParam(name = "pid", value = "分类ID 0编辑器,1商品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图,7前台用户,8微信系列 ", allowableValues = "range[0,1,2,3,4,5,6,7,8]")
|
||||
})
|
||||
public CommonResult<FileResultVo> file(MultipartFile multipart,
|
||||
@RequestParam(value = "model") String model,
|
||||
@RequestParam(value = "pid") Integer pid) throws IOException {
|
||||
return CommonResult.success(uploadService.fileUpload(multipart, model, pid));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,240 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
|
||||
import com.yzt.common.model.user.User;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.*;
|
||||
import com.yzt.common.response.TopDetail;
|
||||
import com.yzt.common.response.UserBrokerageRecordResponse;
|
||||
import com.yzt.common.response.UserCenterResponse;
|
||||
import com.yzt.common.response.UserResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.UserBrokerageRecordService;
|
||||
import com.yzt.service.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user")
|
||||
@Api(tags = "会员管理")
|
||||
@Validated
|
||||
public class UserController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private UserBrokerageRecordService userBrokerageRecordService;
|
||||
|
||||
/**
|
||||
* 分页显示用户表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserResponse>> getList(@ModelAttribute @Validated UserSearchRequest request,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserResponse> userCommonPage = CommonPage.restPage(userService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(userCommonPage);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "指定用户(uid)的被推广人列表")
|
||||
@RequestMapping(value = "/promoted", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserResponse>> getPromotedUserList(@ModelAttribute @Validated UserSearchRequest request,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserResponse> userCommonPage = CommonPage.restPage(userService.getPromotedUserList(request, pageParamRequest));
|
||||
return CommonResult.success(userCommonPage);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取指定用户的奖励记录列表")
|
||||
@RequestMapping(value = "/brokerage/{uid}", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserBrokerageRecordResponse>> getUserBrokerageRecords(@PathVariable Integer uid,String customerName, String phone,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserBrokerageRecordResponse> userCommonPage = CommonPage.restPage(userBrokerageRecordService.getUserBrokerageRecords(uid, customerName,phone,pageParamRequest));
|
||||
return CommonResult.success(userCommonPage);
|
||||
}
|
||||
/**
|
||||
* 创建用户表
|
||||
* @param userRequest 创建参数
|
||||
*/
|
||||
@ApiOperation(value = "创建")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
public CommonResult<String> create(@RequestBody @Validated UserCreateRequest userRequest) {
|
||||
if (userService.createUser(userRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户表
|
||||
* @param id integer id
|
||||
* @param userRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated UserUpdateRequest userRequest) {
|
||||
userRequest.setUid(id);
|
||||
if (userService.updateUser(userRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户手机号
|
||||
* @param id 用户uid
|
||||
* @param phone 手机号
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:update:phone')")
|
||||
@ApiOperation(value = "修改用户手机号")
|
||||
@RequestMapping(value = "/update/phone", method = RequestMethod.GET)
|
||||
public CommonResult<String> updatePhone(@RequestParam(name = "id") Integer id, @RequestParam(name = "phone") String phone) {
|
||||
if (userService.updateUserPhone(id, phone)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户详情
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<User> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(userService.getInfoByUid(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户详情
|
||||
* @param phone Integer
|
||||
*/
|
||||
@ApiOperation(value = "详情通过手机号查询")
|
||||
@RequestMapping(value = "/by-phone", method = RequestMethod.GET)
|
||||
public CommonResult<UserCenterResponse> infoByPhone(@RequestParam(value = "phone") String phone) {
|
||||
return CommonResult.success(userService.getUserCenterResponseByPhone(phone));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数类型查询会员对应的信息
|
||||
* @param userId Integer 会员id
|
||||
* @param type int 类型 0=消费记录,1=积分明细,2=签到记录,3=持有优惠券,4=余额变动,5=好友关系
|
||||
* @param pageParamRequest PageParamRequest 分页
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:infobycondition')")
|
||||
@ApiOperation(value="会员详情")
|
||||
@RequestMapping(value = "/infobycondition", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId",example = "1", required = true),
|
||||
@ApiImplicitParam(name = "type", value="0=消费记录,1=积分明细,2=签到记录,3=持有优惠券,4=余额变动,5=好友关系", example = "0"
|
||||
, required = true)
|
||||
})
|
||||
public CommonResult<CommonPage<T>> infoByCondition(@RequestParam(name = "userId") @Valid Integer userId,
|
||||
@RequestParam(name = "type") @Valid @Max(5) @Min(0) int type,
|
||||
@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage((List<T>) userService.getInfoByCondition(userId,type,pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员详情页Top数据
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:topdetail')")
|
||||
@ApiOperation(value = "会员详情页Top数据")
|
||||
@RequestMapping(value = "topdetail", method = RequestMethod.GET)
|
||||
public CommonResult<TopDetail> topDetail (@RequestParam @Valid Integer userId) {
|
||||
return CommonResult.success(userService.getTopDetail(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作积分
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:operate:founds')")
|
||||
@ApiOperation(value = "积分余额")
|
||||
@RequestMapping(value = "/operate/founds", method = RequestMethod.GET)
|
||||
public CommonResult<Object> founds(@Validated UserOperateIntegralMoneyRequest request) {
|
||||
if (userService.updateIntegralMoney(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员分组
|
||||
* @param id String id
|
||||
* @param groupId Integer 分组Id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:group')")
|
||||
@ApiOperation(value = "分组")
|
||||
@RequestMapping(value = "/group", method = RequestMethod.POST)
|
||||
public CommonResult<String> group(@RequestParam String id, @RequestParam String groupId) {
|
||||
if (userService.group(id, groupId)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员标签
|
||||
* @param id String id
|
||||
* @param tagId Integer 标签id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:tag')")
|
||||
@ApiOperation(value = "标签")
|
||||
@RequestMapping(value = "/tag", method = RequestMethod.POST)
|
||||
public CommonResult<String> tag(@RequestParam String id, @RequestParam String tagId) {
|
||||
if (userService.tag(id, tagId)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改上级推广人
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:update:spread')")
|
||||
@ApiOperation(value = "修改上级推广人")
|
||||
@RequestMapping(value = "/update/spread", method = RequestMethod.POST)
|
||||
public CommonResult<String> editSpread(@Validated @RequestBody UserUpdateSpreadRequest request) {
|
||||
if (userService.editSpread(request)) {
|
||||
return CommonResult.success("修改成功");
|
||||
}
|
||||
return CommonResult.failed("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户会员等级
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:update:level')")
|
||||
@ApiOperation(value = "更新用户会员等级")
|
||||
@RequestMapping(value = "/update/level", method = RequestMethod.POST)
|
||||
public CommonResult<Object> updateUserLevel(@Validated @RequestBody UpdateUserLevelRequest request) {
|
||||
if (userService.updateUserLevel(request)) {
|
||||
return CommonResult.success("更新成功");
|
||||
}
|
||||
return CommonResult.failed("更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,122 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.finance.UserExtract;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.UserExtractRequest;
|
||||
import com.yzt.common.request.UserExtractSearchRequest;
|
||||
import com.yzt.common.response.BalanceResponse;
|
||||
import com.yzt.common.response.UserExtractDetailResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.UserExtractService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 用户提现表 前端控制器
|
||||
* fw_
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/finance/apply")
|
||||
@Api(tags = "财务 -- 提现申请")
|
||||
public class UserExtractController {
|
||||
|
||||
@Autowired
|
||||
private UserExtractService userExtractService;
|
||||
|
||||
/**
|
||||
* 分页显示用户提现表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:apply:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserExtract>> getList(@Validated UserExtractSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<UserExtract> userExtractCommonPage = CommonPage.restPage(userExtractService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(userExtractCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户提现表
|
||||
* @param id integer id
|
||||
* @param userExtractRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:apply:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @Validated UserExtractRequest userExtractRequest){
|
||||
if (userExtractService.updateExtract(id, userExtractRequest)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现申请详情
|
||||
* @param id 提现申请记录id
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:apply:list')")
|
||||
@ApiOperation(value = "提现申请详情")
|
||||
@RequestMapping(value = "/detail", method = RequestMethod.GET)
|
||||
public CommonResult<UserExtractDetailResponse> detail(@RequestParam Integer id) {
|
||||
return CommonResult.success(userExtractService.getDetailById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现统计
|
||||
* @Param dateLimit 时间限制 today,yesterday,lately7,lately30,month,year,/yyyy-MM-dd hh:mm:ss,yyyy-MM-dd hh:mm:ss/
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:apply:balance')")
|
||||
@ApiOperation(value = "提现统计")
|
||||
@RequestMapping(value = "/balance", method = RequestMethod.POST)
|
||||
public CommonResult<BalanceResponse> balance(@RequestParam(value = "dateLimit", required = false,defaultValue = "")
|
||||
String dateLimit){
|
||||
return CommonResult.success(userExtractService.getBalance(dateLimit));
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现审核
|
||||
* @param id 提现id
|
||||
* @param status 审核状态 -1 未通过 0 审核中 1 已提现
|
||||
* @param backMessage 驳回原因
|
||||
* @return 审核结果
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:finance:apply:apply')")
|
||||
@ApiOperation(value = "提现申请审核")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "提现申请记录ID", required = true, dataType = "int", paramType = "query"),
|
||||
@ApiImplicitParam(name = "status", value = "审核状态:-1-未通过,0-审核中,1-已提现", required = true, dataType = "int", paramType = "query"),
|
||||
@ApiImplicitParam(name = "backMessage", value = "驳回原因(status=-1 时必填)", required = false, dataType = "string", paramType = "query"),
|
||||
@ApiImplicitParam(name = "auditRemark", value = "审核备注(记录本次审核说明)", required = false, dataType = "string", paramType = "query"),
|
||||
@ApiImplicitParam(name = "transferVoucherUrl", value = "转账凭证地址(打款截图URL)", required = false, dataType = "string", paramType = "query")
|
||||
})
|
||||
@RequestMapping(value = "/apply", method = RequestMethod.POST)
|
||||
public CommonResult<String> updateStatus(@RequestParam(value = "id") Integer id,
|
||||
@RequestParam(value = "status",defaultValue = "审核状态 -1 未通过 0 审核中 1 已提现") Integer status,
|
||||
@RequestParam(value = "backMessage",defaultValue = "驳回原因", required = false) String backMessage,
|
||||
@RequestParam(value = "auditRemark",required = false) String auditRemark,
|
||||
@RequestParam(value = "transferVoucherUrl",required = false) String transferVoucherUrl){
|
||||
if(userExtractService.updateStatus(id, status, backMessage, auditRemark, transferVoucherUrl)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,99 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.user.UserGroup;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.UserGroupRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.UserGroupService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 用户分组表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user/group")
|
||||
@Api(tags = "会员 -- 分组")
|
||||
public class UserGroupController {
|
||||
|
||||
@Autowired
|
||||
private UserGroupService userGroupService;
|
||||
|
||||
/**
|
||||
* 分页显示用户分组表
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:group:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserGroup>> getList(@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserGroup> userGroupCommonPage = CommonPage.restPage(userGroupService.getList(pageParamRequest));
|
||||
return CommonResult.success(userGroupCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户分组表
|
||||
* @param userGroupRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:group:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated UserGroupRequest userGroupRequest) {
|
||||
if (userGroupService.create(userGroupRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户分组表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:group:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (userGroupService.removeById(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户分组表
|
||||
* @param id integer id
|
||||
* @param userGroupRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:group:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated UserGroupRequest userGroupRequest) {
|
||||
if (userGroupService.edit(id, userGroupRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户分组表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:group:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<UserGroup> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(userGroupService.getById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.AdminIntegralSearchRequest;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.response.UserIntegralRecordResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.UserIntegralRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 用户积分管理控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user/integral")
|
||||
@Api(tags = "用户积分管理")
|
||||
public class UserIntegralController {
|
||||
|
||||
@Autowired
|
||||
private UserIntegralRecordService integralRecordService;
|
||||
|
||||
/**
|
||||
* 积分分页列表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:integral:list')")
|
||||
@ApiOperation(value = "积分分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
||||
public CommonResult<CommonPage<UserIntegralRecordResponse>> getList(@RequestBody @Validated AdminIntegralSearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserIntegralRecordResponse> restPage = CommonPage.restPage(integralRecordService.findAdminList(request, pageParamRequest));
|
||||
return CommonResult.success(restPage);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.user.UserLevel;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.UserLevelService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* 用户等级记录表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user/level")
|
||||
@Api(tags = "会员 -- 等级")
|
||||
public class UserLevelController {
|
||||
|
||||
@Autowired
|
||||
private UserLevelService userLevelService;
|
||||
|
||||
/**
|
||||
* 分页显示用户等级记录表
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:level:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserLevel>> getList(@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserLevel> userLevelCommonPage = CommonPage.restPage(userLevelService.getList(pageParamRequest));
|
||||
return CommonResult.success(userLevelCommonPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,111 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.system.SystemAdmin;
|
||||
import com.yzt.common.model.user.User;
|
||||
import com.yzt.common.model.user.UserLevelUpgradeAudit;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.SystemStoreStaffRequest;
|
||||
import com.yzt.common.request.UserLevelUpgradeAuditQueryRequest;
|
||||
import com.yzt.common.request.UserLevelUpgradeAuditRequest;
|
||||
import com.yzt.common.response.UserLevelUpgradeAuditResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.vo.LoginUserVo;
|
||||
import com.yzt.service.service.UserLevelUpgradeAuditService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* @Author: pengsz
|
||||
* @Date: 2025/11/22
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user/upgrade-audit")
|
||||
@Api(tags = "会员 -- 等级审核")
|
||||
public class UserLevelUpgradeAuditController {
|
||||
|
||||
@Autowired
|
||||
private UserLevelUpgradeAuditService userLevelUpgradeAuditService;
|
||||
|
||||
/**
|
||||
* 分页显示用户等级记录表
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserLevelUpgradeAuditResponse>> getList(@Validated PageParamRequest pageParamRequest, UserLevelUpgradeAuditQueryRequest request) {
|
||||
CommonPage<UserLevelUpgradeAuditResponse> userLevelUpgradeAuditCommonPage = CommonPage.restPage(userLevelUpgradeAuditService.getList(pageParamRequest,request));
|
||||
return CommonResult.success(userLevelUpgradeAuditCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @RequestBody UserLevelUpgradeAudit 新增参数
|
||||
*/
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.POST)
|
||||
public CommonResult<String> edit(@RequestBody UserLevelUpgradeAudit request) {
|
||||
if (userLevelUpgradeAuditService.edit(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @RequestBody UserLevelUpgradeAudit 新增参数
|
||||
*/
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody UserLevelUpgradeAudit request) {
|
||||
if (userLevelUpgradeAuditService.create(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户详情
|
||||
* @param id Integer
|
||||
*/@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<UserLevelUpgradeAuditResponse> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(userLevelUpgradeAuditService.getInfoById(id));
|
||||
}
|
||||
/**
|
||||
* 审核通过
|
||||
*/
|
||||
@ApiOperation(value = "审核通过")
|
||||
@RequestMapping(value = "/approve", method = RequestMethod.POST)
|
||||
public CommonResult<Object> approve(@Validated @RequestBody UserLevelUpgradeAuditRequest request) {
|
||||
LoginUserVo loginUser = (LoginUserVo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
SystemAdmin systemAdmin = loginUser.getUser();
|
||||
if (userLevelUpgradeAuditService.approve(request, systemAdmin.getId().longValue())) {
|
||||
return CommonResult.success("审核通过成功");
|
||||
}
|
||||
return CommonResult.failed("审核通过失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核拒绝
|
||||
*/
|
||||
@ApiOperation(value = "审核拒绝")
|
||||
@RequestMapping(value = "/reject", method = RequestMethod.POST)
|
||||
public CommonResult<Object> reject(@Validated @RequestBody UserLevelUpgradeAuditRequest request) {
|
||||
LoginUserVo loginUser = (LoginUserVo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
SystemAdmin systemAdmin = loginUser.getUser();
|
||||
if (userLevelUpgradeAuditService.reject(request, systemAdmin.getId().longValue())) {
|
||||
return CommonResult.success("审核拒绝成功");
|
||||
}
|
||||
return CommonResult.failed("审核拒绝失败");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.user.UserRechargeApplication;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.UserRechargeApplicationRequest;
|
||||
import com.yzt.common.request.UserRechargeApplicationSearchRequest;
|
||||
import com.yzt.common.request.UserRechargeSearchRequest;
|
||||
import com.yzt.common.response.UserRechargeApplicationResponse;
|
||||
import com.yzt.common.response.UserRechargeResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.UserRechargeApplicationService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: pengsz
|
||||
* @Date: 2025/12/01
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user/recharge")
|
||||
@Api(tags = "财务 -- 充值申请")
|
||||
public class UserRechargeApplicationController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserRechargeApplicationService userRechargeApplicationService;
|
||||
|
||||
/**
|
||||
* 分页显示用户充值表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserRechargeApplicationResponse>> getList(@Validated UserRechargeApplicationSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<UserRechargeApplicationResponse> userRechargeCommonPage = CommonPage.restPage(userRechargeApplicationService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(userRechargeCommonPage);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 用户充值审核
|
||||
// * @param status 充值状态userRechargeApprove
|
||||
// * */
|
||||
// @ApiOperation(value = "用户充值审核")
|
||||
// @RequestMapping(value = "/approve", method = RequestMethod.POST)
|
||||
// public CommonResult<Boolean> approve(@Validated Integer status, Integer id){
|
||||
// return CommonResult.success(userRechargeApplicationService.approve(status,id));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 用户充值审核
|
||||
* @param request 充值状态
|
||||
* */
|
||||
@ApiOperation(value = "用户充值审核")
|
||||
@RequestMapping(value = "/approve", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> userRechargeApprove(@Validated @RequestBody UserRechargeApplicationRequest request){
|
||||
return CommonResult.success(userRechargeApplicationService.approve(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户充值审核
|
||||
* @param request 充值状态
|
||||
* */
|
||||
@ApiOperation(value = "用户充值申请记录新增")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> create(@Validated @RequestBody UserRechargeApplicationRequest request){
|
||||
return CommonResult.success(userRechargeApplicationService.create(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户充值申请信息
|
||||
* @param id 充值状态
|
||||
* */
|
||||
@ApiOperation(value = "用户充值申请记录信息")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<UserRechargeApplicationResponse> info(@Validated Integer id){
|
||||
return CommonResult.success(userRechargeApplicationService.info(id));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.UserRechargeApplicationRequest;
|
||||
import com.yzt.common.request.UserRechargeSearchRequest;
|
||||
import com.yzt.common.response.UserRechargeResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.UserRechargeApplicationService;
|
||||
import com.yzt.service.service.UserRechargeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
/**
|
||||
* 用户充值表 前端控制器
|
||||
* fw_
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user/topUpLog")
|
||||
@Api(tags = "财务 -- 充值")
|
||||
public class UserRechargeController {
|
||||
|
||||
@Autowired
|
||||
private UserRechargeService userRechargeService;
|
||||
|
||||
/**
|
||||
* 分页显示用户充值表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:recharge:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserRechargeResponse>> getList(@Validated UserRechargeSearchRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
CommonPage<UserRechargeResponse> userRechargeCommonPage = CommonPage.restPage(userRechargeService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(userRechargeCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值总金额
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:recharge:balance')")
|
||||
@ApiOperation(value = "提现总金额")
|
||||
@RequestMapping(value = "/balance", method = RequestMethod.POST)
|
||||
public CommonResult<HashMap<String, BigDecimal>> balance(){
|
||||
return CommonResult.success(userRechargeService.getBalanceList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.response.*;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.UserStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 统计 -- 用户统计
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/statistics/user")
|
||||
@Api(tags = "用户统计")
|
||||
public class UserStatisticsController {
|
||||
|
||||
@Autowired
|
||||
private UserStatisticsService statisticsService;
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:statistics:user:overview')")
|
||||
@ApiOperation(value = "用户概览")
|
||||
@RequestMapping(value = "/overview", method = RequestMethod.GET)
|
||||
public CommonResult<UserOverviewResponse> getOverview(@RequestParam(value = "dateLimit", defaultValue = "") String dateLimit) {
|
||||
return CommonResult.success(statisticsService.getOverview(dateLimit));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:statistics:user:channel')")
|
||||
@ApiOperation(value = "用户渠道数据")
|
||||
@RequestMapping(value = "/channel", method = RequestMethod.GET)
|
||||
public CommonResult<List<UserChannelDataResponse>> getChannelData() {
|
||||
return CommonResult.success(statisticsService.getChannelData());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:statistics:user:overview:list')")
|
||||
@ApiOperation(value = "用户概览列表")
|
||||
@RequestMapping(value = "/overview/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<UserOverviewDateResponse>> getOverviewList(@RequestParam(value = "dateLimit", defaultValue = "") String dateLimit) {
|
||||
return CommonResult.success(statisticsService.getOverviewList(dateLimit));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.user.UserTag;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.UserTagRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.UserTagService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 用户标签 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/user/tag")
|
||||
@Api(tags = "会员 -- 标签") //配合swagger使用
|
||||
public class UserTagController {
|
||||
|
||||
@Autowired
|
||||
private UserTagService userTagService;
|
||||
|
||||
/**
|
||||
* 分页显示用户分标签
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:tag:list')")
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserTag>> getList(@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserTag> userTagCommonPage = CommonPage.restPage(userTagService.getList(pageParamRequest));
|
||||
return CommonResult.success(userTagCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户分标签
|
||||
* @param userTagRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:tag:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated UserTagRequest userTagRequest) {
|
||||
if (userTagService.create(userTagRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户分标签
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:tag:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (userTagService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户标签
|
||||
* @param id integer id
|
||||
* @param userTagRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:tag:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated UserTagRequest userTagRequest) {
|
||||
if (userTagService.updateTag(id, userTagRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户标签
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:user:tag:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<UserTag> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(userTagService.getById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
|
||||
import com.yzt.common.response.WeChatJsSdkConfigResponse;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.WechatNewService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 微信 -- 开放平台 admin
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("WeChatAdminController")
|
||||
@RequestMapping("api/admin/wechat")
|
||||
@Api(tags = "微信 -- 开放平台 admin")
|
||||
public class WeChatAdminController {
|
||||
|
||||
@Autowired
|
||||
private WechatNewService wechatNewService;
|
||||
|
||||
/**
|
||||
* 获取微信公众号js配置
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:config')")
|
||||
@ApiOperation(value = "获取微信公众号js配置")
|
||||
@RequestMapping(value = "/config", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "url", value = "页面地址url")
|
||||
public CommonResult<WeChatJsSdkConfigResponse> configJs(@RequestParam(value = "url") String url) {
|
||||
return CommonResult.success(wechatNewService.getJsSdkConfig(url));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.WechatNewService;
|
||||
import com.yzt.service.service.WechatPublicService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 微信缓存表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/wechat/menu")
|
||||
@Api(tags = "微信开放平台 -- 菜单管理")
|
||||
public class WeChatController {
|
||||
|
||||
@Autowired
|
||||
private WechatPublicService wechatPublicService;
|
||||
@Autowired
|
||||
private WechatNewService wechatNewService;
|
||||
|
||||
/**
|
||||
* 获取微信菜单
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:menu:public:get')")
|
||||
@ApiOperation(value = "获取自定义菜单")
|
||||
@RequestMapping(value = "/public/get", method = RequestMethod.GET)
|
||||
public CommonResult<Object> get() {
|
||||
return CommonResult.success(wechatPublicService.getCustomizeMenus());
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建微信菜单
|
||||
* @param data 菜单数据,具体json格式参考微信开放平台
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:menu:public:create')")
|
||||
@ApiOperation(value = "保存自定义菜单")
|
||||
@RequestMapping(value = "/public/create", method = RequestMethod.POST)
|
||||
public CommonResult<JSONObject> create(@RequestBody String data) {
|
||||
if (wechatPublicService.createMenus(data)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除微信菜单
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:menu:public:delete')")
|
||||
@ApiOperation(value = "删除自定义菜单")
|
||||
@RequestMapping(value = "/public/delete", method = RequestMethod.GET)
|
||||
public CommonResult<JSONObject> delete() {
|
||||
if (wechatPublicService.deleteMenus()) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,70 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.service.service.WechatCallbackService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
|
||||
/**
|
||||
* 微信小程序回调
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/public/wechat/mini/callback")
|
||||
@Api(tags = "微信开放平台 -- 小程序回调")
|
||||
public class WechatCallbackController {
|
||||
|
||||
@Autowired
|
||||
private WechatCallbackService wechatCallbackService;
|
||||
|
||||
/**
|
||||
* 小程序回调-自己模拟
|
||||
*/
|
||||
@ApiOperation(value = "小程序回调-自己模拟")
|
||||
@RequestMapping(value = "/test", method = RequestMethod.POST)
|
||||
public String test(@RequestBody String request) {
|
||||
return wechatCallbackService.callback(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序回调
|
||||
* 目前只用于视频号直播
|
||||
*/
|
||||
@ApiOperation(value = "小程序回调")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.POST)
|
||||
public String webHook(@RequestBody String request) {
|
||||
return wechatCallbackService.callback(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信推送地址验证
|
||||
* @param signature 微信加密签名,signature结合了开发者填写的token参数和请求中的timestamp参数、nonce参数。
|
||||
* @param timestamp 时间戳
|
||||
* @param nonce 随机数
|
||||
* @param echostr 随机字符串
|
||||
*/
|
||||
@RequestMapping(value = { "/index" }, method = RequestMethod.GET)
|
||||
private void webHook(
|
||||
@RequestParam(value = "signature", required = false) String signature,
|
||||
@RequestParam(value = "timestamp", required = false) String timestamp,
|
||||
@RequestParam(value = "nonce", required = false) String nonce,
|
||||
@RequestParam(value = "echostr") String echostr,
|
||||
HttpServletResponse response) throws IOException {
|
||||
System.out.println("微信小程序回调测试成功");
|
||||
PrintWriter writer = response.getWriter();
|
||||
writer.print(echostr);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.WechatMediaService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 微信回复表 前端控制器
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/wechat/media")
|
||||
@Api(tags = "微信开放平台 -- 素材")
|
||||
public class WechatMediaController {
|
||||
|
||||
@Autowired
|
||||
private WechatMediaService wechatMediaService;
|
||||
|
||||
/**
|
||||
* 上传
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:media:upload')")
|
||||
@ApiOperation(value = "上传")
|
||||
@RequestMapping(value = "/upload", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, String>> upload(
|
||||
@RequestParam("media") @ApiParam(name = "media", value = "待上传素材图片文件", required = true) MultipartFile file,
|
||||
@RequestParam("type") @ApiParam(name = "type", value = "媒体文件类型,分别有图片(image)、语音(voice", required = true, allowableValues = "range[image,voice]") String type
|
||||
) {
|
||||
return CommonResult.success(wechatMediaService.upload(file, type));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,132 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
import com.yzt.common.model.wechat.WechatReply;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
import com.yzt.common.request.WechatReplyRequest;
|
||||
import com.yzt.common.request.WechatReplySearchRequest;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.WechatReplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 微信关键字回复表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/wechat/keywords/reply")
|
||||
@Api(tags = "微信开放平台 -- 微信关键字回复")
|
||||
public class WechatReplyController {
|
||||
|
||||
@Autowired
|
||||
private WechatReplyService wechatReplyService;
|
||||
|
||||
/**
|
||||
* 分页显示微信关键字回复表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<WechatReply>> getList(@Validated WechatReplySearchRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<WechatReply> wechatReplyCommonPage = CommonPage.restPage(wechatReplyService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(wechatReplyCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增微信关键字回复表
|
||||
* @param wechatReplyRequest 新增参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated WechatReplyRequest wechatReplyRequest) {
|
||||
WechatReply wechatReply = new WechatReply();
|
||||
BeanUtils.copyProperties(wechatReplyRequest, wechatReply);
|
||||
if (wechatReplyService.create(wechatReply)) {
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除微信关键字回复表
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
||||
if (wechatReplyService.removeById(id)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改微信关键字回复表
|
||||
* @param wechatReplyRequest 修改参数
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestBody @Validated WechatReplyRequest wechatReplyRequest) {
|
||||
if (wechatReplyService.updateReply(wechatReplyRequest)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
* @param id integer id
|
||||
* @param status boolean 状态
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:status')")
|
||||
@ApiOperation(value = "状态")
|
||||
@RequestMapping(value = "/status", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam(value = "id") Integer id, @RequestParam(value = "status") Boolean status) {
|
||||
if (wechatReplyService.updateStatus(id, status)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询微信关键字回复表信息
|
||||
* @param id Integer
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<WechatReply> info(@RequestParam(value = "id") Integer id) {
|
||||
WechatReply wechatReply = wechatReplyService.getInfo(id);
|
||||
return CommonResult.success(wechatReply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关键字查询数据
|
||||
* @param keywords String 关键字
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:wechat:keywords:reply:info:keywords')")
|
||||
@ApiOperation(value = "根据关键字查询数据")
|
||||
@RequestMapping(value = "/info/keywords", method = RequestMethod.GET)
|
||||
public CommonResult<WechatReply> info(@RequestParam(value = "keywords") String keywords) {
|
||||
WechatReply wechatReply = wechatReplyService.getVoByKeywords(keywords);
|
||||
return CommonResult.success(wechatReply);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
package com.yzt.admin.controller;
|
||||
|
||||
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.YlyPrintService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 易联云打印订单
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/admin/yly")
|
||||
@Api(tags = "易联云 打印订单小票") //配合swagger使用
|
||||
public class YlyPrintController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private YlyPrintService ylyPrintService;
|
||||
|
||||
@PreAuthorize("hasAuthority('admin:yly:print')")
|
||||
@ApiOperation(value = "打印小票")
|
||||
@RequestMapping(value = "/print/{ordid}", method = RequestMethod.GET)
|
||||
public CommonResult<String> updateStatus(@PathVariable String ordid) {
|
||||
ylyPrintService.YlyPrint(ordid,false);
|
||||
return CommonResult.success();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.yzt.admin.copyright;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 版权信息响应对象
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "CopyrightInfoResponse对象", description = "版权信息响应对象")
|
||||
public class CopyrightInfoResponse {
|
||||
|
||||
@ApiModelProperty(value = "管理端API域名")
|
||||
private String domainUrl;
|
||||
|
||||
@ApiModelProperty(value = "项目版本号")
|
||||
private String version;
|
||||
|
||||
@ApiModelProperty(value = "版权标签")
|
||||
private Integer label;
|
||||
|
||||
@ApiModelProperty(value = "授权码")
|
||||
private String authCode;
|
||||
|
||||
@ApiModelProperty(value = "版权状态:-2=API域名未配置 -1=未提交,0-待审核,1-授权成功,2-审核失败")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "公司信息")
|
||||
private String companyName;
|
||||
|
||||
@ApiModelProperty(value = "公司图片")
|
||||
private String companyImage;
|
||||
|
||||
@ApiModelProperty(value = "版权码")
|
||||
private String copyright;
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.yzt.admin.copyright;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 编辑公司版权信息请求对象
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "CopyrightUpdateInfoRequest对象", description = "编辑公司版权信息请求对象")
|
||||
public class CopyrightUpdateInfoRequest {
|
||||
|
||||
@ApiModelProperty(value = "公司信息")
|
||||
@NotBlank(message = "公司信息不能为空")
|
||||
private String companyName;
|
||||
|
||||
@ApiModelProperty(value = "公司图片")
|
||||
// @NotBlank(message = "公司版权图片不能为空")
|
||||
private String companyImage;
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package com.yzt.admin.filter;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.yzt.common.vo.LoginUserVo;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* token过滤器 验证token有效性
|
||||
*/
|
||||
//@Component
|
||||
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
||||
|
||||
@Resource
|
||||
private TokenComponent tokenComponent;
|
||||
|
||||
/**
|
||||
* 过滤请求,验证token有效性
|
||||
* @param request HttpServletRequest 请求对象
|
||||
* response HttpServletResponse 响应对象
|
||||
* filterChain FilterChain 过滤器链
|
||||
*/
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
|
||||
LoginUserVo loginUser = tokenComponent.getLoginUser( request);
|
||||
// if (ObjectUtil.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
|
||||
if (ObjectUtil.isNotNull(loginUser)) {
|
||||
tokenComponent.verifyToken(loginUser);
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
|
||||
authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
// 将authentication信息放入到上下文对象中
|
||||
SecurityContextHolder.getContext().setAuthentication(authenticationToken);
|
||||
}
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.yzt.admin.filter;
|
||||
|
||||
|
||||
import com.yzt.common.config.YztConfig;
|
||||
import com.yzt.common.utils.RequestUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.security.web.FilterInvocation;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 返回值输出过滤器
|
||||
*/
|
||||
//@Component
|
||||
public class ResponseFilter implements Filter {
|
||||
|
||||
|
||||
@Autowired
|
||||
YztConfig yztConfig;
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest servletRequest, ServletResponse response, FilterChain filterChain)
|
||||
throws IOException, ServletException {
|
||||
ResponseWrapper wrapperResponse = new ResponseWrapper((HttpServletResponse) response);//转换成代理类
|
||||
FilterInvocation fi = new FilterInvocation(servletRequest, (ServletResponse) wrapperResponse, filterChain);
|
||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
|
||||
//OPTIONS请求直接放行
|
||||
if(request.getMethod().equals(HttpMethod.OPTIONS.toString())){
|
||||
fi.getChain().doFilter(fi.getRequest(), fi.getResponse());
|
||||
return;
|
||||
}
|
||||
// 这里只拦截返回,直接让请求过去,如果在请求前有处理,可以在这里处理
|
||||
filterChain.doFilter(servletRequest, (ServletResponse) wrapperResponse);
|
||||
byte[] content = wrapperResponse.getContent();//获取返回值
|
||||
//判断是否有值
|
||||
if (content.length > 0) {
|
||||
String str = new String(content, StandardCharsets.UTF_8);
|
||||
|
||||
try {
|
||||
HttpServletRequest req = (HttpServletRequest) servletRequest;
|
||||
str = new ResponseRouter().filter(str, RequestUtil.getUri((javax.servlet.http.HttpServletRequest) req), yztConfig);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//把返回值输出到客户端
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
if (str.length() > 0) {
|
||||
outputStream.write(str.getBytes());
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
//最后添加这一句,输出到客户端
|
||||
response.flushBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.yzt.admin.filter;
|
||||
|
||||
import com.yzt.common.config.YztConfig;
|
||||
import com.yzt.common.constants.UploadConstants;
|
||||
import com.yzt.common.utils.SpringUtil;
|
||||
import com.yzt.service.service.SystemAttachmentService;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import org.springframework.util.PathMatcher;
|
||||
|
||||
/**
|
||||
* response路径处理
|
||||
*
|
||||
*/
|
||||
public class ResponseRouter {
|
||||
|
||||
public String filter(String data, String path, YztConfig yztConfig) {
|
||||
boolean result = un().contains(path);
|
||||
if (result) {
|
||||
return data;
|
||||
}
|
||||
|
||||
//系统不用过滤的URL,针对数据而非token
|
||||
PathMatcher pathMatcher = new AntPathMatcher();
|
||||
for (String configUrl : yztConfig.getIgnored()) {
|
||||
if(pathMatcher.match(path, configUrl)){
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
if (!path.contains("api/admin/") && !path.contains("api/front/")) {
|
||||
return data;
|
||||
}
|
||||
|
||||
//根据需要处理返回值 && !data.contains("data:image/png;base64")
|
||||
if ((data.contains(UploadConstants.UPLOAD_FILE_KEYWORD + "/"))
|
||||
|| data.contains(UploadConstants.DOWNLOAD_FILE_KEYWORD) || data.contains(UploadConstants.UPLOAD_AFTER_FILE_KEYWORD)) {
|
||||
if (data.contains(UploadConstants.DOWNLOAD_FILE_KEYWORD + "/" + UploadConstants.UPLOAD_MODEL_PATH_EXCEL)) {
|
||||
data = SpringUtil.getBean(SystemAttachmentService.class).prefixFile(data);
|
||||
} else if (data.contains(UploadConstants.UPLOAD_AFTER_FILE_KEYWORD + "/")) {
|
||||
data = SpringUtil.getBean(SystemAttachmentService.class).prefixUploadf(data);
|
||||
} else {
|
||||
data = SpringUtil.getBean(SystemAttachmentService.class).prefixImage(data);
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public static String un() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.yzt.admin.filter;
|
||||
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.WriteListener;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpServletResponseWrapper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Response包装类
|
||||
*
|
||||
*/
|
||||
public class ResponseWrapper extends HttpServletResponseWrapper {
|
||||
|
||||
private ByteArrayOutputStream buffer;
|
||||
|
||||
private ServletOutputStream out;
|
||||
|
||||
public ResponseWrapper(HttpServletResponse httpServletResponse) {
|
||||
super(httpServletResponse);
|
||||
buffer = new ByteArrayOutputStream();
|
||||
out = new WrapperOutputStream(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletOutputStream getOutputStream() {
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushBuffer()
|
||||
throws IOException {
|
||||
if (out != null) {
|
||||
out.flush();
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] getContent()
|
||||
throws IOException {
|
||||
flushBuffer();
|
||||
return buffer.toByteArray();
|
||||
}
|
||||
|
||||
static class WrapperOutputStream extends ServletOutputStream {
|
||||
private ByteArrayOutputStream bos;
|
||||
|
||||
public WrapperOutputStream(ByteArrayOutputStream bos) {
|
||||
this.bos = bos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) {
|
||||
bos.write(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWriteListener(WriteListener arg0) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,129 @@
|
||||
package com.yzt.admin.filter;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yzt.common.constants.Constants;
|
||||
import com.yzt.common.utils.RedisUtil;
|
||||
import com.yzt.common.vo.LoginUserVo;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* token验证处理
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class TokenComponent {
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L;
|
||||
|
||||
private static final Long MILLIS_MINUTE = 60 * 1000L;
|
||||
|
||||
// 令牌有效期(默认30分钟) todo 调试期改为5小时
|
||||
// private static final int expireTime = 30;
|
||||
private static final int expireTime = 5 * 60;
|
||||
|
||||
// Redis 存储的key
|
||||
private static final String TOKEN_REDIS = "TOKEN:ADMIN:";
|
||||
|
||||
/**
|
||||
* 获取用户身份信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
public LoginUserVo getLoginUser(HttpServletRequest request) {
|
||||
// 获取请求携带的令牌
|
||||
String token = getToken(request);
|
||||
if (StrUtil.isNotEmpty(token)) {
|
||||
String userKey = getTokenKey(token);
|
||||
return redisUtil.get(userKey);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户身份信息
|
||||
*/
|
||||
public void setLoginUser(LoginUserVo loginUser) {
|
||||
if (ObjectUtil.isNotNull(loginUser) && StrUtil.isNotEmpty(loginUser.getToken())) {
|
||||
refreshToken(loginUser);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户身份信息
|
||||
*/
|
||||
public void delLoginUser(String token) {
|
||||
if (StrUtil.isNotEmpty(token)) {
|
||||
String userKey = getTokenKey(token);
|
||||
redisUtil.delete(userKey);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建令牌
|
||||
*
|
||||
* @param loginUser 用户信息
|
||||
* @return 令牌
|
||||
*/
|
||||
public String createToken(LoginUserVo loginUser) {
|
||||
String token = UUID.randomUUID().toString().replace("-", "");
|
||||
loginUser.setToken(token);
|
||||
// setUserAgent(loginUser);
|
||||
refreshToken(loginUser);
|
||||
return token;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证令牌有效期,相差不足20分钟,自动刷新缓存
|
||||
*
|
||||
* @param loginUser LoginUserVo
|
||||
*/
|
||||
public void verifyToken(LoginUserVo loginUser) {
|
||||
long expireTime = loginUser.getExpireTime();
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (expireTime - currentTime <= MILLIS_MINUTE_TEN)
|
||||
{
|
||||
refreshToken(loginUser);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新令牌有效期
|
||||
*
|
||||
* @param loginUser 登录信息
|
||||
*/
|
||||
public void refreshToken(LoginUserVo loginUser) {
|
||||
loginUser.setLoginTime(System.currentTimeMillis());
|
||||
loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE);
|
||||
// 根据uuid将loginUser缓存
|
||||
String userKey = getTokenKey(loginUser.getToken());
|
||||
redisUtil.set(userKey, loginUser, (long) expireTime, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求token
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @return token
|
||||
*/
|
||||
private String getToken(HttpServletRequest request) {
|
||||
String token = request.getHeader(Constants.HEADER_AUTHORIZATION_KEY);
|
||||
if (StrUtil.isNotEmpty(token) && token.startsWith(TOKEN_REDIS)) {
|
||||
token = token.replace(TOKEN_REDIS, "");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
private String getTokenKey(String uuid) {
|
||||
return TOKEN_REDIS + uuid;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.yzt.admin.manager;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.result.CommonResultCode;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 认证失败处理类 返回未授权
|
||||
*/
|
||||
@Component
|
||||
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable {
|
||||
|
||||
private static final long serialVersionUID = -8970718410437077606L;
|
||||
|
||||
@Override
|
||||
public void commence(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) {
|
||||
// String msg = StrUtil.format("请求访问:{},认证失败,无法访问系统资源", httpServletRequest.getRequestURI());
|
||||
httpServletResponse.setStatus(200);
|
||||
httpServletResponse.setContentType("application/json");
|
||||
httpServletResponse.setCharacterEncoding("utf-8");
|
||||
try {
|
||||
httpServletResponse.getWriter().print(JSONObject.toJSONString(CommonResult.failed(CommonResultCode.UNAUTHORIZED)));
|
||||
} catch (IOException ioException) {
|
||||
ioException.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.yzt.admin.manager;
|
||||
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.ProviderNotFoundException;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 自定义认证管理器
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class CusAuthenticationManager implements AuthenticationManager {
|
||||
|
||||
// private final CustomAuthenticationProvider customAuthenticationProvider = new CustomAuthenticationProvider();
|
||||
private final CustomAuthenticationProvider customAuthenticationProvider;
|
||||
|
||||
public CusAuthenticationManager(CustomAuthenticationProvider customAuthenticationProvider) {
|
||||
this.customAuthenticationProvider = customAuthenticationProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
||||
Authentication result = customAuthenticationProvider.authenticate(authentication);
|
||||
if (Objects.nonNull(result)) {
|
||||
return result;
|
||||
}
|
||||
throw new ProviderNotFoundException("Authentication failed!");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.yzt.admin.manager;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.result.CommonResultCode;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 自定义权限不足处理程序
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class CustomAccessDeniedHandler implements AccessDeniedHandler, Serializable {
|
||||
|
||||
private static final long serialVersionUID = -8970718410437077606L;
|
||||
|
||||
@Override
|
||||
public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AccessDeniedException e) throws IOException, ServletException {
|
||||
httpServletResponse.setStatus(200);
|
||||
httpServletResponse.setContentType("application/json");
|
||||
httpServletResponse.setCharacterEncoding("utf-8");
|
||||
try {
|
||||
httpServletResponse.getWriter().print(JSONObject.toJSONString(CommonResult.failed(CommonResultCode.FORBIDDEN)));
|
||||
} catch (IOException ioException) {
|
||||
ioException.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.yzt.admin.manager;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.yzt.common.exception.YztException;
|
||||
import com.yzt.common.utils.YztUtil;
|
||||
import com.yzt.common.vo.LoginUserVo;
|
||||
import com.yzt.service.service.impl.UserDetailServiceImpl;
|
||||
import org.springframework.security.authentication.AuthenticationProvider;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 自定义验证(admin登录)
|
||||
*/
|
||||
@Component
|
||||
public class CustomAuthenticationProvider implements AuthenticationProvider {
|
||||
|
||||
private UserDetailServiceImpl userDetailsService;
|
||||
|
||||
public CustomAuthenticationProvider(UserDetailServiceImpl userDetailsService) {
|
||||
this.userDetailsService = userDetailsService;
|
||||
}
|
||||
|
||||
// private final UserDetailServiceImpl userDetailsService = new UserDetailServiceImpl();
|
||||
|
||||
@Override
|
||||
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
||||
String name = authentication.getPrincipal().toString();
|
||||
String password = authentication.getCredentials().toString();
|
||||
|
||||
//以下自定义方法,判断是否登录成功
|
||||
LoginUserVo userDetails = (LoginUserVo) userDetailsService.loadUserByUsername(name);
|
||||
if (ObjectUtil.isNull(userDetails)) {
|
||||
throw new YztException("用户名不存在");
|
||||
}
|
||||
// base64加密获取真正密码
|
||||
String encryptPassword = YztUtil.encryptPassword(password, name);
|
||||
if (!userDetails.getUser().getPwd().equals(encryptPassword)) {
|
||||
throw new YztException("账号或者密码不正确");
|
||||
}
|
||||
return new UsernamePasswordAuthenticationToken(userDetails, password, userDetails.getAuthorities());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> authentication) {
|
||||
//确保authentication能转成该类
|
||||
return authentication.equals(UsernamePasswordAuthenticationToken.class);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.yzt.admin.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yzt.admin.model.ScheduleJobLog;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 定时任务日志 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface ScheduleJobLogMapper extends BaseMapper<ScheduleJobLog> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.yzt.admin.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yzt.admin.model.ScheduleJob;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 定时任务 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public interface ScheduleJobMapper extends BaseMapper<ScheduleJob> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package com.yzt.admin.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 定时任务
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("fw_schedule_job")
|
||||
@ApiModel(value="ScheduleJob对象", description="定时任务")
|
||||
public class ScheduleJob implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "任务id")
|
||||
@TableId(value = "job_id", type = IdType.AUTO)
|
||||
private Integer jobId;
|
||||
|
||||
@ApiModelProperty(value = "spring bean名称")
|
||||
private String beanName;
|
||||
|
||||
@ApiModelProperty(value = "方法名")
|
||||
private String methodName;
|
||||
|
||||
@ApiModelProperty(value = "参数")
|
||||
private String params;
|
||||
|
||||
@ApiModelProperty(value = "cron表达式")
|
||||
private String cronExpression;
|
||||
|
||||
@ApiModelProperty(value = "任务状态 0:正常 1:暂停")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Boolean isDelte;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package com.yzt.admin.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 定时任务日志
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("fw_schedule_job_log")
|
||||
@ApiModel(value="ScheduleJobLog对象", description="定时任务日志")
|
||||
public class ScheduleJobLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "任务日志id")
|
||||
@TableId(value = "log_id", type = IdType.AUTO)
|
||||
private Integer logId;
|
||||
|
||||
@ApiModelProperty(value = "任务id")
|
||||
private Integer jobId;
|
||||
|
||||
@ApiModelProperty(value = "spring bean名称")
|
||||
private String beanName;
|
||||
|
||||
@ApiModelProperty(value = "方法名")
|
||||
private String methodName;
|
||||
|
||||
@ApiModelProperty(value = "参数")
|
||||
private String params;
|
||||
|
||||
@ApiModelProperty(value = "任务状态 0:成功 1:失败")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "失败信息")
|
||||
private String error;
|
||||
|
||||
@ApiModelProperty(value = "耗时(单位:毫秒)")
|
||||
private Integer times;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package com.yzt.admin.pub;
|
||||
|
||||
import com.yzt.common.constants.Constants;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.SystemConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
*
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/public/jsconfig")
|
||||
@Api(tags = "公共JS配置")
|
||||
public class GetJSConfig {
|
||||
|
||||
@Autowired
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@PreAuthorize("hasAuthority('public:jsconfig:getcrmebchatconfig')")
|
||||
@ApiOperation(value = "YZT-chat客服统计")
|
||||
@RequestMapping(value = "/getyztbchatconfig", method = RequestMethod.GET)
|
||||
public String set(){
|
||||
return systemConfigService.getValueByKey(Constants.JS_CONFIG_YZT_CHAT_TONGJI);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取移动端域名")
|
||||
@RequestMapping(value = "/get/front/domain", method = RequestMethod.GET)
|
||||
public CommonResult<String> getFrontDomain() {
|
||||
return CommonResult.success(systemConfigService.getFrontDomain());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取平台当前的素材地址")
|
||||
@RequestMapping(value = "/get/admin/mediadomain", method = RequestMethod.GET)
|
||||
public CommonResult<String> getMediaDomain() {
|
||||
return CommonResult.success(systemConfigService.getMediaDomain());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.yzt.admin.pub;
|
||||
|
||||
import com.anji.captcha.model.common.ResponseModel;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.SafetyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 安全验证控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/public/safety")
|
||||
@Api(tags = "安全验证控制器")
|
||||
public class SafetyController {
|
||||
|
||||
@Autowired
|
||||
private SafetyService safetyService;
|
||||
|
||||
@ApiOperation(value = "获取行为验证码")
|
||||
@RequestMapping(value = "/get", method = RequestMethod.POST)
|
||||
public CommonResult<ResponseModel> getSafetyCode(@RequestBody com.anji.captcha.model.vo.CaptchaVO data, HttpServletRequest request) {
|
||||
return CommonResult.success(safetyService.getSafetyCode(data, request));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "验证行为验证码")
|
||||
@RequestMapping(value = "/check", method = RequestMethod.POST)
|
||||
public CommonResult<ResponseModel> checkSafetyCode(@RequestBody com.anji.captcha.model.vo.CaptchaVO data, HttpServletRequest request) {
|
||||
return CommonResult.success(safetyService.checkSafetyCode(data, request));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "行为验证码二次校验")
|
||||
@RequestMapping(value = "/verify", method = RequestMethod.POST)
|
||||
public CommonResult<ResponseModel> verifySafetyCode(@RequestBody com.anji.captcha.model.vo.CaptchaVO data, HttpServletRequest request) {
|
||||
return CommonResult.success(safetyService.verifySafetyCode(data));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.yzt.admin.pub;
|
||||
|
||||
import com.yzt.admin.service.WeChatMessageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
|
||||
/**
|
||||
* 微信缓存表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/public/wechat/message")
|
||||
@Api(tags = "微信开放平台 -- 消息")
|
||||
public class WeChatMessageController {
|
||||
|
||||
@Autowired
|
||||
private WeChatMessageService weChatMessageService;
|
||||
|
||||
/**
|
||||
* 微信关键字回复
|
||||
*
|
||||
*/
|
||||
@ApiOperation(value = "接受微信推送过来的消息")
|
||||
@RequestMapping(value = "/webHook", method = RequestMethod.POST)
|
||||
public String webHook(HttpServletRequest request){
|
||||
return weChatMessageService.init(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信推送地址验证
|
||||
* @param signature
|
||||
* @param timestamp
|
||||
* @param nonce
|
||||
* @param echostr
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequestMapping(value = { "/webHook" }, method = RequestMethod.GET)
|
||||
private void webHook(
|
||||
@RequestParam(value = "signature", required = false) String signature,
|
||||
@RequestParam(value = "timestamp", required = false) String timestamp,
|
||||
@RequestParam(value = "nonce", required = false) String nonce,
|
||||
@RequestParam(value = "echostr") String echostr,
|
||||
HttpServletResponse response) throws IOException {
|
||||
PrintWriter writer = response.getWriter();
|
||||
writer.print(echostr);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,141 @@
|
||||
package com.yzt.admin.pub;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.utils.RestTemplateUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 后台管理员表 前端控制器
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/public/wechat")
|
||||
@Api(tags = "企业微信消息推送")
|
||||
public class WeChatPushController {
|
||||
|
||||
private static String url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=";
|
||||
|
||||
@Resource
|
||||
private RestTemplateUtil restTemplateUtil;
|
||||
|
||||
|
||||
/**
|
||||
* 新增后台管理员表
|
||||
* @param message string message
|
||||
*/
|
||||
@ApiOperation(value = "gitlab钩子")
|
||||
@RequestMapping(value = "/gitlab", method = RequestMethod.POST)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="message", value="推送消息内容"),
|
||||
@ApiImplicitParam(name="token", value="企业微信群token"),
|
||||
})
|
||||
public CommonResult<Object> gitlab(@RequestBody String message,
|
||||
@RequestParam(name = "token", required = true) String token){
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("msgtype", "text");
|
||||
|
||||
Map<String, Object> text = new HashMap<>();
|
||||
|
||||
//需要@的人
|
||||
ArrayList<Object> people = new ArrayList<>();
|
||||
people.add("@all");
|
||||
text.put("mentioned_list", people);
|
||||
|
||||
//gitlab 动作标签
|
||||
JSONObject jsonObject = JSONObject.parseObject(message);
|
||||
String action = jsonObject.getString("object_kind");
|
||||
String content;
|
||||
switch(action){
|
||||
case "push":
|
||||
content = jsonObject.getJSONArray("commits").getJSONObject(0).getJSONObject("author").getString("name") + " " +
|
||||
action + " " +
|
||||
jsonObject.getString("ref").replace("refs/heads/", "") +
|
||||
"\n 备注:\n" +
|
||||
jsonObject.getJSONArray("commits").getJSONObject(0).getString("message");
|
||||
break;
|
||||
case "tag_push":
|
||||
content = jsonObject.getString("user_name") + " " +
|
||||
action + " " +
|
||||
jsonObject.getString("ref").replace("refs/heads/", "") +
|
||||
"\n 备注:\n" +
|
||||
jsonObject.getJSONArray("commits").getJSONObject(0).getString("message");
|
||||
break;
|
||||
case "note":
|
||||
String author = "未知用户";
|
||||
if(jsonObject.containsKey("commit")){
|
||||
author = jsonObject.getJSONObject("commit").getJSONObject("author").getString("name");
|
||||
}
|
||||
|
||||
if(jsonObject.containsKey("last_commit")){
|
||||
author = jsonObject.getJSONObject("last_commit").getJSONObject("author").getString("name");
|
||||
}
|
||||
|
||||
content = author +
|
||||
" 提交代码到 " +
|
||||
jsonObject.getJSONObject("project").getString("default_branch") +
|
||||
"\n 备注:\n" +
|
||||
jsonObject.getJSONObject("object_attributes").getString("note");
|
||||
break;
|
||||
case "merge_request":
|
||||
content = jsonObject.getJSONObject("object_attributes").getJSONObject("assignee").getString("name") + " " +
|
||||
"合并代码, 从 " +
|
||||
jsonObject.getJSONObject("object_attributes").getString("source_branch") + " ---> " +
|
||||
jsonObject.getJSONObject("object_attributes").getString("target_branch") +
|
||||
"\n 备注:\n" +
|
||||
jsonObject.getJSONObject("object_attributes").getJSONObject("last_commit").getString("message");
|
||||
break;
|
||||
default:
|
||||
content = "gitlab 项目有更新";
|
||||
}
|
||||
|
||||
text.put("content", content);
|
||||
map.put("text", text);
|
||||
String result = restTemplateUtil.postMapData(url + token, map);
|
||||
return CommonResult.success(JSONObject.parseObject(result));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增后台管理员表
|
||||
* @param message string message
|
||||
*/
|
||||
@ApiOperation(value = "消息推送")
|
||||
@RequestMapping(value = "/push", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="message", value="推送消息内容"),
|
||||
@ApiImplicitParam(name="token", value="企业微信群token"),
|
||||
})
|
||||
public CommonResult<Object> push(@RequestParam(name = "message") String message,
|
||||
@RequestParam(name = "token") String token){
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("msgtype", "text");
|
||||
|
||||
Map<String, Object> text = new HashMap<>();
|
||||
|
||||
//需要@的人
|
||||
ArrayList<Object> people = new ArrayList<>();
|
||||
people.add("@all");
|
||||
text.put("mentioned_list", people);
|
||||
text.put("content", message);
|
||||
map.put("text", text);
|
||||
String result = restTemplateUtil.postMapData(url + token, map);
|
||||
return CommonResult.success(JSONObject.parseObject(result));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
package com.yzt.admin.pub;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.common.vo.QrCodeVo;
|
||||
import com.yzt.service.service.QrCodeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 类的详细说明
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/public/wechat/mini")
|
||||
@Api(tags = "微信小程序公共控制器")
|
||||
public class WechatMiniCommonController {
|
||||
|
||||
@Autowired
|
||||
private QrCodeService qrCodeService;
|
||||
|
||||
@ApiOperation(value = "获取微信二维码")
|
||||
@RequestMapping(value = "/get/qrcode", method = RequestMethod.POST)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "data", value = "生成小程序码 path 和 scene 不能为空 可查看具体参数https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/qr-code/getUnlimitedQRCode.html#%E8%B0%83%E7%94%A8%E6%96%B9%E5%BC%8F", dataType = "JSONObject", required = true, paramType = "body")
|
||||
})
|
||||
public CommonResult<QrCodeVo> getWecahtQrCode(@RequestBody JSONObject data) {
|
||||
return CommonResult.success(qrCodeService.getWecahtQrCode(data));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.yzt.admin.quartz;
|
||||
|
||||
import com.yzt.admin.model.ScheduleJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
|
||||
/**
|
||||
* 该类将会被org.springframework.scheduling.quartz.SpringBeanJobFactory 实例化
|
||||
* 并使@Autowired 生效
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@DisallowConcurrentExecution
|
||||
public class QuartzJob implements Job {
|
||||
|
||||
@Autowired
|
||||
private ApplicationEventPublisher publisher;
|
||||
|
||||
/**
|
||||
* 任务调度参数key
|
||||
*/
|
||||
public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY";
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
JobDataMap mergedJobDataMap = jobExecutionContext.getMergedJobDataMap();
|
||||
Object o = mergedJobDataMap.get(JOB_PARAM_KEY);
|
||||
ScheduleJob sysJob = (ScheduleJob) o;
|
||||
publisher.publishEvent(new ScheduleJobEvent(sysJob));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.yzt.admin.quartz;
|
||||
|
||||
/**
|
||||
* 定时任务状态
|
||||
*/
|
||||
public class ScheduleConstants {
|
||||
|
||||
public static final Integer NORMAL = 0;// 正常
|
||||
|
||||
public static final Integer PAUSE = 1;// 暂停
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.yzt.admin.quartz;
|
||||
|
||||
import com.yzt.admin.model.ScheduleJob;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 定时任务事件
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class ScheduleJobEvent {
|
||||
|
||||
private final ScheduleJob scheduleJob;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user