ossIds);
-
- SysOssVo getById(Long ossId);
-
- default SysOssVo upload(MultipartFile file) {
- return upload(file, PRE_DEFAULT);
- }
-
- /**
- * @param file
- * @param pre - 图片保存路径前缀
- * @return
- */
- default SysOssVo upload(MultipartFile file, String pre) {
- if (file == null || file.isEmpty()) {
- throw new RuntimeException("文件不能为空");
- }
- try {
- return save(file.getInputStream(), file.getOriginalFilename(), file.getContentType(), pre);
- } catch (IOException e) {
- throw new RuntimeException(e.getMessage(), e);
- }
- }
-
-
- /**
- * 保存文件, rule:{yyyy}/{MM}/{dd}/{id36}.{ext}
- *
- * @param in 输入流
- * @param filename 文件名
- * @param contentType 文件类型
- * @param pre 路径前缀
- * @return
- */
- default SysOssVo save(InputStream in, String filename, String contentType, String pre) {
- return save(in, filename, contentType, pre, "{yyyy}/{MM}/{dd}/{id36}.{ext}");
- }
-
- /**
- * 保存文件,保留文件名,rule:{yyyy}/{MM}/{dd}/{id36}/{filename}.{ext}
- *
- * @param in 输入流
- * @param filename 文件名
- * @param contentType 文件类型
- * @param pre 路径前缀
- * @return
- */
- default SysOssVo saveFilename(InputStream in, String filename, String contentType, String pre) {
- return save(in, filename, contentType, pre, "{yyyy}/{MM}/{dd}/{id36}/{filename}.{ext}");
- }
-
- /**
- * 保存文件,存放路径规则rule:
- *
- * - 根据存放规则和文件名生成存放的URI
- * - 支持
- * - {yyyy}/{MM}/{dd}/{HH}/{mm}/{ss} 年月日时分秒
- * - {UUID} 32位的唯一标志
- * - {i} 自增id
- * - {id} 当日int类型的唯一id,防止重复建议+年月日路径
- * - {id16} 当日int类型的唯一id16进制表示,防止重复建议+年月日路径
- * - {id36} 当日int类型的唯一id36进制表示,防止重复建议+年月日路径
- * - {filename} 文件基础名称
- * - {ext} 扩展名
- *
- *
- * @param in 输入流
- * @param filename 文件名
- * @param contentType 文件类型
- * @param pre 路径前缀
- * @param rule 路径规则
- * @return
- */
- SysOssVo save(InputStream in, String filename, String contentType, String pre, String rule);
-
- SysOssVo uploadImgs(MultipartFile file, String pre);
-
- default SysOssVo uploadImgs(MultipartFile file, String pre, int maxWidth, int maxHeight, BufferedImage watermark) {
- if (file == null || file.isEmpty()) {
- throw new RuntimeException("图片不能为空");
- }
- try {
- return uploadImgs(file.getInputStream(), pre, maxWidth, maxHeight, watermark);
- } catch (IOException e) {
- throw new RuntimeException(e.getMessage(), e);
- }
- }
-
- /**
- * @param in
- * @param pre - 图片保存路径前缀
- * @param maxWidth - 缩放到指定的宽 小于1表示不缩放
- * @param maxHeight - 缩放到指定的高 小于1表示不缩放
- * @param watermark - 水印图片 null表示不加水印
- * @return
- */
- SysOssVo uploadImgs(InputStream in, String pre, int maxWidth, int maxHeight,
- BufferedImage watermark);
-
- void download(Long ossId, HttpServletResponse response) throws IOException;
-
- void download(String url, Service service, HttpServletResponse response) throws IOException;
-
- InputStream download(Long ossId) throws IOException;
-
- InputStream download(SysOssVo sysOss) throws IOException;
-
- InputStream download(String url, Service service) throws IOException;
-
- Boolean deleteWithValidByIds(Collection ids, Boolean isValid);
-
-
- default InputStream formatImage(MultipartFile file, int maxWidth, int maxHeight,
- BufferedImage watermark) {
- try {
- if (file == null || file.isEmpty()) {
- throw new RuntimeException("上传图片不能为空");
- }
- if (!file.getContentType().startsWith("image/")) {
- throw new RuntimeException("上传的文件不是图片");
- }
- return formatImage(file.getInputStream(), maxWidth, maxHeight, watermark);
- } catch (IOException e) {
- throw new RuntimeException("处理图片错误", e);
- }
- }
-
- default InputStream formatImage(Image img, int maxWidth, int maxHeight, BufferedImage watermark) {
- if (img == null) {
- throw new RuntimeException("图片不能为空");
- }
- return formatImage(Img.from(img), maxWidth, maxHeight, watermark);
- }
-
- default InputStream formatImage(InputStream in, int maxWidth, int maxHeight, BufferedImage watermark) {
- return formatImage(Img.from(in), maxWidth, maxHeight, watermark);
- }
-
- default InputStream formatImage(Img img, int maxWidth, int maxHeight, BufferedImage watermark) {
- try {
- int w = img.getImg().getWidth(null);
- int h = img.getImg().getHeight(null);
- if (maxWidth > 0 && maxHeight > 0) {
- if (w > maxWidth || h > maxHeight) {
- int outWidth = 0;
- int outHeight = 0;
- outHeight = maxWidth * h / w;
- if (outHeight > maxHeight) {
- outHeight = maxHeight;
- outWidth = outHeight * w / h;
- } else {
- outWidth = maxWidth;
- }
- img = img.scale(outWidth, outHeight);
- w = outWidth;
- h = outHeight;
-
- }
- }
-
-
- if (watermark != null) {
- int ww = watermark.getWidth(null);
- int wh = watermark.getHeight(null);
- if (w > ww && h > wh) {
- img = img.pressImage(watermark, 0, 0, 1f);
- }
- }
-
- ByteArrayOutputStream pout = new ByteArrayOutputStream();
-
- img.setTargetImageType(IMAGE_WEBP).write(pout);
-
- ByteArrayInputStream pin = new ByteArrayInputStream(pout.toByteArray());
- pout.close();
- pout = null;
- return pin;
- } catch (Exception e) {
- throw new RuntimeException("处理图片错误", e);
- }
- }
-
-
- /**
- *
- * - 根据存放规则和文件名生成存放的URI
- * - 支持
- * - {yyyy}/{MM}/{dd}/{HH}/{mm}/{ss} 年月日时分秒
- * - {UUID} 32位的唯一标志
- * - {i} 自增id
- * - {id} 当日int类型的唯一id,防止重复建议+年月日路径
- * - {id16} 当日int类型的唯一id16进制表示,防止重复建议+年月日路径
- * - {id36} 当日int类型的唯一id36进制表示,防止重复建议+年月日路径
- * - {filename} 文件基础名称
- * - {ext} 扩展名
- *
- *
- * @param rule
- * @param filename
- * @return
- */
- default String generateURI(String rule, String filename) {
- Calendar c = Calendar.getInstance();
- if (rule.contains("{yyyy}")) {
- rule = rule.replace("{yyyy}", "" + c.get(Calendar.YEAR));
- }
- if (rule.contains("{MM}")) {
- rule = rule.replace("{MM}", String.format("%02d", c.get(Calendar.MONTH) + 1));
- }
- if (rule.contains("{dd}")) {
- rule = rule.replace("{dd}", String.format("%02d", c.get(Calendar.DATE)));
- }
- if (rule.contains("{HH}")) {
- rule = rule.replace("{HH}", String.format("%02d", c.get(Calendar.HOUR_OF_DAY)));
- }
- if (rule.contains("{mm}")) {
- rule = rule.replace("{mm}", String.format("%02d", c.get(Calendar.MINUTE)));
- }
- if (rule.contains("{ss}")) {
- rule = rule.replace("{ss}", String.format("%02d", c.get(Calendar.SECOND)));
- }
- if (rule.contains("{UUID}")) {
- rule = rule.replace("{UUID}", UUID.fastUUID().toString(true));
- }
- if (rule.contains("{i}")) {
- rule = rule.replace("{i}", IdUtils.nextId(Id.groupName).toString());
- }
- if (rule.contains("{id}")) {
- rule = rule.replace("{id}", Long.toString(id.nextId()));
- }
- if (rule.contains("{id16}")) {
- rule = rule.replace("{id16}", Long.toString(id.nextId(), 16));
- }
- if (rule.contains("{id36}")) {
- rule = rule.replace("{id36}", Long.toString(id.nextId(), 36));
- }
- if (rule.contains("{filename}")) {
- String temp = null;
- if (filename.contains(".")) {
- temp = filename.substring(0, filename.lastIndexOf("."));
- } else {
- temp = filename;
- }
- rule = rule.replace("{filename}", temp);
- }
-
- if (rule.contains("{ext}")) {
- String temp = null;
- if (filename.contains(".")) {
- temp = filename.substring(filename.lastIndexOf(".") + 1);
- } else {
- temp = "";
- }
- rule = rule.replace("{ext}", temp.toLowerCase());
- }
- return rule;
- }
-
- Id id = new Id();
-
- static class Id {
-
- private static final String groupName = "file:id";
-
- private SymmetricCrypto crypto;
-
- private String today = DateUtil.today();
-
- public synchronized Long nextId() {
- if (crypto == null || !today.equals(DateUtil.today())) {
- today = DateUtil.today();
- byte[] key = SecureUtil.generateKey(SymmetricAlgorithm.DES.getValue(), today.getBytes()).getEncoded();
- crypto = new SymmetricCrypto(SymmetricAlgorithm.DES, key);
- }
- ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES);
- buffer.putInt(IdUtils.nextDayId(groupName).intValue());
- return Math.abs(ByteBuffer.wrap(crypto.encrypt(buffer.array())).getLong());
- }
-
- }
-
-// public static void main(String[] args) {
-// byte[] key = SecureUtil.generateKey(SymmetricAlgorithm.DES.getValue(),DateUtil.today().getBytes()).getEncoded();
-// System.out.println(HexUtil.encodeHexStr(key));
-//// byte[] key = HexUtil.decodeHex("a359f3fe88445c192f20d573c80af163");
-// SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.DES, key);
-//
-//
-// ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES);
-//
-// System.out.println(buffer.array().length);
-// System.out.println(aes.encrypt(buffer.array()).length);
-// buffer.clear();
-// buffer.putInt(1);
-// System.out.println(ByteBuffer.wrap(aes.encrypt(buffer.array())).getLong());
-// buffer.clear();
-// buffer.putInt(2);
-// System.out.println(ByteBuffer.wrap(aes.encrypt(buffer.array())).getLong());
-// buffer.clear();
-// buffer.putInt(3);
-// System.out.println(ByteBuffer.wrap(aes.encrypt(buffer.array())).getLong());
-// }
-
- SysOssVo url(SysOssVo oss, int second);
-
- default SysOssVo url(SysOssVo oss) {
- return url(oss, 120);
- }
-
- String url(Service service,String url,int second);
-
- default String url(Service service,String url) {
- return url(service,url, 120);
- }
-}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java
index 21fdd61..cfd3a89 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java
@@ -8,7 +8,6 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.Constants;
@@ -16,11 +15,9 @@ import com.ruoyi.common.core.domain.event.LogininforEvent;
import com.ruoyi.common.core.domain.dto.RoleDTO;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
-import com.ruoyi.common.core.domain.model.XcxLoginUser;
import com.ruoyi.common.enums.DeviceType;
import com.ruoyi.common.enums.LoginType;
import com.ruoyi.common.enums.UserStatus;
-import com.ruoyi.common.enums.UserType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.user.CaptchaException;
import com.ruoyi.common.exception.user.CaptchaExpireException;
@@ -63,8 +60,6 @@ public class SysLoginService {
private final IdentifierGenerator id;
- private final ISysOssService ossService;
-
private final RuoYiConfig config;
@@ -139,7 +134,7 @@ public class SysLoginService {
}
String url = null;
try {
- url = ossService.uploadImgs(avatar,"avatar",400,400,null).getUrl();
+// url = ossService.uploadImgs(avatar,"avatar",400,400,null).getUrl();
}catch (Exception e){
log.debug("保存头像失败",e);
// throw new RuntimeException("保存头像失败",e);
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FileServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FileServiceImpl.java
deleted file mode 100644
index 1470632..0000000
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FileServiceImpl.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.ruoyi.system.service.impl;
-
-import cn.hutool.core.io.IoUtil;
-import cn.hutool.core.util.StrUtil;
-import com.ruoyi.common.config.RuoYiConfig;
-import com.ruoyi.system.service.FileService;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-
-/**
- *
- * - 文件存储的本地存储实现
- * Author : J.L.Zhou
- * E-Mail : 2233875735@qq.com
- * Tel : 151 1104 7708
- * Date : 2021-09-16 14:17
- * Version : 1.0
- * Copyright 2021 jlzhou.top Inc. All rights reserved.
- * Warning: this content is only for internal circulation of the company.
- * It is forbidden to divulge it or use it for other commercial purposes.
- *
- **/
-@Service("upload")
-@RequiredArgsConstructor
-@Slf4j
-public class FileServiceImpl implements FileService {
-
- public final RuoYiConfig config;
-
- @Override
- public void delete(String filename) {
- if (StrUtil.isEmpty(filename)) {
- throw new RuntimeException("文件名不能为空");
- }
- try {
- if (filename.startsWith(config.upload.pre)) {
- filename = filename.substring(config.upload.pre.length());
- }
- if (filename.indexOf("?") > -1) {
- filename = filename.substring(0, filename.indexOf("?"));
- }
- File file = new File(config.upload.savePath, filename);
- log.debug("file:"+file.exists());
- file.delete();
- log.info("删除:{}",file.getAbsolutePath());
- } catch (Exception e) {
- throw new RuntimeException("删除错误", e);
- }
- }
-
- @Override
- public File getFile(String filename) {
- if (StrUtil.isEmpty(filename)) {
- throw new RuntimeException("文件名不能为空");
- }
-
- if (filename.startsWith(config.upload.pre)) {
- filename = filename.substring(config.upload.pre.length());
- }
- if (filename.indexOf("?") > -1) {
- filename = filename.substring(0, filename.indexOf("?"));
- }
- return new File(config.upload.savePath, filename);
- }
-
- @Override
- public String save(InputStream in, String filename) {
- File file = new File(config.upload.savePath, filename);
- file.getParentFile().mkdirs();
- try(
- FileOutputStream out = new FileOutputStream(file);
- ) {
- IoUtil.copy(in, out);
- return config.upload.pre + "/" + filename;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java
deleted file mode 100644
index 2e90e50..0000000
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssConfigServiceImpl.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package com.ruoyi.system.service.impl;
-
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.common.constant.CacheNames;
-import com.ruoyi.common.core.domain.PageQuery;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.exception.ServiceException;
-import com.ruoyi.common.utils.JsonUtils;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.redis.CacheUtils;
-import com.ruoyi.common.utils.redis.RedisUtils;
-import com.ruoyi.oss.constant.OssConstant;
-import com.ruoyi.system.domain.SysOssConfig;
-import com.ruoyi.system.domain.bo.SysOssConfigBo;
-import com.ruoyi.system.domain.vo.SysOssConfigVo;
-import com.ruoyi.system.mapper.SysOssConfigMapper;
-import com.ruoyi.system.service.ISysOssConfigService;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.Collection;
-import java.util.List;
-
-/**
- * 对象存储配置Service业务层处理
- *
- * @author Lion Li
- * @author 孤舟烟雨
- * @date 2021-08-13
- */
-@Slf4j
-@RequiredArgsConstructor
-@Service
-public class SysOssConfigServiceImpl implements ISysOssConfigService {
-
- private final SysOssConfigMapper baseMapper;
-
- /**
- * 项目启动时,初始化参数到缓存,加载配置类
- */
- @Override
- public void init() {
- List list = baseMapper.selectList();
- // 加载OSS初始化配置
- for (SysOssConfig config : list) {
- String configKey = config.getConfigKey();
- if ("0".equals(config.getStatus())) {
- RedisUtils.setCacheObject(OssConstant.DEFAULT_CONFIG_KEY, configKey);
- }
- CacheUtils.put(CacheNames.SYS_OSS_CONFIG, config.getConfigKey(), JsonUtils.toJsonString(config));
- }
- }
-
- @Override
- public SysOssConfigVo queryById(Long ossConfigId) {
- return baseMapper.selectVoById(ossConfigId);
- }
-
- @Override
- public TableDataInfo queryPageList(SysOssConfigBo bo, PageQuery pageQuery) {
- LambdaQueryWrapper lqw = buildQueryWrapper(bo);
- Page result = baseMapper.selectVoPage(pageQuery.build(), lqw);
- return TableDataInfo.build(result);
- }
-
-
- private LambdaQueryWrapper buildQueryWrapper(SysOssConfigBo bo) {
- LambdaQueryWrapper lqw = Wrappers.lambdaQuery();
- lqw.eq(StringUtils.isNotBlank(bo.getConfigKey()), SysOssConfig::getConfigKey, bo.getConfigKey());
- lqw.like(StringUtils.isNotBlank(bo.getBucketName()), SysOssConfig::getBucketName, bo.getBucketName());
- lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysOssConfig::getStatus, bo.getStatus());
- return lqw;
- }
-
- @Override
- public Boolean insertByBo(SysOssConfigBo bo) {
- SysOssConfig config = BeanUtil.toBean(bo, SysOssConfig.class);
- validEntityBeforeSave(config);
- boolean flag = baseMapper.insert(config) > 0;
- if (flag) {
- CacheUtils.put(CacheNames.SYS_OSS_CONFIG, config.getConfigKey(), JsonUtils.toJsonString(config));
- }
- return flag;
- }
-
- @Override
- public Boolean updateByBo(SysOssConfigBo bo) {
- SysOssConfig config = BeanUtil.toBean(bo, SysOssConfig.class);
- validEntityBeforeSave(config);
- LambdaUpdateWrapper luw = new LambdaUpdateWrapper<>();
- luw.set(ObjectUtil.isNull(config.getPrefix()), SysOssConfig::getPrefix, "");
- luw.set(ObjectUtil.isNull(config.getRegion()), SysOssConfig::getRegion, "");
- luw.set(ObjectUtil.isNull(config.getExt1()), SysOssConfig::getExt1, "");
- luw.set(ObjectUtil.isNull(config.getRemark()), SysOssConfig::getRemark, "");
- luw.eq(SysOssConfig::getOssConfigId, config.getOssConfigId());
- boolean flag = baseMapper.update(config, luw) > 0;
- if (flag) {
- CacheUtils.put(CacheNames.SYS_OSS_CONFIG, config.getConfigKey(), JsonUtils.toJsonString(config));
- }
- return flag;
- }
-
- /**
- * 保存前的数据校验
- */
- private void validEntityBeforeSave(SysOssConfig entity) {
- if (StringUtils.isNotEmpty(entity.getConfigKey()) && !checkConfigKeyUnique(entity)) {
- throw new ServiceException("操作配置'" + entity.getConfigKey() + "'失败, 配置key已存在!");
- }
- }
-
- @Override
- public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) {
- if (isValid) {
- if (CollUtil.containsAny(ids, OssConstant.SYSTEM_DATA_IDS)) {
- throw new ServiceException("系统内置, 不可删除!");
- }
- }
- List list = CollUtil.newArrayList();
- for (Long configId : ids) {
- SysOssConfig config = baseMapper.selectById(configId);
- list.add(config);
- }
- boolean flag = baseMapper.deleteBatchIds(ids) > 0;
- if (flag) {
- list.forEach(sysOssConfig ->
- CacheUtils.evict(CacheNames.SYS_OSS_CONFIG, sysOssConfig.getConfigKey()));
- }
- return flag;
- }
-
- /**
- * 判断configKey是否唯一
- */
- private boolean checkConfigKeyUnique(SysOssConfig sysOssConfig) {
- long ossConfigId = ObjectUtil.isNull(sysOssConfig.getOssConfigId()) ? -1L : sysOssConfig.getOssConfigId();
- SysOssConfig info = baseMapper.selectOne(new LambdaQueryWrapper()
- .select(SysOssConfig::getOssConfigId, SysOssConfig::getConfigKey)
- .eq(SysOssConfig::getConfigKey, sysOssConfig.getConfigKey()));
- if (ObjectUtil.isNotNull(info) && info.getOssConfigId() != ossConfigId) {
- return false;
- }
- return true;
- }
-
- /**
- * 启用禁用状态
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public int updateOssConfigStatus(SysOssConfigBo bo) {
- SysOssConfig sysOssConfig = BeanUtil.toBean(bo, SysOssConfig.class);
- int row = baseMapper.update(null, new LambdaUpdateWrapper()
- .set(SysOssConfig::getStatus, "1"));
- row += baseMapper.updateById(sysOssConfig);
- if (row > 0) {
- RedisUtils.setCacheObject(OssConstant.DEFAULT_CONFIG_KEY, sysOssConfig.getConfigKey());
- }
- return row;
- }
-
-}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssServiceImpl.java
deleted file mode 100644
index 9cb69b3..0000000
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOssServiceImpl.java
+++ /dev/null
@@ -1,399 +0,0 @@
-package com.ruoyi.system.service.impl;
-
-import cn.hutool.core.convert.Convert;
-import cn.hutool.core.io.IoUtil;
-import cn.hutool.core.io.file.FileNameUtil;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.common.constant.CacheNames;
-import com.ruoyi.common.core.domain.PageQuery;
-import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.core.service.OssService;
-import com.ruoyi.common.exception.ServiceException;
-import com.ruoyi.common.utils.BeanCopyUtils;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.file.FileUtils;
-import com.ruoyi.common.utils.spring.SpringUtils;
-import com.ruoyi.oss.core.OssClient;
-import com.ruoyi.oss.entity.UploadResult;
-import com.ruoyi.oss.enumd.AccessPolicyType;
-import com.ruoyi.oss.factory.OssFactory;
-import com.ruoyi.system.domain.SysOss;
-import com.ruoyi.system.domain.bo.SysOssBo;
-import com.ruoyi.system.domain.vo.SysOssVo;
-import com.ruoyi.system.mapper.SysOssMapper;
-import com.ruoyi.system.service.FileService;
-import com.ruoyi.system.service.ISysConfigService;
-import com.ruoyi.system.service.ISysOssService;
-import lombok.RequiredArgsConstructor;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.http.MediaType;
-import org.springframework.stereotype.Service;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletResponse;
-import java.awt.image.BufferedImage;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.*;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-
-/**
- * 文件上传 服务层实现
- *
- * @author Lion Li
- */
-@RequiredArgsConstructor
-@Service
-public class SysOssServiceImpl implements ISysOssService, OssService {
-
- private static final String UPLOAD = "UPLOAD";
- private final ISysConfigService configService;
- private final FileService fileService;
- private final SysOssMapper baseMapper;
- private static ThreadLocal IGNORE_THREAD_LOCAL = new ThreadLocal<>();
- private static ThreadLocal SERVICE_THREAD_LOCAL = new ThreadLocal<>();
-
- @Override
- public void setService(Service service, Runnable handle) {
- SERVICE_THREAD_LOCAL.set(service);
- try {
- handle.run();
- } finally {
- SERVICE_THREAD_LOCAL.remove();
- }
- }
-
- @Override
- public T setService(Service service, Supplier handle) {
- SERVICE_THREAD_LOCAL.set(service);
- try {
- return handle.get();
- } finally {
- SERVICE_THREAD_LOCAL.remove();
- }
- }
-
- @Override
- public void ignore(Runnable handle) {
- IGNORE_THREAD_LOCAL.set(true);
- try {
- handle.run();
- } finally {
- IGNORE_THREAD_LOCAL.remove();
- }
- }
-
- @Override
- public T ignore(Supplier handle) {
- IGNORE_THREAD_LOCAL.set(true);
- try {
- return handle.get();
- } finally {
- IGNORE_THREAD_LOCAL.remove();
- }
- }
-
- @Override
- public TableDataInfo queryPageList(SysOssBo bo, PageQuery pageQuery) {
- LambdaQueryWrapper lqw = buildQueryWrapper(bo);
- Page result = baseMapper.selectVoPage(pageQuery.build(), lqw);
- List filterResult = result.getRecords().stream().map(this::url).collect(Collectors.toList());
- result.setRecords(filterResult);
- return TableDataInfo.build(result);
- }
-
- @Override
- public List listByIds(Collection ossIds) {
- List list = new ArrayList<>();
- for (Long id : ossIds) {
- SysOssVo vo = SpringUtils.getBean(ISysOssService.class).getById(id);
- if (ObjectUtil.isNotNull(vo)) {
- list.add(this.url(vo));
- }
- }
- return list;
- }
-
- @Override
- public String selectUrlByIds(String ossIds) {
- List list = new ArrayList<>();
- for (Long id : StringUtils.splitTo(ossIds, Convert::toLong)) {
- SysOssVo vo = SpringUtils.getBean(ISysOssService.class).getById(id);
- if (ObjectUtil.isNotNull(vo)) {
- list.add(this.url(vo).getUrl());
- }
- }
- return String.join(StringUtils.SEPARATOR, list);
- }
-
- private LambdaQueryWrapper buildQueryWrapper(SysOssBo bo) {
- Map params = bo.getParams();
- LambdaQueryWrapper lqw = Wrappers.lambdaQuery();
- lqw.like(StringUtils.isNotBlank(bo.getFileName()), SysOss::getFileName, bo.getFileName());
- lqw.like(StringUtils.isNotBlank(bo.getOriginalName()), SysOss::getOriginalName, bo.getOriginalName());
- lqw.eq(StringUtils.isNotBlank(bo.getFileSuffix()), SysOss::getFileSuffix, bo.getFileSuffix());
- lqw.eq(StringUtils.isNotBlank(bo.getUrl()), SysOss::getUrl, bo.getUrl());
- lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
- SysOss::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
- lqw.eq(StringUtils.isNotBlank(bo.getCreateBy()), SysOss::getCreateBy, bo.getCreateBy());
- lqw.eq(StringUtils.isNotBlank(bo.getService()), SysOss::getService, bo.getService());
- return lqw;
- }
-
- @Cacheable(cacheNames = CacheNames.SYS_OSS, key = "#ossId")
- @Override
- public SysOssVo getById(Long ossId) {
- return baseMapper.selectVoById(ossId);
- }
-
- @Override
- public void download(Long ossId, HttpServletResponse response) throws IOException {
- SysOssVo sysOss = SpringUtils.getBean(ISysOssService.class).getById(ossId);
- if (ObjectUtil.isNull(sysOss)) {
- throw new ServiceException("文件数据不存在!");
- }
- FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName());
- response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8");
- if (UPLOAD.equals(sysOss.getService())) {
- try (InputStream inputStream = new FileInputStream(fileService.getFile(sysOss.getUrl()))) {
- int available = inputStream.available();
- IoUtil.copy(inputStream, response.getOutputStream());
- response.setContentLength(available);
- } catch (Exception e) {
- throw new ServiceException(e.getMessage());
- }
- } else {
- OssClient storage = OssFactory.instance(sysOss.getService());
- try (InputStream inputStream = storage.getObjectContent(sysOss.getUrl())) {
- int available = inputStream.available();
- IoUtil.copy(inputStream, response.getOutputStream());
- response.setContentLength(available);
- } catch (Exception e) {
- throw new ServiceException(e.getMessage());
- }
- }
- }
-
- public void download(String url, Service service, HttpServletResponse response) throws IOException {
- FileUtils.setAttachmentResponseHeader(response, FileNameUtil.getName(url));
- response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8");
- if (UPLOAD.equalsIgnoreCase(service.name())) {
- try (InputStream inputStream = new FileInputStream(fileService.getFile(url))) {
- int available = inputStream.available();
- IoUtil.copy(inputStream, response.getOutputStream());
- response.setContentLength(available);
- } catch (Exception e) {
- throw new ServiceException(e.getMessage());
- }
- } else {
- OssClient storage = OssFactory.instance(service.name());
- try (InputStream inputStream = storage.getObjectContent(url)) {
- int available = inputStream.available();
- IoUtil.copy(inputStream, response.getOutputStream());
- response.setContentLength(available);
- } catch (Exception e) {
- throw new ServiceException(e.getMessage());
- }
- }
- }
-
- @Override
- public InputStream download(Long ossId) throws IOException {
- SysOssVo sysOss = SpringUtils.getBean(ISysOssService.class).getById(ossId);
- return download(sysOss);
- }
-
- @Override
- public InputStream download(SysOssVo sysOss) throws IOException {
- if (ObjectUtil.isNull(sysOss)) {
- throw new ServiceException("文件数据不存在!");
- }
- if (UPLOAD.equals(sysOss.getService())) {
- return new FileInputStream(fileService.getFile(sysOss.getUrl()));
- } else {
- OssClient storage = OssFactory.instance(sysOss.getService());
- return storage.getObjectContent(sysOss.getUrl());
- }
- }
-
- @Override
- public InputStream download(String url, Service service) throws IOException {
- if (UPLOAD.equalsIgnoreCase(service.name())) {
- return new FileInputStream(fileService.getFile(url));
- } else {
- OssClient storage = OssFactory.instance(service.name());
- return storage.getObjectContent(url);
- }
- }
-
-
- @Override
- public SysOssVo save(InputStream in, String originalFileName, String contentType, String pre, String rule) {
- String suffix = StringUtils.substring(originalFileName, originalFileName.lastIndexOf("."), originalFileName.length());
- SysOss oss = new SysOss();
- oss.setOriginalName(originalFileName);
- oss.setFileSuffix(suffix);
- if (configService.selectOssEnabled()) {
- OssClient storage = SERVICE_THREAD_LOCAL.get() == null ? OssFactory.instance() : OssFactory.instance(SERVICE_THREAD_LOCAL.get().name());
- UploadResult uploadResult;
- try {
- String path = "";
- if (StrUtil.isNotBlank(storage.getProperties().getPrefix())) {
- path += storage.getProperties().getPrefix() + "/";
-
- }
- if (StrUtil.isBlank(pre)) {
- pre = PRE_DEFAULT;
- }
- path += pre + "/" + generateURI(rule, originalFileName);
- uploadResult = storage.upload(in, path, contentType);
- } catch (Exception e) {
- throw new RuntimeException(e.getMessage(), e);
- }
- // 保存文件信息
-
- oss.setUrl(uploadResult.getUrl());
- oss.setFileName(uploadResult.getFilename());
- oss.setService(storage.getConfigKey());
-
- } else {
- try {
- String url = fileService.save(in, originalFileName, pre);
- oss.setUrl(url);
- oss.setFileName(url);
- oss.setService(UPLOAD);
- } catch (Exception e) {
- throw new RuntimeException("保存文件失败", e);
- }
- }
- if (IGNORE_THREAD_LOCAL.get() == null) {
- baseMapper.insert(oss);
- }
-
- SysOssVo sysOssVo = new SysOssVo();
- BeanCopyUtils.copy(oss, sysOssVo);
- return sysOssVo;
- }
-
- public SysOssVo uploadImgs(MultipartFile file, String pre) {
- return uploadImgs(file, pre, configService.selectImageMaxWidth(), configService.selectImageMaxHeight(), configService.getWatermark());
- }
-
- @Override
- public SysOssVo uploadImgs(InputStream inputStream, String pre, int maxWidth, int maxHeight, BufferedImage watermark) {
- String originalFileName = "temp.webp";
- String suffix = StringUtils.substring(originalFileName, originalFileName.lastIndexOf("."), originalFileName.length());
- SysOss oss = new SysOss();
- oss.setFileSuffix(suffix);
- oss.setOriginalName(originalFileName);
- if (configService.selectOssEnabled()) {
-
- OssClient storage = SERVICE_THREAD_LOCAL.get() == null ? OssFactory.instance() : OssFactory.instance(SERVICE_THREAD_LOCAL.get().name());
- UploadResult uploadResult;
-
- try (
- InputStream in = formatImage(inputStream, maxWidth, maxWidth, watermark)
- ) {
- String path = "";
- if (StrUtil.isNotBlank(storage.getProperties().getPrefix())) {
-
- path += storage.getProperties().getPrefix() + "/";
-
- }
- if (StrUtil.isNotBlank(pre)) {
- path += pre + "/";
- }
- path += generateURI("{yyyy}/{MM}/{dd}/{id36}.webp", "a.webp");
-
- uploadResult = storage.upload(in, path, "image/webp");
- } catch (IOException e) {
- throw new RuntimeException(e.getMessage(), e);
- }
- // 保存文件信息
-
- oss.setUrl(uploadResult.getUrl());
- oss.setFileName(uploadResult.getFilename());
- oss.setService(storage.getConfigKey());
- } else {
- try (
- InputStream in = formatImage(inputStream, maxWidth, maxWidth, watermark)
- ) {
- String url = fileService.save(in, originalFileName + ".webp", pre);
- oss.setUrl(url);
- oss.setFileName(url);
- oss.setService(UPLOAD);
- } catch (IOException e) {
- throw new RuntimeException(e.getMessage(), e);
- }
- }
- if (IGNORE_THREAD_LOCAL.get() == null) {
- baseMapper.insert(oss);
- }
- SysOssVo sysOssVo = new SysOssVo();
- BeanCopyUtils.copy(oss, sysOssVo);
- return sysOssVo;
- }
-
- @Override
- public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) {
- if (isValid) {
- // 做一些业务上的校验,判断是否需要校验
- }
- List list = baseMapper.selectBatchIds(ids);
- for (SysOss sysOss : list) {
- if (UPLOAD.equals(sysOss.getService())) {
- fileService.delete(sysOss.getUrl());
- } else {
- OssClient storage = OssFactory.instance(sysOss.getService());
- storage.delete(sysOss.getUrl());
- }
- }
- return baseMapper.deleteBatchIds(ids) > 0;
- }
-
- @Override
- public SysOssVo url(SysOssVo oss, int second) {
- if (UPLOAD.equals(oss.getService())) {
- return oss;
- } else {
- oss.setUrl(query(oss.getService(), oss.getUrl(), second));
- return oss;
- }
- }
-
- private String query(String service, String url, int second) {
- OssClient storage = OssFactory.instance(service);
- // 仅修改桶类型为 private 的URL,临时URL时长为120s
- if (AccessPolicyType.PRIVATE == storage.getAccessPolicy()) {
- String old = url;
- if (url.indexOf("://") > -1) {
- url = url.substring(url.indexOf("/", url.indexOf("//") + 2));
- }
- if (url.startsWith("/")) {
- url = url.substring(1);
- }
- url = url.substring(url.indexOf("/") + 1);
-
- String queryString = storage.getPrivateUrl(url, second);
- queryString = queryString.substring(queryString.indexOf("?"));
- return old + queryString;
- }
- return url;
- }
-
- @Override
- public String url(Service service, String url, int second) {
- if (Service.upload.equals(service)) {
- return url;
- } else {
- return query(service.name(), url, second);
- }
- }
-
-}
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysOssConfigMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysOssConfigMapper.xml
deleted file mode 100644
index 77dc40e..0000000
--- a/ruoyi-system/src/main/resources/mapper/system/SysOssConfigMapper.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysOssMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysOssMapper.xml
deleted file mode 100644
index a1e4ca8..0000000
--- a/ruoyi-system/src/main/resources/mapper/system/SysOssMapper.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ruoyi.sql b/ruoyi.sql
index d337b21..cea197e 100644
--- a/ruoyi.sql
+++ b/ruoyi.sql
@@ -11,7 +11,7 @@
Target Server Version : 100617
File Encoding : 65001
- Date: 11/10/2024 17:51:13
+ Date: 24/10/2024 17:46:10
*/
SET NAMES utf8mb4;
@@ -209,6 +209,14 @@ CREATE TABLE `sys_logininfor` (
-- Records of sys_logininfor
-- ----------------------------
INSERT INTO `sys_logininfor` VALUES (20241011000000001, 'admin', '127.0.0.1', '内网IP', 'MSEdge', 'Windows 10 or Windows Server 2016', '0', '登录成功', '2024-10-11 17:28:10');
+INSERT INTO `sys_logininfor` VALUES (20241012000000001, 'admin', '127.0.0.1', '内网IP', 'MSEdge', 'Windows 10 or Windows Server 2016', '0', '登录成功', '2024-10-12 17:19:10');
+INSERT INTO `sys_logininfor` VALUES (20241014000000001, 'admin', '127.0.0.1', '内网IP', 'MSEdge', 'Windows 10 or Windows Server 2016', '0', '登录成功', '2024-10-14 09:04:16');
+INSERT INTO `sys_logininfor` VALUES (20241022000000001, 'admin', '127.0.0.1', '内网IP', 'MSEdge', 'Windows 10 or Windows Server 2016', '0', '登录成功', '2024-10-22 10:58:47');
+INSERT INTO `sys_logininfor` VALUES (20241022000000002, 'admin', '127.0.0.1', '内网IP', 'MSEdge', 'Windows 10 or Windows Server 2016', '0', '登录成功', '2024-10-22 14:04:30');
+INSERT INTO `sys_logininfor` VALUES (20241023000000001, 'admin', '127.0.0.1', '内网IP', 'MSEdge', 'Windows 10 or Windows Server 2016', '0', '登录成功', '2024-10-23 09:03:22');
+INSERT INTO `sys_logininfor` VALUES (20241023000000002, 'admin', '127.0.0.1', '内网IP', 'MSEdge', 'Windows 10 or Windows Server 2016', '0', '登录成功', '2024-10-23 15:11:46');
+INSERT INTO `sys_logininfor` VALUES (20241024000000001, 'admin', '127.0.0.1', '内网IP', 'MSEdge', 'Windows 10 or Windows Server 2016', '0', '登录成功', '2024-10-24 08:49:02');
+INSERT INTO `sys_logininfor` VALUES (20241024000000002, 'admin', '127.0.0.1', '内网IP', 'MSEdge', 'Windows 10 or Windows Server 2016', '0', '登录成功', '2024-10-24 14:27:40');
-- ----------------------------
-- Table structure for sys_menu
@@ -347,6 +355,7 @@ INSERT INTO `sys_menu` VALUES (2001, '定时任务查询', 2000, 1, '#', '', NUL
INSERT INTO `sys_menu` VALUES (2002, '定时任务新增', 2000, 2, '#', '', NULL, 1, 0, 'F', '0', '0', 'sys:cron:add', '#', 'admin', '2024-08-08 10:02:52', '', NULL, '');
INSERT INTO `sys_menu` VALUES (2003, '定时任务修改', 2000, 3, '#', '', NULL, 1, 0, 'F', '0', '0', 'sys:cron:update', '#', 'admin', '2024-08-08 10:02:52', '', NULL, '');
INSERT INTO `sys_menu` VALUES (2004, '定时任务删除', 2000, 4, '#', '', NULL, 1, 0, 'F', '0', '0', 'sys:cron:remove', '#', 'admin', '2024-08-08 10:02:52', '', NULL, '');
+INSERT INTO `sys_menu` VALUES (20241022000000001, '文件图片上传', 5, 99, 'file', 'demo/file/index', NULL, 1, 1, 'C', '0', '0', 'demo:file:index', 'upload', 'admin', '2024-10-22 11:01:10', 'admin', '2024-10-22 11:01:10', '');
-- ----------------------------
-- Table structure for sys_notice
@@ -426,63 +435,8 @@ INSERT INTO `sys_oper_log` VALUES (20241011000000016, '测试单表', 1, 'com.ru
INSERT INTO `sys_oper_log` VALUES (20241011000000017, '测试单表', 1, 'com.ruoyi.demo.controller.TestDemoController.add()', 'POST', 1, 'admin', '', '/demo/demo', '127.0.0.1', '内网IP', '{\"createBy\":\"admin\",\"createTime\":\"2023-08-16 10:35:31\",\"id\":1,\"deptId\":102,\"userId\":4,\"orderNum\":1,\"testKey\":\"测试数据权限\",\"value\":\"测试\"}', '', 1, '\r\n### Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry \'1\' for key \'PRIMARY\'\r\n### The error may exist in com/ruoyi/demo/mapper/TestDemoMapper.java (best guess)\r\n### The error may involve com.ruoyi.demo.mapper.TestDemoMapper.insert-Inline\r\n### The error occurred while setting parameters\r\n### SQL: INSERT INTO test_demo ( id, dept_id, user_id, create_user_id, login_ip, update_user_id, order_num, test_key, value, create_by, create_time, update_by, update_time ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )\r\n### Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry \'1\' for key \'PRIMARY\'\n; Duplicate entry \'1\' for key \'PRIMARY\'; nested exception is java.sql.SQLIntegrityConstraintViolationException: Duplicate entry \'1\' for key \'PRIMARY\'', '2024-10-11 17:49:26');
INSERT INTO `sys_oper_log` VALUES (20241011000000018, '测试单表', 1, 'com.ruoyi.demo.controller.TestDemoController.add()', 'POST', 1, 'admin', '', '/demo/demo', '127.0.0.1', '内网IP', '{\"createBy\":\"admin\",\"createTime\":\"2023-08-16 10:35:31\",\"id\":1,\"deptId\":102,\"userId\":4,\"orderNum\":1,\"testKey\":\"测试数据权限\",\"value\":\"测试\"}', '', 1, '\r\n### Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry \'1\' for key \'PRIMARY\'\r\n### The error may exist in com/ruoyi/demo/mapper/TestDemoMapper.java (best guess)\r\n### The error may involve com.ruoyi.demo.mapper.TestDemoMapper.insert-Inline\r\n### The error occurred while setting parameters\r\n### SQL: INSERT INTO test_demo ( id, dept_id, user_id, create_user_id, login_ip, update_user_id, order_num, test_key, value, create_by, create_time, update_by, update_time ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )\r\n### Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry \'1\' for key \'PRIMARY\'\n; Duplicate entry \'1\' for key \'PRIMARY\'; nested exception is java.sql.SQLIntegrityConstraintViolationException: Duplicate entry \'1\' for key \'PRIMARY\'', '2024-10-11 17:49:28');
INSERT INTO `sys_oper_log` VALUES (20241011000000019, '测试单表', 2, 'com.ruoyi.demo.controller.TestDemoController.edit()', 'PUT', 1, 'admin', '', '/demo/demo', '127.0.0.1', '内网IP', '{\"createBy\":\"admin\",\"createTime\":\"2023-08-16 10:35:31\",\"id\":1,\"deptId\":102,\"userId\":4,\"orderNum\":1,\"testKey\":\"测试数据权限\",\"value\":\"测试\"}', '{\"code\":200,\"msg\":\"操作成功\"}', 0, '', '2024-10-11 17:50:05');
-
--- ----------------------------
--- Table structure for sys_oss
--- ----------------------------
-DROP TABLE IF EXISTS `sys_oss`;
-CREATE TABLE `sys_oss` (
- `oss_id` bigint(20) NOT NULL COMMENT '对象存储主键',
- `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '文件名',
- `original_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '原名',
- `file_suffix` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '文件后缀名',
- `url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'URL地址',
- `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
- `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '上传人',
- `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
- `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新人',
- `service` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'minio' COMMENT '服务商',
- PRIMARY KEY (`oss_id`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'OSS对象存储表' ROW_FORMAT = Compact;
-
--- ----------------------------
--- Records of sys_oss
--- ----------------------------
-
--- ----------------------------
--- Table structure for sys_oss_config
--- ----------------------------
-DROP TABLE IF EXISTS `sys_oss_config`;
-CREATE TABLE `sys_oss_config` (
- `oss_config_id` bigint(20) NOT NULL COMMENT '主建',
- `config_key` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '配置key',
- `access_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'accessKey',
- `secret_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '秘钥',
- `bucket_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '桶名称',
- `prefix` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '前缀',
- `endpoint` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '访问站点',
- `domain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '自定义域名',
- `is_https` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '是否https(Y=是,N=否)',
- `region` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '域',
- `access_policy` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1' COMMENT '桶权限类型(0=private 1=public 2=custom)',
- `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '1' COMMENT '状态(0=正常,1=停用)',
- `ext1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '扩展字段',
- `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
- `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
- `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
- `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
- `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
- PRIMARY KEY (`oss_config_id`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '对象存储配置表' ROW_FORMAT = Dynamic;
-
--- ----------------------------
--- Records of sys_oss_config
--- ----------------------------
-INSERT INTO `sys_oss_config` VALUES (1, 'minio', 'base2024', 'base20241415926', 'files', '', '192.168.3.222:9000', '{root}', 'N', '', '1', '0', '', 'admin', '2023-04-28 11:22:31', 'admin', '2024-08-08 09:50:44', '正式环境中访问站点修改为minio:9000');
-INSERT INTO `sys_oss_config` VALUES (2, 'qiniu', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi', '', 's3-cn-north-1.qiniucs.com', '', 'N', '', '1', '1', '', 'admin', '2023-08-16 10:35:08', 'admin', '2023-08-16 10:35:08', NULL);
-INSERT INTO `sys_oss_config` VALUES (3, 'aliyun', 'LTAI5tQMkJBHbYoDcBBrc1Kv', '25MWcjkWRlqTD0pSJrthqXe05CpjWS', 'test-data-resources', 'xxx', 'oss-cn-shenzhen.aliyuncs.com', '', 'Y', '', '1', '1', '', 'admin', '2023-08-16 10:35:08', 'admin', '2024-05-17 08:29:25', '');
-INSERT INTO `sys_oss_config` VALUES (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'cos.ap-beijing.myqcloud.com', '', 'N', 'ap-beijing', '1', '1', '', 'admin', '2023-08-16 10:35:08', 'admin', '2023-08-16 10:35:08', NULL);
-INSERT INTO `sys_oss_config` VALUES (5, 'image', 'ruoyi', 'ruoyi123', 'ruoyi', 'image', '127.0.0.1:9000', '', 'N', '', '1', '1', '', 'admin', '2023-08-16 10:35:08', 'admin', '2023-08-16 10:35:08', NULL);
+INSERT INTO `sys_oper_log` VALUES (20241014000000020, '定时任务', 1, 'com.ruoyi.cron.api.CronTaskApi.add()', 'POST', 1, 'admin', '', '/system/cron/', '127.0.0.1', '内网IP', '{\"id\":202410140000001,\"taskId\":\"5553036b32681350546531d871d5edc9\",\"groupId\":0,\"enabled\":true,\"createTime\":\"2024-10-14 09:04\",\"paramELs\":[],\"userId\":1}', '', 0, '', '2024-10-14 09:04:34');
+INSERT INTO `sys_oper_log` VALUES (20241022000000021, '菜单管理', 1, 'com.ruoyi.web.controller.system.SysMenuController.add()', 'POST', 1, 'admin', '', '/system/menu', '127.0.0.1', '内网IP', '{\"createBy\":\"admin\",\"createTime\":\"2024-10-22 11:01:10\",\"updateBy\":\"admin\",\"updateTime\":\"2024-10-22 11:01:10\",\"parentId\":5,\"children\":[],\"menuId\":\"20241022000000001\",\"menuName\":\"文件图片上传\",\"orderNum\":99,\"path\":\"file\",\"component\":\"demo/file/index\",\"isFrame\":\"1\",\"isCache\":\"1\",\"menuType\":\"C\",\"visible\":\"0\",\"status\":\"0\",\"perms\":\"demo:file:index\",\"icon\":\"upload\"}', '{\"code\":200,\"msg\":\"操作成功\"}', 0, '', '2024-10-22 11:01:10');
-- ----------------------------
-- Table structure for sys_post
@@ -677,7 +631,7 @@ CREATE TABLE `sys_user` (
-- ----------------------------
-- Records of sys_user
-- ----------------------------
-INSERT INTO `sys_user` VALUES (1, 100, NULL, 'admin', '超级管理员', 'sys_user', 'admin@evolvecloud.cn', '13888888888', '1', '', '$2a$10$.ja7BDq5b8jxd6snbRvz8eAmg0loaDb05LR6SpR2F42huJb7GaOD6', '0', '0', '127.0.0.1', '2024-10-11 17:28:10', 'admin', '2024-01-03 10:35:07', 'admin', '2024-10-11 17:28:10', '管理员');
+INSERT INTO `sys_user` VALUES (1, 100, NULL, 'admin', '超级管理员', 'sys_user', 'admin@evolvecloud.cn', '13888888888', '1', '', '$2a$10$.ja7BDq5b8jxd6snbRvz8eAmg0loaDb05LR6SpR2F42huJb7GaOD6', '0', '0', '127.0.0.1', '2024-10-24 14:27:40', 'admin', '2024-01-03 10:35:07', 'admin', '2024-10-24 14:27:40', '管理员');
-- ----------------------------
-- Table structure for sys_user_post
diff --git a/script/docker/nginx/conf/nginx.conf b/script/docker/nginx/conf/nginx.conf
index 9bcc263..1ab66c5 100644
--- a/script/docker/nginx/conf/nginx.conf
+++ b/script/docker/nginx/conf/nginx.conf
@@ -33,14 +33,6 @@ http {
}
- upstream monitor-admin {
- server 127.0.0.1:9090;
- }
-
- upstream xxljob-admin {
- server 127.0.0.1:9100;
- }
-
server {
listen 80;
server_name localhost;
@@ -68,10 +60,7 @@ http {
# return 200 '{"msg":"演示模式,不允许操作","code":500}';
# }
- # 限制外网访问内网 actuator 相关路径
- location ~ ^(/[^/]*)?/actuator(/.*)?$ {
- return 403;
- }
+
location / {
root /usr/share/nginx/html;