mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	update 同步 ruoyi 适配改动
This commit is contained in:
		@@ -10,7 +10,7 @@ import com.ruoyi.common.core.controller.BaseController;
 | 
				
			|||||||
import com.ruoyi.common.core.domain.AjaxResult;
 | 
					import com.ruoyi.common.core.domain.AjaxResult;
 | 
				
			||||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
					import com.ruoyi.common.core.page.TableDataInfo;
 | 
				
			||||||
import com.ruoyi.common.enums.BusinessType;
 | 
					import com.ruoyi.common.enums.BusinessType;
 | 
				
			||||||
import com.ruoyi.common.exception.CustomException;
 | 
					import com.ruoyi.common.exception.ServiceException;
 | 
				
			||||||
import com.ruoyi.common.utils.JsonUtils;
 | 
					import com.ruoyi.common.utils.JsonUtils;
 | 
				
			||||||
import com.ruoyi.common.utils.file.FileUtils;
 | 
					import com.ruoyi.common.utils.file.FileUtils;
 | 
				
			||||||
import com.ruoyi.oss.constant.CloudConstant;
 | 
					import com.ruoyi.oss.constant.CloudConstant;
 | 
				
			||||||
@@ -79,7 +79,7 @@ public class SysOssController extends BaseController {
 | 
				
			|||||||
	@PostMapping("/upload")
 | 
						@PostMapping("/upload")
 | 
				
			||||||
	public AjaxResult<Map<String, String>> upload(@RequestPart("file") MultipartFile file) {
 | 
						public AjaxResult<Map<String, String>> upload(@RequestPart("file") MultipartFile file) {
 | 
				
			||||||
		if (file.isEmpty()) {
 | 
							if (file.isEmpty()) {
 | 
				
			||||||
			throw new CustomException("上传文件不能为空");
 | 
								throw new ServiceException("上传文件不能为空");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		SysOss oss = iSysOssService.upload(file);
 | 
							SysOss oss = iSysOssService.upload(file);
 | 
				
			||||||
		Map<String, String> map = new HashMap<>(2);
 | 
							Map<String, String> map = new HashMap<>(2);
 | 
				
			||||||
@@ -94,7 +94,7 @@ public class SysOssController extends BaseController {
 | 
				
			|||||||
	public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException {
 | 
						public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException {
 | 
				
			||||||
		SysOss sysOss = iSysOssService.getById(ossId);
 | 
							SysOss sysOss = iSysOssService.getById(ossId);
 | 
				
			||||||
		if (sysOss == null) {
 | 
							if (sysOss == null) {
 | 
				
			||||||
			throw new CustomException("文件数据不存在!");
 | 
								throw new ServiceException("文件数据不存在!");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		response.reset();
 | 
							response.reset();
 | 
				
			||||||
		response.addHeader("Access-Control-Allow-Origin", "*");
 | 
							response.addHeader("Access-Control-Allow-Origin", "*");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package com.ruoyi.framework.config;
 | 
					package com.ruoyi.framework.config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.ruoyi.common.exception.CustomException;
 | 
					import com.ruoyi.common.exception.ServiceException;
 | 
				
			||||||
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
 | 
					import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Qualifier;
 | 
					import org.springframework.beans.factory.annotation.Qualifier;
 | 
				
			||||||
@@ -41,7 +41,7 @@ public class AsyncConfig extends AsyncConfigurerSupport {
 | 
				
			|||||||
    public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
 | 
					    public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
 | 
				
			||||||
        return (throwable, method, objects) -> {
 | 
					        return (throwable, method, objects) -> {
 | 
				
			||||||
            throwable.printStackTrace();
 | 
					            throwable.printStackTrace();
 | 
				
			||||||
            throw new CustomException(
 | 
					            throw new ServiceException(
 | 
				
			||||||
                    "Exception message - " + throwable.getMessage()
 | 
					                    "Exception message - " + throwable.getMessage()
 | 
				
			||||||
                    + ", Method name - " + method.getName()
 | 
					                    + ", Method name - " + method.getName()
 | 
				
			||||||
                    + ", Parameter value - " + Arrays.toString(objects));
 | 
					                    + ", Parameter value - " + Arrays.toString(objects));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@ package com.ruoyi.framework.mybatisplus;
 | 
				
			|||||||
import cn.hutool.http.HttpStatus;
 | 
					import cn.hutool.http.HttpStatus;
 | 
				
			||||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
 | 
					import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
 | 
				
			||||||
import com.ruoyi.common.core.domain.model.LoginUser;
 | 
					import com.ruoyi.common.core.domain.model.LoginUser;
 | 
				
			||||||
import com.ruoyi.common.exception.CustomException;
 | 
					import com.ruoyi.common.exception.ServiceException;
 | 
				
			||||||
import com.ruoyi.common.utils.SecurityUtils;
 | 
					import com.ruoyi.common.utils.SecurityUtils;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.apache.ibatis.reflection.MetaObject;
 | 
					import org.apache.ibatis.reflection.MetaObject;
 | 
				
			||||||
@@ -30,7 +30,7 @@ public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler {
 | 
				
			|||||||
				this.setFieldValByName("createBy", getLoginUsername(), metaObject);
 | 
									this.setFieldValByName("createBy", getLoginUsername(), metaObject);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} catch (Exception e) {
 | 
							} catch (Exception e) {
 | 
				
			||||||
			throw new CustomException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
 | 
								throw new ServiceException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		updateFill(metaObject);
 | 
							updateFill(metaObject);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -45,7 +45,7 @@ public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler {
 | 
				
			|||||||
				this.setFieldValByName("updateTime", new Date(), metaObject);
 | 
									this.setFieldValByName("updateTime", new Date(), metaObject);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} catch (Exception e) {
 | 
							} catch (Exception e) {
 | 
				
			||||||
			throw new CustomException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
 | 
								throw new ServiceException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,9 +2,8 @@ package com.ruoyi.framework.web.exception;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import cn.hutool.http.HttpStatus;
 | 
					import cn.hutool.http.HttpStatus;
 | 
				
			||||||
import com.ruoyi.common.core.domain.AjaxResult;
 | 
					import com.ruoyi.common.core.domain.AjaxResult;
 | 
				
			||||||
import com.ruoyi.common.exception.BaseException;
 | 
					 | 
				
			||||||
import com.ruoyi.common.exception.CustomException;
 | 
					 | 
				
			||||||
import com.ruoyi.common.exception.DemoModeException;
 | 
					import com.ruoyi.common.exception.DemoModeException;
 | 
				
			||||||
 | 
					import com.ruoyi.common.exception.ServiceException;
 | 
				
			||||||
import com.ruoyi.common.utils.StringUtils;
 | 
					import com.ruoyi.common.utils.StringUtils;
 | 
				
			||||||
import org.slf4j.Logger;
 | 
					import org.slf4j.Logger;
 | 
				
			||||||
import org.slf4j.LoggerFactory;
 | 
					import org.slf4j.LoggerFactory;
 | 
				
			||||||
@@ -14,8 +13,8 @@ import org.springframework.web.HttpRequestMethodNotSupportedException;
 | 
				
			|||||||
import org.springframework.web.bind.MethodArgumentNotValidException;
 | 
					import org.springframework.web.bind.MethodArgumentNotValidException;
 | 
				
			||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
 | 
					import org.springframework.web.bind.annotation.ExceptionHandler;
 | 
				
			||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
 | 
					import org.springframework.web.bind.annotation.RestControllerAdvice;
 | 
				
			||||||
import org.springframework.web.servlet.NoHandlerFoundException;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.servlet.http.HttpServletRequest;
 | 
				
			||||||
import javax.validation.ConstraintViolationException;
 | 
					import javax.validation.ConstraintViolationException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -267,7 +267,7 @@ public class GenTableServiceImpl extends ServicePlusImpl<GenTableMapper, GenTabl
 | 
				
			|||||||
				try {
 | 
									try {
 | 
				
			||||||
                	String path = getGenPath(table, template);
 | 
					                	String path = getGenPath(table, template);
 | 
				
			||||||
                	FileUtils.writeUtf8String(sw.toString(), path);
 | 
					                	FileUtils.writeUtf8String(sw.toString(), path);
 | 
				
			||||||
				} catch (IOException e) {
 | 
									} catch (Exception e) {
 | 
				
			||||||
					throw new ServiceException("渲染模板失败,表名:" + table.getTableName());
 | 
										throw new ServiceException("渲染模板失败,表名:" + table.getTableName());
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@ import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
				
			|||||||
import com.ruoyi.common.core.page.PagePlus;
 | 
					import com.ruoyi.common.core.page.PagePlus;
 | 
				
			||||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
					import com.ruoyi.common.core.page.TableDataInfo;
 | 
				
			||||||
import com.ruoyi.common.core.redis.RedisCache;
 | 
					import com.ruoyi.common.core.redis.RedisCache;
 | 
				
			||||||
import com.ruoyi.common.exception.CustomException;
 | 
					import com.ruoyi.common.exception.ServiceException;
 | 
				
			||||||
import com.ruoyi.common.utils.JsonUtils;
 | 
					import com.ruoyi.common.utils.JsonUtils;
 | 
				
			||||||
import com.ruoyi.common.utils.PageUtils;
 | 
					import com.ruoyi.common.utils.PageUtils;
 | 
				
			||||||
import com.ruoyi.common.utils.StringUtils;
 | 
					import com.ruoyi.common.utils.StringUtils;
 | 
				
			||||||
@@ -97,7 +97,7 @@ public class SysOssConfigServiceImpl extends ServicePlusImpl<SysOssConfigMapper,
 | 
				
			|||||||
    private void validEntityBeforeSave(SysOssConfig entity){
 | 
					    private void validEntityBeforeSave(SysOssConfig entity){
 | 
				
			||||||
		if (StringUtils.isNotEmpty(entity.getConfigKey())
 | 
							if (StringUtils.isNotEmpty(entity.getConfigKey())
 | 
				
			||||||
			&& UserConstants.NOT_UNIQUE.equals(checkConfigKeyUnique(entity))) {
 | 
								&& UserConstants.NOT_UNIQUE.equals(checkConfigKeyUnique(entity))) {
 | 
				
			||||||
			throw new CustomException("操作配置'" + entity.getConfigKey() + "'失败, 配置key已存在!");
 | 
								throw new ServiceException("操作配置'" + entity.getConfigKey() + "'失败, 配置key已存在!");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -105,7 +105,7 @@ public class SysOssConfigServiceImpl extends ServicePlusImpl<SysOssConfigMapper,
 | 
				
			|||||||
    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
 | 
					    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
 | 
				
			||||||
    	if(isValid) {
 | 
					    	if(isValid) {
 | 
				
			||||||
			if (CollUtil.containsAny(ids, CloudConstant.SYSTEM_DATA_IDS)) {
 | 
								if (CollUtil.containsAny(ids, CloudConstant.SYSTEM_DATA_IDS)) {
 | 
				
			||||||
				throw new CustomException("系统内置, 不可删除!");
 | 
									throw new ServiceException("系统内置, 不可删除!");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
        boolean flag = removeByIds(ids);
 | 
					        boolean flag = removeByIds(ids);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
				
			|||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
					import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
				
			||||||
import com.ruoyi.common.core.page.PagePlus;
 | 
					import com.ruoyi.common.core.page.PagePlus;
 | 
				
			||||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
					import com.ruoyi.common.core.page.TableDataInfo;
 | 
				
			||||||
import com.ruoyi.common.exception.CustomException;
 | 
					import com.ruoyi.common.exception.ServiceException;
 | 
				
			||||||
import com.ruoyi.common.utils.PageUtils;
 | 
					import com.ruoyi.common.utils.PageUtils;
 | 
				
			||||||
import com.ruoyi.common.utils.StringUtils;
 | 
					import com.ruoyi.common.utils.StringUtils;
 | 
				
			||||||
import com.ruoyi.oss.entity.UploadResult;
 | 
					import com.ruoyi.oss.entity.UploadResult;
 | 
				
			||||||
@@ -61,7 +61,7 @@ public class SysOssServiceImpl extends ServicePlusImpl<SysOssMapper, SysOss, Sys
 | 
				
			|||||||
		try {
 | 
							try {
 | 
				
			||||||
			uploadResult = storage.uploadSuffix(file.getBytes(), suffix, file.getContentType());
 | 
								uploadResult = storage.uploadSuffix(file.getBytes(), suffix, file.getContentType());
 | 
				
			||||||
		} catch (IOException e) {
 | 
							} catch (IOException e) {
 | 
				
			||||||
			throw new CustomException("文件读取异常!!!", e);
 | 
								throw new ServiceException(e.getMessage());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// 保存文件信息
 | 
							// 保存文件信息
 | 
				
			||||||
		SysOss oss = new SysOss()
 | 
							SysOss oss = new SysOss()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user