店员管理/店员等级/账户管理

This commit is contained in:
starrySky
2024-03-31 13:52:29 +08:00
parent ccaa00990f
commit c7f81acbe5
125 changed files with 2670 additions and 1033 deletions

View File

@@ -6,7 +6,6 @@ import com.starry.admin.utils.SecurityUtils;
import com.starry.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.NullValue;
import net.sf.jsqlparser.expression.StringValue;
import org.springframework.stereotype.Component;
@@ -35,9 +34,6 @@ public class MyTenantLineHandler implements TenantLineHandler {
public Expression getTenantId() {
// 取出当前请求的服务商ID通过解析器注入到SQL中。
String tenantId = SecurityUtils.getTenantId();
if (StrUtil.isBlankIfStr(tenantId)) {
return new NullValue();
}
if (StrUtil.isBlankIfStr(tenantId)) {
tenantId = "9999";
}
@@ -50,9 +46,6 @@ public class MyTenantLineHandler implements TenantLineHandler {
@Override
public boolean ignoreTable(String tableName) {
String prefix = StringUtils.substringBefore(tableName, "_");
if (Arrays.asList(TABLE_FILTER).contains(tableName) || Arrays.asList(TABLE_PRE).contains(prefix)) {
return true;
}
return false;
return Arrays.asList(TABLE_FILTER).contains(tableName) || Arrays.asList(TABLE_PRE).contains(prefix);
}
}

View File

@@ -12,17 +12,14 @@ import org.springframework.context.annotation.PropertySource;
@PropertySource(value = {"classpath:oss.properties"})
public class OssProperties implements InitializingBean {
public String endpoint;
public String accessKeyId;
public String accessKeySecret;
public String bucketName;
public static String ENDPOINT = "";
public static String KEY_ID = "";
public static String KEY_SECRET = "";
public static String BUCKET_NAME = "";
public String endpoint;
public String accessKeyId;
public String accessKeySecret;
public String bucketName;
@Override
public void afterPropertiesSet() throws Exception {

View File

@@ -30,29 +30,29 @@ public class OssFileServiceImpl implements IOssFileService {
OSS ossClient = new OSSClientBuilder().build(OssProperties.ENDPOINT, OssProperties.KEY_ID, OssProperties.KEY_SECRET);
log.info("OSSClient实例创建成功");
try {
//判断oss实例是否存在如果不存在则创建如果存在则获取
// 判断oss实例是否存在如果不存在则创建如果存在则获取
if (!ossClient.doesBucketExist(OssProperties.BUCKET_NAME)) {
//创建bucket
// 创建bucket
ossClient.createBucket(OssProperties.BUCKET_NAME);
log.info("bucket存储空间【{}】创建成功", OssProperties.BUCKET_NAME);
//设置oss实例的访问权限公共读
// 设置oss实例的访问权限公共读
ossClient.setBucketAcl(OssProperties.BUCKET_NAME, CannedAccessControlList.PublicRead);
log.info("【{}】存储空间访问权限设置为公共读成功", OssProperties.BUCKET_NAME);
}
//构建日期路径avatar/2019/02/26/文件名
// 构建日期路径avatar/2019/02/26/文件名
String folder = new DateTime().toString("yyyy/MM/dd");
//文件名uuid.扩展名
// 文件名uuid.扩展名
filename = IdUtil.fastSimpleUUID() + FileTypeUtil.getType(inputStream);
//文件根路径
// 文件根路径
String key = module + "/" + folder + "/" + filename;
// 创建PutObjectRequest对象。
PutObjectRequest putObjectRequest = new PutObjectRequest(OssProperties.BUCKET_NAME, key, inputStream);
// 创建PutObject请求。
ossClient.putObject(putObjectRequest);
log.info("oss文件上传成功");
//阿里云文件绝对路径
// 阿里云文件绝对路径
String endpoint = OssProperties.ENDPOINT.substring(OssProperties.ENDPOINT.lastIndexOf("//") + 2);
//返回文件的访问路径
// 返回文件的访问路径
return "https://" + OssProperties.BUCKET_NAME + "." + endpoint + "/" + key;
} catch (OSSException oe) {
log.error("OSSException 文件上传失败:", oe);
@@ -74,7 +74,7 @@ public class OssFileServiceImpl implements IOssFileService {
log.info("OSSClient实例创建成功");
try {
String endpoint = OssProperties.ENDPOINT.substring(OssProperties.ENDPOINT.lastIndexOf("//") + 2);
//文件名(服务器上的文件路径)
// 文件名(服务器上的文件路径)
String host = "https://" + OssProperties.BUCKET_NAME + "." + endpoint + "/";
String objectName = url.substring(host.length());
// 删除文件或目录。如果要删除目录,目录必须为空。

View File

@@ -65,7 +65,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
"/v2/api-docs/**"
).permitAll()
// 对登录注册要允许匿名访问
.antMatchers("/login", "/captcha/get-captcha", "/wx/test/**").permitAll()
.antMatchers("/login", "/captcha/get-captcha", "/wx/test/**","/wp/clear/**").permitAll()
// 跨域请求会先进行一次options请求
.antMatchers(HttpMethod.OPTIONS).permitAll()
.anyRequest()// 除上面外的所有请求全部需要鉴权认证

View File

@@ -15,6 +15,7 @@ import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.io.IOException;
/**
@@ -34,7 +35,23 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
private JwtToken jwtToken;
@Override
protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException {
protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException {
String url = request.getRequestURL().toString();
log.debug("url ={}", url);
// 指定URL不拦截
if (url.contains("/wp/clear/")) {
return true;
}
// 指定URL不拦截
if (url.contains("/wp/custom/")) {
return true;
}
return false;
}
@Override
protected void doFilterInternal(@NotNull HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException {
LoginUser jwtUser = jwtToken.getNewLoginUser(httpServletRequest);
if (null != jwtUser && null == SecurityContextHolder.getContext().getAuthentication()) {
jwtToken.verifyToken(jwtUser);