更改目录结构

This commit is contained in:
liuyingfang
2024-03-02 18:31:44 +08:00
parent 8f7acca8e6
commit 0a70a66807
603 changed files with 2256 additions and 6114 deletions

View File

@@ -0,0 +1,67 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier;
import io.swagger.annotations.Api;
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
import cn.ysk.cashier.utils.SpringContextHolder;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.ApplicationPidFileWriter;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RestController;
/**
* 开启审计功能 -> @EnableJpaAuditing
*
* @author Zheng Jie
* @date 2018/11/15 9:20:19
*/
@EnableAsync
@RestController
@Api(hidden = true)
@SpringBootApplication
@EnableTransactionManagement
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
public class AppRun {
public static void main(String[] args) {
SpringApplication springApplication = new SpringApplication(AppRun.class);
// 监控应用的PID启动时可指定PID路径--spring.pid.file=/home/eladmin/app.pid
// 或者在 application.yml 添加文件路径,方便 killkill `cat /home/eladmin/app.pid`
springApplication.addListeners(new ApplicationPidFileWriter());
springApplication.run(args);
}
@Bean
public SpringContextHolder springContextHolder() {
return new SpringContextHolder();
}
/**
* 访问首页提示
*
* @return /
*/
@AnonymousGetMapping("/")
public String index() {
return "Backend service started successfully";
}
}

View File

@@ -0,0 +1,88 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
/**
* WebMvcConfigurer
*
* @author Zheng Jie
* @date 2018-11-30
*/
@Configuration
@EnableWebMvc
public class ConfigurerAdapter implements WebMvcConfigurer {
/** 文件配置 */
private final FileProperties properties;
public ConfigurerAdapter(FileProperties properties) {
this.properties = properties;
}
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOriginPattern("*");
config.addAllowedHeader("*");
config.addAllowedMethod("*");
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
FileProperties.ElPath path = properties.getPath();
String avatarUtl = "file:" + path.getAvatar().replace("\\","/");
String pathUtl = "file:" + path.getPath().replace("\\","/");
registry.addResourceHandler("/avatar/**").addResourceLocations(avatarUtl).setCachePeriod(0);
registry.addResourceHandler("/file/**").addResourceLocations(pathUtl).setCachePeriod(0);
registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/").setCachePeriod(0);
}
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
// 使用 fastjson 序列化,会导致 @JsonIgnore 失效,可以使用 @JSONField(serialize = false) 替换
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
List<MediaType> supportMediaTypeList = new ArrayList<>();
supportMediaTypeList.add(MediaType.APPLICATION_JSON);
FastJsonConfig config = new FastJsonConfig();
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
config.setSerializerFeatures(SerializerFeature.WriteMapNullValue);
converter.setFastJsonConfig(config);
converter.setSupportedMediaTypes(supportMediaTypeList);
converter.setDefaultCharset(StandardCharsets.UTF_8);
converters.add(converter);
}
}

View File

@@ -0,0 +1,31 @@
package cn.ysk.cashier.config;
import org.springframework.context.annotation.Configuration;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import java.io.IOException;
@Configuration
public class JacksonConfig {
@Bean
@Primary
@ConditionalOnMissingBean(ObjectMapper.class)
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
objectMapper.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>() {
@Override
public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeString("");
}
});
return objectMapper;
}
}

View File

@@ -0,0 +1,16 @@
package cn.ysk.cashier.config;
import org.apache.catalina.connector.Connector;
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.context.annotation.Configuration;
/**
* @author bearBoy80
*/
@Configuration(proxyBeanMethods = false)
public class RelaxedQueryCharsConnectorCustomizer implements TomcatConnectorCustomizer {
@Override
public void customize(Connector connector) {
connector.setProperty("relaxedQueryChars", "[]{}");
}
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/**
* @author ZhangHouYing
* @date 2019-08-24 15:44
*/
@Configuration
public class WebSocketConfig {
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
}

View File

@@ -0,0 +1,48 @@
package cn.ysk.cashier.config;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class fastJsonConfig extends WebMvcConfigurationSupport {
/**
* 使用阿里 fastjson 作为JSON MessageConverter
* @param converters
*/
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
FastJsonConfig config = new FastJsonConfig();
config.setSerializerFeatures(
// 保留map空的字段
SerializerFeature.WriteMapNullValue,
// 将String类型的null转成""
SerializerFeature.WriteNullStringAsEmpty,
// 将Number类型的null转成0
SerializerFeature.WriteNullNumberAsZero,
// 将List类型的null转成[]
SerializerFeature.WriteNullListAsEmpty,
// 将Boolean类型的null转成false
SerializerFeature.WriteNullBooleanAsFalse,
// 避免循环引用
SerializerFeature.DisableCircularReferenceDetect);
converter.setFastJsonConfig(config);
converter.setDefaultCharset(Charset.forName("UTF-8"));
List<MediaType> mediaTypeList = new ArrayList<>();
// 解决中文乱码问题相当于在Controller上的@RequestMapping中加了个属性produces = "application/json"
mediaTypeList.add(MediaType.APPLICATION_JSON);
converter.setSupportedMediaTypes(mediaTypeList);
converters.add(converter);
}
}

View File

@@ -0,0 +1,20 @@
package cn.ysk.cashier.config.interceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author lyf
*/
public class UserInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception{
String userName = request.getHeader("userName");
request.setAttribute("userName", userName);
return true;
}
}

View File

@@ -0,0 +1,16 @@
package cn.ysk.cashier.config.interceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author lyf
*/
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry){
registry.addInterceptor(new UserInterceptor());
}
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright 2019-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.config;
import cn.ysk.cashier.config.security.config.bean.LoginProperties;
import cn.ysk.cashier.config.security.config.bean.SecurityProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @apiNote 配置文件转换Pojo类的 统一配置 类
* @author: liaojinlong
* @date: 2020/6/10 19:04
*/
@Configuration
public class ConfigBeanConfiguration {
@Bean
@ConfigurationProperties(prefix = "login")
public LoginProperties loginProperties() {
return new LoginProperties();
}
@Bean
@ConfigurationProperties(prefix = "jwt")
public SecurityProperties securityProperties() {
return new SecurityProperties();
}
}

View File

@@ -0,0 +1,193 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.config;
import cn.ysk.cashier.config.security.security.JwtAccessDeniedHandler;
import cn.ysk.cashier.config.security.security.JwtAuthenticationEntryPoint;
import cn.ysk.cashier.config.security.security.TokenConfigurer;
import cn.ysk.cashier.config.security.security.TokenProvider;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.annotation.AnonymousAccess;
import cn.ysk.cashier.config.security.config.bean.SecurityProperties;
import cn.ysk.cashier.config.security.service.OnlineUserService;
import cn.ysk.cashier.config.security.service.UserCacheManager;
import cn.ysk.cashier.utils.enums.RequestMethodEnum;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.core.GrantedAuthorityDefaults;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import java.util.*;
/**
* @author Zheng Jie
*/
@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
private final TokenProvider tokenProvider;
private final CorsFilter corsFilter;
private final JwtAuthenticationEntryPoint authenticationErrorHandler;
private final JwtAccessDeniedHandler jwtAccessDeniedHandler;
private final ApplicationContext applicationContext;
private final SecurityProperties properties;
private final OnlineUserService onlineUserService;
private final UserCacheManager userCacheManager;
@Bean
GrantedAuthorityDefaults grantedAuthorityDefaults() {
// 去除 ROLE_ 前缀
return new GrantedAuthorityDefaults("");
}
@Bean
public PasswordEncoder passwordEncoder() {
// 密码加密方式
return new BCryptPasswordEncoder();
}
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
// 搜寻匿名标记 url @AnonymousAccess
RequestMappingHandlerMapping requestMappingHandlerMapping = (RequestMappingHandlerMapping) applicationContext.getBean("requestMappingHandlerMapping");
Map<RequestMappingInfo, HandlerMethod> handlerMethodMap = requestMappingHandlerMapping.getHandlerMethods();
// 获取匿名标记
Map<String, Set<String>> anonymousUrls = getAnonymousUrl(handlerMethodMap);
httpSecurity
// 禁用 CSRF
.csrf().disable()
.addFilterBefore(corsFilter, UsernamePasswordAuthenticationFilter.class)
// 授权异常
.exceptionHandling()
.authenticationEntryPoint(authenticationErrorHandler)
.accessDeniedHandler(jwtAccessDeniedHandler)
// 防止iframe 造成跨域
.and()
.headers()
.frameOptions()
.disable()
// 不创建会话
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
// 静态资源等等
.antMatchers(
HttpMethod.GET,
"/*.html",
"/**/*.html",
"/**/*.css",
"/**/*.js",
"/webSocket/**"
).permitAll()
// swagger 文档
.antMatchers("/swagger-ui.html").permitAll()
.antMatchers("/swagger-resources/**").permitAll()
.antMatchers("/webjars/**").permitAll()
.antMatchers("/*/api-docs").permitAll()
// 文件
.antMatchers("/avatar/**").permitAll()
.antMatchers("/file/**").permitAll()
// 阿里巴巴 druid
.antMatchers("/druid/**").permitAll()
// 放行OPTIONS请求
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
// 自定义匿名访问所有url放行允许匿名和带Token访问细腻化到每个 Request 类型
// GET
.antMatchers(HttpMethod.GET, anonymousUrls.get(RequestMethodEnum.GET.getType()).toArray(new String[0])).permitAll()
// POST
.antMatchers(HttpMethod.POST, anonymousUrls.get(RequestMethodEnum.POST.getType()).toArray(new String[0])).permitAll()
// PUT
.antMatchers(HttpMethod.PUT, anonymousUrls.get(RequestMethodEnum.PUT.getType()).toArray(new String[0])).permitAll()
// PATCH
.antMatchers(HttpMethod.PATCH, anonymousUrls.get(RequestMethodEnum.PATCH.getType()).toArray(new String[0])).permitAll()
// DELETE
.antMatchers(HttpMethod.DELETE, anonymousUrls.get(RequestMethodEnum.DELETE.getType()).toArray(new String[0])).permitAll()
// 所有类型的接口都放行
.antMatchers(anonymousUrls.get(RequestMethodEnum.ALL.getType()).toArray(new String[0])).permitAll()
.antMatchers("/auth/appletsLogin").permitAll()
// 所有请求都需要认证
.anyRequest().authenticated()
.and().apply(securityConfigurerAdapter());
}
private TokenConfigurer securityConfigurerAdapter() {
return new TokenConfigurer(tokenProvider, properties, onlineUserService, userCacheManager);
}
private Map<String, Set<String>> getAnonymousUrl(Map<RequestMappingInfo, HandlerMethod> handlerMethodMap) {
Map<String, Set<String>> anonymousUrls = new HashMap<>(8);
Set<String> get = new HashSet<>();
Set<String> post = new HashSet<>();
Set<String> put = new HashSet<>();
Set<String> patch = new HashSet<>();
Set<String> delete = new HashSet<>();
Set<String> all = new HashSet<>();
for (Map.Entry<RequestMappingInfo, HandlerMethod> infoEntry : handlerMethodMap.entrySet()) {
HandlerMethod handlerMethod = infoEntry.getValue();
AnonymousAccess anonymousAccess = handlerMethod.getMethodAnnotation(AnonymousAccess.class);
if (null != anonymousAccess) {
List<RequestMethod> requestMethods = new ArrayList<>(infoEntry.getKey().getMethodsCondition().getMethods());
RequestMethodEnum request = RequestMethodEnum.find(requestMethods.size() == 0 ? RequestMethodEnum.ALL.getType() : requestMethods.get(0).name());
switch (Objects.requireNonNull(request)) {
case GET:
get.addAll(infoEntry.getKey().getPatternsCondition().getPatterns());
break;
case POST:
post.addAll(infoEntry.getKey().getPatternsCondition().getPatterns());
break;
case PUT:
put.addAll(infoEntry.getKey().getPatternsCondition().getPatterns());
break;
case PATCH:
patch.addAll(infoEntry.getKey().getPatternsCondition().getPatterns());
break;
case DELETE:
delete.addAll(infoEntry.getKey().getPatternsCondition().getPatterns());
break;
default:
all.addAll(infoEntry.getKey().getPatternsCondition().getPatterns());
break;
}
}
}
anonymousUrls.put(RequestMethodEnum.GET.getType(), get);
anonymousUrls.put(RequestMethodEnum.POST.getType(), post);
anonymousUrls.put(RequestMethodEnum.PUT.getType(), put);
anonymousUrls.put(RequestMethodEnum.PATCH.getType(), patch);
anonymousUrls.put(RequestMethodEnum.DELETE.getType(), delete);
anonymousUrls.put(RequestMethodEnum.ALL.getType(), all);
return anonymousUrls;
}
}

View File

@@ -0,0 +1,61 @@
/*
* Copyright 2019-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.config.bean;
import lombok.Data;
/**
* 登录验证码配置信息
*
* @author liaojinlong
* @date 2020/6/10 18:53
*/
@Data
public class LoginCode {
/**
* 验证码配置
*/
private LoginCodeEnum codeType;
/**
* 验证码有效期 分钟
*/
private Long expiration = 2L;
/**
* 验证码内容长度
*/
private int length = 2;
/**
* 验证码宽度
*/
private int width = 111;
/**
* 验证码高度
*/
private int height = 36;
/**
* 验证码字体
*/
private String fontName;
/**
* 字体大小
*/
private int fontSize = 25;
public LoginCodeEnum getCodeType() {
return codeType;
}
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright 2019-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.config.bean;
/**
* 验证码配置枚举
*
* @author: liaojinlong
* @date: 2020/6/10 17:40
*/
public enum LoginCodeEnum {
/**
* 算数
*/
ARITHMETIC,
/**
* 中文
*/
CHINESE,
/**
* 中文闪图
*/
CHINESE_GIF,
/**
* 闪图
*/
GIF,
SPEC
}

View File

@@ -0,0 +1,125 @@
/*
* Copyright 2019-2020 the original author or authors.
*
* Licensed under the Apache License, Version loginCode.length.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-loginCode.length.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.config.bean;
import com.wf.captcha.*;
import com.wf.captcha.base.Captcha;
import lombok.Data;
import cn.ysk.cashier.exception.BadConfigurationException;
import cn.ysk.cashier.utils.StringUtils;
import java.awt.*;
import java.util.Objects;
/**
* 配置文件读取
*
* @author liaojinlong
* @date loginCode.length0loginCode.length0/6/10 17:loginCode.length6
*/
@Data
public class LoginProperties {
/**
* 账号单用户 登录
*/
private boolean singleLogin = false;
private LoginCode loginCode;
public static final String cacheKey = "USER-LOGIN-DATA";
public boolean isSingleLogin() {
return singleLogin;
}
/**
* 获取验证码生产类
*
* @return /
*/
public Captcha getCaptcha() {
if (Objects.isNull(loginCode)) {
loginCode = new LoginCode();
if (Objects.isNull(loginCode.getCodeType())) {
loginCode.setCodeType(LoginCodeEnum.ARITHMETIC);
}
}
return switchCaptcha(loginCode);
}
/**
* 依据配置信息生产验证码
*
* @param loginCode 验证码配置信息
* @return /
*/
private Captcha switchCaptcha(LoginCode loginCode) {
Captcha captcha;
switch (loginCode.getCodeType()) {
case ARITHMETIC:
// 算术类型 https://gitee.com/whvse/EasyCaptcha
captcha = new FixedArithmeticCaptcha(loginCode.getWidth(), loginCode.getHeight());
// 几位数运算,默认是两位
captcha.setLen(loginCode.getLength());
break;
case CHINESE:
captcha = new ChineseCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
case CHINESE_GIF:
captcha = new ChineseGifCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
case GIF:
captcha = new GifCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
case SPEC:
captcha = new SpecCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
default:
throw new BadConfigurationException("验证码配置信息错误!正确配置查看 LoginCodeEnum ");
}
if(StringUtils.isNotBlank(loginCode.getFontName())){
captcha.setFont(new Font(loginCode.getFontName(), Font.PLAIN, loginCode.getFontSize()));
}
return captcha;
}
static class FixedArithmeticCaptcha extends ArithmeticCaptcha {
public FixedArithmeticCaptcha(int width, int height) {
super(width, height);
}
@Override
protected char[] alphas() {
// 生成随机数字和运算符
int n1 = num(1, 10), n2 = num(1, 10);
int opt = num(3);
// 计算结果
int res = new int[]{n1 + n2, n1 - n2, n1 * n2}[opt];
// 转换为字符运算符
char optChar = "+-x".charAt(opt);
this.setArithmeticString(String.format("%s%c%s=?", n1, optChar, n2));
this.chars = String.valueOf(res);
return chars.toCharArray();
}
}
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.config.bean;
import lombok.Data;
/**
* Jwt参数配置
*
* @author Zheng Jie
* @date 2019年11月28日
*/
@Data
public class SecurityProperties {
/**
* Request Headers Authorization
*/
private String header;
/**
* 令牌前缀,最后留个空格 Bearer
*/
private String tokenStartWith;
/**
* 必须使用最少88位的Base64对该令牌进行编码
*/
private String base64Secret;
/**
* 令牌过期时间 此处单位/毫秒
*/
private Long tokenValidityInSeconds;
/**
* 在线用户 key根据 key 查询 redis 中在线用户的数据
*/
private String onlineKey;
/**
* 验证码 key
*/
private String codeKey;
/**
* token 续期检查
*/
private Long detect;
/**
* 续期时间
*/
private Long renew;
public String getTokenStartWith() {
return tokenStartWith + " ";
}
}

View File

@@ -0,0 +1,194 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.rest;
import cn.hutool.core.util.IdUtil;
import cn.ysk.cashier.config.security.config.bean.LoginCodeEnum;
import cn.ysk.cashier.config.security.security.TokenProvider;
import com.wf.captcha.base.Captcha;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.annotation.rest.AnonymousDeleteMapping;
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
import cn.ysk.cashier.config.RsaProperties;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.config.security.config.bean.LoginProperties;
import cn.ysk.cashier.config.security.config.bean.SecurityProperties;
import cn.ysk.cashier.config.security.service.dto.AuthUserDto;
import cn.ysk.cashier.config.security.service.dto.JwtUserDto;
import cn.ysk.cashier.config.security.service.OnlineUserService;
import cn.ysk.cashier.pojo.shop.TbShopInfo;
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
import cn.ysk.cashier.utils.RsaUtils;
import cn.ysk.cashier.utils.RedisUtils;
import cn.ysk.cashier.utils.SecurityUtils;
import cn.ysk.cashier.utils.StringUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @author Zheng Jie
* @date 2018-11-23
* 授权、根据token获取用户详细信息
*/
@Slf4j
@RestController
@RequestMapping("/auth")
@RequiredArgsConstructor
@Api(tags = "系统:系统授权接口")
public class AuthorizationController {
private final SecurityProperties properties;
private final RedisUtils redisUtils;
private final OnlineUserService onlineUserService;
private final TokenProvider tokenProvider;
private final AuthenticationManagerBuilder authenticationManagerBuilder;
private final TbShopInfoRepository tbShopInfoRepository;
@Resource
private LoginProperties loginProperties;
@Log("用户登录")
@ApiOperation("登录授权")
@AnonymousPostMapping(value = "/login")
public ResponseEntity<Object> login(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request) throws Exception {
// 密码解密
String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, authUser.getPassword());
// 查询验证码
String code = (String) redisUtils.get(authUser.getUuid());
// 清除验证码
redisUtils.del(authUser.getUuid());
if (StringUtils.isBlank(code)) {
throw new BadRequestException("验证码不存在或已过期");
}
if (StringUtils.isBlank(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) {
throw new BadRequestException("验证码错误");
}
UsernamePasswordAuthenticationToken authenticationToken =
new UsernamePasswordAuthenticationToken(authUser.getUsername(), password);
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
SecurityContextHolder.getContext().setAuthentication(authentication);
// 生成令牌与第三方系统获取令牌方式
// UserDetails userDetails = userDetailsService.loadUserByUsername(userInfo.getUsername());
// Authentication authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
// SecurityContextHolder.getContext().setAuthentication(authentication);
String token = tokenProvider.createToken(authentication);
final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
// 保存在线信息
onlineUserService.save(jwtUserDto, token, request);
// 返回 token 与 用户信息
TbShopInfo byAccount = tbShopInfoRepository.findByAccount(jwtUserDto.getUsername());
Map<String, Object> authInfo = new HashMap<String, Object>(2) {{
put("token", properties.getTokenStartWith() + token);
put("user", jwtUserDto);
if (byAccount!= null){
put("shopId",byAccount.getId());
}
}};
if (loginProperties.isSingleLogin()) {
//踢掉之前已经登录的token
onlineUserService.checkLoginOnUser(authUser.getUsername(), token);
}
return ResponseEntity.ok(authInfo);
}
/**
* 小程序登录
* @param authUser
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/appletsLogin")
public ResponseEntity<Object> appletsLogin(@RequestBody AuthUserDto authUser,HttpServletRequest request)throws Exception{
// 密码解密
String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, authUser.getPassword());
UsernamePasswordAuthenticationToken authenticationToken =
new UsernamePasswordAuthenticationToken(authUser.getUsername(), password);
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
SecurityContextHolder.getContext().setAuthentication(authentication);
// 生成令牌与第三方系统获取令牌方式
String token = tokenProvider.createToken(authentication);
final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
// 保存在线信息
onlineUserService.save(jwtUserDto, token,request);
// 返回 token 与 用户信息
TbShopInfo byAccount = tbShopInfoRepository.findByAccount(jwtUserDto.getUsername());
Map<String, Object> authInfo = new HashMap<String, Object>(2) {{
put("token", properties.getTokenStartWith() + token);
put("user", jwtUserDto);
if (byAccount!= null){
put("shopId",byAccount.getId());
}
}};
if (loginProperties.isSingleLogin()) {
//踢掉之前已经登录的token
onlineUserService.checkLoginOnUser(authUser.getUsername(), token);
}
return ResponseEntity.ok(authInfo);
}
@ApiOperation("获取用户信息")
@GetMapping(value = "/info")
public ResponseEntity<Object> getUserInfo() {
return ResponseEntity.ok(SecurityUtils.getCurrentUser());
}
@ApiOperation("获取验证码")
@AnonymousGetMapping(value = "/code")
public ResponseEntity<Object> getCode() {
// 获取运算的结果
Captcha captcha = loginProperties.getCaptcha();
String uuid = properties.getCodeKey() + IdUtil.simpleUUID();
//当验证码类型为 arithmetic时且长度 >= 2 时captcha.text()的结果有几率为浮点型
String captchaValue = captcha.text();
if (captcha.getCharType() - 1 == LoginCodeEnum.ARITHMETIC.ordinal() && captchaValue.contains(".")) {
captchaValue = captchaValue.split("\\.")[0];
}
// 保存
redisUtils.set(uuid, captchaValue, loginProperties.getLoginCode().getExpiration(), TimeUnit.MINUTES);
// 验证码信息
Map<String, Object> imgResult = new HashMap<String, Object>(2) {{
put("img", captcha.toBase64());
put("uuid", uuid);
}};
return ResponseEntity.ok(imgResult);
}
@ApiOperation("退出登录")
@AnonymousDeleteMapping(value = "/logout")
public ResponseEntity<Object> logout(HttpServletRequest request) {
onlineUserService.logout(tokenProvider.getToken(request));
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,68 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.config.security.service.OnlineUserService;
import cn.ysk.cashier.utils.EncryptUtils;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Set;
/**
* @author Zheng Jie
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/auth/online")
@Api(tags = "系统:在线用户管理")
public class OnlineController {
private final OnlineUserService onlineUserService;
@ApiOperation("查询在线用户")
@GetMapping
@PreAuthorize("@el.check()")
public ResponseEntity<Object> queryOnlineUser(String filter, Pageable pageable){
return new ResponseEntity<>(onlineUserService.getAll(filter, pageable),HttpStatus.OK);
}
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check()")
public void exportOnlineUser(HttpServletResponse response, String filter) throws IOException {
onlineUserService.download(onlineUserService.getAll(filter), response);
}
@ApiOperation("踢出用户")
@DeleteMapping
@PreAuthorize("@el.check()")
public ResponseEntity<Object> deleteOnlineUser(@RequestBody Set<String> keys) throws Exception {
for (String key : keys) {
// 解密Key
key = EncryptUtils.desDecrypt(key);
onlineUserService.kickOut(key);
}
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.security;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author Zheng Jie
*/
@Component
public class JwtAccessDeniedHandler implements AccessDeniedHandler {
@Override
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException {
//当用户在没有授权的情况下访问受保护的REST资源时将调用此方法发送403 Forbidden响应
response.sendError(HttpServletResponse.SC_FORBIDDEN, accessDeniedException.getMessage());
}
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.security;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author Zheng Jie
*/
@Component
public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request,
HttpServletResponse response,
AuthenticationException authException) throws IOException {
// 当用户尝试访问安全的REST资源而不提供任何凭据时将调用此方法发送401 响应
if(!"/api/qiNiuContent/updloadFile".equals(request.getRequestURI())){
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException==null?"Unauthorized":authException.getMessage());
}
}
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.security;
import cn.ysk.cashier.config.security.config.bean.SecurityProperties;
import cn.ysk.cashier.config.security.service.OnlineUserService;
import cn.ysk.cashier.config.security.service.UserCacheManager;
import lombok.RequiredArgsConstructor;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.DefaultSecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
/**
* @author /
*/
@RequiredArgsConstructor
public class TokenConfigurer extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {
private final TokenProvider tokenProvider;
private final SecurityProperties properties;
private final OnlineUserService onlineUserService;
private final UserCacheManager userCacheManager;
@Override
public void configure(HttpSecurity http) {
TokenFilter customFilter = new TokenFilter(tokenProvider, properties, onlineUserService, userCacheManager);
http.addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class);
}
}

View File

@@ -0,0 +1,108 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.security;
import cn.hutool.core.util.StrUtil;
import cn.ysk.cashier.config.security.config.bean.SecurityProperties;
import io.jsonwebtoken.ExpiredJwtException;
import cn.ysk.cashier.config.security.service.UserCacheManager;
import cn.ysk.cashier.config.security.service.dto.OnlineUserDto;
import cn.ysk.cashier.config.security.service.OnlineUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.GenericFilterBean;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Objects;
/**
* @author /
*/
public class TokenFilter extends GenericFilterBean {
private static final Logger log = LoggerFactory.getLogger(TokenFilter.class);
private final TokenProvider tokenProvider;
private final SecurityProperties properties;
private final OnlineUserService onlineUserService;
private final UserCacheManager userCacheManager;
/**
* @param tokenProvider Token
* @param properties JWT
* @param onlineUserService 用户在线
* @param userCacheManager 用户缓存工具
*/
public TokenFilter(TokenProvider tokenProvider, SecurityProperties properties, OnlineUserService onlineUserService, UserCacheManager userCacheManager) {
this.properties = properties;
this.onlineUserService = onlineUserService;
this.tokenProvider = tokenProvider;
this.userCacheManager = userCacheManager;
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String token = resolveToken(httpServletRequest);
// 对于 Token 为空的不需要去查 Redis
if (StrUtil.isNotBlank(token)) {
OnlineUserDto onlineUserDto = null;
boolean cleanUserCache = false;
try {
onlineUserDto = onlineUserService.getOne(properties.getOnlineKey() + token);
} catch (ExpiredJwtException e) {
log.error(e.getMessage());
cleanUserCache = true;
} finally {
if (cleanUserCache || Objects.isNull(onlineUserDto)) {
userCacheManager.cleanUserCache(String.valueOf(tokenProvider.getClaims(token).get(TokenProvider.AUTHORITIES_KEY)));
}
}
if (onlineUserDto != null && StringUtils.hasText(token)) {
Authentication authentication = tokenProvider.getAuthentication(token);
SecurityContextHolder.getContext().setAuthentication(authentication);
// Token 续期
tokenProvider.checkRenewal(token);
}
}
filterChain.doFilter(servletRequest, servletResponse);
}
/**
* 初步检测Token
*
* @param request /
* @return /
*/
private String resolveToken(HttpServletRequest request) {
String bearerToken = request.getHeader(properties.getHeader());
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith(properties.getTokenStartWith())) {
// 去掉令牌前缀
return bearerToken.replace(properties.getTokenStartWith(), "");
} else {
log.debug("非法Token{}", bearerToken);
}
return null;
}
}

View File

@@ -0,0 +1,123 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.security;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import io.jsonwebtoken.*;
import io.jsonwebtoken.io.Decoders;
import io.jsonwebtoken.security.Keys;
import lombok.extern.slf4j.Slf4j;
import cn.ysk.cashier.config.security.config.bean.SecurityProperties;
import cn.ysk.cashier.utils.RedisUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.security.Key;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* @author /
*/
@Slf4j
@Component
public class TokenProvider implements InitializingBean {
private final SecurityProperties properties;
private final RedisUtils redisUtils;
public static final String AUTHORITIES_KEY = "user";
private JwtParser jwtParser;
private JwtBuilder jwtBuilder;
public TokenProvider(SecurityProperties properties, RedisUtils redisUtils) {
this.properties = properties;
this.redisUtils = redisUtils;
}
@Override
public void afterPropertiesSet() {
byte[] keyBytes = Decoders.BASE64.decode(properties.getBase64Secret());
Key key = Keys.hmacShaKeyFor(keyBytes);
jwtParser = Jwts.parserBuilder()
.setSigningKey(key)
.build();
jwtBuilder = Jwts.builder()
.signWith(key, SignatureAlgorithm.HS512);
}
/**
* 创建Token 设置永不过期,
* Token 的时间有效性转到Redis 维护
*
* @param authentication /
* @return /
*/
public String createToken(Authentication authentication) {
return jwtBuilder
// 加入ID确保生成的 Token 都不一致
.setId(IdUtil.simpleUUID())
.claim(AUTHORITIES_KEY, authentication.getName())
.setSubject(authentication.getName())
.compact();
}
/**
* 依据Token 获取鉴权信息
*
* @param token /
* @return /
*/
Authentication getAuthentication(String token) {
Claims claims = getClaims(token);
User principal = new User(claims.getSubject(), "******", new ArrayList<>());
return new UsernamePasswordAuthenticationToken(principal, token, new ArrayList<>());
}
public Claims getClaims(String token) {
return jwtParser
.parseClaimsJws(token)
.getBody();
}
/**
* @param token 需要检查的token
*/
public void checkRenewal(String token) {
// 判断是否续期token,计算token的过期时间
long time = redisUtils.getExpire(properties.getOnlineKey() + token) * 1000;
Date expireDate = DateUtil.offset(new Date(), DateField.MILLISECOND, (int) time);
// 判断当前时间与过期时间的时间差
long differ = expireDate.getTime() - System.currentTimeMillis();
// 如果在续期检查的范围内,则续期
if (differ <= properties.getDetect()) {
long renew = time + properties.getRenew();
redisUtils.expire(properties.getOnlineKey() + token, renew, TimeUnit.MILLISECONDS);
}
}
public String getToken(HttpServletRequest request) {
final String requestHeader = request.getHeader(properties.getHeader());
if (requestHeader != null && requestHeader.startsWith(properties.getTokenStartWith())) {
return requestHeader.substring(7);
}
return null;
}
}

View File

@@ -0,0 +1,191 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.service;
import cn.ysk.cashier.config.security.config.bean.SecurityProperties;
import cn.ysk.cashier.config.security.service.dto.JwtUserDto;
import cn.ysk.cashier.utils.*;
import lombok.extern.slf4j.Slf4j;
import cn.ysk.cashier.config.security.service.dto.OnlineUserDto;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
/**
* @author Zheng Jie
* @date 2019年10月26日21:56:27
*/
@Service
@Slf4j
public class OnlineUserService {
private final SecurityProperties properties;
private final RedisUtils redisUtils;
public OnlineUserService(SecurityProperties properties, RedisUtils redisUtils) {
this.properties = properties;
this.redisUtils = redisUtils;
}
/**
* 保存在线用户信息
* @param jwtUserDto /
* @param token /
* @param request /
*/
public void save(JwtUserDto jwtUserDto, String token, HttpServletRequest request){
String dept = jwtUserDto.getUser().getDept().getName();
String ip = StringUtils.getIp(request);
String browser = StringUtils.getBrowser(request);
String address = StringUtils.getCityInfo(ip);
OnlineUserDto onlineUserDto = null;
try {
onlineUserDto = new OnlineUserDto(jwtUserDto.getUsername(), jwtUserDto.getUser().getNickName(), dept, browser , ip, address, EncryptUtils.desEncrypt(token), new Date());
} catch (Exception e) {
log.error(e.getMessage(),e);
}
redisUtils.set(properties.getOnlineKey() + token, onlineUserDto, properties.getTokenValidityInSeconds()/1000);
}
/**
* 查询全部数据
* @param filter /
* @param pageable /
* @return /
*/
public Map<String,Object> getAll(String filter, Pageable pageable){
List<OnlineUserDto> onlineUserDtos = getAll(filter);
return PageUtil.toPage(
PageUtil.toPage(pageable.getPageNumber(),pageable.getPageSize(), onlineUserDtos),
onlineUserDtos.size()
);
}
/**
* 查询全部数据,不分页
* @param filter /
* @return /
*/
public List<OnlineUserDto> getAll(String filter){
List<String> keys = redisUtils.scan(properties.getOnlineKey() + "*");
Collections.reverse(keys);
List<OnlineUserDto> onlineUserDtos = new ArrayList<>();
for (String key : keys) {
OnlineUserDto onlineUserDto = (OnlineUserDto) redisUtils.get(key);
if(StringUtils.isNotBlank(filter)){
if(onlineUserDto.toString().contains(filter)){
onlineUserDtos.add(onlineUserDto);
}
} else {
onlineUserDtos.add(onlineUserDto);
}
}
onlineUserDtos.sort((o1, o2) -> o2.getLoginTime().compareTo(o1.getLoginTime()));
return onlineUserDtos;
}
/**
* 踢出用户
* @param key /
*/
public void kickOut(String key){
key = properties.getOnlineKey() + key;
redisUtils.del(key);
}
/**
* 退出登录
* @param token /
*/
public void logout(String token) {
String key = properties.getOnlineKey() + token;
redisUtils.del(key);
}
/**
* 导出
* @param all /
* @param response /
* @throws IOException /
*/
public void download(List<OnlineUserDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (OnlineUserDto user : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("用户名", user.getUserName());
map.put("部门", user.getDept());
map.put("登录IP", user.getIp());
map.put("登录地点", user.getAddress());
map.put("浏览器", user.getBrowser());
map.put("登录日期", user.getLoginTime());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
/**
* 查询用户
* @param key /
* @return /
*/
public OnlineUserDto getOne(String key) {
return (OnlineUserDto)redisUtils.get(key);
}
/**
* 检测用户是否在之前已经登录,已经登录踢下线
* @param userName 用户名
*/
public void checkLoginOnUser(String userName, String igoreToken){
List<OnlineUserDto> onlineUserDtos = getAll(userName);
if(onlineUserDtos ==null || onlineUserDtos.isEmpty()){
return;
}
for(OnlineUserDto onlineUserDto : onlineUserDtos){
if(onlineUserDto.getUserName().equals(userName)){
try {
String token =EncryptUtils.desDecrypt(onlineUserDto.getKey());
if(StringUtils.isNotBlank(igoreToken)&&!igoreToken.equals(token)){
this.kickOut(token);
}else if(StringUtils.isBlank(igoreToken)){
this.kickOut(token);
}
} catch (Exception e) {
log.error("checkUser is error",e);
}
}
}
}
/**
* 根据用户名强退用户
* @param username /
*/
@Async
public void kickOutForUsername(String username) throws Exception {
List<OnlineUserDto> onlineUsers = getAll(username);
for (OnlineUserDto onlineUser : onlineUsers) {
if (onlineUser.getUserName().equals(username)) {
String token =EncryptUtils.desDecrypt(onlineUser.getKey());
kickOut(token);
}
}
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.service;
import cn.hutool.core.util.RandomUtil;
import cn.ysk.cashier.config.security.config.bean.LoginProperties;
import cn.ysk.cashier.config.security.service.dto.JwtUserDto;
import cn.ysk.cashier.utils.RedisUtils;
import cn.ysk.cashier.utils.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* @author Zheng Jie
* @description 用户缓存管理
* @date 2022-05-26
**/
@Component
public class UserCacheManager {
@Resource
private RedisUtils redisUtils;
@Value("${login.user-cache.idle-time}")
private long idleTime;
/**
* 返回用户缓存
* @param userName 用户名
* @return JwtUserDto
*/
public JwtUserDto getUserCache(String userName) {
if (StringUtils.isNotEmpty(userName)) {
// 获取数据
Object obj = redisUtils.hget(LoginProperties.cacheKey, userName);
if(obj != null){
return (JwtUserDto)obj;
}
}
return null;
}
/**
* 添加缓存到Redis
* @param userName 用户名
*/
@Async
public void addUserCache(String userName, JwtUserDto user) {
if (StringUtils.isNotEmpty(userName)) {
// 添加数据, 避免数据同时过期
long time = idleTime + RandomUtil.randomInt(900, 1800);
redisUtils.hset(LoginProperties.cacheKey, userName, user, time);
}
}
/**
* 清理用户缓存信息
* 用户信息变更时
* @param userName 用户名
*/
@Async
public void cleanUserCache(String userName) {
if (StringUtils.isNotEmpty(userName)) {
// 清除数据
redisUtils.hdel(LoginProperties.cacheKey, userName);
}
}
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.service;
import cn.ysk.cashier.config.security.service.dto.JwtUserDto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.exception.EntityNotFoundException;
import cn.ysk.cashier.system.service.DataService;
import cn.ysk.cashier.system.service.RoleService;
import cn.ysk.cashier.system.service.UserService;
import cn.ysk.cashier.system.service.dto.UserLoginDto;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
/**
* @author Zheng Jie
* @date 2018-11-22
*/
@Slf4j
@RequiredArgsConstructor
@Service("userDetailsService")
public class UserDetailsServiceImpl implements UserDetailsService {
private final UserService userService;
private final RoleService roleService;
private final DataService dataService;
private final UserCacheManager userCacheManager;
@Override
public JwtUserDto loadUserByUsername(String username) {
JwtUserDto jwtUserDto = userCacheManager.getUserCache(username);
if(jwtUserDto == null){
UserLoginDto user;
try {
user = userService.getLoginData(username);
} catch (EntityNotFoundException e) {
// SpringSecurity会自动转换UsernameNotFoundException为BadCredentialsException
throw new UsernameNotFoundException(username, e);
}
if (user == null) {
throw new UsernameNotFoundException("");
} else {
if (!user.getEnabled()) {
throw new BadRequestException("账号未激活!");
}
jwtUserDto = new JwtUserDto(
user,
dataService.getDeptIds(user),
roleService.mapToGrantedAuthorities(user)
);
// 添加缓存数据
userCacheManager.addUserCache(username, jwtUserDto);
}
}
return jwtUserDto;
}
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.service.dto;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
/**
* @author Zheng Jie
* @date 2018-11-30
*/
@Getter
@Setter
public class AuthUserDto {
@NotBlank
private String username;
@NotBlank
private String password;
private String code;
private String uuid = "";
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.service.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
/**
* 避免序列化问题
* @author Zheng Jie
* @date 2018-11-30
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AuthorityDto implements GrantedAuthority {
private String authority;
}

View File

@@ -0,0 +1,80 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.service.dto;
import cn.ysk.cashier.system.service.dto.UserLoginDto;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Zheng Jie
* @date 2018-11-23
*/
@Getter
@AllArgsConstructor
public class JwtUserDto implements UserDetails {
private final UserLoginDto user;
private final List<Long> dataScopes;
private final List<AuthorityDto> authorities;
public Set<String> getRoles() {
return authorities.stream().map(AuthorityDto::getAuthority).collect(Collectors.toSet());
}
@Override
@JSONField(serialize = false)
public String getPassword() {
return user.getPassword();
}
@Override
@JSONField(serialize = false)
public String getUsername() {
return user.getUsername();
}
@JSONField(serialize = false)
@Override
public boolean isAccountNonExpired() {
return true;
}
@JSONField(serialize = false)
@Override
public boolean isAccountNonLocked() {
return true;
}
@JSONField(serialize = false)
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
@JSONField(serialize = false)
public boolean isEnabled() {
return user.getEnabled();
}
}

View File

@@ -0,0 +1,73 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.security.service.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 在线用户
* @author Zheng Jie
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OnlineUserDto {
/**
* 用户名
*/
private String userName;
/**
* 昵称
*/
private String nickName;
/**
* 岗位
*/
private String dept;
/**
* 浏览器
*/
private String browser;
/**
* IP
*/
private String ip;
/**
* 地址
*/
private String address;
/**
* token
*/
private String key;
/**
* 登录时间
*/
private Date loginTime;
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.thread;
import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 异步任务线程池装配类
* @author https://juejin.im/entry/5abb8f6951882555677e9da2
* @date 2019年10月31日15:06:18
*/
@Slf4j
@Configuration
public class AsyncTaskExecutePool implements AsyncConfigurer {
@Override
public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
//核心线程池大小
executor.setCorePoolSize(AsyncTaskProperties.corePoolSize);
//最大线程数
executor.setMaxPoolSize(AsyncTaskProperties.maxPoolSize);
//队列容量
executor.setQueueCapacity(AsyncTaskProperties.queueCapacity);
//活跃时间
executor.setKeepAliveSeconds(AsyncTaskProperties.keepAliveSeconds);
//线程工厂
executor.setThreadFactory(new TheadFactoryName("el-async"));
// setRejectedExecutionHandler当pool已经达到max size的时候如何处理新任务
// CallerRunsPolicy不在新线程中执行任务而是由调用者所在的线程来执行
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executor.initialize();
return executor;
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return (throwable, method, objects) -> {
log.error("===="+throwable.getMessage()+"====", throwable);
log.error("exception method:"+method.getName());
};
}
}

View File

@@ -0,0 +1,58 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.thread;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
* 线程池配置属性类
* @author https://juejin.im/entry/5abb8f6951882555677e9da2
* @date 2019年10月31日14:58:18
*/
@Data
@Component
public class AsyncTaskProperties {
public static int corePoolSize;
public static int maxPoolSize;
public static int keepAliveSeconds;
public static int queueCapacity;
@Value("${task.pool.core-pool-size}")
public void setCorePoolSize(int corePoolSize) {
AsyncTaskProperties.corePoolSize = corePoolSize;
}
@Value("${task.pool.max-pool-size}")
public void setMaxPoolSize(int maxPoolSize) {
AsyncTaskProperties.maxPoolSize = maxPoolSize;
}
@Value("${task.pool.keep-alive-seconds}")
public void setKeepAliveSeconds(int keepAliveSeconds) {
AsyncTaskProperties.keepAliveSeconds = keepAliveSeconds;
}
@Value("${task.pool.queue-capacity}")
public void setQueueCapacity(int queueCapacity) {
AsyncTaskProperties.queueCapacity = queueCapacity;
}
}

View File

@@ -0,0 +1,64 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.thread;
import cn.ysk.cashier.utils.StringUtils;
import org.springframework.stereotype.Component;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 自定义线程名称
* @author Zheng Jie
* @date 2019年10月31日17:49:55
*/
@Component
public class TheadFactoryName implements ThreadFactory {
private static final AtomicInteger POOL_NUMBER = new AtomicInteger(1);
private final ThreadGroup group;
private final AtomicInteger threadNumber = new AtomicInteger(1);
private final String namePrefix;
private final static String DEF_NAME = "el-pool-";
public TheadFactoryName() {
this(DEF_NAME);
}
public TheadFactoryName(String name){
SecurityManager s = System.getSecurityManager();
group = (s != null) ? s.getThreadGroup() :
Thread.currentThread().getThreadGroup();
//此时namePrefix就是 name + 第几个用这个工厂创建线程池的
this.namePrefix = (StringUtils.isNotBlank(name) ? name : DEF_NAME) + "-" + POOL_NUMBER.getAndIncrement();
}
@Override
public Thread newThread(Runnable r) {
//此时线程的名字 就是 namePrefix + -exec- + 这个线程池中第几个执行的线程
Thread t = new Thread(group, r,
namePrefix + "-exec-"+threadNumber.getAndIncrement(),
0);
if (t.isDaemon()) {
t.setDaemon(false);
}
if (t.getPriority() != Thread.NORM_PRIORITY) {
t.setPriority(Thread.NORM_PRIORITY);
}
return t;
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.config.thread;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* 用于获取自定义线程池
* @author Zheng Jie
* @date 2019年10月31日18:16:47
*/
public class ThreadPoolExecutorUtil {
public static ExecutorService getPoll(){
return getPoll(null);
}
public static ExecutorService getPoll(String threadName){
return new ThreadPoolExecutor(
AsyncTaskProperties.corePoolSize,
AsyncTaskProperties.maxPoolSize,
AsyncTaskProperties.keepAliveSeconds,
TimeUnit.SECONDS,
new ArrayBlockingQueue<>(AsyncTaskProperties.queueCapacity),
new TheadFactoryName(threadName),
// 队列与线程池中线程都满了时使用调用者所在的线程来执行
new ThreadPoolExecutor.CallerRunsPolicy()
);
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.BotButtonConfig;
import cn.ysk.cashier.service.BotButtonConfigService;
import cn.ysk.cashier.dto.BotButtonConfigQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author admin
* @date 2023-10-31
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "buttonConfig管理")
@RequestMapping("/api/botButtonConfig")
public class BotButtonConfigController {
private final BotButtonConfigService botButtonConfigService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('botButtonConfig:list')")
public void exportBotButtonConfig(HttpServletResponse response, BotButtonConfigQueryCriteria criteria) throws IOException {
botButtonConfigService.download(botButtonConfigService.queryAll(criteria), response);
}
@GetMapping
@Log("查询buttonConfig")
@ApiOperation("查询buttonConfig")
@PreAuthorize("@el.check('botButtonConfig:list')")
public ResponseEntity<Object> queryBotButtonConfig(BotButtonConfigQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(botButtonConfigService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增buttonConfig")
@ApiOperation("新增buttonConfig")
@PreAuthorize("@el.check('botButtonConfig:add')")
public ResponseEntity<Object> createBotButtonConfig(@Validated @RequestBody BotButtonConfig resources){
return new ResponseEntity<>(botButtonConfigService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改buttonConfig")
@ApiOperation("修改buttonConfig")
@PreAuthorize("@el.check('botButtonConfig:edit')")
public ResponseEntity<Object> updateBotButtonConfig(@Validated @RequestBody BotButtonConfig resources){
botButtonConfigService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除buttonConfig")
@ApiOperation("删除buttonConfig")
@PreAuthorize("@el.check('botButtonConfig:del')")
public ResponseEntity<Object> deleteBotButtonConfig(@RequestBody Integer[] ids) {
botButtonConfigService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.BotConfig;
import cn.ysk.cashier.service.BotConfigService;
import cn.ysk.cashier.dto.BotConfigQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author admin
* @date 2023-10-31
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "botConfig管理")
@RequestMapping("/api/botConfig")
public class BotConfigController {
private final BotConfigService botConfigService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('botConfig:list')")
public void exportBotConfig(HttpServletResponse response, BotConfigQueryCriteria criteria) throws IOException {
botConfigService.download(botConfigService.queryAll(criteria), response);
}
@GetMapping
@Log("查询botConfig")
@ApiOperation("查询botConfig")
@PreAuthorize("@el.check('botConfig:list')")
public ResponseEntity<Object> queryBotConfig(BotConfigQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(botConfigService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增botConfig")
@ApiOperation("新增botConfig")
@PreAuthorize("@el.check('botConfig:add')")
public ResponseEntity<Object> createBotConfig(@Validated @RequestBody BotConfig resources){
return new ResponseEntity<>(botConfigService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改botConfig")
@ApiOperation("修改botConfig")
@PreAuthorize("@el.check('botConfig:edit')")
public ResponseEntity<Object> updateBotConfig(@Validated @RequestBody BotConfig resources){
botConfigService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除botConfig")
@ApiOperation("删除botConfig")
@PreAuthorize("@el.check('botConfig:del')")
public ResponseEntity<Object> deleteBotConfig(@RequestBody Integer[] ids) {
botConfigService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.BotUser;
import cn.ysk.cashier.service.BotUserService;
import cn.ysk.cashier.dto.BotUserQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author admin
* @date 2023-10-30
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "BotUserController管理")
@RequestMapping("/api/botUser")
public class BotUserController {
private final BotUserService botUserService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('botUser:list')")
public void exportBotUser(HttpServletResponse response, BotUserQueryCriteria criteria) throws IOException {
botUserService.download(botUserService.queryAll(criteria), response);
}
@GetMapping
@Log("查询BotUserController")
@ApiOperation("查询BotUserController")
@PreAuthorize("@el.check('botUser:list')")
public ResponseEntity<Object> queryBotUser(BotUserQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(botUserService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增BotUserController")
@ApiOperation("新增BotUserController")
@PreAuthorize("@el.check('botUser:add')")
public ResponseEntity<Object> createBotUser(@Validated @RequestBody BotUser resources){
return new ResponseEntity<>(botUserService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改BotUserController")
@ApiOperation("修改BotUserController")
@PreAuthorize("@el.check('botUser:edit')")
public ResponseEntity<Object> updateBotUser(@Validated @RequestBody BotUser resources){
botUserService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除BotUserController")
@ApiOperation("删除BotUserController")
@PreAuthorize("@el.check('botUser:del')")
public ResponseEntity<Object> deleteBotUser(@RequestBody Integer[] ids) {
botUserService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.BotUserFlow;
import cn.ysk.cashier.service.BotUserFlowService;
import cn.ysk.cashier.dto.BotUserFlowQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author admin
* @date 2023-10-30
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "accountFlow管理")
@RequestMapping("/api/botUserFlow")
public class BotUserFlowController {
private final BotUserFlowService botUserFlowService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('botUserFlow:list')")
public void exportBotUserFlow(HttpServletResponse response, BotUserFlowQueryCriteria criteria) throws IOException {
botUserFlowService.download(botUserFlowService.queryAll(criteria), response);
}
@GetMapping
@Log("查询accountFlow")
@ApiOperation("查询accountFlow")
@PreAuthorize("@el.check('botUserFlow:list')")
public ResponseEntity<Object> queryBotUserFlow(BotUserFlowQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(botUserFlowService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增accountFlow")
@ApiOperation("新增accountFlow")
@PreAuthorize("@el.check('botUserFlow:add')")
public ResponseEntity<Object> createBotUserFlow(@Validated @RequestBody BotUserFlow resources){
return new ResponseEntity<>(botUserFlowService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改accountFlow")
@ApiOperation("修改accountFlow")
@PreAuthorize("@el.check('botUserFlow:edit')")
public ResponseEntity<Object> updateBotUserFlow(@Validated @RequestBody BotUserFlow resources){
botUserFlowService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除accountFlow")
@ApiOperation("删除accountFlow")
@PreAuthorize("@el.check('botUserFlow:del')")
public ResponseEntity<Object> deleteBotUserFlow(@RequestBody Integer[] ids) {
botUserFlowService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.TbRenewalsPayLog;
import cn.ysk.cashier.service.TbRenewalsPayLogService;
import cn.ysk.cashier.dto.TbRenewalsPayLogQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2023-11-07
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/renewals管理")
@RequestMapping("/api/tbRenewalsPayLog")
public class TbRenewalsPayLogController {
private final TbRenewalsPayLogService tbRenewalsPayLogService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbRenewalsPayLog:list')")
public void exportTbRenewalsPayLog(HttpServletResponse response, TbRenewalsPayLogQueryCriteria criteria) throws IOException {
tbRenewalsPayLogService.download(tbRenewalsPayLogService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/shop/renewals")
@ApiOperation("查询/shop/renewals")
@PreAuthorize("@el.check('tbRenewalsPayLog:list')")
public ResponseEntity<Object> queryTbRenewalsPayLog(TbRenewalsPayLogQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbRenewalsPayLogService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/shop/renewals")
@ApiOperation("新增/shop/renewals")
@PreAuthorize("@el.check('tbRenewalsPayLog:add')")
public ResponseEntity<Object> createTbRenewalsPayLog(@Validated @RequestBody TbRenewalsPayLog resources){
return new ResponseEntity<>(tbRenewalsPayLogService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/renewals")
@ApiOperation("修改/shop/renewals")
@PreAuthorize("@el.check('tbRenewalsPayLog:edit')")
public ResponseEntity<Object> updateTbRenewalsPayLog(@Validated @RequestBody TbRenewalsPayLog resources){
tbRenewalsPayLogService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/renewals")
@ApiOperation("删除/shop/renewals")
@PreAuthorize("@el.check('tbRenewalsPayLog:del')")
public ResponseEntity<Object> deleteTbRenewalsPayLog(@RequestBody Integer[] ids) {
tbRenewalsPayLogService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,81 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.TbShopPayType;
import cn.ysk.cashier.service.TbShopPayTypeService;
import cn.ysk.cashier.dto.TbShopPayTypeQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2023-11-03
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/merchant/system/paytype管理")
@RequestMapping("/api/tbShopPayType")
public class TbShopPayTypeController {
private final TbShopPayTypeService tbShopPayTypeService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
public void exportTbShopPayType(HttpServletResponse response, TbShopPayTypeQueryCriteria criteria) throws IOException {
tbShopPayTypeService.download(tbShopPayTypeService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/merchant/system/paytype")
@ApiOperation("查询/merchant/system/paytype")
public ResponseEntity<Object> queryTbShopPayType(TbShopPayTypeQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbShopPayTypeService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/merchant/system/paytype")
@ApiOperation("新增/merchant/system/paytype")
public ResponseEntity<Object> createTbShopPayType(@Validated @RequestBody TbShopPayType resources){
return new ResponseEntity<>(tbShopPayTypeService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/merchant/system/paytype")
@ApiOperation("修改/merchant/system/paytype")
public ResponseEntity<Object> updateTbShopPayType(@Validated @RequestBody TbShopPayType resources){
tbShopPayTypeService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/merchant/system/paytype")
@ApiOperation("删除/merchant/system/paytype")
public ResponseEntity<Object> deleteTbShopPayType(@RequestBody Integer[] ids) {
tbShopPayTypeService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,83 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.TbUserInfo;
import cn.ysk.cashier.service.TbUserInfoService;
import cn.ysk.cashier.dto.TbUserInfoQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2023-11-13
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/userInfo/list管理")
@RequestMapping("/api/tbUserInfo")
public class TbUserInfoController {
private final TbUserInfoService tbUserInfoService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbUserInfo:list')")
public void exportTbUserInfo(HttpServletResponse response, TbUserInfoQueryCriteria criteria) throws IOException {
tbUserInfoService.download(tbUserInfoService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/userInfo/list")
@ApiOperation("查询/userInfo/list")
public ResponseEntity<Object> queryTbUserInfo(TbUserInfoQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbUserInfoService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/userInfo/list")
@ApiOperation("新增/userInfo/list")
public ResponseEntity<Object> createTbUserInfo(@Validated @RequestBody TbUserInfo resources){
return new ResponseEntity<>(tbUserInfoService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/userInfo/list")
@ApiOperation("修改/userInfo/list")
public ResponseEntity<Object> updateTbUserInfo(@Validated @RequestBody TbUserInfo resources){
tbUserInfoService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/userInfo/list")
@ApiOperation("删除/userInfo/list")
public ResponseEntity<Object> deleteTbUserInfo(@RequestBody Integer[] ids) {
tbUserInfoService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,81 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.order;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.order.TbCashierCart;
import cn.ysk.cashier.service.order.TbCashierCartService;
import cn.ysk.cashier.dto.order.TbCashierCartQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-02
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/cashierCart管理")
@RequestMapping("/api/tbCashierCart")
public class TbCashierCartController {
private final TbCashierCartService tbCashierCartService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
public void exportTbCashierCart(HttpServletResponse response, TbCashierCartQueryCriteria criteria) throws IOException {
tbCashierCartService.download(tbCashierCartService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/cashierCart")
@ApiOperation("查询/cashierCart")
public ResponseEntity<Object> queryTbCashierCart(TbCashierCartQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbCashierCartService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/cashierCart")
@ApiOperation("新增/cashierCart")
public ResponseEntity<Object> createTbCashierCart(@Validated @RequestBody TbCashierCart resources){
return new ResponseEntity<>(tbCashierCartService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/cashierCart")
@ApiOperation("修改/cashierCart")
public ResponseEntity<Object> updateTbCashierCart(@Validated @RequestBody TbCashierCart resources){
tbCashierCartService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/cashierCart")
@ApiOperation("删除/cashierCart")
public ResponseEntity<Object> deleteTbCashierCart(@RequestBody Integer[] ids) {
tbCashierCartService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,81 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.order;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.order.TbOrderDetail;
import cn.ysk.cashier.service.order.TbOrderDetailService;
import cn.ysk.cashier.dto.order.TbOrderDetailQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-02
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/orderDetail管理")
@RequestMapping("/api/tbOrderDetail")
public class TbOrderDetailController {
private final TbOrderDetailService tbOrderDetailService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
public void exportTbOrderDetail(HttpServletResponse response, TbOrderDetailQueryCriteria criteria) throws IOException {
tbOrderDetailService.download(tbOrderDetailService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/orderDetail")
@ApiOperation("查询/orderDetail")
public ResponseEntity<Object> queryTbOrderDetail(TbOrderDetailQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbOrderDetailService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/orderDetail")
@ApiOperation("新增/orderDetail")
public ResponseEntity<Object> createTbOrderDetail(@Validated @RequestBody TbOrderDetail resources){
return new ResponseEntity<>(tbOrderDetailService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/orderDetail")
@ApiOperation("修改/orderDetail")
public ResponseEntity<Object> updateTbOrderDetail(@Validated @RequestBody TbOrderDetail resources){
tbOrderDetailService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/orderDetail")
@ApiOperation("删除/orderDetail")
public ResponseEntity<Object> deleteTbOrderDetail(@RequestBody Integer[] ids) {
tbOrderDetailService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,88 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.order;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.order.TbOrderInfo;
import cn.ysk.cashier.service.order.TbOrderInfoService;
import cn.ysk.cashier.dto.order.TbOrderInfoQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-02
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/orderInfo管理")
@RequestMapping("/api/tbOrderInfo")
public class TbOrderInfoController {
private final TbOrderInfoService tbOrderInfoService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
public void exportTbOrderInfo(HttpServletResponse response, TbOrderInfoQueryCriteria criteria) throws IOException {
tbOrderInfoService.download(tbOrderInfoService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/orderInfo")
@ApiOperation("查询/orderInfo")
public ResponseEntity<Object> queryTbOrderInfo(TbOrderInfoQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbOrderInfoService.queryAll(criteria,pageable),HttpStatus.OK);
}
@GetMapping("/{id}")
@Log("查询/orderInfo")
@ApiOperation("查询/orderInfo")
public Object queryTbOrderInfo(@PathVariable("id") Integer id){
return tbOrderInfoService.findById(id);
}
@PostMapping
@Log("新增/orderInfo")
@ApiOperation("新增/orderInfo")
public ResponseEntity<Object> createTbOrderInfo(@Validated @RequestBody TbOrderInfo resources){
return new ResponseEntity<>(tbOrderInfoService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/orderInfo")
@ApiOperation("修改/orderInfo")
public ResponseEntity<Object> updateTbOrderInfo(@Validated @RequestBody TbOrderInfo resources){
tbOrderInfoService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/orderInfo")
@ApiOperation("删除/orderInfo")
public ResponseEntity<Object> deleteTbOrderInfo(@RequestBody Integer[] ids) {
tbOrderInfoService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,98 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.product;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.vo.TbProductVo;
import cn.ysk.cashier.service.product.TbProductService;
import cn.ysk.cashier.dto.product.TbProductQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2023-12-11
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/product管理")
@RequestMapping("/api/tbProduct")
public class TbProductController {
private final TbProductService tbProductService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbProduct:list')")
public void exportTbProduct(HttpServletResponse response, TbProductQueryCriteria criteria) throws IOException {
tbProductService.download(tbProductService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/product")
@ApiOperation("查询/product")
public ResponseEntity<Object> queryTbProduct(TbProductQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbProductService.queryAll(criteria,pageable),HttpStatus.OK);
}
@GetMapping("/{product}")
@Log("查询/product")
@ApiOperation("查询/product")
public Object queryTbProductInfo(@PathVariable("product") Integer product)throws Exception{
return tbProductService.findByProductId(product);
}
@GetMapping ("/productList")
@Log("查询/product")
@ApiOperation("查询/product")
public Object queryTbProductInfo(@RequestParam List<String> productList){
return tbProductService.findByProductList(productList);
}
@PostMapping
@Log("新增/product")
@ApiOperation("新增/product")
public ResponseEntity<Object> createTbProduct(@Validated @RequestBody TbProductVo resources){
return new ResponseEntity<>(tbProductService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/product")
@ApiOperation("修改/product")
public ResponseEntity<Object> updateTbProduct(@Validated @RequestBody TbProductVo resources){
tbProductService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/product")
@ApiOperation("删除/product")
public ResponseEntity<Object> deleteTbProduct(@RequestBody Integer[] ids) {
tbProductService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,119 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.product;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.service.product.TbProductService;
import cn.ysk.cashier.dto.product.TbProductQueryCriteria;
import cn.ysk.cashier.pojo.product.TbProductGroup;
import cn.ysk.cashier.service.product.TbProductGroupService;
import cn.ysk.cashier.dto.product.TbProductGroupQueryCriteria;
import cn.ysk.cashier.vo.AddProduct;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2023-12-16
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "product/group管理")
@RequestMapping("/api/tbProductGroup")
public class TbProductGroupController {
private final TbProductGroupService tbProductGroupService;
@Resource
private TbProductService tbProductService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbProductGroup:list')")
public void exportTbProductGroup(HttpServletResponse response, TbProductGroupQueryCriteria criteria) throws IOException {
tbProductGroupService.download(tbProductGroupService.queryAll(criteria), response);
}
@GetMapping
@Log("查询product/group")
@ApiOperation("查询product/group")
public ResponseEntity<Object> queryTbProductGroup(TbProductGroupQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbProductGroupService.queryAll(criteria,pageable),HttpStatus.OK);
}
@GetMapping("/{productGroup}")
@Log("查询product/group")
@ApiOperation("查询product/group")
public ResponseEntity<Object> queryTbProductGroup(@PathVariable("productGroup") Integer productGroup){
return new ResponseEntity<>(tbProductGroupService.findByIdProduct(productGroup),HttpStatus.OK);
}
@PostMapping
@Log("新增product/group")
@ApiOperation("新增product/group")
public ResponseEntity<Object> createTbProductGroup(@Validated @RequestBody TbProductGroup resources){
return new ResponseEntity<>(tbProductGroupService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改product/group")
@ApiOperation("修改product/group")
public ResponseEntity<Object> updateTbProductGroup(@Validated @RequestBody TbProductGroup resources){
tbProductGroupService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除product/group")
@ApiOperation("删除product/group")
public ResponseEntity<Object> deleteTbProductGroup(@RequestBody Integer[] ids) {
tbProductGroupService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
/**
*添加商品(商品列表)
* @return
*/
@GetMapping("/addProduct")
public ResponseEntity<Object> ProductList(TbProductQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbProductService.queryAll(criteria,pageable),HttpStatus.OK);
}
/**
* 商品分类增加商品
* @param addProduct
* @param userName
* @return
*/
@PostMapping("/addProductInfo")
public ResponseEntity<Object> addProductInfo(@RequestBody AddProduct addProduct,@RequestAttribute(value = "userName", required = false) String userName){
return new ResponseEntity<>(tbProductGroupService.updateProductIds(addProduct,userName),HttpStatus.OK);
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.product;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.product.TbProductSku;
import cn.ysk.cashier.dto.product.TbProductSkuQueryCriteria;
import cn.ysk.cashier.service.product.TbProductSkuService;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-03
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/product/sku管理")
@RequestMapping("/api/tbProductSku")
public class TbProductSkuController {
private final TbProductSkuService tbProductSkuService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbProductSku:list')")
public void exportTbProductSku(HttpServletResponse response, TbProductSkuQueryCriteria criteria) throws IOException {
tbProductSkuService.download(tbProductSkuService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/product/sku")
@ApiOperation("查询/product/sku")
@PreAuthorize("@el.check('tbProductSku:list')")
public ResponseEntity<Object> queryTbProductSku(TbProductSkuQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbProductSkuService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/product/sku")
@ApiOperation("新增/product/sku")
@PreAuthorize("@el.check('tbProductSku:add')")
public ResponseEntity<Object> createTbProductSku(@Validated @RequestBody TbProductSku resources){
return new ResponseEntity<>(tbProductSkuService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/product/sku")
@ApiOperation("修改/product/sku")
@PreAuthorize("@el.check('tbProductSku:edit')")
public ResponseEntity<Object> updateTbProductSku(@Validated @RequestBody TbProductSku resources){
tbProductSkuService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/product/sku")
@ApiOperation("删除/product/sku")
@PreAuthorize("@el.check('tbProductSku:del')")
public ResponseEntity<Object> deleteTbProductSku(@RequestBody Integer[] ids) {
tbProductSkuService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.product;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.product.TbProductSkuResult;
import cn.ysk.cashier.service.product.TbProductSkuResultService;
import cn.ysk.cashier.dto.product.TbProductSkuResultQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-02-08
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/skuResult管理")
@RequestMapping("/api/tbProductSkuResult")
public class TbProductSkuResultController {
private final TbProductSkuResultService tbProductSkuResultService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbProductSkuResult:list')")
public void exportTbProductSkuResult(HttpServletResponse response, TbProductSkuResultQueryCriteria criteria) throws IOException {
tbProductSkuResultService.download(tbProductSkuResultService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/skuResult")
@ApiOperation("查询/skuResult")
@PreAuthorize("@el.check('tbProductSkuResult:list')")
public ResponseEntity<Object> queryTbProductSkuResult(TbProductSkuResultQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbProductSkuResultService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/skuResult")
@ApiOperation("新增/skuResult")
@PreAuthorize("@el.check('tbProductSkuResult:add')")
public ResponseEntity<Object> createTbProductSkuResult(@Validated @RequestBody TbProductSkuResult resources){
return new ResponseEntity<>(tbProductSkuResultService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/skuResult")
@ApiOperation("修改/skuResult")
@PreAuthorize("@el.check('tbProductSkuResult:edit')")
public ResponseEntity<Object> updateTbProductSkuResult(@Validated @RequestBody TbProductSkuResult resources){
tbProductSkuResultService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/skuResult")
@ApiOperation("删除/skuResult")
@PreAuthorize("@el.check('tbProductSkuResult:del')")
public ResponseEntity<Object> deleteTbProductSkuResult(@RequestBody Integer[] ids) {
tbProductSkuResultService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.product;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.product.TbProductSpec;
import cn.ysk.cashier.service.product.TbProductSpecService;
import cn.ysk.cashier.dto.product.SpecDto;
import cn.ysk.cashier.dto.product.TbProductSpecQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-03
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "product/spec管理")
@RequestMapping("/api/tbProductSpec")
public class TbProductSpecController {
private final TbProductSpecService tbProductSpecService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbProductSpec:list')")
public void exportTbProductSpec(HttpServletResponse response, TbProductSpecQueryCriteria criteria) throws IOException {
tbProductSpecService.download(tbProductSpecService.queryAll(criteria), response);
}
@GetMapping
@Log("查询product/spec")
@ApiOperation("查询product/spec")
public ResponseEntity<Object> queryTbProductSpec(TbProductSpecQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbProductSpecService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增product/spec")
@ApiOperation("新增product/spec")
public ResponseEntity<Object> createTbProductSpec(@Validated @RequestBody SpecDto resources){
return new ResponseEntity<>(tbProductSpecService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改product/spec")
@ApiOperation("修改product/spec")
public ResponseEntity<Object> updateTbProductSpec(@Validated @RequestBody TbProductSpec resources){
tbProductSpecService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除product/spec")
@ApiOperation("删除product/spec")
public ResponseEntity<Object> deleteTbProductSpec(@RequestBody Integer[] ids) {
tbProductSpecService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,106 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.product;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
import cn.ysk.cashier.service.product.TbProductStockDetailService;
import cn.ysk.cashier.dto.product.TbProductStockDetailQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-19
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/product/Stock管理")
@RequestMapping("/api/tbProductStockDetail")
public class TbProductStockDetailController {
private final TbProductStockDetailService tbProductStockDetailService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbProductStockDetail:list')")
public void exportTbProductStockDetail(HttpServletResponse response, TbProductStockDetailQueryCriteria criteria) throws IOException {
tbProductStockDetailService.download(tbProductStockDetailService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/product/Stock")
@ApiOperation("查询/product/Stock")
@PreAuthorize("@el.check('tbProductStockDetail:list')")
public ResponseEntity<Object> queryTbProductStockDetail(TbProductStockDetailQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbProductStockDetailService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping("/stock")
@Log("查询/product/Stock")
@ApiOperation("查询/product/Stock")
// @PreAuthorize("@el.check('tbProductStockDetail:list')")
public ResponseEntity<Object> queryPage(@RequestBody TbProductStockDetailQueryCriteria criteria){
return new ResponseEntity<>(tbProductStockDetailService.queryPage(criteria),HttpStatus.OK);
}
@GetMapping("/sum")
@Log("查询/product/Stock")
public ResponseEntity<Object> sumType(TbProductStockDetailQueryCriteria criteria){
return new ResponseEntity<>(tbProductStockDetailService.sumStockNumber(criteria.getProductId()),HttpStatus.OK);
}
/**
* 出库/入库
* @param resources
* @return
*/
@PostMapping
@Log("新增/product/Stock")
@ApiOperation("新增/product/Stock")
@PreAuthorize("@el.check('tbProductStockDetail:add')")
public ResponseEntity<Object> createTbProductStockDetail(@Validated @RequestBody TbProductStockDetail resources){
return new ResponseEntity<>(tbProductStockDetailService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/product/Stock")
@ApiOperation("修改/product/Stock")
@PreAuthorize("@el.check('tbProductStockDetail:edit')")
public ResponseEntity<Object> updateTbProductStockDetail(@Validated @RequestBody TbProductStockDetail resources){
tbProductStockDetailService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/product/Stock")
@ApiOperation("删除/product/Stock")
@PreAuthorize("@el.check('tbProductStockDetail:del')")
public ResponseEntity<Object> deleteTbProductStockDetail(@RequestBody Long[] ids) {
tbProductStockDetailService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,104 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.product;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.product.TbProductStockOperate;
import cn.ysk.cashier.service.TbProductStockOperateService;
import cn.ysk.cashier.dto.product.OutAndOnDto;
import cn.ysk.cashier.dto.product.TbProductStockOperateQueryCriteria;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-25
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/product/StockOperate管理")
@RequestMapping("/api/tbProductStockOperate")
public class TbProductStockOperateController {
private final TbProductStockOperateService tbProductStockOperateService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbProductStockOperate:list')")
public void exportTbProductStockOperate(HttpServletResponse response, TbProductStockOperateQueryCriteria criteria) throws IOException {
tbProductStockOperateService.download(tbProductStockOperateService.queryAll(criteria), response);
}
@PostMapping("/list")
public ResponseEntity<Object> queryTbProductStockOperate(@RequestBody TbProductStockOperateQueryCriteria criteria){
return new ResponseEntity<>(tbProductStockOperateService.queryAllPage(criteria),HttpStatus.OK);
}
@GetMapping("/{id}")
public ResponseEntity<Object> queryById(@PathVariable Integer id){
return new ResponseEntity<>(tbProductStockOperateService.findById(id),HttpStatus.OK);
}
@GetMapping("/nullify/{id}")
public ResponseEntity<Object> nullify(@PathVariable Integer id){
tbProductStockOperateService.nullify(id);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping
@Log("新增/product/StockOperate")
@ApiOperation("新增/product/StockOperate")
@PreAuthorize("@el.check('tbProductStockOperate:add')")
public ResponseEntity<Object> createTbProductStockOperate(@Validated @RequestBody TbProductStockOperate resources){
return new ResponseEntity<>(tbProductStockOperateService.create(resources),HttpStatus.CREATED);
}
@PostMapping("/outAndOn")
@Log("新增/product/StockOperate")
@ApiOperation("新增/product/StockOperate")
// @PreAuthorize("@el.check('tbProductStockOperate:add')")
public ResponseEntity<Object> createOutAndONOperate(@RequestBody OutAndOnDto outAndOnDto){
return new ResponseEntity<>(tbProductStockOperateService.createOutAndONOperate(outAndOnDto),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/product/StockOperate")
@ApiOperation("修改/product/StockOperate")
@PreAuthorize("@el.check('tbProductStockOperate:edit')")
public ResponseEntity<Object> updateTbProductStockOperate(@Validated @RequestBody TbProductStockOperate resources){
tbProductStockOperateService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/product/StockOperate")
@ApiOperation("删除/product/StockOperate")
@PreAuthorize("@el.check('tbProductStockOperate:del')")
public ResponseEntity<Object> deleteTbProductStockOperate(@RequestBody Integer[] ids) {
tbProductStockOperateService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.product;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.product.TbShopCategory;
import cn.ysk.cashier.service.product.TbShopCategoryService;
import cn.ysk.cashier.dto.product.TbShopCategoryQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-08
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "product/category管理")
@RequestMapping("/api/tbShopCategory")
public class TbShopCategoryController {
private final TbShopCategoryService tbShopCategoryService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbShopCategory:list')")
public void exportTbShopCategory(HttpServletResponse response, TbShopCategoryQueryCriteria criteria) throws IOException {
tbShopCategoryService.download(tbShopCategoryService.queryAll(criteria), response);
}
@GetMapping
@Log("查询product/category")
@ApiOperation("查询product/category")
public ResponseEntity<Object> queryTbShopCategory(TbShopCategoryQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbShopCategoryService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增product/category")
@ApiOperation("新增product/category")
public ResponseEntity<Object> createTbShopCategory(@Validated @RequestBody TbShopCategory resources){
return new ResponseEntity<>(tbShopCategoryService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改product/category")
@ApiOperation("修改product/category")
public ResponseEntity<Object> updateTbShopCategory(@Validated @RequestBody TbShopCategory resources){
tbShopCategoryService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除product/category")
@ApiOperation("删除product/category")
public ResponseEntity<Object> deleteTbShopCategory(@RequestBody Integer[] ids) {
tbShopCategoryService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
import cn.ysk.cashier.service.shop.TbMerchantAccountService;
import cn.ysk.cashier.dto.shop.TbMerchantAccountQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-02-08
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/merchant/account管理")
@RequestMapping("/api/tbMerchantAccount")
public class TbMerchantAccountController {
private final TbMerchantAccountService tbMerchantAccountService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbMerchantAccount:list')")
public void exportTbMerchantAccount(HttpServletResponse response, TbMerchantAccountQueryCriteria criteria) throws IOException {
tbMerchantAccountService.download(tbMerchantAccountService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/merchant/account")
@ApiOperation("查询/merchant/account")
@PreAuthorize("@el.check('tbMerchantAccount:list')")
public ResponseEntity<Object> queryTbMerchantAccount(TbMerchantAccountQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbMerchantAccountService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/merchant/account")
@ApiOperation("新增/merchant/account")
@PreAuthorize("@el.check('tbMerchantAccount:add')")
public ResponseEntity<Object> createTbMerchantAccount(@Validated @RequestBody TbMerchantAccount resources){
return new ResponseEntity<>(tbMerchantAccountService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/merchant/account")
@ApiOperation("修改/merchant/account")
@PreAuthorize("@el.check('tbMerchantAccount:edit')")
public ResponseEntity<Object> updateTbMerchantAccount(@Validated @RequestBody TbMerchantAccount resources){
tbMerchantAccountService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/merchant/account")
@ApiOperation("删除/merchant/account")
@PreAuthorize("@el.check('tbMerchantAccount:del')")
public ResponseEntity<Object> deleteTbMerchantAccount(@RequestBody Integer[] ids) {
tbMerchantAccountService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,85 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbMerchantRegister;
import cn.ysk.cashier.service.shop.TbMerchantRegisterService;
import cn.ysk.cashier.dto.shop.TbMerchantRegisterDto;
import cn.ysk.cashier.dto.shop.TbMerchantRegisterQueryCriteria;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-02-23
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/register管理")
@RequestMapping("/api/tbMerchantRegister")
public class TbMerchantRegisterController {
private final TbMerchantRegisterService tbMerchantRegisterService;
// @Log("导出数据")
// @ApiOperation("导出数据")
// @GetMapping(value = "/download")
// @PreAuthorize("@el.check('tbMerchantRegister:list')")
// public void exportTbMerchantRegister(HttpServletResponse response, TbMerchantRegisterQueryCriteria criteria) throws IOException {
// tbMerchantRegisterService.download(tbMerchantRegisterService.queryAll(criteria), response);
// }
@PostMapping("/list")
@Log("查询/shop/register")
@ApiOperation("查询/shop/register")
@PreAuthorize("@el.check('tbMerchantRegister:list')")
public ResponseEntity<Object> queryTbMerchantRegister(@RequestBody TbMerchantRegisterQueryCriteria criteria){
return new ResponseEntity<>(tbMerchantRegisterService.queryAll(criteria),HttpStatus.OK);
}
@PostMapping
@Log("新增/shop/register")
@ApiOperation("新增/shop/register")
@PreAuthorize("@el.check('tbMerchantRegister:add')")
public ResponseEntity<Object> createTbMerchantRegister(@Validated @RequestBody TbMerchantRegisterDto resources){
return new ResponseEntity<>(tbMerchantRegisterService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/register")
@ApiOperation("修改/shop/register")
@PreAuthorize("@el.check('tbMerchantRegister:edit')")
public ResponseEntity<Object> updateTbMerchantRegister(@Validated @RequestBody TbMerchantRegister resources){
tbMerchantRegisterService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/register")
@ApiOperation("删除/shop/register")
@PreAuthorize("@el.check('tbMerchantRegister:del')")
public ResponseEntity<Object> deleteTbMerchantRegister(@RequestBody Integer[] ids) {
tbMerchantRegisterService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,97 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbMerchantThirdApply;
import cn.ysk.cashier.service.shop.TbMerchantThirdApplyService;
import cn.ysk.cashier.dto.shop.TbMerchantThirdApplyDto;
import cn.ysk.cashier.dto.shop.TbMerchantThirdApplyQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-02-02
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/thirdApply管理")
@RequestMapping("/api/tbMerchantThirdApply")
public class TbMerchantThirdApplyController {
private final TbMerchantThirdApplyService tbMerchantThirdApplyService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbMerchantThirdApply:list')")
public void exportTbMerchantThirdApply(HttpServletResponse response, TbMerchantThirdApplyQueryCriteria criteria) throws IOException {
tbMerchantThirdApplyService.download(tbMerchantThirdApplyService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/shop/thirdApply")
@ApiOperation("查询/shop/thirdApply")
public ResponseEntity<Object> queryTbMerchantThirdApply(TbMerchantThirdApplyQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbMerchantThirdApplyService.queryAll(criteria,pageable),HttpStatus.OK);
}
@GetMapping("/{merchantId}")
public ResponseEntity<Object> queryTbMerchantThirdApply(@PathVariable Integer merchantId){
TbMerchantThirdApplyDto byShopId = tbMerchantThirdApplyService.findByShopId(merchantId);
if (byShopId == null){
return new ResponseEntity<>(new TbMerchantThirdApplyDto(),HttpStatus.OK);
}
return new ResponseEntity<>(byShopId,HttpStatus.OK);
}
@PostMapping
@Log("新增/shop/thirdApply")
@ApiOperation("新增/shop/thirdApply")
@PreAuthorize("@el.check('tbMerchantThirdApply:add')")
public ResponseEntity<Object> createTbMerchantThirdApply(@Validated @RequestBody TbMerchantThirdApply resources){
return new ResponseEntity<>(tbMerchantThirdApplyService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/thirdApply")
@ApiOperation("修改/shop/thirdApply")
@PreAuthorize("@el.check('tbMerchantThirdApply:edit')")
public ResponseEntity<Object> updateTbMerchantThirdApply(@Validated @RequestBody TbMerchantThirdApply resources){
tbMerchantThirdApplyService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/thirdApply")
@ApiOperation("删除/shop/thirdApply")
@PreAuthorize("@el.check('tbMerchantThirdApply:del')")
public ResponseEntity<Object> deleteTbMerchantThirdApply(@RequestBody Integer[] ids) {
tbMerchantThirdApplyService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,81 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
import cn.ysk.cashier.service.shop.TbPlussShopStaffService;
import cn.ysk.cashier.dto.shop.TbPlussShopStaffQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-01
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/shopStaff管理")
@RequestMapping("/api/tbPlussShopStaff")
public class TbPlussShopStaffController {
private final TbPlussShopStaffService tbPlussShopStaffService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
public void exportTbPlussShopStaff(HttpServletResponse response, TbPlussShopStaffQueryCriteria criteria) throws IOException {
tbPlussShopStaffService.download(tbPlussShopStaffService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/shop/shopStaff")
@ApiOperation("查询/shop/shopStaff")
public ResponseEntity<Object> queryTbPlussShopStaff(TbPlussShopStaffQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbPlussShopStaffService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/shop/shopStaff")
@ApiOperation("新增/shop/shopStaff")
public ResponseEntity<Object> createTbPlussShopStaff(@Validated @RequestBody TbPlussShopStaff resources){
return new ResponseEntity<>(tbPlussShopStaffService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/shopStaff")
@ApiOperation("修改/shop/shopStaff")
public ResponseEntity<Object> updateTbPlussShopStaff(@Validated @RequestBody TbPlussShopStaff resources){
tbPlussShopStaffService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/shopStaff")
@ApiOperation("删除/shop/shopStaff")
public ResponseEntity<Object> deleteTbPlussShopStaff(@RequestBody Integer[] ids) {
tbPlussShopStaffService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,115 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-02-28
**/
@Entity
@Data
@Table(name="tb_print_machine")
public class TbPrintMachine implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "`id`")
@ApiModelProperty(value = "id")
private Integer id;
@Column(name = "`name`",nullable = false)
@NotBlank
@ApiModelProperty(value = "设备名称")
private String name;
@Column(name = "`type`")
@ApiModelProperty(value = "printer")
private String type;
@Column(name = "`connection_type`")
@ApiModelProperty(value = "现在打印机支持USB 和 网络、蓝牙")
private String connectionType;
@Column(name = "`address`")
@ApiModelProperty(value = "ip地址")
private String address;
@Column(name = "`port`")
@ApiModelProperty(value = "端口")
private String port;
@Column(name = "`sub_type`")
@ApiModelProperty(value = "打印类型(分类)")
private String subType;
@Column(name = "`status`")
@ApiModelProperty(value = "状态 online")
private Integer status;
@Column(name = "`shop_id`")
@ApiModelProperty(value = "店铺Id")
private String shopId;
@Column(name = "`category_ids`")
@ApiModelProperty(value = "分类Id")
private String categoryIds;
@Column(name = "`content_type`")
@ApiModelProperty(value = "现在打印机支持USB 和 网络两种")
private String contentType;
@Column(name = "`config`")
@ApiModelProperty(value = "主配置")
private String config;
@Column(name = "`created_at`")
@ApiModelProperty(value = "createdAt")
private Long createdAt;
@Column(name = "`updated_at`")
@ApiModelProperty(value = "updatedAt")
private Long updatedAt;
@Column(name = "`category_list`")
@ApiModelProperty(value = "分类")
private String categoryList;
@Column(name = "`sort`")
@ApiModelProperty(value = "排序")
private Integer sort;
@Column(name = "`vendor_id`")
@ApiModelProperty(value = "Android打印机需要标识设备ID ")
private String vendorId;
@Column(name = "`product_id`")
@ApiModelProperty(value = "Android打印机需要标识设备ID ")
private String productId;
public void copy(TbPrintMachine source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@@ -0,0 +1,83 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.service.shop.TbPrintMachineService;
import cn.ysk.cashier.dto.shop.PrintMachineDto;
import cn.ysk.cashier.dto.shop.TbPrintMachineQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-02-28
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/print管理")
@RequestMapping("/api/tbPrintMachine")
public class TbPrintMachineController {
private final TbPrintMachineService tbPrintMachineService;
// @Log("导出数据")
// @ApiOperation("导出数据")
// @GetMapping(value = "/download")
// public void exportTbPrintMachine(HttpServletResponse response, TbPrintMachineQueryCriteria criteria) throws IOException {
// tbPrintMachineService.download(tbPrintMachineService.queryAll(criteria), response);
// }
@GetMapping
@Log("查询/shop/print")
@ApiOperation("查询/shop/print")
public ResponseEntity<Object> queryTbPrintMachine(TbPrintMachineQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbPrintMachineService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/shop/print")
@ApiOperation("新增/shop/print")
public ResponseEntity<Object> createTbPrintMachine(@Validated @RequestBody PrintMachineDto resources){
return new ResponseEntity<>(tbPrintMachineService.create(resources),HttpStatus.CREATED);
}
@GetMapping("/{id}")
public ResponseEntity<Object> createTbPrintMachine(@PathVariable Integer id){
return new ResponseEntity<>(tbPrintMachineService.findById(id),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/print")
@ApiOperation("修改/shop/print")
public ResponseEntity<Object> updateTbPrintMachine(@Validated @RequestBody PrintMachineDto resources){
tbPrintMachineService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/print")
@ApiOperation("删除/shop/print")
public ResponseEntity<Object> deleteTbPrintMachine(@RequestBody Integer[] ids) {
tbPrintMachineService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,97 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbReceiptSales;
import cn.ysk.cashier.dto.shop.TbReceiptSalesQueryCriteria;
import cn.ysk.cashier.service.shop.TbReceiptSalesService;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-08
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/receiptSales管理")
@RequestMapping("/api/tbReceiptSales")
public class TbReceiptSalesController {
private final TbReceiptSalesService tbReceiptSalesService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbReceiptSales:list')")
public void exportTbReceiptSales(HttpServletResponse response, TbReceiptSalesQueryCriteria criteria) throws IOException {
tbReceiptSalesService.download(tbReceiptSalesService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/shop/receiptSales")
@ApiOperation("查询/shop/receiptSales")
@PreAuthorize("@el.check('tbReceiptSales:list')")
public ResponseEntity<Object> queryTbReceiptSales(TbReceiptSalesQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbReceiptSalesService.queryAll(criteria,pageable),HttpStatus.OK);
}
@GetMapping("/{shopId}")
@Log("查询/shop/receiptSales")
@ApiOperation("查询/shop/receiptSales")
@PreAuthorize("@el.check('tbReceiptSales:info')")
public Object queryTbReceiptSalesInfo(@PathVariable("shopId")Integer shopId){
return tbReceiptSalesService.findById(shopId);
}
@PostMapping
@Log("新增/shop/receiptSales")
@ApiOperation("新增/shop/receiptSales")
@PreAuthorize("@el.check('tbReceiptSales:add')")
public ResponseEntity<Object> createTbReceiptSales(@Validated @RequestBody TbReceiptSales resources){
return new ResponseEntity<>(tbReceiptSalesService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/receiptSales")
@ApiOperation("修改/shop/receiptSales")
@PreAuthorize("@el.check('tbReceiptSales:edit')")
public ResponseEntity<Object> updateTbReceiptSales(@Validated @RequestBody TbReceiptSales resources){
tbReceiptSalesService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/receiptSales")
@ApiOperation("删除/shop/receiptSales")
@PreAuthorize("@el.check('tbReceiptSales:del')")
public ResponseEntity<Object> deleteTbReceiptSales(@RequestBody Integer[] ids) {
tbReceiptSalesService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,83 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbShopArea;
import cn.ysk.cashier.service.shop.TbShopAreaService;
import cn.ysk.cashier.dto.shop.TbShopAreaQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-31
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/area管理")
@RequestMapping("/api/tbShopArea")
public class TbShopAreaController {
private final TbShopAreaService tbShopAreaService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbShopArea:list')")
public void exportTbShopArea(HttpServletResponse response, TbShopAreaQueryCriteria criteria) throws IOException {
tbShopAreaService.download(tbShopAreaService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/shop/area")
@ApiOperation("查询/shop/area")
public ResponseEntity<Object> queryTbShopArea(TbShopAreaQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbShopAreaService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/shop/area")
@ApiOperation("新增/shop/area")
public ResponseEntity<Object> createTbShopArea(@Validated @RequestBody TbShopArea resources){
return new ResponseEntity<>(tbShopAreaService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/area")
@ApiOperation("修改/shop/area")
public ResponseEntity<Object> updateTbShopArea(@Validated @RequestBody TbShopArea resources){
tbShopAreaService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/area")
@ApiOperation("删除/shop/area")
public ResponseEntity<Object> deleteTbShopArea(@RequestBody Integer[] ids) {
tbShopAreaService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,101 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbShopCashSpread;
import cn.ysk.cashier.service.shop.TbShopCashSpreadService;
import cn.ysk.cashier.dto.shop.TbShopCashSpreadQueryCriteria;
import cn.ysk.cashier.utils.StringUtils;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-05
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/spread管理")
@RequestMapping("/api/tbShopCashSpread")
public class TbShopCashSpreadController {
private final TbShopCashSpreadService tbShopCashSpreadService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbShopCashSpread:list')")
public void exportTbShopCashSpread(HttpServletResponse response, TbShopCashSpreadQueryCriteria criteria) throws IOException {
tbShopCashSpreadService.download(tbShopCashSpreadService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/shop/spread")
@ApiOperation("查询/shop/spread")
@PreAuthorize("@el.check('tbShopCashSpread:list')")
public ResponseEntity<Object> queryTbShopCashSpread(TbShopCashSpreadQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbShopCashSpreadService.queryAll(criteria,pageable),HttpStatus.OK);
}
@GetMapping("/{shopId}")
@Log("查询/shop/spread/info")
@ApiOperation("查询/shop/spread/info")
@PreAuthorize("@el.check('tbShopCashSpread:info')")
public Object queryTbShopCashSpreadInfo(@PathVariable("shopId") Integer shopId){
TbShopCashSpread byShopId = tbShopCashSpreadService.findByShopId(shopId);
String screenConfig = byShopId.getScreenConfig();
return StringUtils.stringChangeMap(screenConfig);
}
@PostMapping
@Log("新增/shop/spread")
@ApiOperation("新增/shop/spread")
@PreAuthorize("@el.check('tbShopCashSpread:add')")
public ResponseEntity<Object> createTbShopCashSpread(@Validated @RequestBody TbShopCashSpread resources){
return new ResponseEntity<>(tbShopCashSpreadService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/spread")
@ApiOperation("修改/shop/spread")
@PreAuthorize("@el.check('tbShopCashSpread:edit')")
public ResponseEntity<Object> updateTbShopCashSpread(@Validated @RequestBody TbShopCashSpread resources){
Integer update = tbShopCashSpreadService.update(resources);
if (update>0){
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
@DeleteMapping
@Log("删除/shop/spread")
@ApiOperation("删除/shop/spread")
@PreAuthorize("@el.check('tbShopCashSpread:del')")
public ResponseEntity<Object> deleteTbShopCashSpread(@RequestBody String[] ids) {
tbShopCashSpreadService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,95 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbShopCurrency;
import cn.ysk.cashier.service.shop.TbShopCurrencyService;
import cn.ysk.cashier.dto.shop.TbShopCurrencyQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-05
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/currency管理")
@RequestMapping("/api/tbShopCurrency")
public class TbShopCurrencyController {
private final TbShopCurrencyService tbShopCurrencyService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbShopCurrency:list')")
public void exportTbShopCurrency(HttpServletResponse response, TbShopCurrencyQueryCriteria criteria) throws IOException {
tbShopCurrencyService.download(tbShopCurrencyService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/shop/currency")
@ApiOperation("查询/shop/currency")
@PreAuthorize("@el.check('tbShopCurrency:list')")
public ResponseEntity<Object> queryTbShopCurrency(TbShopCurrencyQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbShopCurrencyService.queryAll(criteria,pageable),HttpStatus.OK);
}
@GetMapping("/{shopId}")
@Log("查询/shop/currency/info")
@ApiOperation("查询/shop/currency/info")
@PreAuthorize("@el.check('tbShopCurrency:info')")
public Object queryTbShopCurrencyInfo(@PathVariable("shopId") String shopId){
return tbShopCurrencyService.findByShopId(shopId);
}
@PostMapping
@Log("新增/shop/currency")
@ApiOperation("新增/shop/currency")
@PreAuthorize("@el.check('tbShopCurrency:add')")
public ResponseEntity<Object> createTbShopCurrency(@Validated @RequestBody TbShopCurrency resources){
return new ResponseEntity<>(tbShopCurrencyService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/currency")
@ApiOperation("修改/shop/currency")
@PreAuthorize("@el.check('tbShopCurrency:edit')")
public ResponseEntity<Object> updateTbShopCurrency(@Validated @RequestBody TbShopCurrency resources){
tbShopCurrencyService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/currency")
@ApiOperation("删除/shop/currency")
@PreAuthorize("@el.check('tbShopCurrency:del')")
public ResponseEntity<Object> deleteTbShopCurrency(@RequestBody Integer[] ids) {
tbShopCurrencyService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,96 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbShopInfo;
import cn.ysk.cashier.service.shop.TbShopInfoService;
import cn.ysk.cashier.dto.shop.TbShopInfoDto;
import cn.ysk.cashier.dto.shop.TbShopInfoQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2023-11-07
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/list管理")
@RequestMapping("/api/tbShopInfo")
public class TbShopInfoController {
private final TbShopInfoService tbShopInfoService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbShopInfo:list')")
public void exportTbShopInfo(HttpServletResponse response, TbShopInfoQueryCriteria criteria) throws IOException {
tbShopInfoService.download(tbShopInfoService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/shop/list")
@ApiOperation("查询/shop/list")
@PreAuthorize("@el.check('tbShopInfo:list')")
public ResponseEntity<Object> queryTbShopInfo(TbShopInfoQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbShopInfoService.queryAll(criteria,pageable),HttpStatus.OK);
}
@GetMapping("/{shopId}")
@Log("查询/shop/list")
@ApiOperation("查询/shop/list")
@PreAuthorize("@el.check('tbShopInfo:info')")
public Object queryInfo(@PathVariable("shopId") Integer shopId){
return tbShopInfoService.findById(shopId);
}
@PostMapping
@Log("新增/shop/list")
@ApiOperation("新增/shop/list")
@PreAuthorize("@el.check('tbShopInfo:add')")
public ResponseEntity<Object> createTbShopInfo(@Validated @RequestBody TbShopInfoDto resources){
return new ResponseEntity<>(tbShopInfoService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/list")
@ApiOperation("修改/shop/list")
@PreAuthorize("@el.check('tbShopInfo:edit')")
public ResponseEntity<Object> updateTbShopInfo(@Validated @RequestBody TbShopInfo resources){
tbShopInfoService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/list")
@ApiOperation("删除/shop/list")
@PreAuthorize("@el.check('tbShopInfo:del')")
public ResponseEntity<Object> deleteTbShopInfo(@RequestBody Integer[] ids) {
tbShopInfoService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,83 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbShopPurveyor;
import cn.ysk.cashier.service.shop.TbShopPurveyorService;
import cn.ysk.cashier.dto.shop.TbShopPurveyorQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-22
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/purveyor管理")
@RequestMapping("/api/tbShopPurveyor")
public class TbShopPurveyorController {
private final TbShopPurveyorService tbShopPurveyorService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbShopPurveyor:list')")
public void exportTbShopPurveyor(HttpServletResponse response, TbShopPurveyorQueryCriteria criteria) throws IOException {
tbShopPurveyorService.download(tbShopPurveyorService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/shop/purveyor")
@ApiOperation("查询/shop/purveyor")
public ResponseEntity<Object> queryTbShopPurveyor(TbShopPurveyorQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbShopPurveyorService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/shop/purveyor")
@ApiOperation("新增/shop/purveyor")
public ResponseEntity<Object> createTbShopPurveyor(@Validated @RequestBody TbShopPurveyor resources){
return new ResponseEntity<>(tbShopPurveyorService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/purveyor")
@ApiOperation("修改/shop/purveyor")
public ResponseEntity<Object> updateTbShopPurveyor(@Validated @RequestBody TbShopPurveyor resources){
tbShopPurveyorService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/purveyor")
@ApiOperation("删除/shop/purveyor")
public ResponseEntity<Object> deleteTbShopPurveyor(@RequestBody Integer[] ids) {
tbShopPurveyorService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,110 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbShopPurveyorTransact;
import cn.ysk.cashier.service.shop.TbShopPurveyorTransactService;
import cn.ysk.cashier.dto.shop.TbShopPurveyorTransactQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-23
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/purveyorTransact管理")
@RequestMapping("/api/tbShopPurveyorTransact")
public class TbShopPurveyorTransactController {
private final TbShopPurveyorTransactService tbShopPurveyorTransactService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbShopPurveyorTransact:list')")
public void exportTbShopPurveyorTransact(HttpServletResponse response, TbShopPurveyorTransactQueryCriteria criteria) throws IOException {
tbShopPurveyorTransactService.download(tbShopPurveyorTransactService.queryAll(criteria), response);
}
/**
* 进货账目
* @param criteria
* @param pageable
* @return
*/
@GetMapping
@Log("查询/shop/purveyorTransact")
@ApiOperation("查询/shop/purveyorTransact")
public ResponseEntity<Object> queryTbShopPurveyorTransactSum(TbShopPurveyorTransactQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbShopPurveyorTransactService.queryTransactDate(criteria,pageable),HttpStatus.OK);
}
/**
* 进货账目详情
* @param criteria
* @return
*/
@PostMapping("/info")
@Log("查询/shop/purveyorTransact")
public ResponseEntity<Object> queryPurveyorTransact(@RequestBody TbShopPurveyorTransactQueryCriteria criteria){
return new ResponseEntity<>(tbShopPurveyorTransactService.queryPurveyorTransact(criteria),HttpStatus.OK);
}
/**
* 汇总
* @param criteria
* @return
*/
@GetMapping("/sum")
public ResponseEntity<Object> queryTransactSum( TbShopPurveyorTransactQueryCriteria criteria){
return new ResponseEntity<>(tbShopPurveyorTransactService.queryTransactSum(criteria),HttpStatus.OK);
}
@PostMapping
@Log("新增/shop/purveyorTransact")
@ApiOperation("新增/shop/purveyorTransact")
public ResponseEntity<Object> createTbShopPurveyorTransact(@Validated @RequestBody TbShopPurveyorTransact resources){
return new ResponseEntity<>(tbShopPurveyorTransactService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/purveyorTransact")
@ApiOperation("修改/shop/purveyorTransact")
public ResponseEntity<Object> updateTbShopPurveyorTransact(@Validated @RequestBody TbShopPurveyorTransact resources){
tbShopPurveyorTransactService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/purveyorTransact")
@ApiOperation("删除/shop/purveyorTransact")
public ResponseEntity<Object> deleteTbShopPurveyorTransact(@RequestBody Integer[] ids) {
tbShopPurveyorTransactService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,89 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbShopTable;
import cn.ysk.cashier.service.shop.TbShopTableService;
import cn.ysk.cashier.dto.shop.TbShopTableQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-18
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/table管理")
@RequestMapping("/api/tbShopTable")
public class TbShopTableController {
private final TbShopTableService tbShopTableService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbShopTable:list')")
public void exportTbShopTable(HttpServletResponse response, TbShopTableQueryCriteria criteria) throws IOException {
tbShopTableService.download(tbShopTableService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/shop/table")
@ApiOperation("查询/shop/table")
public ResponseEntity<Object> queryTbShopTable(TbShopTableQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbShopTableService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/shop/table")
@ApiOperation("新增/shop/table")
public ResponseEntity<Object> createTbShopTable(@Validated @RequestBody TbShopTable resources){
return new ResponseEntity<>(tbShopTableService.create(resources),HttpStatus.CREATED);
}
@PostMapping("/qrcode")
public ResponseEntity<Object> bindingQRcode(@RequestBody TbShopTable resources){
tbShopTableService.binding(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PutMapping
@Log("修改/shop/table")
@ApiOperation("修改/shop/table")
public ResponseEntity<Object> updateTbShopTable(@Validated @RequestBody TbShopTable resources){
tbShopTableService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/table")
@ApiOperation("删除/shop/table")
public ResponseEntity<Object> deleteTbShopTable(@RequestBody Integer[] ids) {
tbShopTableService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,83 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbShopUnit;
import cn.ysk.cashier.service.shop.TbShopUnitService;
import cn.ysk.cashier.dto.shop.TbShopUnitQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-02
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/unit管理")
@RequestMapping("/api/tbShopUnit")
public class TbShopUnitController {
private final TbShopUnitService tbShopUnitService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbShopUnit:list')")
public void exportTbShopUnit(HttpServletResponse response, TbShopUnitQueryCriteria criteria) throws IOException {
tbShopUnitService.download(tbShopUnitService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/shop/unit")
@ApiOperation("查询/shop/unit")
public ResponseEntity<Object> queryTbShopUnit(TbShopUnitQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbShopUnitService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/shop/unit")
@ApiOperation("新增/shop/unit")
public ResponseEntity<Object> createTbShopUnit(@Validated @RequestBody TbShopUnit resources)throws Exception{
return new ResponseEntity<>(tbShopUnitService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/unit")
@ApiOperation("修改/shop/unit")
public ResponseEntity<Object> updateTbShopUnit(@Validated @RequestBody TbShopUnit resources){
tbShopUnitService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/unit")
@ApiOperation("删除/shop/unit")
public ResponseEntity<Object> deleteTbShopUnit(@RequestBody Integer[] ids) {
tbShopUnitService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.service.shop.TbShopUserService;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-01
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/user管理")
@RequestMapping("/api/tbShopUser")
public class TbShopUserController {
private final TbShopUserService tbShopUserService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
@PreAuthorize("@el.check('tbShopUser:list')")
public void exportTbShopUser(HttpServletResponse response, TbShopUserQueryCriteria criteria) throws IOException {
tbShopUserService.download(tbShopUserService.queryAll(criteria), response);
}
@GetMapping
@Log("查询/shop/user")
@ApiOperation("查询/shop/user")
@PreAuthorize("@el.check('tbShopUser:list')")
public ResponseEntity<Object> queryTbShopUser(TbShopUserQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbShopUserService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增/shop/user")
@ApiOperation("新增/shop/user")
@PreAuthorize("@el.check('tbShopUser:add')")
public ResponseEntity<Object> createTbShopUser(@Validated @RequestBody TbShopUser resources){
return new ResponseEntity<>(tbShopUserService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改/shop/user")
@ApiOperation("修改/shop/user")
@PreAuthorize("@el.check('tbShopUser:edit')")
public ResponseEntity<Object> updateTbShopUser(@Validated @RequestBody TbShopUser resources){
tbShopUserService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除/shop/user")
@ApiOperation("删除/shop/user")
@PreAuthorize("@el.check('tbShopUser:del')")
public ResponseEntity<Object> deleteTbShopUser(@RequestBody Integer[] ids) {
tbShopUserService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author admin
* @date 2023-10-31
**/
@Data
public class BotButtonConfigDto implements Serializable {
private Integer id;
/** 按钮名称 */
private String buttonName;
/** 按钮值 */
private String buttonValue;
}

View File

@@ -0,0 +1,32 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author admin
* @date 2023-10-31
**/
@Data
public class BotButtonConfigQueryCriteria{
/** 精确 */
@Query
private String buttonName;
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author admin
* @date 2023-10-31
**/
@Data
public class BotConfigDto implements Serializable {
private Integer id;
/** 元素键值 */
private String configKey;
/** 元素值 */
private String configValue;
/** 描述 */
private String remark;
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author admin
* @date 2023-10-31
**/
@Data
public class BotConfigQueryCriteria{
/** 精确 */
@Query
private String configKey;
/** 精确 */
@Query
private String configValue;
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author admin
* @date 2023-10-30
**/
@Data
public class BotUserDto implements Serializable {
private Integer id;
private Integer fatherId;
/** 父级电报号 */
private String fatherTelegramId;
/** 电报号 */
private String userTelegramId;
/** 用户名称 */
private String userName;
/** 组电报号 */
private String groupTelegramId;
/** 用户代码 */
private String userCode;
private String userPayPass;
private String bombStatus;
/** 用户状态 */
private String botStatus;
/** 总充值 */
private BigDecimal usdtRechargeTotal;
/** 总提现 */
private BigDecimal usdtWithdrawTotal;
/** 总资金 */
private BigDecimal balance;
/** 冻结资金 */
private BigDecimal freezeBalance;
/** 版本号 */
private Integer version;
/** 创建时间 */
private Timestamp createTime;
/** 更新时间 */
private Timestamp updateTime;
/** 语言 */
private String userLanguage;
/** 质押资金 */
private BigDecimal chipBalance;
/** 绑定时间 */
private Timestamp fatherBindTime;
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author admin
* @date 2023-10-30
**/
@Data
public class BotUserFlowDto implements Serializable {
private Integer id;
/** 电报号 */
private String userTelegramId;
/** 用户名称 */
private String userName;
/** 业务代码 */
private String bizCode;
/** 变动金额 */
private BigDecimal amount;
/** 变动前金额 */
private BigDecimal oldBalance;
/** 变动后金额 */
private BigDecimal newBalance;
/** 创建时间 */
private Timestamp createTime;
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author admin
* @date 2023-10-30
**/
@Data
public class BotUserFlowQueryCriteria{
/** 精确 */
@Query
private String userTelegramId;
/** 精确 */
@Query
private String userName;
/** 精确 */
@Query
private String bizCode;
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author admin
* @date 2023-10-30
**/
@Data
public class BotUserQueryCriteria{
/** 精确 */
@Query
private String fatherTelegramId;
/** 精确 */
@Query
private String userTelegramId;
/** 精确 */
@Query
private String userName;
/** 精确 */
@Query
private String userCode;
/** 精确 */
@Query
private String botStatus;
}

View File

@@ -0,0 +1,70 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2023-11-07
**/
@Data
public class TbRenewalsPayLogDto implements Serializable {
/** id */
private Integer id;
/** 支付方式 */
private String payType;
/** 店铺Id */
private String shopId;
/** 订单Id */
private String orderId;
private String openId;
/** 用户Id */
private String userId;
/** 交易单号(第三方交易单号) */
private String transactionId;
/** 金额 */
private BigDecimal amount;
/** 状态 */
private Integer status;
/** 备注 */
private String remark;
/** 用户自定义参数 */
private String attach;
/** 到期时间 */
private Long expiredAt;
/** 创建时间 */
private Long createdAt;
private Long updatedAt;
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import java.math.BigDecimal;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2023-11-07
**/
@Data
public class TbRenewalsPayLogQueryCriteria{
/** 精确 */
@Query
private Integer id;
/** 精确 */
@Query
private String payType;
/** 精确 */
@Query
private String shopId;
/** 精确 */
@Query
private String transactionId;
/** 精确 */
@Query
private BigDecimal amount;
/** 精确 */
@Query
private Integer status;
/** 精确 */
@Query
private String remark;
/** 精确 */
@Query
private Long expiredAt;
/** 精确 */
@Query
private Long createdAt;
}

View File

@@ -0,0 +1,70 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2023-11-03
**/
@Data
public class TbShopPayTypeDto implements Serializable {
/** 自增id */
private Integer id;
/** 支付类型cash,alipay,weixin,deposit,arrears,virtual,member-account */
private String payType;
/** 支付类型名称支付类型名称现金支付宝刷卡deposit挂单arrears储值member-account自定义virtual */
private String payName;
/** 是否快捷展示1是0否 */
private Integer isShowShortcut;
/** 店铺id */
private String shopId;
/** 0允许退款 1-不允许退款 */
private Integer isRefundable;
/** 是否打开钱箱 */
private Integer isOpenCashDrawer;
/** 0不是 1是 [系统级支付] */
private Integer isSystem;
/** 0-非虚拟 1虚拟 virtual */
private Integer isIdeal;
/** 0-不显示1显示 */
private Integer isDisplay;
private Long createdAt;
private Long updatedAt;
/** 排序 */
private Integer sorts;
/**
* 图标
*/
private String icon;
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2023-11-03
**/
@Data
public class TbShopPayTypeQueryCriteria{
/** 精确 */
@Query
private Integer id;
/** 精确 */
@Query
private String payType;
/** 精确 */
@Query
private String payName;
/** 精确 */
@Query
private Integer isShowShortcut;
/** 精确 */
@Query
private String shopId;
/** 精确 */
@Query
private Integer isOpenCashDrawer;
/** 精确 */
@Query
private Long createdAt;
/** 精确 */
@Query
private Integer sorts;
}

View File

@@ -0,0 +1,156 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2023-11-13
**/
@Data
public class TbUserInfoDto implements Serializable {
/** id */
private Integer id;
/** 钱包余额 */
private BigDecimal amount;
/** 累计充值 */
private BigDecimal chargeAmount;
/** 授信额度 */
private BigDecimal lineOfCredit;
private BigDecimal consumeAmount;
/** 消费次数累计 */
private Integer consumeNumber;
/** 总积分 */
private Integer totalScore;
/** 锁定积分 */
private Integer lockScore;
/** 会员卡号 */
private String cardNo;
/** 会员密码 */
private String cardPassword;
/** 等级 */
private String levelId;
/** 用户头像 */
private String headImg;
/** 用户昵称 */
private String nickName;
/** 电话号码 */
private String telephone;
/** 小程序Id */
private String wxMaAppId;
/** 会员生日 */
private String birthDay;
/** 0-女 1男 */
private Integer sex;
/** 小程序的openId */
private String miniAppOpenId;
/** 公众号openId */
private String openId;
/** 联合Id */
private String unionId;
/** 用户编号 */
private String code;
/** 用户类型-保留字段 */
private String type;
/** 'DOCTOR'-->医生,'USER'->用户 */
private Integer identify;
/** 1正常 */
private Integer status;
/** 引荐人 */
private String parentId;
private String parentLevel;
/** 上家类开型,店铺-SHOP/ 个人- PERSON */
private String parentType;
/** 关注进入的活动Id */
private String projectId;
/** 商户Id */
private String merchantId;
/** 0未认证1认证 */
private Integer isResource;
/** 是否在线 */
private Integer isOnline;
private Integer isVip;
private Integer vipEffectAt;
private String tips;
/** 用户来源:公众号 WECHAT 小程序 WECHAT-APP 手机注册 TELEPHONE */
private String sourcePath;
/** 是否推广员 1 是 0不是 */
private Integer isSalesPerson;
/** 是否关注公众号 */
private Integer isAttentionMp;
/** 城市 */
private String city;
private String searchWord;
/** 最近登陆时间 */
private Long lastLogInAt;
private Long lastLeaveAt;
private Long createdAt;
private Long updatedAt;
/** 绑定时间 */
private Long bindParentAt;
/** 上上家 */
private String grandParentId;
}

View File

@@ -0,0 +1,61 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto;
import lombok.Data;
import java.math.BigDecimal;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2023-11-13
**/
@Data
public class TbUserInfoQueryCriteria{
/** 精确 */
@Query
private Integer id;
/** 精确 */
@Query
private BigDecimal amount;
/** 精确 */
@Query
private String levelId;
/** 精确 */
@Query
private String headImg;
/** 精确 */
@Query
private String nickName;
/** 精确 */
@Query
private String telephone;
/** 精确 */
@Query
private Long lastLogInAt;
@Query
private String shopId;
}

View File

@@ -0,0 +1,108 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.order;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-03-02
**/
@Data
public class TbCashierCartDto implements Serializable {
/** id */
private Integer id;
/** 主单Id */
private String masterId;
/** 本次下单Id */
private Integer orderId;
/** 退单Id */
private Integer refOrderId;
/** 购物车总额 */
private BigDecimal totalAmount;
/** 商品Id */
private String productId;
/** 商品图片 */
private String coverImg;
/** 是否sku */
private String isSku;
/** skuId */
private String skuId;
/** 商品名 */
private String name;
/** 单价 */
private BigDecimal salePrice;
/** 结余数量 */
private Integer number;
/** 总下单数量 */
private Integer totalNumber;
/** 退单数量 */
private Integer refundNumber;
/** 分类Id */
private String categoryId;
/** '购物车关闭 closed',' 购物车挂起 refund',' 购物车列表生效create',' 购物车完成final' */
private String status;
/** 是否为组合商品 0-单商品 1为组合商品 */
private Integer type;
/** 商户Id */
private String merchantId;
/** 店铺Id */
private String shopId;
private Long createdAt;
private Long updatedAt;
/** 用户的openId */
private Integer userId;
/** 台桌id */
private Integer tableId;
/** 打包费 */
private BigDecimal packFee;
private String tradeDay;
private String isPack;
private String isGift;
private Long pendingAt;
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.order;
import lombok.Data;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-02
**/
@Data
public class TbCashierCartQueryCriteria{
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.order;
import lombok.Data;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-03-02
**/
@Data
public class TbOrderDetailDto implements Serializable {
private Integer id;
private Integer orderId;
private Integer shopId;
private Integer productId;
private Integer productSkuId;
private Integer num;
private String productName;
private String productSkuName;
private String productImg;
private Timestamp createTime;
private Timestamp updateTime;
private BigDecimal price;
private BigDecimal priceAmount;
private String status;
/** 打包费 */
private BigDecimal packAmount;
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.order;
import lombok.Data;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-02
**/
@Data
public class TbOrderDetailQueryCriteria{
}

View File

@@ -0,0 +1,158 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.order;
import lombok.Data;
import cn.ysk.cashier.pojo.order.TbCashierCart;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.List;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-03-02
**/
@Data
public class TbOrderInfoDto implements Serializable {
private Integer id;
/** 订单编号 */
private String orderNo;
/** 商户结算金额 */
private BigDecimal settlementAmount;
/** 包装费 */
private BigDecimal packFee;
/** 订单原金额 */
private BigDecimal originAmount;
/** 商品售价 */
private BigDecimal productAmount;
/** 最终金额---退单后,金额变动 */
private BigDecimal amount;
/** 退单金额 */
private BigDecimal refundAmount;
/** 支付金额 */
private BigDecimal payAmount;
/** 订单邮递费用 */
private BigDecimal freightAmount;
/** 折扣金额 */
private BigDecimal discountAmount;
/** 台桌Id */
private String tableId;
/** 订单抹零 */
private BigDecimal smallChange;
/** 发货类型 */
private String sendType;
/** 订单类型-cash收银-miniapp小程序-offline线下 */
private String orderType;
/** 订单里面商品的类型 */
private String productType;
/** 状态: unpaid 待支付unsend待发货 closed 订单完成 send 已发refunding申请退单refund退单cancelled取消订单merge合台 */
private String status;
/** orderType为union-minor时parentId生效为其上级合单id */
private String billingId;
/** 对于平台订单,是收款商户Id */
private String merchantId;
/** 店铺Id */
private String shopId;
/** 是否vip订单 */
private Integer isVip;
/** 商户会员Id */
private String memberId;
/** 用户Id */
private String userId;
/** 该订单商品赠送的积分 */
private Integer productScore;
/** 抵扣积分 */
private Integer deductScore;
/** 用户使用的卡券 */
private String userCouponId;
/** 优惠券抵扣金额 */
private BigDecimal userCouponAmount;
/** 如果为退单时,主单号 */
private String masterId;
/** 是否支持退款1支持退单 0不支持退单 */
private Integer refundAble;
/** 支付时间 */
private Long paidTime;
/** 是否生效,若订单合单之后,则原订单不会生效 */
private Integer isEffect;
/** 是否合台 */
private Integer isGroup;
private Long updatedAt;
/** 系统时间 */
private Long systemTime;
private Long createdAt;
/** 收银台是否已接单 */
private Integer isAccepted;
/** 支付类型 */
private String payType;
/** 订单金额 */
private BigDecimal orderAmount;
/** 折扣比例 */
private BigDecimal discountRatio;
/** 支付订单号 */
private String payOrderNo;
private String tradeDay;
private Integer source;
private String remark;
private List<TbCashierCart> cartList;
}

View File

@@ -0,0 +1,78 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.order;
import lombok.Data;
import java.math.BigDecimal;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-02
**/
@Data
public class TbOrderInfoQueryCriteria{
/** 精确 */
@Query
private Integer id;
/** 精确 */
@Query
private String orderNo;
/** 精确 */
@Query
private BigDecimal productAmount;
/** 精确 */
@Query
private BigDecimal payAmount;
/** 精确 */
@Query
private String sendType;
/** 精确 */
@Query
private String status;
/** 精确 */
@Query
private String shopId;
/** 精确 */
@Query
private String memberId;
/** 精确 */
@Query
private String userId;
/** 精确 */
@Query
private Long paidTime;
/** 精确 */
@Query
private Long createdAt;
/** 精确 */
@Query
private Integer isAccepted;
}

View File

@@ -0,0 +1,145 @@
package cn.ysk.cashier.dto.product;
import lombok.Data;
import lombok.NonNull;
import java.math.BigDecimal;
import java.util.List;
/**
* @author 出库入库Dto
*/
public class OutAndOnDto {
/**
* 批号
*/
private String batchNumber;
/**
* 商品list
*/
private List<Object> list;
/**
* 实收金额
*/
private BigDecimal paidAmount;
/**
* 实收时间
*/
private Long paidAt;
/**
* 供货商id
*/
private String purveyorId;
/**
* 供货商名称
*/
private String purveyorName;
/**
* 备注
*/
private String remark;
/**
* 出库时间
*/
private Long time;
/**
* 应收金额
*/
private BigDecimal totalAmount;
@NonNull
private String type;
@NonNull
private String shopId;
public String getBatchNumber() {
return batchNumber;
}
public void setBatchNumber(String batchNumber) {
this.batchNumber = batchNumber;
}
public List<Object> getList() {
return list;
}
public void setList(List<Object> list) {
this.list = list;
}
public BigDecimal getPaidAmount() {
return paidAmount;
}
public void setPaidAmount(BigDecimal paidAmount) {
this.paidAmount = paidAmount;
}
public Long getPaidAt() {
return paidAt;
}
public void setPaidAt(Long paidAt) {
this.paidAt = paidAt;
}
public String getPurveyorId() {
return purveyorId;
}
public void setPurveyorId(String purveyorId) {
this.purveyorId = purveyorId;
}
public String getPurveyorName() {
return purveyorName;
}
public void setPurveyorName(String purveyorName) {
this.purveyorName = purveyorName;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Long getTime() {
return time;
}
public void setTime(Long time) {
this.time = time;
}
public BigDecimal getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getShopId() {
return shopId;
}
public void setShopId(String shopId) {
this.shopId = shopId;
}
}

View File

@@ -0,0 +1,50 @@
package cn.ysk.cashier.dto.product;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author lyf
*/
@Data
public class ProductListDto {
/**
* sku id
*/
private Integer id;
/**
* 进价
*/
private BigDecimal guidePrice;
/**
* 产品id
*/
private String productId;
/**
* 数量
*/
private Integer number;
private BigDecimal costPrice;
private String name;
/**
*
*/
private BigDecimal totalAmount;
/**
* 单位
*/
private String unitName;
/**
*规格
*/
private String specSnap;
}

View File

@@ -0,0 +1,22 @@
package cn.ysk.cashier.dto.product;
import lombok.Data;
import java.util.List;
/**
* @author lyf
*/
@Data
public class SpecDto {
/**
* 规格名称
*/
private String name;
/**
* shopId
*/
private String shopId;
private List<String> specList;
}

View File

@@ -0,0 +1,220 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.product;
import lombok.Data;
import cn.ysk.cashier.pojo.product.TbProductSku;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.List;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2023-12-11
**/
@Data
public class TbProductDto implements Serializable {
/** id */
private Integer id;
/** 商品来源 NORMAL普通商品 --,SCORE积分商品 */
private String sourcePath;
/** 商户Id */
private String merchantId;
/** 店铺id */
private String shopId;
/** 商品名称 */
private String name;
/** 商品类型(属性):REAL- 实物商品 VIR---虚拟商品 */
private String type;
/** 包装费 */
private BigDecimal packFee;
/** 商品最低价 */
private BigDecimal lowPrice;
/** 单位Id */
private String unitId;
/** 商品封面图 */
private String coverImg;
private String categoryId;
/** 商品规格 */
private Integer specId;
/** 品牌Id */
private Integer brandId;
/** 短标题--促销语 */
private String shortTitle;
private BigDecimal lowMemberPrice;
/** 单位镜像 */
private String unitSnap;
/** 商品分享图 */
private String shareImg;
/** 商品图片(第一张为缩略图,其他为详情) */
private String images;
/** 商品视频URL地址 */
private String video;
/** 视频封面图 */
private String videoCoverImg;
/** 排序 */
private Integer sort;
/** 0-不限购 */
private Integer limitNumber;
/** 商品赚送积分 */
private Integer productScore;
/** 0--待审核 1审核通过 -1审核失败 -2违规下架 */
private Integer status;
/** 审核失败原因 */
private String failMsg;
/** 是否推荐,店铺推荐展示 */
private Integer isRecommend;
/** 是否热销 */
private Integer isHot;
/** 是否新品 */
private Integer isNew;
/** 是否促销1-是0-否 */
private Integer isOnSale;
/** 是否展示0-下架 1上架---废弃 */
private Integer isShow;
/** 商品规格0-单规格 1多规格 */
private String typeEnum;
/** 是否独立分销 */
private Integer isDistribute;
/** 是否回收站 0-否1回收站 */
private Integer isDel;
/** 是否开启库存 */
private Integer isStock;
/** 是否暂停销售 */
private Integer isPauseSale;
/** 是否免邮1-是 0-否 */
private Integer isFreeFreight;
/** 邮费模版 */
private Long freightId;
/** 商品当前生效策略 */
private String strategyType;
/** 策略Id */
private Integer strategyId;
/** vip专属 */
private Integer isVip;
/** 是否删除 */
private Integer isDelete;
/** 购买须知 */
private String notice;
private Long createdAt;
private Long updatedAt;
/** 基础出售数量 */
private Double baseSalesNumber;
/** 实际销量 */
private Integer realSalesNumber;
/** 合计销量 */
private Integer salesNumber;
/** 点赞次数 */
private Integer thumbCount;
/** 收藏次数 */
private Integer storeCount;
/** 支持堂食 */
private Integer furnishMeal;
/** 支持配送 */
private Integer furnishExpress;
/** 支持自提 */
private Integer furnishDraw;
/** 支持虚拟 */
private Integer furnishVir;
/** 是否套餐 */
private Integer isCombo;
/** 套餐内容 */
private String groupSnap;
private Integer isShowCash;
private Integer isShowMall;
/** 是否需要审核 */
private Integer isNeedExamine;
/** 线上商城展示状态0待审核 -1 异常 1正常 */
private Integer showOnMallStatus;
/** 提交审核时间 */
private Long showOnMallTime;
/** 线上商城展示失败原因 */
private String showOnMallErrorMsg;
/** 使用标签打印 选择 是 并在 前台>本机设置 勾选打印标签后,收银完成后会自动打印对应数量的标签数 */
private Integer enableLabel;
/** 税率 */
private String taxConfigId;
/**
* 商品sku信息
*/
private List<TbProductSku> skuList;
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.product;
import lombok.Data;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2023-12-16
**/
@Data
public class TbProductGroupDto implements Serializable {
/** id */
private Integer id;
/** 分组名称 */
private String name;
/** 商户Id */
private String merchantId;
/** 店铺Id */
private Integer shopId;
/** 图标 */
private String pic;
/** 是否显示 */
private Integer isShow;
/** 分类描述 */
private String detail;
private String style;
/** 排序 */
private Integer sort;
/** 商品列表 */
private String productIds;
private Long createdAt;
private Long updatedAt;
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.product;
import lombok.Data;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2023-12-16
**/
@Data
public class TbProductGroupQueryCriteria{
@Query
private Integer shopId;
@Query
private String name;
}

View File

@@ -0,0 +1,124 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.product;
import lombok.Data;
import java.math.BigDecimal;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2023-12-11
**/
@Data
public class TbProductQueryCriteria{
/** 精确 */
@Query
private Integer id;
/** 精确 */
@Query
private String shopId;
/** 精确 */
@Query
private String name;
@Query
private String categoryId;
/** 精确 */
@Query
private BigDecimal packFee;
/** 精确 */
@Query
private BigDecimal lowPrice;
/** 精确 */
@Query
private String unitId;
/** 精确 */
@Query
private String coverImg;
/** 精确 */
@Query
private Integer specId;
/** 精确 */
@Query
private Integer brandId;
/** 精确 */
@Query
private String images;
/** 精确 */
@Query
private String videoCoverImg;
/** 精确 */
@Query
private Integer status;
/** 精确 */
@Query
private Integer isDel;
/** 精确 */
@Query
private Integer isFreeFreight;
/** 精确 */
@Query
private Integer isDelete;
/** 精确 */
@Query
private Double baseSalesNumber;
/** 精确 */
@Query
private Integer realSalesNumber;
/** 精确 */
@Query
private Integer salesNumber;
/** 精确 */
@Query
private Integer thumbCount;
/** 精确 */
@Query
private Integer storeCount;
/** 精确 */
@Query
private Integer furnishMeal;
/** 精确 */
@Query
private Integer furnishExpress;
@Query
private String typeEnum;
}

View File

@@ -0,0 +1,88 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.product;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-01-03
**/
@Data
public class TbProductSkuDto implements Serializable {
/** 自增id */
private Integer id;
private String shopId;
/** 条形码 */
private String barCode;
/** 商品Id */
private String productId;
/** 原价 */
private BigDecimal originPrice;
/** 成本价 */
private BigDecimal costPrice;
/** 会员价 */
private BigDecimal memberPrice;
private BigDecimal mealPrice;
/** 售价 */
private BigDecimal salePrice;
/** 进货参考价 */
private BigDecimal guidePrice;
private BigDecimal strategyPrice;
/** 库存数量 */
private Double stockNumber;
/** 标签镜像 */
private String specSnap;
private String coverImg;
/** 库存警戒线 */
private Integer warnLine;
private Double weight;
private Float volume;
/** 销量 */
private Double realSalesNumber;
/** 一级分销金额 */
private BigDecimal firstShared;
/** 二级分销金额 */
private BigDecimal secondShared;
private Long createdAt;
private Long updatedAt;
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.product;
import lombok.Data;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-03
**/
@Data
public class TbProductSkuQueryCriteria{
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.product;
import lombok.Data;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-02-08
**/
@Data
public class TbProductSkuResultDto implements Serializable {
/** 商品Id */
private Integer id;
/** 商户Id */
private String merchantId;
/** 规格id */
private Long specId;
/** 标签列表,包括名称,显示 */
private String tagSnap;
private Long createdAt;
private Long updatedAt;
}

View File

@@ -0,0 +1,32 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.product;
import lombok.Data;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-02-08
**/
@Data
public class TbProductSkuResultQueryCriteria{
/** 精确 */
@Query
private Integer id;
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.product;
import lombok.Data;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-01-03
**/
@Data
public class TbProductSpecDto implements Serializable {
/** id */
private Integer id;
private String shopId;
/** 商品属性名称 */
private String name;
/** 规格属性 */
private String specTag;
/** 属性介绍 */
private String specTagDetail;
private String specList;
/** 排序 */
private Integer sort;
private Long createdAt;
private Long updatedAt;
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.product;
import lombok.Data;
import cn.ysk.cashier.annotation.Query;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-01-03
**/
@Data
public class TbProductSpecQueryCriteria{
/**
* shopId
*/
@Query
private String shopId;
}

View File

@@ -0,0 +1,104 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.dto.product;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-01-19
**/
@Data
public class TbProductStockDetailDto implements Serializable {
private Long id;
/** skuId */
private String skuId;
/** 商品Id */
private String productId;
/** 商品名称 */
private String productName;
/** 是否开启库存 */
private Integer isStock;
/** 规格 */
private String specSnap;
/** 商品单位 */
private String unitName;
/** 店铺Id */
private String shopId;
private String recordId;
/** 操作批次号 */
private String batchNumber;
/** 库存操作来源:收银端调用 CASHIER 系统后台调用SHOP */
private String sourcePath;
/** 关联订单Id */
private String orderId;
/** 1入库 -1出库 */
private Integer subType;
/** purchase采购入库 transfer调拔入库
stockpile存酒入库
2盘点入库3退货入库4期初5生产归还入库6内部令用归还7借出归还8其它入库9调拔出库sale销售出库11盘点出库12锁定13生产领料14内部领用15借用出库16其它出库17报废出库 */
private String type;
/** 上次剩余数量 */
private Integer leftNumber;
/** 出入库时间 */
private Long stockTime;
/** 本次操作库存数量 */
private Double stockNumber;
/** 入库合计成本金额 */
private BigDecimal costAmount;
/** 出售合计金额 */
private BigDecimal salesAmount;
/** 操作人 */
private String operator;
/** 备注 */
private String remark;
/** 库存镜像 */
private String stockSnap;
private String barCode;
private String coverImg;
private Long createdAt;
private Long updatedAt;
}

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