mirror of
https://gitee.com/ZhongBangKeJi/crmeb_java.git
synced 2026-05-01 06:21:26 +08:00
更新发布
This commit is contained in:
76
crmeb/crmeb-front/pom.xml
Normal file
76
crmeb/crmeb-front/pom.xml
Normal file
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>crmeb</artifactId>
|
||||
<groupId>com.zbkj</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>crmeb-front</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<crmeb-service>0.0.1-SNAPSHOT</crmeb-service>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zbkj</groupId>
|
||||
<artifactId>crmeb-service</artifactId>
|
||||
<version>${crmeb-service}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<!--打包配置-->
|
||||
<finalName>Crmeb-front</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</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>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.zbkj.front;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 程序主入口
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@EnableAsync //开启异步调用
|
||||
@EnableSwagger2
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) //去掉数据源
|
||||
@ComponentScan(basePackages = {"com.zbkj", "com.zbkj.front"})
|
||||
@MapperScan(basePackages = {"com.zbkj.**.dao"})
|
||||
public class CrmebFrontApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CrmebFrontApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.zbkj.front.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 访问接口不在调用security
|
||||
* @Author 指缝de阳光
|
||||
* @Date 2021/11/26 14:27
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class CloseSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
//super.configure(http);
|
||||
http.csrf().disable();
|
||||
//配置不需要登陆验证
|
||||
http.authorizeRequests().anyRequest().permitAll().and().logout().permitAll();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.zbkj.front.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;
|
||||
|
||||
/** 跨域配置
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@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,56 @@
|
||||
package com.zbkj.front.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配置组件
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@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,36 @@
|
||||
package com.zbkj.front.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配置组件
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@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,55 @@
|
||||
package com.zbkj.front.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配置组件
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@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,131 @@
|
||||
package com.zbkj.front.config;
|
||||
|
||||
import com.zbkj.common.config.CrmebConfig;
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.google.common.base.Predicate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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配置组件
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
@ConfigurationProperties(prefix = "api.doc")
|
||||
public class SwaggerConfig{
|
||||
|
||||
//是否开启swagger,正式环境一般是需要关闭的,可根据springboot的多环境配置进行设置
|
||||
Boolean swaggerEnabled = true;
|
||||
|
||||
@Autowired
|
||||
CrmebConfig crmebConfig;
|
||||
|
||||
@Bean("front")
|
||||
public Docket create1RestApis() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.groupName("front")
|
||||
.host(crmebConfig.getDomain())
|
||||
.apiInfo(apiInfo())
|
||||
// 是否开启
|
||||
.enable(swaggerEnabled)
|
||||
.select()
|
||||
// 扫描的路径包
|
||||
.apis(RequestHandlerSelectors.basePackage("com.zbkj.front"))
|
||||
// 指定路径处理PathSelectors.any()代表所有的路径
|
||||
.paths(frontPathsAnt()) //只监听
|
||||
.build()
|
||||
.securitySchemes(security())
|
||||
.securityContexts(securityContexts())
|
||||
// .globalOperationParameters(pars) // 针对单个url的验证 如果需要的话
|
||||
.pathMapping("/");
|
||||
}
|
||||
|
||||
@Bean("public")
|
||||
public Docket create2RestApis() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.groupName("public")
|
||||
.host(crmebConfig.getDomain())
|
||||
.apiInfo(apiInfo())
|
||||
// 是否开启
|
||||
.enable(swaggerEnabled)
|
||||
.select()
|
||||
// 扫描的路径包
|
||||
.apis(RequestHandlerSelectors.basePackage("com.zbkj.front"))
|
||||
// 指定路径处理PathSelectors.any()代表所有的路径
|
||||
.paths(publicPathsAnt()) //只监听
|
||||
.build()
|
||||
.securitySchemes(security())
|
||||
.securityContexts(securityContexts())
|
||||
// .globalOperationParameters(pars) // 针对单个url的验证 如果需要的话
|
||||
.pathMapping("/");
|
||||
}
|
||||
|
||||
private Predicate<String> frontPathsAnt() {
|
||||
return PathSelectors.ant("/api/front/**");
|
||||
}
|
||||
|
||||
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("Crmeb Java")
|
||||
.description("Crmeb")
|
||||
.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,105 @@
|
||||
package com.zbkj.front.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类的线程配置
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@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,119 @@
|
||||
package com.zbkj.front.config;
|
||||
|
||||
import com.zbkj.common.interceptor.SwaggerInterceptor;
|
||||
import com.zbkj.front.filter.ResponseFilter;
|
||||
import com.zbkj.front.interceptor.FrontTokenInterceptor;
|
||||
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.HandlerInterceptor;
|
||||
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验证拦截器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Configuration
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
// 这里使用一个Bean为的是可以在拦截器中自由注入,也可以在拦截器中使用SpringUtil.getBean 获取
|
||||
// 但是觉得这样更优雅
|
||||
|
||||
@Bean
|
||||
public HandlerInterceptor frontTokenInterceptor(){
|
||||
return new FrontTokenInterceptor();
|
||||
}
|
||||
|
||||
@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(frontTokenInterceptor()).
|
||||
addPathPatterns("/api/front/**").
|
||||
excludePathPatterns("/api/front/index").
|
||||
excludePathPatterns("/api/front/qrcode/**").
|
||||
excludePathPatterns("/api/front/login/mobile").
|
||||
excludePathPatterns("/api/front/login").
|
||||
excludePathPatterns("/api/front/sendCode").
|
||||
excludePathPatterns("/api/front/wechat/**").
|
||||
excludePathPatterns("/api/front/search/keyword").
|
||||
excludePathPatterns("/api/front/share").
|
||||
excludePathPatterns("/api/front/article/**").
|
||||
excludePathPatterns("/api/front/city/**").
|
||||
excludePathPatterns("/api/front/product/hot").
|
||||
excludePathPatterns("/api/front/product/good").
|
||||
excludePathPatterns("/api/front/products/**").
|
||||
excludePathPatterns("/api/front/reply/**").
|
||||
excludePathPatterns("/api/front/user/service/**").
|
||||
excludePathPatterns("/api/front/logistics").
|
||||
excludePathPatterns("/api/front/groom/list/**").
|
||||
excludePathPatterns("/api/front/config").
|
||||
excludePathPatterns("/api/front/category").
|
||||
excludePathPatterns("/api/front/seckill/*").
|
||||
excludePathPatterns("/api/front/seckill/list/*").
|
||||
excludePathPatterns("/api/front/seckill/detail/*").
|
||||
excludePathPatterns("/api/front/ios/*").
|
||||
excludePathPatterns("/api/front/ios/register/binding/phone").
|
||||
excludePathPatterns("api/front/combination/index").
|
||||
excludePathPatterns("api/front/seckill/index").
|
||||
excludePathPatterns("api/front/bargain/index").
|
||||
excludePathPatterns("api/front/combination/index").
|
||||
excludePathPatterns("api/front/index/product/*").
|
||||
excludePathPatterns("api/front/index/color/config").
|
||||
excludePathPatterns("api/front/image/domain").
|
||||
excludePathPatterns("api/front/product/leaderboard").
|
||||
excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
|
||||
}
|
||||
|
||||
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/");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean filterRegister()
|
||||
{
|
||||
//注册过滤器
|
||||
FilterRegistrationBean registration = new FilterRegistrationBean(responseFilter());
|
||||
registration.addUrlPatterns("/*");
|
||||
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,90 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.ArticleResponse;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.article.Article;
|
||||
import com.zbkj.common.model.category.Category;
|
||||
import com.zbkj.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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 文章
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("ArticleFrontController")
|
||||
@RequestMapping("api/front/article")
|
||||
@Api(tags = "文章")
|
||||
public class ArticleController {
|
||||
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
|
||||
/**
|
||||
* 分页列表
|
||||
*/
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list/{cid}", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ArticleResponse>> getList(@PathVariable(name="cid") String cid,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(articleService.getList(cid, pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 热门列表
|
||||
*/
|
||||
@ApiOperation(value = "热门列表")
|
||||
@RequestMapping(value = "/hot/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ArticleResponse>> getHotList() {
|
||||
return CommonResult.success(CommonPage.restPage(articleService.getHotList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 轮播列表
|
||||
*/
|
||||
@ApiOperation(value = "轮播列表")
|
||||
@RequestMapping(value = "/banner/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<Article>> getList() {
|
||||
return CommonResult.success(CommonPage.restPage(articleService.getBannerList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章分类列表
|
||||
*/
|
||||
@ApiOperation(value = "文章分类列表")
|
||||
@RequestMapping(value = "/category/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<Category>> categoryList() {
|
||||
return CommonResult.success(CommonPage.restPage(articleService.getCategoryList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文章详情
|
||||
* @param id Integer
|
||||
*/
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="文章ID")
|
||||
public CommonResult<ArticleResponse> info(@RequestParam(value = "id") Integer id) {
|
||||
return CommonResult.success(articleService.getVoByFront(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.BargainFrontRequest;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.common.response.*;
|
||||
import com.zbkj.service.service.StoreBargainService;
|
||||
import com.zbkj.service.service.StoreBargainUserHelpService;
|
||||
import com.zbkj.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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* H5 砍价
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/front/bargain")
|
||||
@Api(tags = "砍价商品")
|
||||
public class BargainController {
|
||||
|
||||
@Autowired
|
||||
private StoreBargainService storeBargainService;
|
||||
|
||||
@Autowired
|
||||
private StoreBargainUserService storeBargainUserService;
|
||||
|
||||
@Autowired
|
||||
private StoreBargainUserHelpService storeBargainUserHelpService;
|
||||
|
||||
/**
|
||||
* 砍价首页信息
|
||||
*/
|
||||
@ApiOperation(value = "砍价首页信息")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
public CommonResult<BargainIndexResponse> index(){
|
||||
return CommonResult.success(storeBargainService.getIndexInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价商品列表header
|
||||
*/
|
||||
@ApiOperation(value = "砍价商品列表header")
|
||||
@RequestMapping(value = "/header", method = RequestMethod.GET)
|
||||
public CommonResult<BargainHeaderResponse> header(){
|
||||
return CommonResult.success(storeBargainService.getHeader());
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价商品列表
|
||||
* @return 砍价商品列表
|
||||
*/
|
||||
@ApiOperation(value = "砍价商品列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<PageInfo<StoreBargainDetailResponse>> list(@ModelAttribute PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(storeBargainService.getH5List(pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户砍价信息
|
||||
*/
|
||||
@ApiOperation(value = "获取用户砍价信息")
|
||||
@RequestMapping(value = "/user", method = RequestMethod.GET)
|
||||
public CommonResult<BargainUserInfoResponse> getBargainUserInfo(@ModelAttribute @Validated BargainFrontRequest bargainFrontRequest) {
|
||||
return CommonResult.success(storeBargainUserService.getBargainUserInfo(bargainFrontRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价商品详情
|
||||
*/
|
||||
@ApiOperation(value = "砍价商品详情")
|
||||
@RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<BargainDetailH5Response> detail(@PathVariable(value = "id") Integer id) {
|
||||
BargainDetailH5Response h5Detail = storeBargainService.getH5Detail(id);
|
||||
return CommonResult.success(h5Detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建砍价活动
|
||||
*/
|
||||
@ApiOperation(value = "创建砍价活动")
|
||||
@RequestMapping(value = "/start", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> start(@RequestBody @Validated BargainFrontRequest bargainFrontRequest) {
|
||||
return CommonResult.success(storeBargainService.start(bargainFrontRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价
|
||||
*/
|
||||
@ApiOperation(value = "砍价")
|
||||
@RequestMapping(value = "/help", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> help(@RequestBody @Validated BargainFrontRequest bargainFrontRequest) {
|
||||
return CommonResult.success(storeBargainUserHelpService.help(bargainFrontRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价记录
|
||||
*/
|
||||
@ApiOperation(value = "砍价记录")
|
||||
@RequestMapping(value = "/record", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<BargainRecordResponse>> recordList(@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(storeBargainUserService.getRecordList(pageParamRequest)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.CartNumRequest;
|
||||
import com.zbkj.common.request.CartRequest;
|
||||
import com.zbkj.common.request.CartResetRequest;
|
||||
import com.zbkj.common.response.CartInfoResponse;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.service.service.StoreCartService;
|
||||
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.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 购物车 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/front/cart")
|
||||
@Api(tags = "商品 -- 购物车") //配合swagger使用
|
||||
public class CartController {
|
||||
|
||||
@Autowired
|
||||
private StoreCartService storeCartService;
|
||||
|
||||
/**
|
||||
* 分页显示购物车表
|
||||
*/
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="isValid", value="类型,true-有效商品,false-无效商品", required = true),
|
||||
@ApiImplicitParam(name="page", value="页码", required = true),
|
||||
@ApiImplicitParam(name="limit", value="每页数量", required = true)
|
||||
})
|
||||
public CommonResult<CommonPage<CartInfoResponse>> getList(@RequestParam Boolean isValid, @Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<CartInfoResponse> restPage = CommonPage.restPage(storeCartService.getList(pageParamRequest, isValid));
|
||||
return CommonResult.success(restPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增购物车表
|
||||
* @param storeCartRequest 新增参数
|
||||
*/
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<HashMap<String,String>> save(@RequestBody @Validated CartRequest storeCartRequest) {
|
||||
String cartId = storeCartService.saveCate(storeCartRequest);
|
||||
if (StringUtils.isNotBlank(cartId)) {
|
||||
HashMap<String,String> result = new HashMap<>();
|
||||
result.put("cartId", cartId);
|
||||
return CommonResult.success(result);
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除购物车表
|
||||
* @param ids 购物车ids
|
||||
*/
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
public CommonResult<String> delete(@RequestParam(value = "ids") List<Long> ids) {
|
||||
if (storeCartService.deleteCartByIds(ids)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品数量
|
||||
* @param id integer id
|
||||
* @param number 修改的产品数量
|
||||
*/
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/num", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestParam Integer number) {
|
||||
if (storeCartService.updateCartNum(id, number)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取购物车数量
|
||||
*/
|
||||
@ApiOperation(value = "获取购物车数量")
|
||||
@RequestMapping(value = "/count", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Integer>> count(@Validated CartNumRequest request) {
|
||||
return CommonResult.success(storeCartService.getUserCount(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 购物车重选提交
|
||||
* @param resetRequest 重选参数
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation(value = "购物车重选提交")
|
||||
@RequestMapping(value = "/resetcart", method = RequestMethod.POST)
|
||||
public CommonResult<Object> resetCart(@RequestBody @Validated CartResetRequest resetRequest){
|
||||
return CommonResult.success(storeCartService.resetCart(resetRequest));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.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.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 城市服务
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("CityFrontController")
|
||||
@RequestMapping("api/front/city")
|
||||
@Api(tags = "城市服务")
|
||||
public class CityController {
|
||||
|
||||
@Autowired
|
||||
private SystemCityService systemCityService;
|
||||
|
||||
/**
|
||||
* 城市服务树形结构数据
|
||||
*/
|
||||
@ApiOperation(value = "树形结构")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<Object> register(){
|
||||
return CommonResult.success(systemCityService.getListTree());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.common.model.combination.StoreCombination;
|
||||
import com.zbkj.common.request.StorePinkRequest;
|
||||
import com.zbkj.common.response.*;
|
||||
import com.zbkj.service.service.StoreCombinationService;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 拼团商品
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/front/combination")
|
||||
@Api(tags = "拼团商品")
|
||||
public class CombinationController {
|
||||
|
||||
@Autowired
|
||||
private StoreCombinationService storeCombinationService;
|
||||
|
||||
/**
|
||||
* 拼团首页
|
||||
*/
|
||||
@ApiOperation(value = "拼团首页数据")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
public CommonResult<CombinationIndexResponse> index() {
|
||||
return CommonResult.success(storeCombinationService.getIndexInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团商品列表header
|
||||
*/
|
||||
@ApiOperation(value = "拼团商品列表header")
|
||||
@RequestMapping(value = "/header", method = RequestMethod.GET)
|
||||
public CommonResult<CombinationHeaderResponse> header() {
|
||||
return CommonResult.success(storeCombinationService.getHeader());
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团商品列表
|
||||
*/
|
||||
@ApiOperation(value = "拼团商品列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreCombinationH5Response>> list(@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(storeCombinationService.getH5List(pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团商品详情
|
||||
*/
|
||||
@ApiOperation(value = "拼团商品详情")
|
||||
@RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<CombinationDetailResponse> detail(@PathVariable(value = "id") Integer id) {
|
||||
CombinationDetailResponse h5Detail = storeCombinationService.getH5Detail(id);
|
||||
return CommonResult.success(h5Detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 去拼团
|
||||
* @param pinkId 拼团团长单id
|
||||
*/
|
||||
@ApiOperation(value = "去拼团")
|
||||
@RequestMapping(value = "/pink/{pinkId}", method = RequestMethod.GET)
|
||||
public CommonResult<GoPinkResponse> goPink(@PathVariable(value = "pinkId") Integer pinkId) {
|
||||
GoPinkResponse goPinkResponse = storeCombinationService.goPink(pinkId);
|
||||
return CommonResult.success(goPinkResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更多拼团
|
||||
*/
|
||||
@ApiOperation(value = "更多拼团")
|
||||
@RequestMapping(value = "/more", method = RequestMethod.GET)
|
||||
public CommonResult<PageInfo<StoreCombination>> getMore(@RequestParam Integer comId, @Validated PageParamRequest pageParamRequest) {
|
||||
PageInfo<StoreCombination> more = storeCombinationService.getMore(pageParamRequest, comId);
|
||||
return CommonResult.success(more);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消拼团
|
||||
*/
|
||||
@ApiOperation(value = "取消拼团")
|
||||
@RequestMapping(value = "/remove", method = RequestMethod.POST)
|
||||
public CommonResult<Object> remove(@RequestBody @Validated StorePinkRequest storePinkRequest) {
|
||||
if (storeCombinationService.removePink(storePinkRequest)) {
|
||||
return CommonResult.success("取消成功");
|
||||
} else {
|
||||
return CommonResult.failed("取消失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.response.StoreCouponFrontResponse;
|
||||
import com.zbkj.common.response.StoreCouponUserOrder;
|
||||
import com.zbkj.service.service.StoreCouponService;
|
||||
import com.zbkj.service.service.StoreCouponUserService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("CouponFrontController")
|
||||
@RequestMapping("api/front")
|
||||
@Api(tags = "优惠券")
|
||||
public class CouponController {
|
||||
|
||||
@Autowired
|
||||
private StoreCouponService storeCouponService;
|
||||
|
||||
@Autowired
|
||||
private StoreCouponUserService storeCouponUserService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页显示优惠券表
|
||||
* @param type 类型,1-通用,2-商品,3-品类
|
||||
* @param productId 产品id,搜索产品指定优惠券
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/coupons", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="type", value="类型,1-通用,2-商品,3-品类", required = true),
|
||||
@ApiImplicitParam(name="productId", value="产品id"),
|
||||
@ApiImplicitParam(name="page", value="页码", required = true),
|
||||
@ApiImplicitParam(name="limit", value="每页数量", required = true)
|
||||
})
|
||||
public CommonResult<List<StoreCouponFrontResponse>> getList(@RequestParam(value = "type", defaultValue = "0") int type,
|
||||
@RequestParam(value = "productId", defaultValue = "0") int productId, @Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(storeCouponService.getH5List(type, productId, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据购物车id获取可用优惠券
|
||||
*/
|
||||
@ApiOperation(value = "当前订单可用优惠券")
|
||||
@RequestMapping(value = "coupons/order/{preOrderNo}", method = RequestMethod.GET)
|
||||
public CommonResult<List<StoreCouponUserOrder>> getCouponsListByPreOrderNo(@PathVariable String preOrderNo) {
|
||||
return CommonResult.success(storeCouponUserService.getListByPreOrderNo(preOrderNo));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.system.SystemConfig;
|
||||
import com.zbkj.common.response.IndexInfoResponse;
|
||||
import com.zbkj.common.response.IndexProductResponse;
|
||||
import com.zbkj.front.service.IndexService;
|
||||
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.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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户 -- 用户中心
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("IndexController")
|
||||
@RequestMapping("api/front")
|
||||
@Api(tags = "首页")
|
||||
public class IndexController {
|
||||
|
||||
@Autowired
|
||||
private IndexService indexService;
|
||||
|
||||
/**
|
||||
* 首页数据
|
||||
*/
|
||||
@ApiOperation(value = "首页数据")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
public CommonResult<IndexInfoResponse> getIndexInfo() {
|
||||
return CommonResult.success(indexService.getIndexInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页商品列表
|
||||
*/
|
||||
@ApiOperation(value = "首页商品列表")
|
||||
@RequestMapping(value = "/index/product/{type}", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "type", value = "类型 【1 精品推荐 2 热门榜单 3首发新品 4促销单品】", dataType = "int", required = true)
|
||||
public CommonResult<CommonPage<IndexProductResponse>> getProductList(@PathVariable(value = "type") Integer type, PageParamRequest pageParamRequest) {
|
||||
|
||||
return CommonResult.success(indexService.findIndexProductList(type, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 热门搜索
|
||||
*/
|
||||
@ApiOperation(value = "热门搜索")
|
||||
@RequestMapping(value = "/search/keyword", method = RequestMethod.GET)
|
||||
public CommonResult<List<HashMap<String, Object>>> hotKeywords() {
|
||||
return CommonResult.success(indexService.hotKeywords());
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享配置
|
||||
*/
|
||||
@ApiOperation(value = "分享配置")
|
||||
@RequestMapping(value = "/share", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, String>> share() {
|
||||
return CommonResult.success(indexService.getShareConfig());
|
||||
}
|
||||
|
||||
/**
|
||||
* 颜色配置
|
||||
*/
|
||||
@ApiOperation(value = "颜色配置")
|
||||
@RequestMapping(value = "/index/color/config", method = RequestMethod.GET)
|
||||
public CommonResult<SystemConfig> getColorConfig() {
|
||||
return CommonResult.success(indexService.getColorConfig());
|
||||
}
|
||||
|
||||
/**
|
||||
* 版本信息
|
||||
*/
|
||||
@ApiOperation(value = "获取版本信息")
|
||||
@RequestMapping(value = "/index/get/version", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> getVersion() {
|
||||
return CommonResult.success(indexService.getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* 全局本地图片域名
|
||||
*/
|
||||
@ApiOperation(value = "全局本地图片域名")
|
||||
@RequestMapping(value = "/image/domain", method = RequestMethod.GET)
|
||||
public CommonResult<String> getImageDomain() {
|
||||
return CommonResult.success(indexService.getImageDomain(), "成功");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
|
||||
import com.zbkj.common.request.LoginMobileRequest;
|
||||
import com.zbkj.common.request.LoginRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.response.LoginResponse;
|
||||
import com.zbkj.front.service.LoginService;
|
||||
import com.zbkj.service.service.SmsService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 用户登陆 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("FrontLoginController")
|
||||
@RequestMapping("api/front")
|
||||
@Api(tags = "用户 -- 登录注册")
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
private SmsService smsService;
|
||||
|
||||
@Autowired
|
||||
private LoginService loginService;
|
||||
|
||||
/**
|
||||
* 手机号登录接口
|
||||
*/
|
||||
@ApiOperation(value = "手机号登录接口")
|
||||
@RequestMapping(value = "/login/mobile", method = RequestMethod.POST)
|
||||
public CommonResult<LoginResponse> phoneLogin(@RequestBody @Validated LoginMobileRequest loginRequest) {
|
||||
return CommonResult.success(loginService.phoneLogin(loginRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 账号密码登录
|
||||
*/
|
||||
@ApiOperation(value = "账号密码登录")
|
||||
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
||||
public CommonResult<LoginResponse> login(@RequestBody @Validated LoginRequest loginRequest) {
|
||||
return CommonResult.success(loginService.login(loginRequest));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
*/
|
||||
@ApiOperation(value = "退出")
|
||||
@RequestMapping(value = "/logout", method = RequestMethod.GET)
|
||||
public CommonResult<String> loginOut(HttpServletRequest request){
|
||||
loginService.loginOut(request);
|
||||
return CommonResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信登录验证码
|
||||
* @param phone 手机号码
|
||||
* @return 发送是否成功
|
||||
*/
|
||||
@ApiOperation(value = "发送短信登录验证码")
|
||||
@RequestMapping(value = "/sendCode", method = RequestMethod.POST)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="phone", value="手机号码", required = true)
|
||||
})
|
||||
public CommonResult<Object> sendCode(@RequestParam String phone){
|
||||
if(smsService.sendCommonCode(phone)){
|
||||
return CommonResult.success("发送成功");
|
||||
}else{
|
||||
return CommonResult.failed("发送失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.request.OrderPayRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.response.OrderPayResultResponse;
|
||||
import com.zbkj.common.utils.CrmebUtil;
|
||||
import com.zbkj.service.service.OrderPayService;
|
||||
import com.zbkj.service.service.WeChatPayService;
|
||||
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.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 微信缓存表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/front/pay")
|
||||
@Api(tags = "支付管理")
|
||||
public class PayController {
|
||||
|
||||
@Autowired
|
||||
private WeChatPayService weChatPayService;
|
||||
|
||||
@Autowired
|
||||
private OrderPayService orderPayService;
|
||||
|
||||
/**
|
||||
* 订单支付
|
||||
*/
|
||||
@ApiOperation(value = "订单支付")
|
||||
@RequestMapping(value = "/payment", method = RequestMethod.POST)
|
||||
public CommonResult<OrderPayResultResponse> payment(@RequestBody @Validated OrderPayRequest orderPayRequest, HttpServletRequest request) {
|
||||
String ip = CrmebUtil.getClientIp(request);
|
||||
return CommonResult.success(orderPayService.payment(orderPayRequest, ip));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支付结果
|
||||
*
|
||||
* @param orderNo |订单编号|String|必填
|
||||
*/
|
||||
@ApiOperation(value = "查询支付结果")
|
||||
@RequestMapping(value = "/queryPayResult", method = RequestMethod.GET)
|
||||
public CommonResult<Boolean> queryPayResult(@RequestParam String orderNo) {
|
||||
return CommonResult.success(weChatPayService.queryPayResult(orderNo));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
|
||||
import com.zbkj.common.model.product.StoreProduct;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.ProductListRequest;
|
||||
import com.zbkj.common.request.ProductRequest;
|
||||
import com.zbkj.common.response.*;
|
||||
import com.zbkj.common.vo.CategoryTreeVo;
|
||||
import com.zbkj.front.service.ProductService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户 -- 用户中心
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("ProductController")
|
||||
@RequestMapping("api/front")
|
||||
@Api(tags = "商品")
|
||||
public class ProductController {
|
||||
|
||||
@Autowired
|
||||
private ProductService productService;
|
||||
|
||||
/**
|
||||
* 热门商品推荐
|
||||
*/
|
||||
@ApiOperation(value = "热门商品推荐")
|
||||
@RequestMapping(value = "/product/hot", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<IndexProductResponse>> getHotProductList(@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(productService.getHotProductList(pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 优选商品推荐
|
||||
*/
|
||||
@ApiOperation(value = "优选商品推荐")
|
||||
@RequestMapping(value = "/product/good", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<IndexProductResponse>> getGoodProductList() {
|
||||
return CommonResult.success(productService.getGoodProductList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分类
|
||||
*/
|
||||
@ApiOperation(value = "获取分类")
|
||||
@RequestMapping(value = "/category", method = RequestMethod.GET)
|
||||
public CommonResult<List<CategoryTreeVo>> getCategory() {
|
||||
return CommonResult.success(productService.getCategory());
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
@ApiOperation(value = "商品列表")
|
||||
@RequestMapping(value = "/products", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<IndexProductResponse>> getList(@Validated ProductRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(productService.getList(request, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品详情
|
||||
*/
|
||||
@ApiOperation(value = "商品详情")
|
||||
@RequestMapping(value = "/product/detail/{id}", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "type", value = "normal-正常,video-视频")
|
||||
public CommonResult<ProductDetailResponse> getDetail(@PathVariable Integer id, @RequestParam(value = "type", defaultValue = "normal") String type) {
|
||||
return CommonResult.success(productService.getDetail(id, type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品评论列表
|
||||
*/
|
||||
@ApiOperation(value = "商品评论列表")
|
||||
@RequestMapping(value = "/reply/list/{id}", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "type", value = "评价等级|0=全部,1=好评,2=中评,3=差评", allowableValues = "range[0,1,2,3]")
|
||||
public CommonResult<CommonPage<ProductReplyResponse>> getReplyList(@PathVariable Integer id,
|
||||
@RequestParam(value = "type") Integer type, @Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(productService.getReplyList(id, type, pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品评论数量
|
||||
*/
|
||||
@ApiOperation(value = "商品评论数量")
|
||||
@RequestMapping(value = "/reply/config/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductReplayCountResponse> getReplyCount(@PathVariable Integer id) {
|
||||
return CommonResult.success(productService.getReplyCount(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品详情评论
|
||||
*/
|
||||
@ApiOperation(value = "商品详情评论")
|
||||
@RequestMapping(value = "/reply/product/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<ProductDetailReplyResponse> getProductReply(@PathVariable Integer id) {
|
||||
return CommonResult.success(productService.getProductReply(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
@ApiOperation(value = "商品列表(个别分类模型使用)")
|
||||
@RequestMapping(value = "/product/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<IndexProductResponse>> getProductList(@Validated ProductListRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(productService.getCategoryProductList(request, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品规格详情
|
||||
*/
|
||||
@ApiOperation(value = "商品规格详情")
|
||||
@RequestMapping(value = "/product/sku/detail/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<ProductDetailResponse> getSkuDetail(@PathVariable Integer id) {
|
||||
return CommonResult.success(productService.getSkuDetail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品排行榜
|
||||
*/
|
||||
@ApiOperation(value = "商品排行榜")
|
||||
@RequestMapping(value = "/product/leaderboard", method = RequestMethod.GET)
|
||||
public CommonResult<List<StoreProduct>> getLeaderboard() {
|
||||
return CommonResult.success(productService.getLeaderboard());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.common.exception.CrmebException;
|
||||
import com.zbkj.front.service.QrCodeService;
|
||||
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 java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/front/qrcode")
|
||||
@Api(tags = "二维码服务")
|
||||
public class QrCodeController {
|
||||
|
||||
@Autowired
|
||||
private QrCodeService qrCodeService;
|
||||
/**
|
||||
* 获取二维码
|
||||
* @return CommonResult
|
||||
*/
|
||||
@ApiOperation(value="获取二维码")
|
||||
@RequestMapping(value = "/get", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> get(@RequestBody JSONObject data) {
|
||||
return CommonResult.success(qrCodeService.get(data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 远程图片转base64
|
||||
* @return CommonResult
|
||||
*/
|
||||
@ApiOperation(value="远程图片转base64")
|
||||
@RequestMapping(value = "/base64", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> get(@RequestParam String url) {
|
||||
return CommonResult.success(qrCodeService.base64(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串 转base64
|
||||
* @return CommonResult
|
||||
*/
|
||||
@ApiOperation(value="将字符串 转base64")
|
||||
@RequestMapping(value = "/str2base64", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> getQrcodeByString(
|
||||
@RequestParam String text,
|
||||
@RequestParam int width,
|
||||
@RequestParam int height) {
|
||||
if((width < 50 || height < 50) && (width > 500 || height > 500) && text.length() >= 999){
|
||||
throw new CrmebException(Constants.RESULT_QRCODE_PRAMERROR);
|
||||
}
|
||||
return CommonResult.success(qrCodeService.base64String(text, width,height));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.response.*;
|
||||
import com.zbkj.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.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* SecKillController
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/front/seckill")
|
||||
@Api(tags = "秒杀商品")
|
||||
public class SecKillController {
|
||||
|
||||
@Autowired
|
||||
StoreSeckillService storeSeckillService;
|
||||
|
||||
/**
|
||||
* 秒杀首页数据
|
||||
* @return 可秒杀配置
|
||||
*/
|
||||
@ApiOperation(value = "秒杀首页数据")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
public CommonResult<SeckillIndexResponse> index() {
|
||||
return CommonResult.success(storeSeckillService.getIndexInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 秒杀Index
|
||||
* @return 可秒杀配置
|
||||
*/
|
||||
@ApiOperation(value = "秒杀Header")
|
||||
@RequestMapping(value = "/header", method = RequestMethod.GET)
|
||||
public CommonResult<List<SecKillResponse>> header() {
|
||||
return CommonResult.success(storeSeckillService.getForH5Index());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据时间段查询秒杀信息
|
||||
* @return 查询时间内的秒杀商品列表
|
||||
*/
|
||||
@ApiOperation(value = "秒杀列表")
|
||||
@RequestMapping(value = "/list/{timeId}", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreSecKillH5Response>> list(@PathVariable("timeId") String timeId, @ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(storeSeckillService.getKillListByTimeId(timeId, pageParamRequest)));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<StoreSeckillDetailResponse> info(@PathVariable(value = "id") Integer id) {
|
||||
StoreSeckillDetailResponse storeSeckill = storeSeckillService.getDetailH5(id);
|
||||
return CommonResult.success(storeSeckill);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
|
||||
import com.zbkj.common.request.StoreNearRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.response.StoreNearResponse;
|
||||
import com.zbkj.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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 提货点
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("StoreController")
|
||||
@RequestMapping("api/front/store")
|
||||
@Api(tags = "提货点")
|
||||
public class StoreController {
|
||||
@Autowired
|
||||
private SystemStoreService systemStoreService;
|
||||
|
||||
/**
|
||||
* 附近的提货点
|
||||
*/
|
||||
@ApiOperation(value = "附近的提货点")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
||||
public CommonResult<StoreNearResponse> register(@Validated StoreNearRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(systemStoreService.getNearList(request, pageParamRequest));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.*;
|
||||
import com.zbkj.common.response.*;
|
||||
import com.zbkj.service.service.OrderService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* H5端订单操作
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("StoreOrderFrontController")
|
||||
@RequestMapping("api/front/order")
|
||||
@Api(tags = "订单")
|
||||
public class StoreOrderController {
|
||||
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
/**
|
||||
* 预下单
|
||||
*/
|
||||
@ApiOperation(value = "预下单")
|
||||
@RequestMapping(value = "/pre/order", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> preOrder(@RequestBody @Validated PreOrderRequest request) {
|
||||
return CommonResult.success(orderService.preOrder(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载预下单
|
||||
*/
|
||||
@ApiOperation(value = "加载预下单")
|
||||
@RequestMapping(value = "load/pre/{preOrderNo}", method = RequestMethod.GET)
|
||||
public CommonResult<PreOrderResponse> loadPreOrder(@PathVariable String preOrderNo) {
|
||||
return CommonResult.success(orderService.loadPreOrder(preOrderNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数计算订单价格
|
||||
*/
|
||||
@ApiOperation(value = "计算订单价格")
|
||||
@RequestMapping(value = "/computed/price", method = RequestMethod.POST)
|
||||
public CommonResult<ComputedOrderPriceResponse> computedPrice(@Validated @RequestBody OrderComputedPriceRequest request) {
|
||||
return CommonResult.success(orderService.computedOrderPrice(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建订单
|
||||
*/
|
||||
@ApiOperation(value = "创建订单")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> createOrder(@Validated @RequestBody CreateOrderRequest orderRequest) {
|
||||
return CommonResult.success(orderService.createOrder(orderRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
* @param type 类型
|
||||
* @param pageRequest 分页
|
||||
* @return 订单列表
|
||||
*/
|
||||
@ApiOperation(value = "订单列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ApiImplicitParams ({
|
||||
@ApiImplicitParam(name = "type", value = "评价等级|0=未支付,1=待发货,2=待收货,3=待评价,4=已完成,-3=售后/退款", required = true)
|
||||
})
|
||||
public CommonResult<CommonPage<OrderDetailResponse>> orderList(@RequestParam(name = "type") Integer type,
|
||||
@ModelAttribute PageParamRequest pageRequest) {
|
||||
return CommonResult.success(orderService.list(type, pageRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
* @param orderId 订单编号
|
||||
* @return 订单详情
|
||||
*/
|
||||
@ApiOperation(value = "订单详情")
|
||||
@RequestMapping(value = "/detail/{orderId}", method = RequestMethod.GET)
|
||||
public CommonResult<StoreOrderDetailInfoResponse> orderDetail(@PathVariable String orderId) {
|
||||
return CommonResult.success(orderService.detailOrder(orderId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单头部信息
|
||||
* @return 查询集合数量
|
||||
*/
|
||||
@ApiOperation(value = "订单头部数量")
|
||||
@RequestMapping(value = "/data", method = RequestMethod.GET)
|
||||
public CommonResult<OrderDataResponse> orderData() {
|
||||
return CommonResult.success(orderService.orderData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除已完成订单
|
||||
* @param id String 订单号
|
||||
* @return 删除结果
|
||||
*/
|
||||
@ApiOperation(value = "删除订单")
|
||||
@RequestMapping(value = "/del", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> delete(@RequestParam Integer id) {
|
||||
if( orderService.delete(id)) {
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单评价
|
||||
* @param request StoreProductReplyAddRequest 评论参数
|
||||
*/
|
||||
@ApiOperation(value = "评价订单")
|
||||
@RequestMapping(value = "/comment", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> comment(@RequestBody @Validated StoreProductReplyAddRequest request) {
|
||||
if(orderService.reply(request)) {
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单收货
|
||||
* @param id Integer 订单id
|
||||
*/
|
||||
@ApiOperation(value = "订单收货")
|
||||
@RequestMapping(value = "/take", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> take(@RequestParam(value = "id") Integer id) {
|
||||
if(orderService.take(id)) {
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单取消
|
||||
* @param id Integer 订单id
|
||||
*/
|
||||
@ApiOperation(value = "订单取消")
|
||||
@RequestMapping(value = "/cancel", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> cancel(@RequestParam(value = "id") Integer id) {
|
||||
if(orderService.cancel(id)) {
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取申请订单退款信息
|
||||
* @param orderId 订单编号
|
||||
*/
|
||||
@ApiOperation(value = "获取申请订单退款信息")
|
||||
@RequestMapping(value = "/apply/refund/{orderId}", method = RequestMethod.GET)
|
||||
public CommonResult<ApplyRefundOrderInfoResponse> refundApplyOrder(@PathVariable String orderId) {
|
||||
return CommonResult.success(orderService.applyRefundOrderInfo(orderId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单退款申请
|
||||
* @param request OrderRefundApplyRequest 订单id
|
||||
*/
|
||||
@ApiOperation(value = "订单退款申请")
|
||||
@RequestMapping(value = "/refund", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> refundApply(@RequestBody @Validated OrderRefundApplyRequest request) {
|
||||
if(orderService.refundApply(request)) {
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单退款理由
|
||||
* @return 退款理由
|
||||
*/
|
||||
@ApiOperation(value = "订单退款理由(商家提供)")
|
||||
@RequestMapping(value = "/refund/reason", method = RequestMethod.GET)
|
||||
public CommonResult<List<String>> refundReason() {
|
||||
return CommonResult.success(orderService.getRefundReason());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单号查询物流信息
|
||||
* @param orderId 订单号
|
||||
* @return 物流信息
|
||||
*/
|
||||
@ApiOperation(value = "物流信息查询")
|
||||
@RequestMapping(value = "/express/{orderId}", method = RequestMethod.GET)
|
||||
public CommonResult<Object> getExpressInfo(@PathVariable String orderId) {
|
||||
return CommonResult.success(orderService.expressOrder(orderId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "待评价商品信息查询")
|
||||
@RequestMapping(value = "/product", method = RequestMethod.POST)
|
||||
public CommonResult<OrderProductReplyResponse> getOrderProductForReply(@Validated @RequestBody GetProductReply request) {
|
||||
return CommonResult.success(orderService.getReplyProduct(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付配置
|
||||
*/
|
||||
@ApiOperation(value = "获取支付配置")
|
||||
@RequestMapping(value = "get/pay/config", method = RequestMethod.GET)
|
||||
public CommonResult<PreOrderResponse> getPayConfig() {
|
||||
return CommonResult.success(orderService.getPayConfig());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.vo.FileResultVo;
|
||||
import com.zbkj.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;
|
||||
|
||||
|
||||
/**
|
||||
* 商品表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/front/user/upload")
|
||||
@Api(tags = "上传文件")
|
||||
public class UploadFrontController {
|
||||
|
||||
@Autowired
|
||||
private UploadService uploadService;
|
||||
|
||||
/**
|
||||
* 图片上传
|
||||
*/
|
||||
@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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.UserAddressDelRequest;
|
||||
import com.zbkj.common.request.UserAddressRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.user.UserAddress;
|
||||
import com.zbkj.service.service.UserAddressService;
|
||||
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.*;
|
||||
|
||||
|
||||
/**
|
||||
* 用户地址 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/front/address")
|
||||
@Api(tags = "用户 -- 地址")
|
||||
public class UserAddressController {
|
||||
|
||||
@Autowired
|
||||
private UserAddressService userAddressService;
|
||||
|
||||
/**
|
||||
* 分页显示用户地址
|
||||
*/
|
||||
@ApiOperation(value = "列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserAddress>> getList(PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(userAddressService.getList(pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户地址
|
||||
* @param request 新增参数
|
||||
*/
|
||||
@ApiOperation(value = "保存")
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.POST)
|
||||
public CommonResult<UserAddress> save(@RequestBody @Validated UserAddressRequest request) {
|
||||
return CommonResult.success(userAddressService.create(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户地址
|
||||
* @param request UserAddressDelRequest 参数
|
||||
*/
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/del", method = RequestMethod.POST)
|
||||
public CommonResult<String> delete(@RequestBody UserAddressDelRequest request) {
|
||||
if (userAddressService.delete(request.getId())) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 地址详情
|
||||
*/
|
||||
@ApiOperation(value = "地址详情")
|
||||
@RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<UserAddress> info(@PathVariable("id") Integer id) {
|
||||
return CommonResult.success(userAddressService.getDetail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取默认地址
|
||||
*/
|
||||
@ApiOperation(value = "获取默认地址")
|
||||
@RequestMapping(value = "/default", method = RequestMethod.GET)
|
||||
public CommonResult<UserAddress> getDefault() {
|
||||
return CommonResult.success(userAddressService.getDefault());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认地址
|
||||
* @param request UserAddressDelRequest 参数
|
||||
*/
|
||||
@ApiOperation(value = "设置默认地址")
|
||||
@RequestMapping(value = "/default/set", method = RequestMethod.POST)
|
||||
public CommonResult<UserAddress> def(@RequestBody UserAddressDelRequest request) {
|
||||
if (userAddressService.def(request.getId())) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.UserCollectAllRequest;
|
||||
import com.zbkj.common.request.UserCollectRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.response.UserRelationResponse;
|
||||
import com.zbkj.service.service.StoreProductRelationService;
|
||||
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.*;
|
||||
|
||||
|
||||
/**
|
||||
* 商品点赞和收藏表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/front/collect")
|
||||
@Api(tags = "用户 -- 点赞/收藏")
|
||||
public class UserCollectController {
|
||||
|
||||
@Autowired
|
||||
private StoreProductRelationService storeProductRelationService;
|
||||
|
||||
/**
|
||||
* 我的收藏列表
|
||||
*/
|
||||
@ApiOperation(value = "我的收藏列表")
|
||||
@RequestMapping(value = "/user", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserRelationResponse>> getList(@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(storeProductRelationService.getUserList(pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加收藏产品
|
||||
* @param request StoreProductRelationRequest 新增参数
|
||||
*/
|
||||
@ApiOperation(value = "添加收藏产品")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated UserCollectRequest request) {
|
||||
if (storeProductRelationService.add(request)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加收藏产品
|
||||
* @param request UserCollectAllRequest 新增参数
|
||||
*/
|
||||
@ApiOperation(value = "批量收藏")
|
||||
@RequestMapping(value = "/all", method = RequestMethod.POST)
|
||||
public CommonResult<String> all(@RequestBody @Validated UserCollectAllRequest request) {
|
||||
if (storeProductRelationService.all(request)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消收藏产品
|
||||
*/
|
||||
@ApiOperation(value = "取消收藏产品")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
public CommonResult<String> delete(@RequestBody String requestJson) {
|
||||
if (storeProductRelationService.delete(requestJson)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消收藏产品(通过商品)
|
||||
*/
|
||||
@ApiOperation(value = "取消收藏产品(通过商品)")
|
||||
@RequestMapping(value = "/cancel/{proId}", method = RequestMethod.POST)
|
||||
public CommonResult<String> cancel(@PathVariable Integer proId) {
|
||||
if (storeProductRelationService.deleteByProIdAndUid(proId)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.common.model.system.SystemUserLevel;
|
||||
import com.zbkj.common.model.user.User;
|
||||
import com.zbkj.common.model.user.UserExperienceRecord;
|
||||
import com.zbkj.common.model.user.UserIntegralRecord;
|
||||
import com.zbkj.common.request.*;
|
||||
import com.zbkj.common.response.*;
|
||||
import com.zbkj.front.service.UserCenterService;
|
||||
import com.zbkj.service.service.SystemGroupDataService;
|
||||
import com.zbkj.service.service.UserService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户 -- 用户中心
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("FrontUserController")
|
||||
@RequestMapping("api/front")
|
||||
@Api(tags = "用户 -- 用户中心")
|
||||
public class UserController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private SystemGroupDataService systemGroupDataService;
|
||||
|
||||
@Autowired
|
||||
private UserCenterService userCenterService;
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
@ApiOperation(value = "手机号修改密码")
|
||||
@RequestMapping(value = "/register/reset", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> password(@RequestBody @Validated PasswordRequest request) {
|
||||
return CommonResult.success(userService.password(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改个人资料
|
||||
*/
|
||||
@ApiOperation(value = "修改个人资料")
|
||||
@RequestMapping(value = "/user/edit", method = RequestMethod.POST)
|
||||
public CommonResult<Object> personInfo(@RequestBody @Validated UserEditRequest request) {
|
||||
if (userService.editUser(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人中心-用户信息
|
||||
*/
|
||||
@ApiOperation(value = "个人中心-用户信息")
|
||||
@RequestMapping(value = "/user", method = RequestMethod.GET)
|
||||
public CommonResult<UserCenterResponse> getUserCenter() {
|
||||
return CommonResult.success(userService.getUserCenter());
|
||||
}
|
||||
|
||||
/**
|
||||
* 换绑手机号校验
|
||||
*/
|
||||
@ApiOperation(value = "换绑手机号校验")
|
||||
@RequestMapping(value = "update/binding/verify", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> updatePhoneVerify(@RequestBody @Validated UserBindingPhoneUpdateRequest request) {
|
||||
return CommonResult.success(userService.updatePhoneVerify(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定手机号
|
||||
*/
|
||||
@ApiOperation(value = "换绑手机号")
|
||||
@RequestMapping(value = "update/binding", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> updatePhone(@RequestBody @Validated UserBindingPhoneUpdateRequest request) {
|
||||
return CommonResult.success(userService.updatePhone(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户中心菜单
|
||||
*/
|
||||
@ApiOperation(value = "获取个人中心菜单")
|
||||
@RequestMapping(value = "/menu/user", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, Object>> getMenuUser() {
|
||||
return CommonResult.success(systemGroupDataService.getMenuUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广数据接口(昨天的佣金 累计提现金额 当前佣金)
|
||||
*/
|
||||
@ApiOperation(value = "推广数据接口(昨天的佣金 累计提现金额 当前佣金)")
|
||||
@RequestMapping(value = "/commission", method = RequestMethod.GET)
|
||||
public CommonResult<UserCommissionResponse> getCommission() {
|
||||
return CommonResult.success(userCenterService.getCommission());
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广佣金明细
|
||||
*/
|
||||
@ApiOperation(value = "推广佣金明细")
|
||||
@RequestMapping(value = "/spread/commission/detail", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SpreadCommissionDetailResponse>> getSpreadCommissionDetail(@Validated PageParamRequest pageParamRequest) {
|
||||
PageInfo<SpreadCommissionDetailResponse> commissionDetail = userCenterService.getSpreadCommissionDetail(pageParamRequest);
|
||||
return CommonResult.success(CommonPage.restPage(commissionDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广佣金/提现总和
|
||||
*/
|
||||
@ApiOperation(value = "推广佣金/提现总和")
|
||||
@RequestMapping(value = "/spread/count/{type}", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "type", value = "类型 佣金类型3=佣金,4=提现", allowableValues = "range[3,4]", dataType = "int")
|
||||
public CommonResult<Map<String, BigDecimal>> getSpreadCountByType(@PathVariable Integer type) {
|
||||
Map<String, BigDecimal> map = new HashMap<>();
|
||||
map.put("count", userCenterService.getSpreadCountByType(type));
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现申请
|
||||
*/
|
||||
@ApiOperation(value = "提现申请")
|
||||
@RequestMapping(value = "/extract/cash", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> extractCash(@RequestBody @Validated UserExtractRequest request) {
|
||||
return CommonResult.success(userCenterService.extractCash(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现记录
|
||||
*/
|
||||
@ApiOperation(value = "提现记录")
|
||||
@RequestMapping(value = "/extract/record", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserExtractRecordResponse>> getExtractRecord(@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(userCenterService.getExtractRecord(pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现用户信息
|
||||
*/
|
||||
@ApiOperation(value = "提现用户信息")
|
||||
@RequestMapping(value = "/extract/user", method = RequestMethod.GET)
|
||||
public CommonResult<UserExtractCashResponse> getExtractUser() {
|
||||
return CommonResult.success(userCenterService.getExtractUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现银行
|
||||
*/
|
||||
@ApiOperation(value = "提现银行/提现最低金额")
|
||||
@RequestMapping(value = "/extract/bank", method = RequestMethod.GET)
|
||||
public CommonResult<List<String>> getExtractBank() {
|
||||
return CommonResult.success(userCenterService.getExtractBank());
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员等级列表
|
||||
*/
|
||||
@ApiOperation(value = "会员等级列表")
|
||||
@RequestMapping(value = "/user/level/grade", method = RequestMethod.GET)
|
||||
public CommonResult<List<SystemUserLevel>> getUserLevelList() {
|
||||
return CommonResult.success(userCenterService.getUserLevelList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广人统计
|
||||
*/
|
||||
@ApiOperation(value = "推广人统计")
|
||||
@RequestMapping(value = "/spread/people/count", method = RequestMethod.GET)
|
||||
public CommonResult<UserSpreadPeopleResponse> getSpreadPeopleCount() {
|
||||
return CommonResult.success(userCenterService.getSpreadPeopleCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广人列表
|
||||
*/
|
||||
@ApiOperation(value = "推广人列表")
|
||||
@RequestMapping(value = "/spread/people", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserSpreadPeopleItemResponse>> getSpreadPeopleList(@Validated UserSpreadPeopleRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
List<UserSpreadPeopleItemResponse> spreadPeopleList = userCenterService.getSpreadPeopleList(request, pageParamRequest);
|
||||
CommonPage<UserSpreadPeopleItemResponse> commonPage = CommonPage.restPage(spreadPeopleList);
|
||||
return CommonResult.success(commonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户积分信息
|
||||
*/
|
||||
@ApiOperation(value = "用户积分信息")
|
||||
@RequestMapping(value = "/integral/user", method = RequestMethod.GET)
|
||||
public CommonResult<IntegralUserResponse> getIntegralUser() {
|
||||
return CommonResult.success(userCenterService.getIntegralUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* 积分记录
|
||||
*/
|
||||
@ApiOperation(value = "积分记录")
|
||||
@RequestMapping(value = "/integral/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserIntegralRecord>> getIntegralList(@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(userCenterService.getUserIntegralRecordList(pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 经验记录
|
||||
*/
|
||||
@ApiOperation(value = "经验记录")
|
||||
@RequestMapping(value = "/user/expList", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserExperienceRecord>> getExperienceList(@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(userCenterService.getUserExperienceList(pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户资金统计
|
||||
*/
|
||||
@ApiOperation(value = "用户资金统计")
|
||||
@RequestMapping(value = "/user/balance", method = RequestMethod.GET)
|
||||
public CommonResult<UserBalanceResponse> getUserBalance() {
|
||||
return CommonResult.success(userCenterService.getUserBalance());
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广订单
|
||||
*/
|
||||
@ApiOperation(value = "推广订单")
|
||||
@RequestMapping(value = "/spread/order", method = RequestMethod.GET)
|
||||
public CommonResult<UserSpreadOrderResponse> getSpreadOrder(@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(userCenterService.getSpreadOrder(pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广人排行
|
||||
* @return List<User>
|
||||
*/
|
||||
@ApiOperation(value = "推广人排行")
|
||||
@RequestMapping(value = "/rank", method = RequestMethod.GET)
|
||||
public CommonResult<List<User>> getTopSpreadPeopleListByDate(@RequestParam(required = false) String type, @Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(userCenterService.getTopSpreadPeopleListByDate(type, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 佣金排行
|
||||
* @return 优惠券集合
|
||||
*/
|
||||
@ApiOperation(value = "佣金排行")
|
||||
@RequestMapping(value = "/brokerage_rank", method = RequestMethod.GET)
|
||||
public CommonResult<List<User>> getTopBrokerageListByDate(@RequestParam String type, @Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(userCenterService.getTopBrokerageListByDate(type, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前用户在佣金排行第几名
|
||||
*/
|
||||
@ApiOperation(value = "当前用户在佣金排行第几名")
|
||||
@RequestMapping(value = "/user/brokerageRankNumber", method = RequestMethod.GET)
|
||||
public CommonResult<Integer> getNumberByTop(@RequestParam String type) {
|
||||
return CommonResult.success(userCenterService.getNumberByTop(type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 海报背景图
|
||||
*/
|
||||
@ApiOperation(value = "推广海报图")
|
||||
@RequestMapping(value = "/user/spread/banner", method = RequestMethod.GET)
|
||||
public CommonResult<List<UserSpreadBannerResponse>> getSpreadBannerList() {
|
||||
return CommonResult.success(userCenterService.getSpreadBannerList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定推广关系(登录状态)
|
||||
* @param spreadPid 推广id
|
||||
* @return 绑定结果
|
||||
*/
|
||||
@ApiOperation(value = "绑定推广关系(登录状态)")
|
||||
@RequestMapping(value = "/user/bindSpread", method = RequestMethod.GET)
|
||||
public CommonResult<Boolean> bindsSpread(Integer spreadPid) {
|
||||
userService.bindSpread(spreadPid);
|
||||
return CommonResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.UserCouponReceiveRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.response.StoreCouponUserResponse;
|
||||
import com.zbkj.service.service.StoreCouponUserService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 优惠卷控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/front/coupon")
|
||||
@Api(tags = "营销 -- 优惠券")
|
||||
public class UserCouponController {
|
||||
|
||||
@Autowired
|
||||
private StoreCouponUserService storeCouponUserService;
|
||||
|
||||
/**
|
||||
* 我的优惠券
|
||||
*/
|
||||
@ApiOperation(value = "我的优惠券")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="type", value="类型,usable-可用,unusable-不可用", required = true),
|
||||
@ApiImplicitParam(name="page", value="页码", required = true),
|
||||
@ApiImplicitParam(name="limit", value="每页数量", required = true)
|
||||
})
|
||||
public CommonResult<CommonPage<StoreCouponUserResponse>> getList(@RequestParam(value = "type") String type,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(storeCouponUserService.getMyCouponList(type, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 领券
|
||||
* @param request UserCouponReceiveRequest 新增参数
|
||||
*/
|
||||
@ApiOperation(value = "领券")
|
||||
@RequestMapping(value = "/receive", method = RequestMethod.POST)
|
||||
public CommonResult<String> receive(@RequestBody @Validated UserCouponReceiveRequest request) {
|
||||
if (storeCouponUserService.receiveCoupon(request)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.UserRechargeRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.response.OrderPayResultResponse;
|
||||
import com.zbkj.common.response.UserRechargeBillRecordResponse;
|
||||
import com.zbkj.common.response.UserRechargeFrontResponse;
|
||||
import com.zbkj.common.utils.CrmebUtil;
|
||||
import com.zbkj.front.service.UserCenterService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户 -- 充值
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("UserRechargeController")
|
||||
@RequestMapping("api/front/recharge")
|
||||
@Api(tags = "用户 -- 充值")
|
||||
public class UserRechargeController {
|
||||
@Autowired
|
||||
private UserCenterService userCenterService;
|
||||
|
||||
/**
|
||||
* 充值额度选择
|
||||
*/
|
||||
@ApiOperation(value = "充值额度选择")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
public CommonResult<UserRechargeFrontResponse> getRechargeConfig() {
|
||||
return CommonResult.success(userCenterService.getRechargeConfig());
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序充值
|
||||
*/
|
||||
@ApiOperation(value = "小程序充值")
|
||||
@RequestMapping(value = "/routine", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> routineRecharge(HttpServletRequest httpServletRequest, @RequestBody @Validated UserRechargeRequest request) {
|
||||
request.setFromType(Constants.PAY_TYPE_WE_CHAT_FROM_PROGRAM);
|
||||
request.setClientIp(CrmebUtil.getClientIp(httpServletRequest));
|
||||
OrderPayResultResponse recharge = userCenterService.recharge(request);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("data", recharge);
|
||||
map.put("type", request.getFromType());
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公众号充值
|
||||
*/
|
||||
@ApiOperation(value = "公众号充值")
|
||||
@RequestMapping(value = "/wechat", method = RequestMethod.POST)
|
||||
public CommonResult<OrderPayResultResponse> weChatRecharge(HttpServletRequest httpServletRequest, @RequestBody @Validated UserRechargeRequest request) {
|
||||
request.setClientIp(CrmebUtil.getClientIp(httpServletRequest));
|
||||
return CommonResult.success(userCenterService.recharge(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 佣金转入余额
|
||||
*/
|
||||
@ApiOperation(value = "佣金转入余额")
|
||||
@RequestMapping(value = "/transferIn", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> transferIn(@RequestParam(name = "price") BigDecimal price) {
|
||||
return CommonResult.success(userCenterService.transferIn(price));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户账单记录
|
||||
*/
|
||||
@ApiOperation(value = "用户账单记录")
|
||||
@RequestMapping(value = "/bill/record", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "type", value = "记录类型:all-全部,expenditure-支出,income-收入", required = true)
|
||||
public CommonResult<CommonPage<UserRechargeBillRecordResponse>> billRecord(@RequestParam(name = "type") String type, @ModelAttribute PageParamRequest pageRequest) {
|
||||
return CommonResult.success(userCenterService.nowMoneyBillRecord(type, pageRequest));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.response.UserSignInfoResponse;
|
||||
import com.zbkj.common.vo.SystemGroupDataSignConfigVo;
|
||||
import com.zbkj.common.vo.UserSignMonthVo;
|
||||
import com.zbkj.common.vo.UserSignVo;
|
||||
import com.zbkj.service.service.UserSignService;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 签到记录表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/front/user/sign")
|
||||
@Api(tags = "用户 -- 签到")
|
||||
public class UserSignController {
|
||||
|
||||
@Autowired
|
||||
private UserSignService userSignService;
|
||||
|
||||
/**
|
||||
* 签到列表
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserSignVo>> getList(@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserSignVo> userSignCommonPage = CommonPage.restPage(userSignService.getList(pageParamRequest));
|
||||
return CommonResult.success(userSignCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到列表,年月纬度
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/month", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserSignMonthVo>> getListGroupMonth(@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserSignMonthVo> userSignCommonPage = CommonPage.restPage(userSignService.getListGroupMonth(pageParamRequest));
|
||||
return CommonResult.success(userSignCommonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*/
|
||||
@ApiOperation(value = "配置")
|
||||
@RequestMapping(value = "/config", method = RequestMethod.GET)
|
||||
public CommonResult<List<SystemGroupDataSignConfigVo>> config() {
|
||||
return CommonResult.success(userSignService.getSignConfig());
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到
|
||||
*/
|
||||
@ApiOperation(value = "签到")
|
||||
@RequestMapping(value = "/integral", method = RequestMethod.GET)
|
||||
public CommonResult<SystemGroupDataSignConfigVo> info() {
|
||||
return CommonResult.success(userSignService.sign());
|
||||
}
|
||||
|
||||
/**
|
||||
* 今日记录详情
|
||||
*/
|
||||
@ApiOperation(value = "今日记录详情")
|
||||
@RequestMapping(value = "/get", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, Object>> get() {
|
||||
return CommonResult.success(userSignService.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到用户信息
|
||||
*/
|
||||
@ApiOperation(value = "签到用户信息")
|
||||
@RequestMapping(value = "/user", method = RequestMethod.POST)
|
||||
public CommonResult<UserSignInfoResponse> getUserInfo() {
|
||||
return CommonResult.success(userSignService.getUserSignInfo());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.model.wechat.TemplateMessage;
|
||||
import com.zbkj.common.request.RegisterAppWxRequest;
|
||||
import com.zbkj.common.request.RegisterThirdUserRequest;
|
||||
import com.zbkj.common.request.WxBindingPhoneRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.response.LoginResponse;
|
||||
import com.zbkj.common.response.WeChatJsSdkConfigResponse;
|
||||
import com.zbkj.front.service.UserCenterService;
|
||||
import com.zbkj.service.service.SystemNotificationService;
|
||||
import com.zbkj.service.service.WechatNewService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 微信缓存表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("WeChatFrontController")
|
||||
@RequestMapping("api/front/wechat")
|
||||
@Api(tags = "微信 -- 开放平台")
|
||||
public class WeChatController {
|
||||
|
||||
@Autowired
|
||||
private UserCenterService userCenterService;
|
||||
|
||||
@Autowired
|
||||
private WechatNewService wechatNewService;
|
||||
|
||||
@Autowired
|
||||
private SystemNotificationService systemNotificationService;
|
||||
|
||||
/**
|
||||
* 通过微信code登录
|
||||
*/
|
||||
@ApiOperation(value = "微信登录公共号授权登录")
|
||||
@RequestMapping(value = "/authorize/login", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "spread_spid", value = "推荐人id", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "code", value = "code码", dataType = "String", required = true)
|
||||
})
|
||||
public CommonResult<LoginResponse> login(@RequestParam(value = "spread_spid", defaultValue = "0", required = false) Integer spreadUid,
|
||||
@RequestParam(value = "code") String code){
|
||||
return CommonResult.success(userCenterService.weChatAuthorizeLogin(code, spreadUid));
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信登录小程序授权登录
|
||||
*/
|
||||
@ApiOperation(value = "微信登录小程序授权登录")
|
||||
@RequestMapping(value = "/authorize/program/login", method = RequestMethod.POST)
|
||||
public CommonResult<LoginResponse> programLogin(@RequestParam String code, @RequestBody @Validated RegisterThirdUserRequest request){
|
||||
return CommonResult.success(userCenterService.weChatAuthorizeProgramLogin(code, request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信注册绑定手机号
|
||||
*/
|
||||
@ApiOperation(value = "微信注册绑定手机号")
|
||||
@RequestMapping(value = "/register/binding/phone", method = RequestMethod.POST)
|
||||
public CommonResult<LoginResponse> registerBindingPhone(@RequestBody @Validated WxBindingPhoneRequest request){
|
||||
return CommonResult.success(userCenterService.registerBindingPhone(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信公众号js配置
|
||||
*/
|
||||
@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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序获取授权logo
|
||||
*/
|
||||
@ApiOperation(value = "小程序获取授权logo")
|
||||
@RequestMapping(value = "/getLogo", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, String>> getLogo(){
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("logoUrl", userCenterService.getLogo());
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订阅消息模板列表
|
||||
*/
|
||||
@ApiOperation(value = "订阅消息模板列表")
|
||||
@RequestMapping(value = "/program/my/temp/list", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "type", value = "支付之前:beforePay|支付成功:afterPay|申请退款:refundApply|充值之前:beforeRecharge|创建砍价:createBargain|参与拼团:pink|取消拼团:cancelPink")
|
||||
public CommonResult<List<TemplateMessage>> programMyTempList(@RequestParam(name = "type") String type){
|
||||
return CommonResult.success(systemNotificationService.getMiniTempList(type));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.zbkj.front.filter;
|
||||
|
||||
|
||||
import com.zbkj.common.utils.RequestUtil;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
||||
/**
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
* 返回值输出过滤器
|
||||
*/
|
||||
//@Component
|
||||
public class ResponseFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
|
||||
throws IOException, ServletException {
|
||||
ResponseWrapper wrapperResponse = new ResponseWrapper((HttpServletResponse) response);//转换成代理类
|
||||
// 这里只拦截返回,直接让请求过去,如果在请求前有处理,可以在这里处理
|
||||
filterChain.doFilter(request, wrapperResponse);
|
||||
byte[] content = wrapperResponse.getContent();//获取返回值
|
||||
//判断是否有值
|
||||
if (content.length > 0) {
|
||||
String str = new String(content, StandardCharsets.UTF_8);
|
||||
|
||||
try {
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
str = new ResponseRouter().filter(str, RequestUtil.getUri(req));
|
||||
} 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,46 @@
|
||||
package com.zbkj.front.filter;
|
||||
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.common.utils.SpringUtil;
|
||||
import com.zbkj.service.service.SystemAttachmentService;
|
||||
|
||||
/**
|
||||
* response路径处理
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class ResponseRouter {
|
||||
|
||||
public String filter(String data, String path) {
|
||||
boolean result = un().contains(path);
|
||||
if (result) {
|
||||
return data;
|
||||
}
|
||||
|
||||
if (!path.contains("api/admin/") && !path.contains("api/front/")) {
|
||||
return data;
|
||||
}
|
||||
|
||||
//根据需要处理返回值
|
||||
if (data.contains(Constants.UPLOAD_TYPE_IMAGE+"/") && !data.contains("data:image/png;base64")) {
|
||||
data = SpringUtil.getBean(SystemAttachmentService.class).prefixImage(data);
|
||||
}
|
||||
|
||||
if (data.contains("file/")) {
|
||||
data = SpringUtil.getBean(SystemAttachmentService.class).prefixFile(data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public static String un() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.zbkj.front.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包装类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
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,60 @@
|
||||
package com.zbkj.front.interceptor;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.token.FrontTokenComponent;
|
||||
import com.zbkj.common.utils.RequestUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 移动端管理端 token验证拦截器 使用前注意需要一个@Bean手动注解,否则注入无效
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class FrontTokenInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Autowired
|
||||
private FrontTokenComponent frontTokenComponent;
|
||||
|
||||
//程序处理之前需要处理的业务
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
String token = frontTokenComponent.getToken(request);
|
||||
if(token == null || token.isEmpty()){
|
||||
//判断路由,部分路由不管用户是否登录都可以访问
|
||||
boolean result = frontTokenComponent.checkRouter(RequestUtil.getUri(request));
|
||||
if(result){
|
||||
return true;
|
||||
}
|
||||
response.getWriter().write(JSONObject.toJSONString(CommonResult.unauthorized()));
|
||||
return false;
|
||||
}
|
||||
|
||||
Boolean result = frontTokenComponent.check(token, request);
|
||||
if(!result){
|
||||
response.getWriter().write(JSONObject.toJSONString(CommonResult.unauthorized()));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
|
||||
}
|
||||
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.zbkj.front.pub;
|
||||
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.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;
|
||||
|
||||
/**
|
||||
* @program: crmeb
|
||||
* @author: 大粽子
|
||||
* @create: 2021-09-23 09:18
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/public/jsconfig")
|
||||
@Api(tags = "公共JS配置")
|
||||
public class GetJSConfig {
|
||||
|
||||
@Autowired
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@PreAuthorize("hasAuthority('public:jsconfig:getcrmebchatconfig')")
|
||||
@ApiOperation(value = "CRMEB-chat客服统计")
|
||||
@RequestMapping(value = "/getcrmebchatconfig", method = RequestMethod.GET)
|
||||
public String set(){
|
||||
return systemConfigService.getValueByKey(Constants.JS_CONFIG_CRMEB_CHAT_TONGJI);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.zbkj.front.pub;
|
||||
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.utils.ImageMergeUtil;
|
||||
import com.zbkj.common.vo.ImageMergeUtilVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 图片操作
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/public/qrcode")
|
||||
@Api(tags = "图片操作")
|
||||
public class ImageMergeController {
|
||||
|
||||
@ApiOperation(value = "合并图片返回文件")
|
||||
@RequestMapping(value = "/mergeList", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, String>> mergeList(@RequestBody @Validated List<ImageMergeUtilVo> list){
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("base64Code", ImageMergeUtil.drawWordFile(list)); //需要云服务域名,如果需要存入数据库参照上传图片服务
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package com.zbkj.front.pub;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.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;
|
||||
|
||||
|
||||
/**
|
||||
* 后台管理员表 前端控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@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
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-13
|
||||
*/
|
||||
@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
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-13
|
||||
*/
|
||||
@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,69 @@
|
||||
package com.zbkj.front.service;
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.IndexInfoResponse;
|
||||
import com.zbkj.common.response.IndexProductResponse;
|
||||
import com.zbkj.common.vo.MyRecord;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.system.SystemConfig;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* IndexService 接口
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public interface IndexService{
|
||||
|
||||
/**
|
||||
* 首页信息
|
||||
* @return IndexInfoResponse
|
||||
*/
|
||||
IndexInfoResponse getIndexInfo();
|
||||
|
||||
/**
|
||||
* 热门搜索
|
||||
* @return List
|
||||
*/
|
||||
List<HashMap<String, Object>> hotKeywords();
|
||||
|
||||
/**
|
||||
* 分享配置信息
|
||||
*/
|
||||
HashMap<String, String> getShareConfig();
|
||||
|
||||
/**
|
||||
* 获取首页商品列表
|
||||
* @param type 类型 【1 精品推荐 2 热门榜单 3首发新品 4促销单品】
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return List
|
||||
*/
|
||||
CommonPage<IndexProductResponse> findIndexProductList(Integer type, PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 获取颜色配置
|
||||
* @return SystemConfig
|
||||
*/
|
||||
SystemConfig getColorConfig();
|
||||
|
||||
/**
|
||||
* 获取版本信息
|
||||
* @return MyRecord
|
||||
*/
|
||||
MyRecord getVersion();
|
||||
|
||||
/**
|
||||
* 获取全局本地图片域名
|
||||
* @return String
|
||||
*/
|
||||
String getImageDomain();
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.zbkj.front.service;
|
||||
|
||||
import com.zbkj.common.model.user.User;
|
||||
import com.zbkj.common.request.LoginMobileRequest;
|
||||
import com.zbkj.common.request.LoginRequest;
|
||||
import com.zbkj.common.response.LoginResponse;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 移动端登录服务类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public interface LoginService {
|
||||
|
||||
/**
|
||||
* 账号密码登录
|
||||
* @return LoginResponse
|
||||
*/
|
||||
LoginResponse login(LoginRequest loginRequest);
|
||||
|
||||
/**
|
||||
* 手机号验证码登录
|
||||
*/
|
||||
LoginResponse phoneLogin(LoginMobileRequest loginRequest);
|
||||
|
||||
/**
|
||||
* 老绑定分销关系
|
||||
* @param user User 用户user类
|
||||
* @param spreadUid Integer 推广人id
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean bindSpread(User user, Integer spreadUid);
|
||||
|
||||
/**
|
||||
* 推出登录
|
||||
* @param request HttpServletRequest
|
||||
*/
|
||||
void loginOut(HttpServletRequest request);
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.zbkj.front.service;
|
||||
|
||||
import com.zbkj.common.model.product.StoreProduct;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.ProductListRequest;
|
||||
import com.zbkj.common.request.ProductRequest;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.common.response.*;
|
||||
import com.zbkj.common.vo.CategoryTreeVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* IndexService 接口
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public interface ProductService {
|
||||
|
||||
/**
|
||||
* 商品分类
|
||||
* @return List
|
||||
*/
|
||||
List<CategoryTreeVo> getCategory();
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
* @param request 请求参数
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return CommonPage
|
||||
*/
|
||||
CommonPage<IndexProductResponse> getList(ProductRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 获取商品详情
|
||||
* @param id 商品编号
|
||||
* @param type normal-正常,void-视频
|
||||
* @return 商品详情信息
|
||||
*/
|
||||
ProductDetailResponse getDetail(Integer id, String type);
|
||||
|
||||
/**
|
||||
* 获取商品SKU详情
|
||||
* @param id 商品编号
|
||||
* @return 商品详情信息
|
||||
*/
|
||||
ProductDetailResponse getSkuDetail(Integer id);
|
||||
|
||||
/**
|
||||
* 商品评论列表
|
||||
* @param proId 商品编号
|
||||
* @param type 评价等级|0=全部,1=好评,2=中评,3=差评
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return PageInfo<ProductReplyResponse>
|
||||
*/
|
||||
PageInfo<ProductReplyResponse> getReplyList(Integer proId, Integer type, PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 商品评论数量
|
||||
* @param id 商品id
|
||||
* @return StoreProductReplayCountResponse
|
||||
*/
|
||||
StoreProductReplayCountResponse getReplyCount(Integer id);
|
||||
|
||||
/**
|
||||
* 获取热门推荐商品列表
|
||||
* @param pageRequest 分页参数
|
||||
* @return CommonPage<IndexProductResponse>
|
||||
*/
|
||||
CommonPage<IndexProductResponse> getHotProductList(PageParamRequest pageRequest);
|
||||
|
||||
/**
|
||||
* 商品详情评论
|
||||
* @param id 商品id
|
||||
* @return ProductDetailReplyResponse
|
||||
*/
|
||||
ProductDetailReplyResponse getProductReply(Integer id);
|
||||
|
||||
/**
|
||||
* 优选商品推荐
|
||||
* @return CommonPage<IndexProductResponse>
|
||||
*/
|
||||
CommonPage<IndexProductResponse> getGoodProductList();
|
||||
|
||||
/**
|
||||
* 商品列表(个别分类模型使用)
|
||||
* @param request 列表请求参数
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return CommonPage
|
||||
*/
|
||||
CommonPage<IndexProductResponse> getCategoryProductList(ProductListRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 获取商品排行榜
|
||||
* @return List
|
||||
*/
|
||||
List<StoreProduct> getLeaderboard();
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.zbkj.front.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* QrCodeService 接口
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public interface QrCodeService {
|
||||
|
||||
/**
|
||||
* 获取二维码
|
||||
* @return CommonResult
|
||||
*/
|
||||
Map<String, Object> get(JSONObject data);
|
||||
|
||||
/**
|
||||
* 远程图片转base64
|
||||
* @param url 图片链接地址
|
||||
*/
|
||||
Map<String, Object> base64(String url);
|
||||
|
||||
/**
|
||||
* 将字符串 转base64
|
||||
* @param text 字符串
|
||||
* @param width 宽
|
||||
* @param height 高
|
||||
*/
|
||||
Map<String, Object> base64String(String text,int width, int height);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package com.zbkj.front.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.common.model.system.SystemUserLevel;
|
||||
import com.zbkj.common.model.user.User;
|
||||
import com.zbkj.common.model.user.UserExperienceRecord;
|
||||
import com.zbkj.common.model.user.UserIntegralRecord;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.*;
|
||||
import com.zbkj.common.response.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户中心 服务类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public interface UserCenterService extends IService<User> {
|
||||
|
||||
/**
|
||||
* 推广数据接口(昨天的佣金 累计提现金额 当前佣金)
|
||||
* @return UserCommissionResponse
|
||||
*/
|
||||
UserCommissionResponse getCommission();
|
||||
|
||||
/**
|
||||
* 推广佣金/提现总和
|
||||
* @param type 类型 佣金类型3=佣金,4=提现
|
||||
* @return BigDecimal
|
||||
*/
|
||||
BigDecimal getSpreadCountByType(Integer type);
|
||||
|
||||
/**
|
||||
* 提现申请
|
||||
* @param request 申请参数
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean extractCash(UserExtractRequest request);
|
||||
|
||||
/**
|
||||
* 获取提现银行列表
|
||||
* @return List<String>
|
||||
*/
|
||||
List<String> getExtractBank();
|
||||
|
||||
/**
|
||||
* 会员等级列表
|
||||
*/
|
||||
List<SystemUserLevel> getUserLevelList();
|
||||
|
||||
/**
|
||||
* 获取推广人列表
|
||||
* @param request 查询参数
|
||||
* @param pageParamRequest 分页
|
||||
* @return List<UserSpreadPeopleItemResponse>
|
||||
*/
|
||||
List<UserSpreadPeopleItemResponse> getSpreadPeopleList(UserSpreadPeopleRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 充值额度选择
|
||||
* @return UserRechargeResponse
|
||||
*/
|
||||
UserRechargeFrontResponse getRechargeConfig();
|
||||
|
||||
/**
|
||||
* 用户资金统计
|
||||
* @return UserBalanceResponse
|
||||
*/
|
||||
UserBalanceResponse getUserBalance();
|
||||
|
||||
/**
|
||||
* 推广订单
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return UserSpreadOrderResponse
|
||||
*/
|
||||
UserSpreadOrderResponse getSpreadOrder(PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 充值
|
||||
* @return UserSpreadOrderResponse;
|
||||
*/
|
||||
OrderPayResultResponse recharge(UserRechargeRequest request);
|
||||
|
||||
/**
|
||||
* 通过微信code登录
|
||||
*/
|
||||
LoginResponse weChatAuthorizeLogin(String code, Integer spreadUid);
|
||||
|
||||
/**
|
||||
* 小程序获取授权logo
|
||||
* @return String
|
||||
*/
|
||||
String getLogo();
|
||||
|
||||
/**
|
||||
* 微信登录小程序授权登录
|
||||
* @param code code
|
||||
* @param request 用户参数
|
||||
* @return LoginResponse
|
||||
*/
|
||||
LoginResponse weChatAuthorizeProgramLogin(String code, RegisterThirdUserRequest request);
|
||||
|
||||
/**
|
||||
* 推广人排行榜
|
||||
* @param type String 时间范围(week-周,month-月)
|
||||
* @param pageParamRequest PageParamRequest 分页
|
||||
* @return List<LoginResponse>
|
||||
*/
|
||||
List<User> getTopSpreadPeopleListByDate(String type, PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 佣金排行榜
|
||||
* @param type String 时间范围
|
||||
* @param pageParamRequest PageParamRequest 分页
|
||||
* @return List<User>
|
||||
*/
|
||||
List<User> getTopBrokerageListByDate(String type, PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 海报背景图
|
||||
* @return List
|
||||
*/
|
||||
List<UserSpreadBannerResponse> getSpreadBannerList();
|
||||
|
||||
/**
|
||||
* 当前用户在佣金排行第几名
|
||||
* @param type String 时间范围
|
||||
* @return 排名
|
||||
*/
|
||||
Integer getNumberByTop(String type);
|
||||
|
||||
/**
|
||||
* 佣金转入余额
|
||||
* @param price 金额
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean transferIn(BigDecimal price);
|
||||
|
||||
/**
|
||||
* 提现记录
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return PageInfo
|
||||
*/
|
||||
PageInfo<UserExtractRecordResponse> getExtractRecord(PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 推广佣金明细
|
||||
* @param pageParamRequest 分页参数
|
||||
*/
|
||||
PageInfo<SpreadCommissionDetailResponse> getSpreadCommissionDetail(PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 用户账单记录(现金)
|
||||
* @param type 记录类型:all-全部,expenditure-支出,income-收入
|
||||
* @return CommonPage
|
||||
*/
|
||||
CommonPage<UserRechargeBillRecordResponse> nowMoneyBillRecord(String type, PageParamRequest pageRequest);
|
||||
|
||||
/**
|
||||
* 微信注册绑定手机号
|
||||
* @param request 请求参数
|
||||
* @return 登录信息
|
||||
*/
|
||||
LoginResponse registerBindingPhone(WxBindingPhoneRequest request);
|
||||
|
||||
/**
|
||||
* 用户积分记录列表
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return List<UserIntegralRecord>
|
||||
*/
|
||||
List<UserIntegralRecord> getUserIntegralRecordList(PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 获取用户积分信息
|
||||
* @return IntegralUserResponse
|
||||
*/
|
||||
IntegralUserResponse getIntegralUser();
|
||||
|
||||
/**
|
||||
* 获取用户经验记录
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return List<UserExperienceRecord>
|
||||
*/
|
||||
List<UserExperienceRecord> getUserExperienceList(PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 提现用户信息
|
||||
* @return UserExtractCashResponse
|
||||
*/
|
||||
UserExtractCashResponse getExtractUser();
|
||||
|
||||
/**
|
||||
* 推广人列表统计
|
||||
* @return UserSpreadPeopleResponse
|
||||
*/
|
||||
UserSpreadPeopleResponse getSpreadPeopleCount();
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
package com.zbkj.front.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.IndexInfoResponse;
|
||||
import com.zbkj.common.response.IndexProductResponse;
|
||||
import com.zbkj.common.response.ProductActivityItemResponse;
|
||||
import com.zbkj.common.vo.MyRecord;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.common.constants.SysConfigConstants;
|
||||
import com.zbkj.common.constants.SysGroupDataConstants;
|
||||
import com.zbkj.common.exception.CrmebException;
|
||||
import com.zbkj.common.utils.CrmebUtil;
|
||||
import com.zbkj.common.model.record.UserVisitRecord;
|
||||
import com.zbkj.common.model.product.StoreProduct;
|
||||
import com.zbkj.common.model.system.SystemConfig;
|
||||
import com.zbkj.common.model.user.User;
|
||||
import com.zbkj.front.service.IndexService;
|
||||
import com.zbkj.service.delete.ProductUtils;
|
||||
import com.zbkj.service.service.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* IndexServiceImpl 接口实现
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Service
|
||||
public class IndexServiceImpl implements IndexService {
|
||||
|
||||
@Autowired
|
||||
private SystemGroupDataService systemGroupDataService;
|
||||
|
||||
@Autowired
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private StoreProductService storeProductService;
|
||||
|
||||
@Autowired
|
||||
private ProductUtils productUtils;
|
||||
|
||||
@Autowired
|
||||
private UserVisitRecordService userVisitRecordService;
|
||||
|
||||
/**
|
||||
* 首页数据
|
||||
* banner、金刚区、广告位
|
||||
*/
|
||||
@Override
|
||||
public IndexInfoResponse getIndexInfo() {
|
||||
IndexInfoResponse indexInfoResponse = new IndexInfoResponse();
|
||||
indexInfoResponse.setBanner(systemGroupDataService.getListMapByGid(Constants.GROUP_DATA_ID_INDEX_BANNER)); //首页banner滚动图
|
||||
indexInfoResponse.setMenus(systemGroupDataService.getListMapByGid(Constants.GROUP_DATA_ID_INDEX_MENU)); //导航模块
|
||||
indexInfoResponse.setRoll(systemGroupDataService.getListMapByGid(Constants.GROUP_DATA_ID_INDEX_NEWS_BANNER)); //首页滚动新闻
|
||||
|
||||
indexInfoResponse.setLogoUrl(systemConfigService.getValueByKey(Constants.CONFIG_KEY_SITE_LOGO));// 企业logo地址
|
||||
indexInfoResponse.setYzfUrl(systemConfigService.getValueByKey(Constants.CONFIG_KEY_YZF_H5_URL));// 云智服H5 url
|
||||
indexInfoResponse.setConsumerHotline(systemConfigService.getValueByKey(Constants.CONFIG_KEY_CONSUMER_HOTLINE));// 客服电话
|
||||
indexInfoResponse.setTelephoneServiceSwitch(systemConfigService.getValueByKey(Constants.CONFIG_KEY_TELEPHONE_SERVICE_SWITCH));// 客服电话服务
|
||||
indexInfoResponse.setCategoryPageConfig(systemConfigService.getValueByKey(Constants.CONFIG_CATEGORY_CONFIG));// 商品分类页配置
|
||||
indexInfoResponse.setIsShowCategory(systemConfigService.getValueByKey(Constants.CONFIG_IS_SHOW_CATEGORY));// 是否隐藏一级分类
|
||||
indexInfoResponse.setExplosiveMoney(systemGroupDataService.getListMapByGid(Constants.GROUP_DATA_ID_INDEX_EX_BANNER));//首页超值爆款
|
||||
indexInfoResponse.setHomePageSaleListStyle(systemConfigService.getValueByKey(Constants.CONFIG_IS_PRODUCT_LIST_STYLE));// 首页商品列表模板配置
|
||||
indexInfoResponse.setSubscribe(false);
|
||||
User user = userService.getInfo();
|
||||
if(ObjectUtil.isNotNull(user) && user.getSubscribe()) {
|
||||
indexInfoResponse.setSubscribe(user.getSubscribe());
|
||||
}
|
||||
|
||||
// 保存用户访问记录
|
||||
UserVisitRecord visitRecord = new UserVisitRecord();
|
||||
visitRecord.setDate(DateUtil.date().toString("yyyy-MM-dd"));
|
||||
visitRecord.setUid(userService.getUserId());
|
||||
visitRecord.setVisitType(1);
|
||||
userVisitRecordService.save(visitRecord);
|
||||
return indexInfoResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 热门搜索
|
||||
* @return List<HashMap<String, String>>
|
||||
*/
|
||||
@Override
|
||||
public List<HashMap<String, Object>> hotKeywords() {
|
||||
return systemGroupDataService.getListMapByGid(SysGroupDataConstants.GROUP_DATA_ID_INDEX_KEYWORDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信分享配置
|
||||
* @return Object
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, String> getShareConfig() {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
HashMap<String, String> info = systemConfigService.info(Constants.CONFIG_FORM_ID_PUBLIC);
|
||||
if(info == null) {
|
||||
throw new CrmebException("请配置公众号分享信息!");
|
||||
}
|
||||
map.put("img", info.get(SysConfigConstants.CONFIG_KEY_ADMIN_WECHAT_SHARE_IMAGE));
|
||||
map.put("title", info.get(SysConfigConstants.CONFIG_KEY_ADMIN_WECHAT_SHARE_TITLE));
|
||||
map.put("synopsis", info.get(SysConfigConstants.CONFIG_KEY_ADMIN_WECHAT_SHARE_SYNOSIS));
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取首页商品列表
|
||||
* @param type 类型 【1 精品推荐 2 热门榜单 3首发新品 4促销单品】
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public CommonPage<IndexProductResponse> findIndexProductList(Integer type, PageParamRequest pageParamRequest) {
|
||||
if (type < Constants.INDEX_RECOMMEND_BANNER || type > Constants.INDEX_BENEFIT_BANNER) {
|
||||
return CommonPage.restPage(new ArrayList<>());
|
||||
}
|
||||
List<StoreProduct> storeProductList = storeProductService.getIndexProduct(type, pageParamRequest);
|
||||
if(CollUtil.isEmpty(storeProductList)) {
|
||||
return CommonPage.restPage(new ArrayList<>());
|
||||
}
|
||||
CommonPage<StoreProduct> storeProductCommonPage = CommonPage.restPage(storeProductList);
|
||||
|
||||
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
|
||||
for (StoreProduct storeProduct : storeProductList) {
|
||||
IndexProductResponse productResponse = new IndexProductResponse();
|
||||
List<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
|
||||
// 活动类型默认:直接跳过
|
||||
if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
|
||||
BeanUtils.copyProperties(storeProduct, productResponse);
|
||||
productResponseArrayList.add(productResponse);
|
||||
continue;
|
||||
}
|
||||
// 根据参与活动添加对应商品活动标示
|
||||
HashMap<Integer, ProductActivityItemResponse> activityByProduct =
|
||||
productUtils.getActivityByProduct(storeProduct.getId(), storeProduct.getActivity());
|
||||
if (CollUtil.isNotEmpty(activityByProduct)) {
|
||||
for (Integer activity : activityList) {
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_NORMAL)) {
|
||||
break;
|
||||
}
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_SECKILL)) {
|
||||
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_SECKILL);
|
||||
if (ObjectUtil.isNotNull(itemResponse)) {
|
||||
productResponse.setActivityH5(itemResponse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_BARGAIN)) {
|
||||
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_BARGAIN);
|
||||
if (ObjectUtil.isNotNull(itemResponse)) {
|
||||
productResponse.setActivityH5(itemResponse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_PINGTUAN)) {
|
||||
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
if (ObjectUtil.isNotNull(itemResponse)) {
|
||||
productResponse.setActivityH5(itemResponse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BeanUtils.copyProperties(storeProduct, productResponse);
|
||||
productResponseArrayList.add(productResponse);
|
||||
}
|
||||
CommonPage<IndexProductResponse> productResponseCommonPage = CommonPage.restPage(productResponseArrayList);
|
||||
BeanUtils.copyProperties(storeProductCommonPage, productResponseCommonPage, "list");
|
||||
return productResponseCommonPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取颜色配置
|
||||
* @return SystemConfig
|
||||
*/
|
||||
@Override
|
||||
public SystemConfig getColorConfig() {
|
||||
return systemConfigService.getColorConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取版本信息
|
||||
* @return MyRecord
|
||||
*/
|
||||
@Override
|
||||
public MyRecord getVersion() {
|
||||
MyRecord record = new MyRecord();
|
||||
// app版本号
|
||||
record.set("appVersion", systemConfigService.getValueByKey(Constants.CONFIG_APP_VERSION));
|
||||
record.set("androidAddress", systemConfigService.getValueByKey(Constants.CONFIG_APP_ANDROID_ADDRESS));
|
||||
record.set("iosAddress", systemConfigService.getValueByKey(Constants.CONFIG_APP_IOS_ADDRESS));
|
||||
record.set("openUpgrade", systemConfigService.getValueByKey(Constants.CONFIG_APP_OPEN_UPGRADE));
|
||||
return record;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全局本地图片域名
|
||||
* @return String
|
||||
*/
|
||||
@Override
|
||||
public String getImageDomain() {
|
||||
String localUploadUrl = systemConfigService.getValueByKey("localUploadUrl");
|
||||
return StrUtil.isBlank(localUploadUrl) ? "" : localUploadUrl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.zbkj.front.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.zbkj.common.constants.SmsConstants;
|
||||
import com.zbkj.common.exception.CrmebException;
|
||||
import com.zbkj.common.model.user.User;
|
||||
import com.zbkj.common.request.LoginMobileRequest;
|
||||
import com.zbkj.common.request.LoginRequest;
|
||||
import com.zbkj.common.response.LoginResponse;
|
||||
import com.zbkj.common.token.FrontTokenComponent;
|
||||
import com.zbkj.common.utils.CrmebUtil;
|
||||
import com.zbkj.common.utils.DateUtil;
|
||||
import com.zbkj.common.utils.RedisUtil;
|
||||
import com.zbkj.front.service.LoginService;
|
||||
import com.zbkj.service.service.UserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 移动端登录服务类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Service
|
||||
public class LoginServiceImpl implements LoginService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(LoginServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private FrontTokenComponent tokenComponent;
|
||||
|
||||
/**
|
||||
* 账号密码登录
|
||||
*
|
||||
* @return LoginResponse
|
||||
*/
|
||||
@Override
|
||||
public LoginResponse login(LoginRequest loginRequest) {
|
||||
User user = userService.getByPhone(loginRequest.getPhone());
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
throw new CrmebException("此账号未注册");
|
||||
}
|
||||
if (!user.getStatus()) {
|
||||
throw new CrmebException("此账号被禁用");
|
||||
}
|
||||
|
||||
// 校验密码
|
||||
String password = CrmebUtil.encryptPassword(loginRequest.getPassword(), loginRequest.getPhone());
|
||||
if (!user.getPwd().equals(password)) {
|
||||
throw new CrmebException("密码错误");
|
||||
}
|
||||
|
||||
LoginResponse loginResponse = new LoginResponse();
|
||||
String token = tokenComponent.createToken(user);
|
||||
loginResponse.setToken(token);
|
||||
|
||||
//绑定推广关系
|
||||
if (loginRequest.getSpreadPid() > 0) {
|
||||
bindSpread(user, loginRequest.getSpreadPid());
|
||||
}
|
||||
|
||||
// 记录最后一次登录时间
|
||||
user.setLastLoginTime(DateUtil.nowDateTime());
|
||||
userService.updateById(user);
|
||||
|
||||
loginResponse.setUid(user.getUid());
|
||||
loginResponse.setNikeName(user.getNickname());
|
||||
loginResponse.setPhone(user.getPhone());
|
||||
return loginResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号验证码登录
|
||||
*
|
||||
* @param loginRequest 登录请求信息
|
||||
* @return LoginResponse
|
||||
*/
|
||||
@Override
|
||||
public LoginResponse phoneLogin(LoginMobileRequest loginRequest) {
|
||||
//检测验证码
|
||||
checkValidateCode(loginRequest.getPhone(), loginRequest.getCaptcha());
|
||||
Integer spreadPid = Optional.ofNullable(loginRequest.getSpreadPid()).orElse(0);
|
||||
//查询手机号信息
|
||||
User user = userService.getByPhone(loginRequest.getPhone());
|
||||
if (ObjectUtil.isNull(user)) {// 此用户不存在,走新用户注册流程
|
||||
user = userService.registerPhone(loginRequest.getPhone(), spreadPid);
|
||||
} else {
|
||||
if (!user.getStatus()) {
|
||||
throw new CrmebException("当前账户已禁用,请联系管理员!");
|
||||
}
|
||||
if (user.getSpreadUid().equals(0) && spreadPid > 0) {
|
||||
// 绑定推广关系
|
||||
bindSpread(user, spreadPid);
|
||||
}
|
||||
// 记录最后一次登录时间
|
||||
user.setLastLoginTime(DateUtil.nowDateTime());
|
||||
boolean b = userService.updateById(user);
|
||||
if (!b) {
|
||||
logger.error("用户登录时,记录最后一次登录时间出错,uid = " + user.getUid());
|
||||
}
|
||||
}
|
||||
|
||||
//生成token
|
||||
LoginResponse loginResponse = new LoginResponse();
|
||||
String token = tokenComponent.createToken(user);
|
||||
loginResponse.setToken(token);
|
||||
loginResponse.setUid(user.getUid());
|
||||
loginResponse.setNikeName(user.getNickname());
|
||||
loginResponse.setPhone(user.getPhone());
|
||||
return loginResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测手机验证码
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @param code 验证码
|
||||
*/
|
||||
private void checkValidateCode(String phone, String code) {
|
||||
Object validateCode = redisUtil.get(SmsConstants.SMS_VALIDATE_PHONE + phone);
|
||||
if (ObjectUtil.isNull(validateCode)) {
|
||||
throw new CrmebException("验证码已过期");
|
||||
}
|
||||
if (!validateCode.toString().equals(code)) {
|
||||
throw new CrmebException("验证码错误");
|
||||
}
|
||||
//删除验证码
|
||||
redisUtil.delete(SmsConstants.SMS_VALIDATE_PHONE + phone);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定分销关系
|
||||
*
|
||||
* @param user User 用户user类
|
||||
* @param spreadUid Integer 推广人id
|
||||
* @return Boolean
|
||||
* 1.判断分销功能是否启用
|
||||
* 2.判断分销模式
|
||||
* 3.根据不同的分销模式校验
|
||||
* 4.指定分销,只有分销员才可以分销,需要spreadUid是推广员才可以绑定
|
||||
* 5.满额分销,同上
|
||||
* 6.人人分销,可以直接绑定
|
||||
*/
|
||||
@Override
|
||||
public Boolean bindSpread(User user, Integer spreadUid) {
|
||||
Boolean checkBingSpread = userService.checkBingSpread(user, spreadUid, "old");
|
||||
if (!checkBingSpread) return false;
|
||||
|
||||
user.setSpreadUid(spreadUid);
|
||||
user.setSpreadTime(DateUtil.nowDateTime());
|
||||
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
userService.updateById(user);
|
||||
userService.updateSpreadCountByUid(spreadUid, "add");
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if (!execute) {
|
||||
logger.error(StrUtil.format("绑定推广人时出错,userUid = {}, spreadUid = {}", user.getUid(), spreadUid));
|
||||
}
|
||||
return execute;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推出登录
|
||||
* @param request HttpServletRequest
|
||||
*/
|
||||
@Override
|
||||
public void loginOut(HttpServletRequest request) {
|
||||
tokenComponent.logout(request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,542 @@
|
||||
package com.zbkj.front.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.common.constants.CategoryConstants;
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.common.constants.RedisConstatns;
|
||||
import com.zbkj.common.constants.SysConfigConstants;
|
||||
import com.zbkj.common.model.product.StoreProduct;
|
||||
import com.zbkj.common.model.product.StoreProductAttr;
|
||||
import com.zbkj.common.model.product.StoreProductAttrValue;
|
||||
import com.zbkj.common.model.record.UserVisitRecord;
|
||||
import com.zbkj.common.model.system.SystemUserLevel;
|
||||
import com.zbkj.common.model.user.User;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.ProductListRequest;
|
||||
import com.zbkj.common.request.ProductRequest;
|
||||
import com.zbkj.common.response.*;
|
||||
import com.zbkj.common.utils.CrmebUtil;
|
||||
import com.zbkj.common.utils.RedisUtil;
|
||||
import com.zbkj.common.vo.CategoryTreeVo;
|
||||
import com.zbkj.common.vo.MyRecord;
|
||||
import com.zbkj.front.service.ProductService;
|
||||
import com.zbkj.service.delete.ProductUtils;
|
||||
import com.zbkj.service.service.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* IndexServiceImpl 接口实现
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Service
|
||||
public class ProductServiceImpl implements ProductService {
|
||||
|
||||
@Autowired
|
||||
private StoreProductService storeProductService;
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
@Autowired
|
||||
private StoreProductReplyService storeProductReplyService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private StoreProductRelationService storeProductRelationService;
|
||||
|
||||
@Autowired
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@Autowired
|
||||
private ProductUtils productUtils;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private StoreProductAttrService attrService;
|
||||
|
||||
@Autowired
|
||||
private StoreProductAttrValueService storeProductAttrValueService;
|
||||
|
||||
@Autowired
|
||||
private SystemUserLevelService systemUserLevelService;
|
||||
|
||||
@Autowired
|
||||
private StoreCartService cartService;
|
||||
|
||||
@Autowired
|
||||
private UserVisitRecordService userVisitRecordService;
|
||||
|
||||
/**
|
||||
* 获取分类
|
||||
* @return List<CategoryTreeVo>
|
||||
*/
|
||||
@Override
|
||||
public List<CategoryTreeVo> getCategory() {
|
||||
List<CategoryTreeVo> listTree = categoryService.getListTree(CategoryConstants.CATEGORY_TYPE_PRODUCT, 1, "");
|
||||
for (int i = 0; i < listTree.size();) {
|
||||
CategoryTreeVo categoryTreeVo = listTree.get(i);
|
||||
if (!categoryTreeVo.getPid().equals(0)) {
|
||||
listTree.remove(i);
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return listTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
* @return CommonPage<IndexProductResponse>
|
||||
*/
|
||||
@Override
|
||||
public CommonPage<IndexProductResponse> getList(ProductRequest request, PageParamRequest pageRequest) {
|
||||
List<StoreProduct> storeProductList = storeProductService.findH5List(request, pageRequest);
|
||||
if (CollUtil.isEmpty(storeProductList)) {
|
||||
return CommonPage.restPage(new ArrayList<>());
|
||||
}
|
||||
CommonPage<StoreProduct> storeProductCommonPage = CommonPage.restPage(storeProductList);
|
||||
|
||||
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
|
||||
for (StoreProduct storeProduct : storeProductList) {
|
||||
IndexProductResponse productResponse = new IndexProductResponse();
|
||||
List<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
|
||||
// 活动类型默认:直接跳过
|
||||
if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
|
||||
BeanUtils.copyProperties(storeProduct, productResponse);
|
||||
productResponseArrayList.add(productResponse);
|
||||
continue;
|
||||
}
|
||||
// 根据参与活动添加对应商品活动标示
|
||||
HashMap<Integer, ProductActivityItemResponse> activityByProduct =
|
||||
productUtils.getActivityByProduct(storeProduct.getId(), storeProduct.getActivity());
|
||||
if (CollUtil.isNotEmpty(activityByProduct)) {
|
||||
for (Integer activity : activityList) {
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_NORMAL)) {
|
||||
break;
|
||||
}
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_SECKILL)) {
|
||||
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_SECKILL);
|
||||
if (ObjectUtil.isNotNull(itemResponse)) {
|
||||
productResponse.setActivityH5(itemResponse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_BARGAIN)) {
|
||||
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_BARGAIN);
|
||||
if (ObjectUtil.isNotNull(itemResponse)) {
|
||||
productResponse.setActivityH5(itemResponse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_PINGTUAN)) {
|
||||
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
if (ObjectUtil.isNotNull(itemResponse)) {
|
||||
productResponse.setActivityH5(itemResponse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BeanUtils.copyProperties(storeProduct, productResponse);
|
||||
productResponseArrayList.add(productResponse);
|
||||
}
|
||||
CommonPage<IndexProductResponse> productResponseCommonPage = CommonPage.restPage(productResponseArrayList);
|
||||
BeanUtils.copyProperties(storeProductCommonPage, productResponseCommonPage, "list");
|
||||
return productResponseCommonPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品详情
|
||||
* @param id 商品编号
|
||||
* @param type normal-正常,video-视频
|
||||
* @return 商品详情信息
|
||||
*/
|
||||
@Override
|
||||
public ProductDetailResponse getDetail(Integer id, String type) {
|
||||
// 获取用户
|
||||
User user = userService.getInfo();
|
||||
SystemUserLevel userLevel = null;
|
||||
if (ObjectUtil.isNotNull(user) && user.getLevel() > 0) {
|
||||
userLevel = systemUserLevelService.getByLevelId(user.getLevel());
|
||||
}
|
||||
|
||||
ProductDetailResponse productDetailResponse = new ProductDetailResponse();
|
||||
// 查询商品
|
||||
StoreProduct storeProduct = storeProductService.getH5Detail(id);
|
||||
if (ObjectUtil.isNotNull(userLevel)) {
|
||||
storeProduct.setVipPrice(storeProduct.getPrice());
|
||||
}
|
||||
productDetailResponse.setProductInfo(storeProduct);
|
||||
|
||||
// 获取商品规格
|
||||
List<StoreProductAttr> attrList = attrService.getListByProductIdAndType(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL);
|
||||
// 根据制式设置attr属性
|
||||
productDetailResponse.setProductAttr(attrList);
|
||||
|
||||
// 根据制式设置sku属性
|
||||
HashMap<String, Object> skuMap = CollUtil.newHashMap();
|
||||
List<StoreProductAttrValue> storeProductAttrValues = storeProductAttrValueService.getListByProductIdAndType(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL);
|
||||
for (StoreProductAttrValue storeProductAttrValue : storeProductAttrValues) {
|
||||
StoreProductAttrValueResponse atr = new StoreProductAttrValueResponse();
|
||||
BeanUtils.copyProperties(storeProductAttrValue, atr);
|
||||
// 设置会员价
|
||||
if (ObjectUtil.isNotNull(userLevel)) {
|
||||
atr.setVipPrice(atr.getPrice());
|
||||
}
|
||||
skuMap.put(atr.getSuk(), atr);
|
||||
}
|
||||
productDetailResponse.setProductValue(skuMap);
|
||||
|
||||
// 用户收藏、分销返佣
|
||||
if (ObjectUtil.isNotNull(user)) {
|
||||
// 查询用户是否收藏收藏
|
||||
user = userService.getInfo();
|
||||
productDetailResponse.setUserCollect(storeProductRelationService.getLikeOrCollectByUser(user.getUid(), id,false).size() > 0);
|
||||
// 判断是否开启分销
|
||||
String brokerageFuncStatus = systemConfigService.getValueByKey(SysConfigConstants.CONFIG_KEY_BROKERAGE_FUNC_STATUS);
|
||||
if (brokerageFuncStatus.equals(Constants.COMMON_SWITCH_OPEN)) {// 分销开启
|
||||
// 判断是否开启气泡
|
||||
String isBubble = systemConfigService.getValueByKey(SysConfigConstants.CONFIG_KEY_STORE_BROKERAGE_IS_BUBBLE);
|
||||
if (isBubble.equals(Constants.COMMON_SWITCH_OPEN)) {
|
||||
productDetailResponse.setPriceName(getPacketPriceRange(storeProduct.getIsSub(), storeProductAttrValues, user.getIsPromoter()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
productDetailResponse.setUserCollect(false);
|
||||
}
|
||||
// 商品活动
|
||||
List<ProductActivityItemResponse> activityAllH5 = productUtils.getProductAllActivity(storeProduct);
|
||||
productDetailResponse.setActivityAllH5(activityAllH5);
|
||||
|
||||
// 商品浏览量+1
|
||||
StoreProduct updateProduct = new StoreProduct();
|
||||
updateProduct.setId(id);
|
||||
updateProduct.setBrowse(storeProduct.getBrowse() + 1);
|
||||
storeProductService.updateById(updateProduct);
|
||||
|
||||
// 保存用户访问记录
|
||||
if (userService.getUserId() > 0) {
|
||||
UserVisitRecord visitRecord = new UserVisitRecord();
|
||||
visitRecord.setDate(DateUtil.date().toString("yyyy-MM-dd"));
|
||||
visitRecord.setUid(userService.getUserId());
|
||||
visitRecord.setVisitType(2);
|
||||
userVisitRecordService.save(visitRecord);
|
||||
}
|
||||
|
||||
return productDetailResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品SKU详情
|
||||
* @param id 商品编号
|
||||
* @return 商品详情信息
|
||||
*/
|
||||
@Override
|
||||
public ProductDetailResponse getSkuDetail(Integer id) {
|
||||
// 获取用户
|
||||
User user = userService.getInfo();
|
||||
SystemUserLevel userLevel = null;
|
||||
if (ObjectUtil.isNotNull(user) && user.getLevel() > 0) {
|
||||
userLevel = systemUserLevelService.getByLevelId(user.getLevel());
|
||||
}
|
||||
|
||||
ProductDetailResponse productDetailResponse = new ProductDetailResponse();
|
||||
// 查询商品
|
||||
StoreProduct storeProduct = storeProductService.getH5Detail(id);
|
||||
|
||||
// 获取商品规格
|
||||
List<StoreProductAttr> attrList = attrService.getListByProductIdAndType(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL);
|
||||
// 根据制式设置attr属性
|
||||
productDetailResponse.setProductAttr(attrList);
|
||||
|
||||
// 根据制式设置sku属性
|
||||
HashMap<String, Object> skuMap = CollUtil.newHashMap();
|
||||
List<StoreProductAttrValue> storeProductAttrValues = storeProductAttrValueService.getListByProductIdAndType(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL);
|
||||
for (StoreProductAttrValue storeProductAttrValue : storeProductAttrValues) {
|
||||
StoreProductAttrValueResponse atr = new StoreProductAttrValueResponse();
|
||||
BeanUtils.copyProperties(storeProductAttrValue, atr);
|
||||
// 设置会员价
|
||||
if (ObjectUtil.isNotNull(userLevel)) {
|
||||
BigDecimal vipPrice = atr.getPrice().multiply(new BigDecimal(userLevel.getDiscount())).divide(new BigDecimal(100), 2 ,BigDecimal.ROUND_HALF_UP);
|
||||
atr.setVipPrice(vipPrice);
|
||||
}
|
||||
skuMap.put(atr.getSuk(), atr);
|
||||
}
|
||||
productDetailResponse.setProductValue(skuMap);
|
||||
|
||||
return productDetailResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品评论列表
|
||||
* @param proId 商品编号
|
||||
* @param type 评价等级|0=全部,1=好评,2=中评,3=差评
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return PageInfo<ProductReplyResponse>
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<ProductReplyResponse> getReplyList(Integer proId, Integer type, PageParamRequest pageParamRequest) {
|
||||
return storeProductReplyService.getH5List(proId, type, pageParamRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品评价数量和好评度
|
||||
* @return StoreProductReplayCountResponse
|
||||
*/
|
||||
@Override
|
||||
public StoreProductReplayCountResponse getReplyCount(Integer id) {
|
||||
MyRecord myRecord = storeProductReplyService.getH5Count(id);
|
||||
Long sumCount = myRecord.getLong("sumCount");
|
||||
Long goodCount = myRecord.getLong("goodCount");
|
||||
Long inCount = myRecord.getLong("mediumCount");
|
||||
Long poorCount = myRecord.getLong("poorCount");
|
||||
String replyChance = myRecord.getStr("replyChance");
|
||||
Integer replyStar = myRecord.getInt("replyStar");
|
||||
return new StoreProductReplayCountResponse(sumCount, goodCount, inCount, poorCount, replyChance, replyStar);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品佣金区间
|
||||
* @param isSub 是否单独计算分佣
|
||||
* @param attrValueList 商品属性列表
|
||||
* @param isPromoter 是否推荐人
|
||||
* @return String 金额区间
|
||||
*/
|
||||
private String getPacketPriceRange(Boolean isSub, List<StoreProductAttrValue> attrValueList, Boolean isPromoter) {
|
||||
String priceName = "0";
|
||||
if (!isPromoter) return priceName;
|
||||
// 获取一级返佣比例
|
||||
String brokerageRatioString = systemConfigService.getValueByKey(SysConfigConstants.CONFIG_KEY_STORE_BROKERAGE_RATIO);
|
||||
BigDecimal BrokerRatio = new BigDecimal(brokerageRatioString).divide(new BigDecimal("100"), 2, RoundingMode.DOWN);
|
||||
BigDecimal maxPrice;
|
||||
BigDecimal minPrice;
|
||||
// 获取佣金比例区间
|
||||
if (isSub) { // 是否单独分拥
|
||||
maxPrice = attrValueList.stream().map(StoreProductAttrValue::getBrokerage).reduce(BigDecimal.ZERO,BigDecimal::max);
|
||||
minPrice = attrValueList.stream().map(StoreProductAttrValue::getBrokerage).reduce(BigDecimal.ZERO,BigDecimal::min);
|
||||
} else {
|
||||
BigDecimal _maxPrice = attrValueList.stream().map(StoreProductAttrValue::getPrice).reduce(BigDecimal.ZERO,BigDecimal::max);
|
||||
BigDecimal _minPrice = attrValueList.stream().map(StoreProductAttrValue::getPrice).reduce(BigDecimal.ZERO,BigDecimal::min);
|
||||
maxPrice = BrokerRatio.multiply(_maxPrice).setScale(2, RoundingMode.HALF_UP);
|
||||
minPrice = BrokerRatio.multiply(_minPrice).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
if (minPrice.compareTo(BigDecimal.ZERO) == 0 && maxPrice.compareTo(BigDecimal.ZERO) == 0) {
|
||||
priceName = "0";
|
||||
} else if (minPrice.compareTo(BigDecimal.ZERO) == 0 && maxPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
priceName = maxPrice.toString();
|
||||
} else if (minPrice.compareTo(BigDecimal.ZERO) > 0 && maxPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
priceName = minPrice.toString();
|
||||
} else if (minPrice.compareTo(maxPrice) == 0) {
|
||||
priceName = minPrice.toString();
|
||||
} else {
|
||||
priceName = minPrice.toString() + "~" + maxPrice.toString();
|
||||
}
|
||||
return priceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取热门推荐商品列表
|
||||
* @param pageRequest 分页参数
|
||||
* @return CommonPage<IndexProductResponse>
|
||||
*/
|
||||
@Override
|
||||
public CommonPage<IndexProductResponse> getHotProductList(PageParamRequest pageRequest) {
|
||||
List<StoreProduct> storeProductList = storeProductService.getIndexProduct(Constants.INDEX_HOT_BANNER, pageRequest);
|
||||
if (CollUtil.isEmpty(storeProductList)) {
|
||||
return CommonPage.restPage(new ArrayList<>());
|
||||
}
|
||||
CommonPage<StoreProduct> storeProductCommonPage = CommonPage.restPage(storeProductList);
|
||||
|
||||
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
|
||||
for (StoreProduct storeProduct : storeProductList) {
|
||||
IndexProductResponse productResponse = new IndexProductResponse();
|
||||
List<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
|
||||
// 活动类型默认:直接跳过
|
||||
if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
|
||||
BeanUtils.copyProperties(storeProduct, productResponse);
|
||||
productResponseArrayList.add(productResponse);
|
||||
continue;
|
||||
}
|
||||
// 根据参与活动添加对应商品活动标示
|
||||
HashMap<Integer, ProductActivityItemResponse> activityByProduct =
|
||||
productUtils.getActivityByProduct(storeProduct.getId(), storeProduct.getActivity());
|
||||
if (CollUtil.isNotEmpty(activityByProduct)) {
|
||||
for (Integer activity : activityList) {
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_NORMAL)) {
|
||||
break;
|
||||
}
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_SECKILL)) {
|
||||
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_SECKILL);
|
||||
if (ObjectUtil.isNotNull(itemResponse)) {
|
||||
productResponse.setActivityH5(itemResponse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_BARGAIN)) {
|
||||
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_BARGAIN);
|
||||
if (ObjectUtil.isNotNull(itemResponse)) {
|
||||
productResponse.setActivityH5(itemResponse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_PINGTUAN)) {
|
||||
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
if (ObjectUtil.isNotNull(itemResponse)) {
|
||||
productResponse.setActivityH5(itemResponse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BeanUtils.copyProperties(storeProduct, productResponse);
|
||||
productResponseArrayList.add(productResponse);
|
||||
}
|
||||
CommonPage<IndexProductResponse> productResponseCommonPage = CommonPage.restPage(productResponseArrayList);
|
||||
BeanUtils.copyProperties(storeProductCommonPage, productResponseCommonPage, "list");
|
||||
return productResponseCommonPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品详情评论
|
||||
* @param id 商品id
|
||||
* @return ProductDetailReplyResponse
|
||||
* 评论只有一条,图文
|
||||
* 评价总数
|
||||
* 好评率
|
||||
*/
|
||||
@Override
|
||||
public ProductDetailReplyResponse getProductReply(Integer id) {
|
||||
return storeProductReplyService.getH5ProductReply(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 优选商品推荐
|
||||
* @return CommonPage<IndexProductResponse>
|
||||
*/
|
||||
@Override
|
||||
public CommonPage<IndexProductResponse> getGoodProductList() {
|
||||
PageParamRequest pageRequest = new PageParamRequest();
|
||||
pageRequest.setLimit(9);
|
||||
List<StoreProduct> storeProductList = storeProductService.getIndexProduct(Constants.INDEX_RECOMMEND_BANNER, pageRequest);
|
||||
if (CollUtil.isEmpty(storeProductList)) {
|
||||
return CommonPage.restPage(new ArrayList<>());
|
||||
}
|
||||
CommonPage<StoreProduct> storeProductCommonPage = CommonPage.restPage(storeProductList);
|
||||
|
||||
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
|
||||
for (StoreProduct storeProduct : storeProductList) {
|
||||
IndexProductResponse productResponse = new IndexProductResponse();
|
||||
List<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
|
||||
// 活动类型默认:直接跳过
|
||||
if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
|
||||
BeanUtils.copyProperties(storeProduct, productResponse);
|
||||
productResponseArrayList.add(productResponse);
|
||||
continue;
|
||||
}
|
||||
// 根据参与活动添加对应商品活动标示
|
||||
HashMap<Integer, ProductActivityItemResponse> activityByProduct =
|
||||
productUtils.getActivityByProduct(storeProduct.getId(), storeProduct.getActivity());
|
||||
if (CollUtil.isNotEmpty(activityByProduct)) {
|
||||
for (Integer activity : activityList) {
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_NORMAL)) {
|
||||
break;
|
||||
}
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_SECKILL)) {
|
||||
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_SECKILL);
|
||||
if (ObjectUtil.isNotNull(itemResponse)) {
|
||||
productResponse.setActivityH5(itemResponse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_BARGAIN)) {
|
||||
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_BARGAIN);
|
||||
if (ObjectUtil.isNotNull(itemResponse)) {
|
||||
productResponse.setActivityH5(itemResponse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (activity.equals(Constants.PRODUCT_TYPE_PINGTUAN)) {
|
||||
ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
if (ObjectUtil.isNotNull(itemResponse)) {
|
||||
productResponse.setActivityH5(itemResponse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BeanUtils.copyProperties(storeProduct, productResponse);
|
||||
productResponseArrayList.add(productResponse);
|
||||
}
|
||||
CommonPage<IndexProductResponse> productResponseCommonPage = CommonPage.restPage(productResponseArrayList);
|
||||
BeanUtils.copyProperties(storeProductCommonPage, productResponseCommonPage, "list");
|
||||
return productResponseCommonPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表(个别分类模型使用)
|
||||
* @param request 列表请求参数
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return CommonPage
|
||||
*/
|
||||
@Override
|
||||
public CommonPage<IndexProductResponse> getCategoryProductList(ProductListRequest request, PageParamRequest pageParamRequest) {
|
||||
ProductRequest searchRequest = new ProductRequest();
|
||||
BeanUtils.copyProperties(searchRequest, request);
|
||||
List<StoreProduct> storeProductList = storeProductService.findH5List(searchRequest, pageParamRequest);
|
||||
if (CollUtil.isEmpty(storeProductList)) {
|
||||
return CommonPage.restPage(new ArrayList<>());
|
||||
}
|
||||
CommonPage<StoreProduct> storeProductCommonPage = CommonPage.restPage(storeProductList);
|
||||
|
||||
User user = userService.getInfo();
|
||||
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
|
||||
for (StoreProduct storeProduct : storeProductList) {
|
||||
IndexProductResponse productResponse = new IndexProductResponse();
|
||||
// 获取商品购物车数量
|
||||
if (ObjectUtil.isNotNull(user)) {
|
||||
productResponse.setCartNum(cartService.getProductNumByUidAndProductId(user.getUid(), storeProduct.getId()));
|
||||
}
|
||||
BeanUtils.copyProperties(storeProduct, productResponse);
|
||||
productResponseArrayList.add(productResponse);
|
||||
}
|
||||
CommonPage<IndexProductResponse> productResponseCommonPage = CommonPage.restPage(productResponseArrayList);
|
||||
BeanUtils.copyProperties(storeProductCommonPage, productResponseCommonPage, "list");
|
||||
return productResponseCommonPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品排行榜
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<StoreProduct> getLeaderboard() {
|
||||
return storeProductService.getLeaderboard();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.zbkj.front.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zbkj.common.exception.CrmebException;
|
||||
import com.zbkj.common.utils.CrmebUtil;
|
||||
import com.zbkj.common.utils.QRCodeUtil;
|
||||
import com.zbkj.common.utils.RestTemplateUtil;
|
||||
import com.zbkj.front.service.QrCodeService;
|
||||
import com.zbkj.service.service.WechatNewService;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* QrCodeServiceImpl 接口实现
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Service
|
||||
public class QrCodeServiceImpl implements QrCodeService {
|
||||
// @Autowired
|
||||
// private WeChatService weChatService;
|
||||
|
||||
@Autowired
|
||||
private RestTemplateUtil restTemplateUtil;
|
||||
@Autowired
|
||||
private WechatNewService wechatNewService;
|
||||
|
||||
/**
|
||||
* 二维码
|
||||
* @return Object
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> get(JSONObject data) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
StringBuilder scene = new StringBuilder();
|
||||
String page = "";
|
||||
try{
|
||||
if(null != data){
|
||||
Map<Object, Object> dataMap = JSONObject.toJavaObject(data, Map.class);
|
||||
|
||||
for (Map.Entry<Object, Object> m : dataMap.entrySet()) {
|
||||
if(m.getKey().equals("path")){
|
||||
//前端路由, 不需要拼参数
|
||||
page = m.getValue().toString();
|
||||
continue;
|
||||
}
|
||||
if (scene.length() > 0) {
|
||||
scene.append(",");
|
||||
}
|
||||
scene.append(m.getKey()).append(":").append(m.getValue());
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new CrmebException("url参数错误 " + e.getMessage());
|
||||
}
|
||||
map.put("code", wechatNewService.createQrCode(page, scene.length() > 0 ? scene.toString() : ""));
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> base64(String url) {
|
||||
byte[] bytes = restTemplateUtil.getBuffer(url);
|
||||
String base64Image = CrmebUtil.getBase64Image(Base64.encodeBase64String(bytes));
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("code", base64Image);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 讲字符串转为QRcode
|
||||
* @param text 待转换字符串
|
||||
* @return QRcode base64格式
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> base64String(String text,int width, int height) {
|
||||
|
||||
String base64Image = null;
|
||||
try {
|
||||
base64Image = QRCodeUtil.crateQRCode(text,width,height);
|
||||
}catch (Exception e){
|
||||
throw new CrmebException("生成二维码异常");
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("code", base64Image);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
31
crmeb/crmeb-front/src/main/resources/application-beta.yml
Normal file
31
crmeb/crmeb-front/src/main/resources/application-beta.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
# CRMEB 相关配置
|
||||
crmeb:
|
||||
version: CRMEB-JAVA-SY-v2.0 # 当前代码版本
|
||||
|
||||
server:
|
||||
port: 20009
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
# 配置的环境
|
||||
active: beta
|
||||
# 数据库配置
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/crmeb_java_beta?characterEncoding=utf-8&useSSL=false&serverTimeZone=GMT+8
|
||||
username: root
|
||||
password: 123456
|
||||
redis:
|
||||
host: 127.0.0.1 #地址
|
||||
port: 6379 #端口
|
||||
password: 123456
|
||||
timeout: 10000 # 连接超时时间(毫秒)
|
||||
database: 3 #默认数据库
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 200 # 连接池最大连接数(使用负值表示没有限制)
|
||||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-idle: 10 # 连接池中的最大空闲连接
|
||||
min-idle: 0 # 连接池中的最小空闲连接
|
||||
time-between-eviction-runs: -1 #逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认-1
|
||||
31
crmeb/crmeb-front/src/main/resources/application-dev.yml
Normal file
31
crmeb/crmeb-front/src/main/resources/application-dev.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
# CRMEB 相关配置
|
||||
crmeb:
|
||||
version: CRMEB-JAVA-SY-v2.0 # 当前代码版本
|
||||
|
||||
server:
|
||||
port: 20011
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
# 配置的环境
|
||||
active: dev
|
||||
# 数据库配置
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/crmeb_java_dev?characterEncoding=utf-8&useSSL=false&serverTimeZone=GMT+8
|
||||
username: root
|
||||
password: 123456
|
||||
redis:
|
||||
host: 127.0.0.1 #地址
|
||||
port: 6379 #端口
|
||||
password: 123456
|
||||
timeout: 10000 # 连接超时时间(毫秒)
|
||||
database: 10 #默认数据库
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 200 # 连接池最大连接数(使用负值表示没有限制)
|
||||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-idle: 10 # 连接池中的最大空闲连接
|
||||
min-idle: 0 # 连接池中的最小空闲连接
|
||||
time-between-eviction-runs: -1 #逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认-1
|
||||
55
crmeb/crmeb-front/src/main/resources/application-prod.yml
Normal file
55
crmeb/crmeb-front/src/main/resources/application-prod.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
# CRMEB 相关配置
|
||||
crmeb:
|
||||
version: CRMEB-JAVA-SY-v2.0 # 当前代码版本
|
||||
|
||||
server:
|
||||
port: 20001
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
# 配置的环境
|
||||
active: prod
|
||||
# 数据库配置
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/crmeb_java?characterEncoding=utf-8&useSSL=false&serverTimeZone=GMT+8
|
||||
username: root
|
||||
password: 123456
|
||||
redis:
|
||||
host: 127.0.0.1 #地址
|
||||
port: 6379 #端口
|
||||
password: 123456
|
||||
timeout: 10000 # 连接超时时间(毫秒)
|
||||
database: 15 #默认数据库
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 200 # 连接池最大连接数(使用负值表示没有限制)
|
||||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-idle: 10 # 连接池中的最大空闲连接
|
||||
min-idle: 0 # 连接池中的最小空闲连接
|
||||
time-between-eviction-runs: -1 #逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认-1
|
||||
|
||||
debug: true
|
||||
logging:
|
||||
level:
|
||||
io.swagger.*: error
|
||||
com.zbjk.crmeb: debug
|
||||
org.springframework.boot.autoconfigure: ERROR
|
||||
config: classpath:logback-spring.xml
|
||||
file:
|
||||
path: ./crmeb_log
|
||||
|
||||
# mybatis 配置
|
||||
mybatis-plus:
|
||||
# 配置slq打印日志
|
||||
configuration:
|
||||
log-impl:
|
||||
|
||||
#swagger 配置
|
||||
swagger:
|
||||
basic:
|
||||
enable: true #是否开启界面
|
||||
check: true #是否打开验证
|
||||
username: crmeb #访问swagger的账号
|
||||
password: ZeypRDYBfM #访问swagger的密码
|
||||
82
crmeb/crmeb-front/src/main/resources/application.yml
Normal file
82
crmeb/crmeb-front/src/main/resources/application.yml
Normal file
@@ -0,0 +1,82 @@
|
||||
# CRMEB 相关配置
|
||||
crmeb:
|
||||
version: CRMEB-JAVA-SY-v2.0 # 当前代码版本
|
||||
|
||||
# 配置端口
|
||||
server:
|
||||
port: 8081
|
||||
servlet:
|
||||
context-path: / # 访问path
|
||||
tomcat:
|
||||
uri-encoding: UTF-8 # 默认编码格式
|
||||
max-threads: 1000 # 最大线程数量 默认200
|
||||
min-spare-threads: 30 # 初始化启动线程数量
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
# 配置的环境
|
||||
# active: #spring.profiles.active#
|
||||
active:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 50MB #设置单个文件大小
|
||||
max-request-size: 50MB #设置单次请求文件的总大小
|
||||
resources:
|
||||
static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${crmeb.filePath}
|
||||
application:
|
||||
name: cemrb-front #这个很重要,这在以后的服务与服务之间相互调用一般都是根据这个name
|
||||
jackson:
|
||||
locale: zh_CN
|
||||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
# 数据库配置
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/crmeb_java_beta?characterEncoding=utf-8&useSSL=false&serverTimeZone=GMT+8
|
||||
username: root
|
||||
password: 123456
|
||||
redis:
|
||||
host: 127.0.0.1 #地址
|
||||
port: 6379 #端口
|
||||
password: 123456
|
||||
timeout: 30000 # 连接超时时间(毫秒)
|
||||
database: 3 #默认数据库
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 200 # 连接池最大连接数(使用负值表示没有限制)
|
||||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-idle: 10 # 连接池中的最大空闲连接
|
||||
min-idle: 0 # 连接池中的最小空闲连接
|
||||
time-between-eviction-runs: -1 #逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认-1
|
||||
|
||||
debug: true
|
||||
logging:
|
||||
level:
|
||||
io.swagger.*: error
|
||||
com.zbjk.crmeb: debug
|
||||
org.springframework.boot.autoconfigure: ERROR
|
||||
config: classpath:logback-spring.xml
|
||||
file:
|
||||
path: ./crmeb_log
|
||||
|
||||
# mybatis 配置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:mapper/*/*Mapper.xml #xml扫描,多个目录用逗号或者分号分隔(告诉 Mapper 所对应的 XML 文件位置)
|
||||
# 配置slq打印日志
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
global-config:
|
||||
db-config:
|
||||
# logic-delete-field: isDel #全局逻辑删除字段值 3.3.0开始支持,详情看下面。
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
|
||||
|
||||
#swagger 配置
|
||||
swagger:
|
||||
basic:
|
||||
enable: true #是否开启
|
||||
check: false #是否打开验证
|
||||
username: #访问swagger的账号
|
||||
password: #访问swagger的密码
|
||||
11
crmeb/crmeb-front/src/main/resources/banner.txt
Normal file
11
crmeb/crmeb-front/src/main/resources/banner.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
,ad8888ba, 88888888ba 88b d88 88888888888 88888888ba
|
||||
d8"' `"8b 88 "8b 888b d888 88 88 "8b
|
||||
d8' 88 ,8P 88`8b d8'88 88 88 ,8P
|
||||
88 88aaaaaa8P' 88 `8b d8' 88 88aaaaa 88aaaaaa8P'
|
||||
88 88""""88' 88 `8b d8' 88 88""""" 88""""""8b,
|
||||
Y8, 88 `8b 88 `8b d8' 88 88 88 `8b
|
||||
Y8a. .a8P 88 `8b 88 `888' 88 88 88 a8P
|
||||
`"Y8888Y"' 88 `8b 88 `8' 88 88888888888 88888888P"
|
||||
文档地址: https://help.crmeb.net/crmeb_java/1748037
|
||||
演示站WEBPC: https://admin.java.crmeb.ne
|
||||
演示站H5: https://java.crmeb.net
|
||||
234
crmeb/crmeb-front/src/main/resources/logback-spring.xml
Normal file
234
crmeb/crmeb-front/src/main/resources/logback-spring.xml
Normal file
@@ -0,0 +1,234 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false">
|
||||
<!-- 根据需要自行配置 -->
|
||||
<springProperty scope="context" name="LOG_PORT" source="server.port"/>
|
||||
<property name="APP_NAME" value="Crmeb"/>
|
||||
<property name="log.path" value="../crmeb_front_log/${LOG_PORT}}"/>
|
||||
|
||||
<!--"@timestamp": "2019-06-27T09:59:41.897+08:00",-->
|
||||
<!--"@version": "1",-->
|
||||
<!--"message": "queryAllEveryDayDataRate",-->
|
||||
<!--"logger_name": "com.example.demo.controller.GetAllSummaryDataController",-->
|
||||
<!--"thread_name": "http-nio-8000-exec-1",-->
|
||||
<!--"level": "INFO",-->
|
||||
<!--"level_value": 20000-->
|
||||
|
||||
<!--<property name="CONSOLE_LOG_PATTERN"-->
|
||||
<!--value="{ %d{yyyy-MM-dd HH:mm:ss.SSS}-->
|
||||
<!--${APP_NAME} %highlight(%-5level)-->
|
||||
<!--%yellow(%X{X-B3-TraceId}),-->
|
||||
<!--%green(%X{X-B3-SpanId}),-->
|
||||
<!--%blue(%X{X-B3-ParentSpanId})-->
|
||||
<!--%yellow(%thread)-->
|
||||
<!--%green(%logger)-->
|
||||
<!--%msg%n}"/>-->
|
||||
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
|
||||
<!--<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>-->
|
||||
<pattern>
|
||||
|
||||
<pattern>
|
||||
{
|
||||
"app": "${APP_NAME}",
|
||||
"timestamp":"%d{yyyy-MM-dd HH:mm:ss.SSS}",
|
||||
"level": "%level",
|
||||
"thread": "%thread",
|
||||
"class": "%logger{40}",
|
||||
"message": "%msg" }
|
||||
%n
|
||||
</pattern>
|
||||
</pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
|
||||
<!--输出到文件-->
|
||||
|
||||
<!-- 时间滚动输出 level为 DEBUG 日志 -->
|
||||
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文件的路径及文件名 -->
|
||||
<file>${log.path}/log_debug.log</file>
|
||||
<!--日志文件输出格式-->
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
|
||||
<!--<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>-->
|
||||
<pattern>
|
||||
|
||||
<pattern>
|
||||
{
|
||||
"app": "${APP_NAME}",
|
||||
"timestamp":"%d{yyyy-MM-dd HH:mm:ss.SSS}",
|
||||
"level": "%level",
|
||||
"thread": "%thread",
|
||||
"class": "%logger{40}",
|
||||
"message": "%msg" }
|
||||
%n
|
||||
</pattern>
|
||||
</pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志归档 -->
|
||||
<fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文件只记录debug级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>debug</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 时间滚动输出 level为 INFO 日志 -->
|
||||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文件的路径及文件名 -->
|
||||
<file>${log.path}/log_info.log</file>
|
||||
<!--日志文件输出格式-->
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
|
||||
<!--<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>-->
|
||||
<pattern>
|
||||
|
||||
<pattern>
|
||||
{
|
||||
"app": "${APP_NAME}",
|
||||
"timestamp":"%d{yyyy-MM-dd HH:mm:ss.SSS}",
|
||||
"level": "%level",
|
||||
"thread": "%thread",
|
||||
"class": "%logger{40}",
|
||||
"message": "%msg" }
|
||||
%n
|
||||
</pattern>
|
||||
</pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 每天日志归档路径以及格式 -->
|
||||
<fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文件只记录info级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>info</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 时间滚动输出 level为 WARN 日志 -->
|
||||
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文件的路径及文件名 -->
|
||||
<file>${log.path}/log_warn.log</file>
|
||||
<!--日志文件输出格式-->
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
|
||||
<!--<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>-->
|
||||
<pattern>
|
||||
|
||||
<pattern>
|
||||
{
|
||||
"app": "${APP_NAME}",
|
||||
"timestamp":"%d{yyyy-MM-dd HH:mm:ss.SSS}",
|
||||
"level": "%level",
|
||||
"thread": "%thread",
|
||||
"class": "%logger{40}",
|
||||
"message": "%msg" }
|
||||
%n
|
||||
</pattern>
|
||||
</pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>2</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文件只记录warn级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>warn</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
|
||||
<!-- 时间滚动输出 level为 ERROR 日志 -->
|
||||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文件的路径及文件名 -->
|
||||
<file>${log.path}/log_error.log</file>
|
||||
<!--日志文件输出格式-->
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
|
||||
<!--<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>-->
|
||||
<pattern>
|
||||
|
||||
<pattern>
|
||||
{
|
||||
"app": "${APP_NAME}",
|
||||
"timestamp":"%d{yyyy-MM-dd HH:mm:ss.SSS}",
|
||||
"level": "%level",
|
||||
"thread": "%thread",
|
||||
"class": "%logger{40}",
|
||||
"message": "%msg" }
|
||||
%n
|
||||
</pattern>
|
||||
</pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文件保留天数-->
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文件只记录ERROR级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>ERROR</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!--<appender name="LOGSTASH" class="ch.qos.logback.core.rolling.RollingFileAppender">-->
|
||||
<!--<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder"/>-->
|
||||
|
||||
<!--<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
|
||||
<!--<fileNamePattern>${LOG_HOME}/${APP_NAME}-%d{yyyy-MM-dd}.log</fileNamePattern>-->
|
||||
<!--</rollingPolicy>-->
|
||||
|
||||
<!--</appender>-->
|
||||
<!-- 日志输出级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="DEBUG_FILE" />
|
||||
<!-- <appender-ref ref="INFO_FILE" />-->
|
||||
<!-- <appender-ref ref="WARN_FILE" />-->
|
||||
<appender-ref ref="ERROR_FILE" />
|
||||
<!--<appender-ref ref="LOGSTASH"/>-->
|
||||
</root>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user