Merge remote-tracking branch 'refs/remotes/origin/master' into dev
This commit is contained in:
@@ -149,11 +149,21 @@ public class SchisandraAuthUserController {
|
|||||||
schisandraAuthAddressBO.setAgent(userAgent.toString());
|
schisandraAuthAddressBO.setAgent(userAgent.toString());
|
||||||
schisandraAuthAddressBO.setUserId(result.getId());
|
schisandraAuthAddressBO.setUserId(result.getId());
|
||||||
schisandraAuthAddressBO.setIp(ip);
|
schisandraAuthAddressBO.setIp(ip);
|
||||||
schisandraAuthAddressBO.setBrowser(userAgent.getBrowser().toString());
|
if (userAgent.getBrowser() != null) {
|
||||||
schisandraAuthAddressBO.setBrowserVersion(userAgent.getBrowserVersion().getVersion());
|
schisandraAuthAddressBO.setBrowser(userAgent.getBrowser().toString());
|
||||||
|
}
|
||||||
|
if (userAgent.getBrowserVersion() != null) {
|
||||||
|
schisandraAuthAddressBO.setBrowserVersion(userAgent.getBrowserVersion().toString());
|
||||||
|
}
|
||||||
schisandraAuthAddressBO.setLocation(ip2region);
|
schisandraAuthAddressBO.setLocation(ip2region);
|
||||||
Boolean add = schisandraAuthAddressDomainService.add(schisandraAuthAddressBO);
|
SchisandraAuthAddressBO authAddressBO = schisandraAuthAddressDomainService.queryByUserId(result.getId());
|
||||||
assert add;
|
if (ObjectUtils.isNotEmpty(authAddressBO)) {
|
||||||
|
schisandraAuthAddressBO.setId(authAddressBO.getId());
|
||||||
|
schisandraAuthAddressDomainService.update(schisandraAuthAddressBO);
|
||||||
|
} else {
|
||||||
|
Boolean add = schisandraAuthAddressDomainService.add(schisandraAuthAddressBO);
|
||||||
|
assert add;
|
||||||
|
}
|
||||||
map.put("user", result);
|
map.put("user", result);
|
||||||
if (login != null) {
|
if (login != null) {
|
||||||
if (StpUtil.isLogin(result.getId())) {
|
if (StpUtil.isLogin(result.getId())) {
|
||||||
@@ -211,12 +221,21 @@ public class SchisandraAuthUserController {
|
|||||||
schisandraAuthAddressBO.setAgent(userAgent.toString());
|
schisandraAuthAddressBO.setAgent(userAgent.toString());
|
||||||
schisandraAuthAddressBO.setUserId(result.getId());
|
schisandraAuthAddressBO.setUserId(result.getId());
|
||||||
schisandraAuthAddressBO.setIp(ip);
|
schisandraAuthAddressBO.setIp(ip);
|
||||||
schisandraAuthAddressBO.setBrowser(userAgent.getBrowser().toString());
|
if (userAgent.getBrowser() != null) {
|
||||||
schisandraAuthAddressBO.setBrowserVersion(userAgent.getBrowserVersion().getVersion());
|
schisandraAuthAddressBO.setBrowser(userAgent.getBrowser().toString());
|
||||||
|
}
|
||||||
|
if (userAgent.getBrowserVersion() != null) {
|
||||||
|
schisandraAuthAddressBO.setBrowserVersion(userAgent.getBrowserVersion().toString());
|
||||||
|
}
|
||||||
schisandraAuthAddressBO.setLocation(ip2region);
|
schisandraAuthAddressBO.setLocation(ip2region);
|
||||||
Boolean add = schisandraAuthAddressDomainService.add(schisandraAuthAddressBO);
|
SchisandraAuthAddressBO authAddressBO = schisandraAuthAddressDomainService.queryByUserId(result.getId());
|
||||||
assert add;
|
if (ObjectUtils.isNotEmpty(authAddressBO)) {
|
||||||
|
schisandraAuthAddressBO.setId(authAddressBO.getId());
|
||||||
|
schisandraAuthAddressDomainService.update(schisandraAuthAddressBO);
|
||||||
|
} else {
|
||||||
|
Boolean add = schisandraAuthAddressDomainService.add(schisandraAuthAddressBO);
|
||||||
|
assert add;
|
||||||
|
}
|
||||||
map.put("user", result);
|
map.put("user", result);
|
||||||
if (loginByPhone != null) {
|
if (loginByPhone != null) {
|
||||||
if (StpUtil.isLogin(result.getId())) {
|
if (StpUtil.isLogin(result.getId())) {
|
||||||
@@ -420,14 +439,20 @@ public class SchisandraAuthUserController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户设置安全信息
|
* 用户设置安全信息
|
||||||
|
*
|
||||||
* @param schisandraAuthUserDTO
|
* @param schisandraAuthUserDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("update")
|
@PostMapping("update")
|
||||||
public Result update(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO){
|
public Result update(@RequestBody SchisandraAuthUserDTO schisandraAuthUserDTO) {
|
||||||
SchisandraAuthUserBO schisandraAuthUserBO = SchisandraAuthUserDTOConverter.INSTANCE.convertDTOToBO(schisandraAuthUserDTO);
|
SchisandraAuthUserBO schisandraAuthUserBO = SchisandraAuthUserDTOConverter.INSTANCE.convertDTOToBO(schisandraAuthUserDTO);
|
||||||
return Result.ok(schisandraAuthUserDomainService.update(schisandraAuthUserBO));
|
return Result.ok(schisandraAuthUserDomainService.update(schisandraAuthUserBO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("logout")
|
||||||
|
public Result logout(@RequestParam("userId") String userId) {
|
||||||
|
StpUtil.logout(userId);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ public interface SchisandraAuthUserDomainService {
|
|||||||
* @author: landaiqing
|
* @author: landaiqing
|
||||||
* @date: 2024/5/26 17:28
|
* @date: 2024/5/26 17:28
|
||||||
*/
|
*/
|
||||||
SchisandraAuthUserBO login(SchisandraAuthUserBO schisandraAuthUserBO);
|
SchisandraAuthUserBO login(SchisandraAuthUserBO schisandraAuthUserB);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 通过手机号登录
|
* @description: 通过手机号登录
|
||||||
|
@@ -235,10 +235,14 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean wechatRegister(String appId, String openId,String clientId, HttpServletRequest httpServletRequest) {
|
public Boolean wechatRegister(String appId, String openId,String clientId, HttpServletRequest httpServletRequest) {
|
||||||
SchisandraSocialUser socialUser = schisandraSocialUserService.selectByOpenId(openId);
|
SchisandraSocialUser socialUser = schisandraSocialUserService.selectByOpenId(appId,openId);
|
||||||
if (ObjectUtils.isNotEmpty(socialUser)) {
|
if (ObjectUtils.isNotEmpty(socialUser)) {
|
||||||
String userId = socialUser.getId();
|
String SocialUserId = socialUser.getId();
|
||||||
|
SchisandraSocialUserAuth schisandraSocialUserAuth= schisandraSocialUserAuthService.queryBySocialUserId(SocialUserId);
|
||||||
|
if(ObjectUtils.isEmpty(schisandraSocialUserAuth)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String userId = schisandraSocialUserAuth.getUserId();
|
||||||
|
|
||||||
// 加入登录IP地址
|
// 加入登录IP地址
|
||||||
String ip = IPUtil.getIp(httpServletRequest);
|
String ip = IPUtil.getIp(httpServletRequest);
|
||||||
@@ -250,8 +254,12 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
|
|||||||
schisandraAuthAddressBO.setAgent(userAgent.toString());
|
schisandraAuthAddressBO.setAgent(userAgent.toString());
|
||||||
schisandraAuthAddressBO.setUserId(userId);
|
schisandraAuthAddressBO.setUserId(userId);
|
||||||
schisandraAuthAddressBO.setIp(ip);
|
schisandraAuthAddressBO.setIp(ip);
|
||||||
schisandraAuthAddressBO.setBrowser(userAgent.getBrowser().toString());
|
if(userAgent.getBrowser() != null) {
|
||||||
schisandraAuthAddressBO.setBrowserVersion(userAgent.getBrowserVersion().getVersion());
|
schisandraAuthAddressBO.setBrowser(userAgent.getBrowser().toString());
|
||||||
|
}
|
||||||
|
if(userAgent.getBrowserVersion() != null){
|
||||||
|
schisandraAuthAddressBO.setBrowserVersion(userAgent.getBrowserVersion().toString());
|
||||||
|
}
|
||||||
schisandraAuthAddressBO.setLocation(ip2region);
|
schisandraAuthAddressBO.setLocation(ip2region);
|
||||||
SchisandraAuthAddress schisandraAuthAddress = SchisandraAuthAddressBOConverter.INSTANCE.convertBOToEntity(schisandraAuthAddressBO);
|
SchisandraAuthAddress schisandraAuthAddress = SchisandraAuthAddressBOConverter.INSTANCE.convertBOToEntity(schisandraAuthAddressBO);
|
||||||
int insert = schisandraAuthAddressService.update(schisandraAuthAddress);
|
int insert = schisandraAuthAddressService.update(schisandraAuthAddress);
|
||||||
@@ -268,6 +276,7 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
|
|||||||
}else{
|
}else{
|
||||||
// 插入社会用户信息表
|
// 插入社会用户信息表
|
||||||
SchisandraSocialUserBO socialUserBO = new SchisandraSocialUserBO();
|
SchisandraSocialUserBO socialUserBO = new SchisandraSocialUserBO();
|
||||||
|
socialUserBO.setUuid(appId);
|
||||||
socialUserBO.setOpenId(openId);
|
socialUserBO.setOpenId(openId);
|
||||||
SchisandraSocialUser schisandraSocialUser = SchisandraSocialUserBOConverter.INSTANCE.convertBOToEntity(socialUserBO);
|
SchisandraSocialUser schisandraSocialUser = SchisandraSocialUserBOConverter.INSTANCE.convertBOToEntity(socialUserBO);
|
||||||
int result = schisandraSocialUserService.insertSocialUser(schisandraSocialUser);
|
int result = schisandraSocialUserService.insertSocialUser(schisandraSocialUser);
|
||||||
@@ -299,8 +308,12 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
|
|||||||
schisandraAuthAddressBO.setAgent(userAgent.toString());
|
schisandraAuthAddressBO.setAgent(userAgent.toString());
|
||||||
schisandraAuthAddressBO.setUserId(authUserId);
|
schisandraAuthAddressBO.setUserId(authUserId);
|
||||||
schisandraAuthAddressBO.setIp(ip);
|
schisandraAuthAddressBO.setIp(ip);
|
||||||
schisandraAuthAddressBO.setBrowser(userAgent.getBrowser().toString());
|
if(userAgent.getBrowser() != null) {
|
||||||
schisandraAuthAddressBO.setBrowserVersion(userAgent.getBrowserVersion().getVersion());
|
schisandraAuthAddressBO.setBrowser(userAgent.getBrowser().toString());
|
||||||
|
}
|
||||||
|
if(userAgent.getBrowserVersion() != null){
|
||||||
|
schisandraAuthAddressBO.setBrowserVersion(userAgent.getBrowserVersion().toString());
|
||||||
|
}
|
||||||
schisandraAuthAddressBO.setLocation(ip2region);
|
schisandraAuthAddressBO.setLocation(ip2region);
|
||||||
SchisandraAuthAddress schisandraAuthAddress = SchisandraAuthAddressBOConverter.INSTANCE.convertBOToEntity(schisandraAuthAddressBO);
|
SchisandraAuthAddress schisandraAuthAddress = SchisandraAuthAddressBOConverter.INSTANCE.convertBOToEntity(schisandraAuthAddressBO);
|
||||||
int insertIp = schisandraAuthAddressService.insert(schisandraAuthAddress);
|
int insertIp = schisandraAuthAddressService.insert(schisandraAuthAddress);
|
||||||
@@ -359,6 +372,12 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
|
|||||||
AuthToken token = data.getToken();
|
AuthToken token = data.getToken();
|
||||||
SchisandraSocialUser socialUser = schisandraSocialUserService.selectByUuidAndType(uuid, type);
|
SchisandraSocialUser socialUser = schisandraSocialUserService.selectByUuidAndType(uuid, type);
|
||||||
if (ObjectUtils.isNotEmpty(socialUser)) {
|
if (ObjectUtils.isNotEmpty(socialUser)) {
|
||||||
|
|
||||||
|
SchisandraSocialUserAuth schisandraSocialUserAuth= schisandraSocialUserAuthService.queryBySocialUserId(socialUser.getId());
|
||||||
|
if(ObjectUtils.isEmpty(schisandraSocialUserAuth)){
|
||||||
|
return Result.fail();
|
||||||
|
}
|
||||||
|
String userId = schisandraSocialUserAuth.getUserId();
|
||||||
// 更新用户信息
|
// 更新用户信息
|
||||||
SchisandraSocialUserBO socialUserBO = new SchisandraSocialUserBO();
|
SchisandraSocialUserBO socialUserBO = new SchisandraSocialUserBO();
|
||||||
socialUserBO.setAccessToken(token.getAccessToken());
|
socialUserBO.setAccessToken(token.getAccessToken());
|
||||||
@@ -383,7 +402,6 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
|
|||||||
}
|
}
|
||||||
return Result.fail("Social User update fail");
|
return Result.fail("Social User update fail");
|
||||||
}
|
}
|
||||||
String userId = socialUser.getId();
|
|
||||||
|
|
||||||
// 加入登录IP地址
|
// 加入登录IP地址
|
||||||
String ip = IPUtil.getIp(httpServletRequest);
|
String ip = IPUtil.getIp(httpServletRequest);
|
||||||
@@ -395,8 +413,12 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
|
|||||||
schisandraAuthAddressBO.setAgent(userAgent.toString());
|
schisandraAuthAddressBO.setAgent(userAgent.toString());
|
||||||
schisandraAuthAddressBO.setUserId(userId);
|
schisandraAuthAddressBO.setUserId(userId);
|
||||||
schisandraAuthAddressBO.setIp(ip);
|
schisandraAuthAddressBO.setIp(ip);
|
||||||
schisandraAuthAddressBO.setBrowser(userAgent.getBrowser().toString());
|
if(userAgent.getBrowser() != null) {
|
||||||
schisandraAuthAddressBO.setBrowserVersion(userAgent.getBrowserVersion().getVersion());
|
schisandraAuthAddressBO.setBrowser(userAgent.getBrowser().toString());
|
||||||
|
}
|
||||||
|
if(userAgent.getBrowserVersion() != null){
|
||||||
|
schisandraAuthAddressBO.setBrowserVersion(userAgent.getBrowserVersion().toString());
|
||||||
|
}
|
||||||
schisandraAuthAddressBO.setLocation(ip2region);
|
schisandraAuthAddressBO.setLocation(ip2region);
|
||||||
SchisandraAuthAddress schisandraAuthAddress = SchisandraAuthAddressBOConverter.INSTANCE.convertBOToEntity(schisandraAuthAddressBO);
|
SchisandraAuthAddress schisandraAuthAddress = SchisandraAuthAddressBOConverter.INSTANCE.convertBOToEntity(schisandraAuthAddressBO);
|
||||||
int insert = schisandraAuthAddressService.update(schisandraAuthAddress);
|
int insert = schisandraAuthAddressService.update(schisandraAuthAddress);
|
||||||
@@ -463,8 +485,12 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
|
|||||||
schisandraAuthAddressBO.setAgent(userAgent.toString());
|
schisandraAuthAddressBO.setAgent(userAgent.toString());
|
||||||
schisandraAuthAddressBO.setUserId(authUserId);
|
schisandraAuthAddressBO.setUserId(authUserId);
|
||||||
schisandraAuthAddressBO.setIp(ip);
|
schisandraAuthAddressBO.setIp(ip);
|
||||||
schisandraAuthAddressBO.setBrowser(userAgent.getBrowser().toString());
|
if(userAgent.getBrowser() != null) {
|
||||||
schisandraAuthAddressBO.setBrowserVersion(userAgent.getBrowserVersion().getVersion());
|
schisandraAuthAddressBO.setBrowser(userAgent.getBrowser().toString());
|
||||||
|
}
|
||||||
|
if(userAgent.getBrowserVersion() != null){
|
||||||
|
schisandraAuthAddressBO.setBrowserVersion(userAgent.getBrowserVersion().toString());
|
||||||
|
}
|
||||||
schisandraAuthAddressBO.setLocation(ip2region);
|
schisandraAuthAddressBO.setLocation(ip2region);
|
||||||
SchisandraAuthAddress schisandraAuthAddress = SchisandraAuthAddressBOConverter.INSTANCE.convertBOToEntity(schisandraAuthAddressBO);
|
SchisandraAuthAddress schisandraAuthAddress = SchisandraAuthAddressBOConverter.INSTANCE.convertBOToEntity(schisandraAuthAddressBO);
|
||||||
int insertIp = schisandraAuthAddressService.insert(schisandraAuthAddress);
|
int insertIp = schisandraAuthAddressService.insert(schisandraAuthAddress);
|
||||||
|
@@ -43,4 +43,5 @@ public interface SchisandraSocialUserAuthService {
|
|||||||
boolean deleteById(String id);
|
boolean deleteById(String id);
|
||||||
|
|
||||||
|
|
||||||
|
SchisandraSocialUserAuth queryBySocialUserId(String socialUserId);
|
||||||
}
|
}
|
||||||
|
@@ -53,5 +53,5 @@ public interface SchisandraSocialUserService {
|
|||||||
|
|
||||||
int insertSocialUser(SchisandraSocialUser schisandraSocialUser);
|
int insertSocialUser(SchisandraSocialUser schisandraSocialUser);
|
||||||
|
|
||||||
SchisandraSocialUser selectByOpenId(String openId);
|
SchisandraSocialUser selectByOpenId(String appId,String openId);
|
||||||
}
|
}
|
||||||
|
@@ -1,14 +1,15 @@
|
|||||||
package com.schisandra.auth.infra.basic.service.impl;
|
package com.schisandra.auth.infra.basic.service.impl;
|
||||||
|
|
||||||
import com.schisandra.auth.infra.basic.entity.SchisandraSocialUserAuth;
|
|
||||||
import com.schisandra.auth.infra.basic.dao.SchisandraSocialUserAuthDao;
|
import com.schisandra.auth.infra.basic.dao.SchisandraSocialUserAuthDao;
|
||||||
|
import com.schisandra.auth.infra.basic.entity.SchisandraSocialUserAuth;
|
||||||
|
import com.schisandra.auth.infra.basic.entity.table.SchisandraSocialUserAuthTableDef;
|
||||||
import com.schisandra.auth.infra.basic.service.SchisandraSocialUserAuthService;
|
import com.schisandra.auth.infra.basic.service.SchisandraSocialUserAuthService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表服务实现类
|
* 表服务实现类
|
||||||
*
|
*
|
||||||
* @author landaiqing
|
* @author landaiqing
|
||||||
* @since 2024-06-24 11:10:08
|
* @since 2024-06-24 11:10:08
|
||||||
@@ -49,7 +50,7 @@ public class SchisandraSocialUserAuthServiceImpl implements SchisandraSocialUser
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int update(SchisandraSocialUserAuth schisandraSocialUserAuth) {
|
public int update(SchisandraSocialUserAuth schisandraSocialUserAuth) {
|
||||||
return this.schisandraSocialUserAuthDao.update(schisandraSocialUserAuth,true);
|
return this.schisandraSocialUserAuthDao.update(schisandraSocialUserAuth, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,5 +64,10 @@ public class SchisandraSocialUserAuthServiceImpl implements SchisandraSocialUser
|
|||||||
return this.schisandraSocialUserAuthDao.deleteById(id) > 0;
|
return this.schisandraSocialUserAuthDao.deleteById(id) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SchisandraSocialUserAuth queryBySocialUserId(String socialUserId) {
|
||||||
|
return this.schisandraSocialUserAuthDao.selectOneByCondition(SchisandraSocialUserAuthTableDef.SCHISANDRA_SOCIAL_USER_AUTH.SOCIAL_USER_ID.eq(socialUserId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -115,8 +115,8 @@ public class SchisandraSocialUserServiceImpl implements SchisandraSocialUserServ
|
|||||||
* @date: 2024/6/27 下午3:05
|
* @date: 2024/6/27 下午3:05
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SchisandraSocialUser selectByOpenId(String openId) {
|
public SchisandraSocialUser selectByOpenId(String appId,String openId) {
|
||||||
return schisandraSocialUserDao.selectOneByCondition(SchisandraSocialUserTableDef.SCHISANDRA_SOCIAL_USER.OPEN_ID.eq(openId));
|
return schisandraSocialUserDao.selectOneByCondition(SchisandraSocialUserTableDef.SCHISANDRA_SOCIAL_USER.OPEN_ID.eq(openId).and(SchisandraSocialUserTableDef.SCHISANDRA_SOCIAL_USER.UUID.eq(appId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ spring:
|
|||||||
# Redis服务器连接密码(默认为空)
|
# Redis服务器连接密码(默认为空)
|
||||||
password: LDQ20020618xxx
|
password: LDQ20020618xxx
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 2s
|
timeout: 10s
|
||||||
lettuce:
|
lettuce:
|
||||||
pool:
|
pool:
|
||||||
# 连接池最大连接数
|
# 连接池最大连接数
|
||||||
@@ -102,7 +102,7 @@ mybatis-flex:
|
|||||||
|
|
||||||
# 前端地址
|
# 前端地址
|
||||||
web:
|
web:
|
||||||
url: http://127.0.0.1:5173/
|
url: https://landaiqing.cn/
|
||||||
|
|
||||||
# MD5加密salt
|
# MD5加密salt
|
||||||
cipher:
|
cipher:
|
||||||
|
@@ -3,30 +3,20 @@ package com.schisandra.oss.application.controller;
|
|||||||
import cn.hutool.core.util.ZipUtil;
|
import cn.hutool.core.util.ZipUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.github.benmanes.caffeine.cache.Cache;
|
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.mybatisflex.annotation.RelationOneToMany;
|
|
||||||
import com.schisandra.oss.application.convert.SchisandraOssMinioDTOConverter;
|
import com.schisandra.oss.application.convert.SchisandraOssMinioDTOConverter;
|
||||||
import com.schisandra.oss.application.convert.SchisandraOssQiniuDTOConverter;
|
|
||||||
import com.schisandra.oss.application.dto.SchisandraOssMinioDTO;
|
import com.schisandra.oss.application.dto.SchisandraOssMinioDTO;
|
||||||
import com.schisandra.oss.application.dto.SchisandraOssQiniuDTO;
|
|
||||||
import com.schisandra.oss.application.oss.constant.OssConstant;
|
import com.schisandra.oss.application.oss.constant.OssConstant;
|
||||||
import com.schisandra.oss.application.oss.core.minio.MinioOssClient;
|
import com.schisandra.oss.application.oss.core.minio.MinioOssClient;
|
||||||
import com.schisandra.oss.application.oss.core.minio.MinioOssConfiguration;
|
import com.schisandra.oss.application.oss.core.minio.MinioOssConfiguration;
|
||||||
import com.schisandra.oss.application.oss.model.OssInfo;
|
import com.schisandra.oss.application.oss.model.OssInfo;
|
||||||
import com.schisandra.oss.common.entity.Result;
|
import com.schisandra.oss.common.entity.Result;
|
||||||
import com.schisandra.oss.common.utils.CaffeineUtil;
|
import com.schisandra.oss.common.utils.CaffeineUtil;
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssAliBO;
|
|
||||||
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
import com.schisandra.oss.domain.bo.SchisandraOssMinioBO;
|
||||||
import com.schisandra.oss.domain.redis.RedisUtil;
|
import com.schisandra.oss.domain.redis.RedisUtil;
|
||||||
import com.schisandra.oss.domain.service.SchisandraOssMinioDomainService;
|
import com.schisandra.oss.domain.service.SchisandraOssMinioDomainService;
|
||||||
import io.minio.errors.*;
|
import io.minio.errors.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.cache.annotation.Caching;
|
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.util.StreamUtils;
|
import org.springframework.util.StreamUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -42,7 +32,6 @@ import java.net.URLEncoder;
|
|||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -81,23 +70,23 @@ public class SchisandraOssMinioController {
|
|||||||
public Result returnOneById(String Id) {
|
public Result returnOneById(String Id) {
|
||||||
SchisandraOssMinioBO bo = schisandraOssMinioDomainService.selectOneById(Id);
|
SchisandraOssMinioBO bo = schisandraOssMinioDomainService.selectOneById(Id);
|
||||||
SchisandraOssMinioDTO dto = SchisandraOssMinioDTOConverter.INSTANCE.convertBOToDTO(bo);
|
SchisandraOssMinioDTO dto = SchisandraOssMinioDTOConverter.INSTANCE.convertBOToDTO(bo);
|
||||||
if(dto == null){
|
if (dto == null) {
|
||||||
return Result.fail("查询失败");
|
return Result.fail("查询失败");
|
||||||
}
|
}
|
||||||
return Result.ok(dto);
|
return Result.ok(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回当前用户minio表所有数据
|
* 返回当前用户minio表所有数据
|
||||||
|
*
|
||||||
* @param userId
|
* @param userId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("return_online")
|
@GetMapping("return_online")
|
||||||
public Result returnOnline(String userId) {
|
public Result returnOnline(String userId) {
|
||||||
List<SchisandraOssMinioBO> list = schisandraOssMinioDomainService.selectAllPresent(userId);
|
List<SchisandraOssMinioBO> list = schisandraOssMinioDomainService.selectAllPresent(userId);
|
||||||
if(list.isEmpty()){
|
if (list.isEmpty()) {
|
||||||
return Result.fail();
|
return Result.fail();
|
||||||
}
|
}
|
||||||
return Result.ok(SchisandraOssMinioDTOConverter.INSTANCE.convertBOToDTOList(list));
|
return Result.ok(SchisandraOssMinioDTOConverter.INSTANCE.convertBOToDTOList(list));
|
||||||
@@ -178,12 +167,12 @@ public class SchisandraOssMinioController {
|
|||||||
Preconditions.checkNotNull(userId, "不能为空");
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
||||||
bean.getMinioOssConfig().setBucketName(bucket);
|
bean.getMinioOssConfig().setBucketName(bucket);
|
||||||
List<OssInfo> object= (List<OssInfo>) caffeineUtil.caffeineBuild().getIfPresent(userId+bucket+dirName);
|
List<OssInfo> object = (List<OssInfo>) caffeineUtil.caffeineBuild().getIfPresent(userId + bucket + dirName);
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
return Result.ok(object);
|
return Result.ok(object);
|
||||||
}else {
|
} else {
|
||||||
List<OssInfo> list=bean.listDir(bucket,dirName);
|
List<OssInfo> list = bean.listDir(bucket, dirName);
|
||||||
caffeineUtil.caffeineBuild().put(userId+bucket+dirName, list);
|
caffeineUtil.caffeineBuild().put(userId + bucket + dirName, list);
|
||||||
return Result.ok(list);
|
return Result.ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +234,7 @@ public class SchisandraOssMinioController {
|
|||||||
Preconditions.checkNotNull(bucket, "不能为空");
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
Preconditions.checkNotNull(userId, "不能为空");
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
Preconditions.checkNotNull(filePath, "不能为空");
|
Preconditions.checkNotNull(filePath, "不能为空");
|
||||||
int index=filePath.lastIndexOf("/");
|
int index = filePath.lastIndexOf("/");
|
||||||
String fileName = filePath.substring(index + 1);
|
String fileName = filePath.substring(index + 1);
|
||||||
caffeineUtil.caffeineBuild().invalidate("MinioListDir" + userId + bucket + fileName);
|
caffeineUtil.caffeineBuild().invalidate("MinioListDir" + userId + bucket + fileName);
|
||||||
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
||||||
@@ -262,17 +251,17 @@ public class SchisandraOssMinioController {
|
|||||||
* @date: 2024/6/26 14:34
|
* @date: 2024/6/26 14:34
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "uploadFile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = "uploadFile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
public Result<Object> uploadMinioFile(SchisandraOssMinioDTO schisandraOssMinioDTO,@RequestParam MultipartFile file) throws IOException {
|
public Result<Object> uploadMinioFile(SchisandraOssMinioDTO schisandraOssMinioDTO, @RequestParam MultipartFile file) throws IOException {
|
||||||
String path=schisandraOssMinioDTO.getPath();
|
String path = schisandraOssMinioDTO.getPath();
|
||||||
String bucket=schisandraOssMinioDTO.getBucketName();
|
String bucket = schisandraOssMinioDTO.getBucketName();
|
||||||
String userId=schisandraOssMinioDTO.getUserId();
|
String userId = schisandraOssMinioDTO.getUserId();
|
||||||
Preconditions.checkNotNull(path, "path不能为空");
|
Preconditions.checkNotNull(path, "path不能为空");
|
||||||
Preconditions.checkNotNull(bucket, "bucket不能为空");
|
Preconditions.checkNotNull(bucket, "bucket不能为空");
|
||||||
Preconditions.checkNotNull(userId, "userId不能为空");
|
Preconditions.checkNotNull(userId, "userId不能为空");
|
||||||
if (path.lastIndexOf("") == path.length() - 1) {
|
if (path.lastIndexOf("") == path.length() - 1) {
|
||||||
path=path+file.getName();
|
path = path + file.getName();
|
||||||
}else{
|
} else {
|
||||||
path=path+"/"+file.getOriginalFilename();
|
path = path + "/" + file.getOriginalFilename();
|
||||||
}
|
}
|
||||||
// 获取文件输入流
|
// 获取文件输入流
|
||||||
InputStream is = file.getInputStream();
|
InputStream is = file.getInputStream();
|
||||||
@@ -290,7 +279,7 @@ public class SchisandraOssMinioController {
|
|||||||
map.put("time", formattedDate);
|
map.put("time", formattedDate);
|
||||||
if (bean.upLoad(is, path, true) != null) {
|
if (bean.upLoad(is, path, true) != null) {
|
||||||
redisUtil.setNx(key, map, 30L, TimeUnit.DAYS);
|
redisUtil.setNx(key, map, 30L, TimeUnit.DAYS);
|
||||||
caffeineUtil.caffeineBuild().invalidate("MinioListDir"+userId+bucket+schisandraOssMinioDTO.getPath());
|
caffeineUtil.caffeineBuild().invalidate("MinioListDir" + userId + bucket + schisandraOssMinioDTO.getPath());
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
} else {
|
} else {
|
||||||
return Result.fail();
|
return Result.fail();
|
||||||
@@ -312,7 +301,7 @@ public class SchisandraOssMinioController {
|
|||||||
Preconditions.checkNotNull(bucket, "不能为空");
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
Preconditions.checkNotNull(oldFileName, "不能为空");
|
Preconditions.checkNotNull(oldFileName, "不能为空");
|
||||||
Preconditions.checkNotNull(newFileName, "不能为空");
|
Preconditions.checkNotNull(newFileName, "不能为空");
|
||||||
String path=oldFileName.substring(0,oldFileName.lastIndexOf("/")+1);
|
String path = oldFileName.substring(0, oldFileName.lastIndexOf("/") + 1);
|
||||||
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
||||||
bean.getMinioOssConfig().setBucketName(bucket);
|
bean.getMinioOssConfig().setBucketName(bucket);
|
||||||
try {
|
try {
|
||||||
@@ -320,7 +309,7 @@ public class SchisandraOssMinioController {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Result.fail(e.getMessage());
|
return Result.fail(e.getMessage());
|
||||||
}
|
}
|
||||||
caffeineUtil.caffeineBuild().invalidate("MinioListDir"+userId+bucket+path);
|
caffeineUtil.caffeineBuild().invalidate("MinioListDir" + userId + bucket + path);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,14 +329,14 @@ public class SchisandraOssMinioController {
|
|||||||
Preconditions.checkNotNull(oldFilePath, "不能为空");
|
Preconditions.checkNotNull(oldFilePath, "不能为空");
|
||||||
Preconditions.checkNotNull(newFilePath, "不能为空");
|
Preconditions.checkNotNull(newFilePath, "不能为空");
|
||||||
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
||||||
String path=oldFilePath.substring(0,oldFilePath.lastIndexOf("/")+1);
|
String path = oldFilePath.substring(0, oldFilePath.lastIndexOf("/") + 1);
|
||||||
bean.getMinioOssConfig().setBucketName(bucket);
|
bean.getMinioOssConfig().setBucketName(bucket);
|
||||||
try {
|
try {
|
||||||
bean.copy(oldFilePath, newFilePath);
|
bean.copy(oldFilePath, newFilePath);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Result.fail(e.getMessage());
|
return Result.fail(e.getMessage());
|
||||||
}
|
}
|
||||||
caffeineUtil.caffeineBuild().invalidate("MinioListDir"+userId+bucket+path);
|
caffeineUtil.caffeineBuild().invalidate("MinioListDir" + userId + bucket + path);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -415,28 +404,28 @@ public class SchisandraOssMinioController {
|
|||||||
public Result<String> seleteBucket(@RequestParam String userId) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
public Result<String> seleteBucket(@RequestParam String userId) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||||
Preconditions.checkNotNull(userId, "不能为空");
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
||||||
List<HashMap<String,String>>list= (List<HashMap<String, String>>) caffeineUtil.caffeineBuild().getIfPresent("MinioBucket"+userId);
|
List<HashMap<String, String>> list = (List<HashMap<String, String>>) caffeineUtil.caffeineBuild().getIfPresent("MinioBucket" + userId);
|
||||||
if (list!=null){
|
if (list != null) {
|
||||||
return Result.ok(list);
|
return Result.ok(list);
|
||||||
}
|
}
|
||||||
list=bean.selectAllBucket();
|
list = bean.selectAllBucket();
|
||||||
if (list==null){
|
if (list == null) {
|
||||||
return Result.fail();
|
return Result.fail();
|
||||||
}
|
}
|
||||||
caffeineUtil.caffeineBuild().put("MinioBucket",list);
|
caffeineUtil.caffeineBuild().put("MinioBucket", list);
|
||||||
return Result.ok(list);
|
return Result.ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("getBucketSize")
|
@PostMapping("getBucketSize")
|
||||||
public Result<String> getBucketSize(@RequestParam String userId, @RequestParam String bucket) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
public Result<String> getBucketSize(@RequestParam String userId, @RequestParam String bucket) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
|
||||||
Preconditions.checkNotNull(userId, "不能为空");
|
Preconditions.checkNotNull(userId, "不能为空");
|
||||||
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO+userId);
|
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
||||||
String size= (String) caffeineUtil.caffeineBuild().getIfPresent("MinioBucket"+userId+bucket);
|
String size = (String) caffeineUtil.caffeineBuild().getIfPresent("MinioBucket" + userId + bucket);
|
||||||
if (size!=null){
|
if (size != null) {
|
||||||
return Result.ok(size);
|
return Result.ok(size);
|
||||||
}
|
}
|
||||||
size=bean.getMinioBucketSize(bucket);
|
size = bean.getMinioBucketSize(bucket);
|
||||||
caffeineUtil.caffeineBuild().put("MinioBucket"+userId+bucket,size);
|
caffeineUtil.caffeineBuild().put("MinioBucket" + userId + bucket, size);
|
||||||
return Result.ok(size);
|
return Result.ok(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,7 +442,7 @@ public class SchisandraOssMinioController {
|
|||||||
Preconditions.checkNotNull(bucket, "不能为空");
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
||||||
bean.getMinioOssConfig().setBucketName(bucket);
|
bean.getMinioOssConfig().setBucketName(bucket);
|
||||||
caffeineUtil.caffeineBuild().invalidate("MinioBucket"+userId);
|
caffeineUtil.caffeineBuild().invalidate("MinioBucket" + userId);
|
||||||
return Result.ok(bean.createBucket(bucket));
|
return Result.ok(bean.createBucket(bucket));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,7 +460,7 @@ public class SchisandraOssMinioController {
|
|||||||
Preconditions.checkNotNull(bucket, "不能为空");
|
Preconditions.checkNotNull(bucket, "不能为空");
|
||||||
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
MinioOssClient bean = SpringUtil.getBean(OssConstant.OssType.MINIO + userId);
|
||||||
bean.getMinioOssConfig().setBucketName(bucket);
|
bean.getMinioOssConfig().setBucketName(bucket);
|
||||||
caffeineUtil.caffeineBuild().invalidate("MinioBucket"+userId);
|
caffeineUtil.caffeineBuild().invalidate("MinioBucket" + userId);
|
||||||
return Result.ok(bean.deleteBucket(bucket));
|
return Result.ok(bean.deleteBucket(bucket));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ spring:
|
|||||||
# Redis服务器连接密码(默认为空)
|
# Redis服务器连接密码(默认为空)
|
||||||
password: LDQ20020618xxx
|
password: LDQ20020618xxx
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 2s
|
timeout: 10s
|
||||||
lettuce:
|
lettuce:
|
||||||
pool:
|
pool:
|
||||||
# 连接池最大连接数
|
# 连接池最大连接数
|
||||||
@@ -78,6 +78,6 @@ xxl:
|
|||||||
appname: schisandra-cloud-storage-oss
|
appname: schisandra-cloud-storage-oss
|
||||||
address:
|
address:
|
||||||
ip: 1.95.0.111
|
ip: 1.95.0.111
|
||||||
port: 9998
|
port: 9997
|
||||||
logpath: /data/applogs/xxl-job/jobhandler
|
logpath: /data/applogs/xxl-job/jobhandler
|
||||||
logretentiondays: 30
|
logretentiondays: 30
|
@@ -73,7 +73,6 @@ public class SchisandraShareCircleController {
|
|||||||
/**
|
/**
|
||||||
* 分享圈列表返回
|
* 分享圈列表返回
|
||||||
*/
|
*/
|
||||||
@Cacheable(value = "sharelist", key = "'sharelist'")
|
|
||||||
@GetMapping("sharelist")
|
@GetMapping("sharelist")
|
||||||
public Result<List<SchisandraShareCircleDTO>> getShareList() {
|
public Result<List<SchisandraShareCircleDTO>> getShareList() {
|
||||||
try {
|
try {
|
||||||
|
@@ -38,7 +38,7 @@ spring:
|
|||||||
# Redis服务器连接密码(默认为空)
|
# Redis服务器连接密码(默认为空)
|
||||||
password: LDQ20020618xxx
|
password: LDQ20020618xxx
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 2s
|
timeout: 10s
|
||||||
lettuce:
|
lettuce:
|
||||||
pool:
|
pool:
|
||||||
# 连接池最大连接数
|
# 连接池最大连接数
|
||||||
|
@@ -1,83 +1,78 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.schisandra.system</groupId>
|
<groupId>com.schisandra.system</groupId>
|
||||||
<artifactId>schisandra-cloud-storage-system</artifactId>
|
<artifactId>schisandra-cloud-storage-system</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>schisandra-cloud-storage-system-domain</artifactId>
|
<artifactId>schisandra-cloud-storage-system-domain</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>schisandra-cloud-storage-system-domain</name>
|
<name>schisandra-cloud-storage-system-domain</name>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
<version>3.13.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>1.8</source>
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
<annotationProcessorPaths>
|
<annotationProcessorPaths>
|
||||||
<path>
|
<path>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.24</version>
|
<version>1.18.24</version>
|
||||||
</path>
|
</path>
|
||||||
<!-- 必须要加, 否则生成不了 MapperImpl 实现类 -->
|
<!-- 必须要加, 否则生成不了 MapperImpl 实现类 -->
|
||||||
<path>
|
<path>
|
||||||
<groupId>org.mapstruct</groupId>
|
<groupId>org.mapstruct</groupId>
|
||||||
<artifactId>mapstruct-processor</artifactId>
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
<version>1.4.2.Final</version>
|
<version>1.4.2.Final</version>
|
||||||
</path>
|
</path>
|
||||||
<!-- 如果是 0.1.0 有可能出现生成了maptruct的实现类, 但该类只创建了对象, 没有进行赋值 -->
|
<!-- 如果是 0.1.0 有可能出现生成了maptruct的实现类, 但该类只创建了对象, 没有进行赋值 -->
|
||||||
<path>
|
<path>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok-mapstruct-binding</artifactId>
|
<artifactId>lombok-mapstruct-binding</artifactId>
|
||||||
<version>0.2.0</version>
|
<version>0.2.0</version>
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<groupId>com.mybatis-flex</groupId>
|
<groupId>com.mybatis-flex</groupId>
|
||||||
<artifactId>mybatis-flex-processor</artifactId>
|
<artifactId>mybatis-flex-processor</artifactId>
|
||||||
<version>1.9.0</version>
|
<version>1.9.0</version>
|
||||||
</path>
|
</path>
|
||||||
</annotationProcessorPaths>
|
</annotationProcessorPaths>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.schisandra.system</groupId>
|
<groupId>com.schisandra.system</groupId>
|
||||||
<artifactId>schisandra-cloud-storage-system-infra</artifactId>
|
<artifactId>schisandra-cloud-storage-system-infra</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.schisandra.system</groupId>
|
<groupId>com.schisandra.system</groupId>
|
||||||
<artifactId>schisandra-cloud-storage-system-common</artifactId>
|
<artifactId>schisandra-cloud-storage-system-common</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xuxueli</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>xxl-job-core</artifactId>
|
<artifactId>spring-context</artifactId>
|
||||||
<version>2.4.0</version>
|
<version>5.3.27</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
</dependencies>
|
||||||
<groupId>org.springframework</groupId>
|
</project>
|
||||||
<artifactId>spring-context</artifactId>
|
|
||||||
<version>5.3.27</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
|
@@ -1,78 +0,0 @@
|
|||||||
package com.schisandra.system.domain.config;
|
|
||||||
|
|
||||||
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xxl-job config
|
|
||||||
*
|
|
||||||
* @author xuxueli 2017-04-28
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class XxlJobConfig {
|
|
||||||
private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
|
|
||||||
|
|
||||||
@Value("${xxl.job.admin.addresses}")
|
|
||||||
private String adminAddresses;
|
|
||||||
|
|
||||||
@Value("${xxl.job.accessToken}")
|
|
||||||
private String accessToken;
|
|
||||||
|
|
||||||
@Value("${xxl.job.executor.appname}")
|
|
||||||
private String appname;
|
|
||||||
|
|
||||||
@Value("${xxl.job.executor.address}")
|
|
||||||
private String address;
|
|
||||||
|
|
||||||
@Value("${xxl.job.executor.ip}")
|
|
||||||
private String ip;
|
|
||||||
|
|
||||||
@Value("${xxl.job.executor.port}")
|
|
||||||
private int port;
|
|
||||||
|
|
||||||
@Value("${xxl.job.executor.logpath}")
|
|
||||||
private String logPath;
|
|
||||||
|
|
||||||
@Value("${xxl.job.executor.logretentiondays}")
|
|
||||||
private int logRetentionDays;
|
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public XxlJobSpringExecutor xxlJobExecutor() {
|
|
||||||
logger.info(">>>>>>>>>>> xxl-job config init.");
|
|
||||||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
|
||||||
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
|
|
||||||
xxlJobSpringExecutor.setAppname(appname);
|
|
||||||
xxlJobSpringExecutor.setAddress(address);
|
|
||||||
xxlJobSpringExecutor.setIp(ip);
|
|
||||||
xxlJobSpringExecutor.setPort(port);
|
|
||||||
xxlJobSpringExecutor.setAccessToken(accessToken);
|
|
||||||
xxlJobSpringExecutor.setLogPath(logPath);
|
|
||||||
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
|
|
||||||
|
|
||||||
return xxlJobSpringExecutor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
|
|
||||||
*
|
|
||||||
* 1、引入依赖:
|
|
||||||
* <dependency>
|
|
||||||
* <groupId>org.springframework.cloud</groupId>
|
|
||||||
* <artifactId>spring-cloud-commons</artifactId>
|
|
||||||
* <version>${version}</version>
|
|
||||||
* </dependency>
|
|
||||||
*
|
|
||||||
* 2、配置文件,或者容器启动变量
|
|
||||||
* spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
|
|
||||||
*
|
|
||||||
* 3、获取IP
|
|
||||||
* String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@@ -1,98 +1,84 @@
|
|||||||
server:
|
server:
|
||||||
port: 5000
|
port: 5000
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
username: root
|
username: root
|
||||||
password: BZbVbGDBePiA2q8/mt0eMxKNpHniDzxBtOxFadQiAOTDzCDlopC4qOKwwBEi9CAZcuFsCrRJdwn0wP6jwsnzxw==
|
password: BZbVbGDBePiA2q8/mt0eMxKNpHniDzxBtOxFadQiAOTDzCDlopC4qOKwwBEi9CAZcuFsCrRJdwn0wP6jwsnzxw==
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://1.95.0.111:3306/schisandra-cloud-storage?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=true
|
url: jdbc:mysql://1.95.0.111:3306/schisandra-cloud-storage?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=true
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
druid:
|
druid:
|
||||||
initial-size: 20
|
initial-size: 20
|
||||||
min-idle: 20
|
min-idle: 20
|
||||||
max-active: 100
|
max-active: 100
|
||||||
max-wait: 60000
|
max-wait: 60000
|
||||||
connectionProperties: config.decrypt=true;config.decrypt.key=${publicKey};
|
connectionProperties: config.decrypt=true;config.decrypt.key=${publicKey};
|
||||||
stat-view-servlet:
|
stat-view-servlet:
|
||||||
enabled: true
|
enabled: true
|
||||||
url-pattern: /druid/*
|
url-pattern: /druid/*
|
||||||
login-username: admin
|
login-username: admin
|
||||||
login-password: 123456
|
login-password: 123456
|
||||||
filter:
|
filter:
|
||||||
stat:
|
stat:
|
||||||
enabled: true
|
enabled: true
|
||||||
slow-sql-millis: 2000
|
slow-sql-millis: 2000
|
||||||
log-slow-sql: true
|
log-slow-sql: true
|
||||||
wall:
|
wall:
|
||||||
enabled: true
|
enabled: true
|
||||||
config:
|
config:
|
||||||
enabled: true
|
enabled: true
|
||||||
# redis配置
|
# redis配置
|
||||||
redis:
|
redis:
|
||||||
# Redis数据库索引(默认为0)
|
# Redis数据库索引(默认为0)
|
||||||
database: 1
|
database: 1
|
||||||
# Redis服务器地址
|
# Redis服务器地址
|
||||||
host: 1.95.0.111
|
host: 1.95.0.111
|
||||||
# Redis服务器连接端口
|
# Redis服务器连接端口
|
||||||
port: 6379
|
port: 6379
|
||||||
# Redis服务器连接密码(默认为空)
|
# Redis服务器连接密码(默认为空)
|
||||||
password: LDQ20020618xxx
|
password: LDQ20020618xxx
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 2s
|
timeout: 10s
|
||||||
lettuce:
|
lettuce:
|
||||||
pool:
|
pool:
|
||||||
# 连接池最大连接数
|
# 连接池最大连接数
|
||||||
max-active: 200
|
max-active: 200
|
||||||
# 连接池最大阻塞等待时间(使用负值表示没有限制)
|
# 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||||
max-wait: -1ms
|
max-wait: -1ms
|
||||||
# 连接池中的最大空闲连接
|
# 连接池中的最大空闲连接
|
||||||
max-idle: 10
|
max-idle: 10
|
||||||
# 连接池中的最小空闲连接
|
# 连接池中的最小空闲连接
|
||||||
min-idle: 0
|
min-idle: 0
|
||||||
publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANUVxjcrVoirBZaNmDrUqatHEW4FOHbO5ynW6zvhIbRMo6hEFGgglbURkjuHOlgEduxJVz6Xa+sG+FMrxTguOJECAwEAAQ==
|
publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANUVxjcrVoirBZaNmDrUqatHEW4FOHbO5ynW6zvhIbRMo6hEFGgglbURkjuHOlgEduxJVz6Xa+sG+FMrxTguOJECAwEAAQ==
|
||||||
logging:
|
logging:
|
||||||
config: classpath:log4j2-spring.xml
|
config: classpath:log4j2-spring.xml
|
||||||
############## Sa-Token 配置 (文档: https://sa-token.cc) ##############
|
############## Sa-Token 配置 (文档: https://sa-token.cc) ##############
|
||||||
sa-token:
|
sa-token:
|
||||||
# token 名称(同时也是 cookie 名称)
|
# token 名称(同时也是 cookie 名称)
|
||||||
token-name: token
|
token-name: token
|
||||||
# token 有效期(单位:秒) 默认30天,-1 代表永久有效
|
# token 有效期(单位:秒) 默认30天,-1 代表永久有效
|
||||||
timeout: 2592000
|
timeout: 2592000
|
||||||
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||||
active-timeout: -1
|
active-timeout: -1
|
||||||
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
|
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
|
||||||
is-concurrent: true
|
is-concurrent: true
|
||||||
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token)
|
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token)
|
||||||
is-share: true
|
is-share: true
|
||||||
# token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik)
|
# token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik)
|
||||||
token-style: random-32
|
token-style: random-32
|
||||||
# 是否输出操作日志
|
# 是否输出操作日志
|
||||||
is-log: false
|
is-log: false
|
||||||
token-prefix: schisandra
|
token-prefix: schisandra
|
||||||
is-print: false
|
is-print: false
|
||||||
|
|
||||||
mybatis-flex:
|
mybatis-flex:
|
||||||
global-config:
|
global-config:
|
||||||
print-banner: false
|
print-banner: false
|
||||||
key-config:
|
key-config:
|
||||||
key-type: generator
|
key-type: generator
|
||||||
normal-value-of-logic-delete: 0
|
normal-value-of-logic-delete: 0
|
||||||
deleted-value-of-logic-delete: 1
|
deleted-value-of-logic-delete: 1
|
||||||
logic-delete-column: is_deleted
|
logic-delete-column: is_deleted
|
||||||
mapper-locations:
|
mapper-locations:
|
||||||
- "classpath*:/mapper/**/*.xml"
|
- "classpath*:/mapper/**/*.xml"
|
||||||
|
|
||||||
# xxl-job配置
|
|
||||||
xxl:
|
|
||||||
job:
|
|
||||||
admin:
|
|
||||||
addresses: http://1.95.0.111:8088/xxl-job-admin
|
|
||||||
accessToken: default_token
|
|
||||||
executor:
|
|
||||||
appname: schisandra-cloud-storage-system
|
|
||||||
address:
|
|
||||||
ip: 1.95.0.111
|
|
||||||
port: 9999
|
|
||||||
logpath: /data/applogs/xxl-job/jobhandler
|
|
||||||
logretentiondays: 30
|
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@ spring:
|
|||||||
# Redis服务器连接密码(默认为空)
|
# Redis服务器连接密码(默认为空)
|
||||||
password: LDQ20020618xxx
|
password: LDQ20020618xxx
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 2s
|
timeout: 10s
|
||||||
lettuce:
|
lettuce:
|
||||||
pool:
|
pool:
|
||||||
# 连接池最大连接数
|
# 连接池最大连接数
|
||||||
@@ -28,8 +28,8 @@ spring:
|
|||||||
wx:
|
wx:
|
||||||
mp:
|
mp:
|
||||||
token: LDQ20020618xxx
|
token: LDQ20020618xxx
|
||||||
appid: wx55251c2f83b9fc25
|
appid: wx7c3b1f52f460e5dd
|
||||||
secret: d511800cd53d248afe1260bb8aeed230
|
secret: f924c42c90223a0013908e204863c3b8
|
||||||
codeExpire: 3600
|
codeExpire: 3600
|
||||||
encodingAESKey:
|
encodingAESKey:
|
||||||
|
|
||||||
@@ -37,12 +37,12 @@ wx:
|
|||||||
xxl:
|
xxl:
|
||||||
job:
|
job:
|
||||||
admin:
|
admin:
|
||||||
addresses: http://127.0.0.1:8081/xxl-job-admin
|
addresses: http://1.95.0.111:8088/xxl-job-admin
|
||||||
accessToken: default_token
|
accessToken: default_token
|
||||||
executor:
|
executor:
|
||||||
appname: schisandra-cloud-storage-wechat
|
appname: schisandra-cloud-storage-wechat
|
||||||
address:
|
address:
|
||||||
ip: 127.0.0.1
|
ip: 1.95.0.111
|
||||||
port: 9998
|
port: 9996
|
||||||
logpath: /data/applogs/xxl-job/jobhandler
|
logpath: /data/applogs/xxl-job/jobhandler
|
||||||
logretentiondays: 30
|
logretentiondays: 30
|
||||||
|
Reference in New Issue
Block a user