Merge pull request 'master' (#66) from master into gateway
Reviewed-on: http://git.feashow.cn/clay/fateverse/pulls/66
This commit is contained in:
@@ -94,7 +94,7 @@ trigger:
|
||||
- log-biz
|
||||
- monitor
|
||||
- code-gen
|
||||
- custom-query
|
||||
- custom-query-biz
|
||||
- sentinel-dashboard
|
||||
- workflow
|
||||
|
||||
|
||||
@@ -8,6 +8,15 @@
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 相关地址
|
||||
- 演示地址:
|
||||
1. vue版本 [http://vue.fateverse.cn/](http://vue.fateverse.cn/)
|
||||
- 项目地址:
|
||||
- 前端gitee地址: [https://gitee.com/fateverse/fateverse-vue](https://gitee.com/fateverse/fateverse-vue)
|
||||
- 后端gitee地址: [https://gitee.com/fateverse/fateverse](https://gitee.com/fateverse/fateverse)
|
||||
- 前端github地址: [https://github.com/fateverse/fateverse-vue](https://github.com/fateverse/fateverse-vue)
|
||||
- 后端github地址: [https://github.com/fateverse/fateverse](https://github.com/fateverse/fateverse)
|
||||
|
||||
### 核心依赖
|
||||
|
||||
| 依赖 | 版本 |
|
||||
|
||||
@@ -25,10 +25,5 @@
|
||||
<artifactId>common-swagger</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.fateverse</groupId>
|
||||
<artifactId>common-decrypt</artifactId>
|
||||
<!-- <optional>true</optional>-->
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -1,6 +1,6 @@
|
||||
package cn.fateverse.admin.controller;
|
||||
|
||||
import cn.fateverse.admin.dto.MappingSwitchDto;
|
||||
import cn.fateverse.admin.entity.dto.MappingSwitchDto;
|
||||
import cn.fateverse.admin.entity.vo.MappingSwitchVo;
|
||||
import cn.fateverse.admin.query.MappingSwitchQuery;
|
||||
import cn.fateverse.admin.service.MappingSwitchService;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.fateverse.admin.dto;
|
||||
package cn.fateverse.admin.entity.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -1,6 +1,6 @@
|
||||
package cn.fateverse.admin.service;
|
||||
|
||||
import cn.fateverse.admin.dto.MappingSwitchDto;
|
||||
import cn.fateverse.admin.entity.dto.MappingSwitchDto;
|
||||
import cn.fateverse.admin.entity.vo.MappingSwitchVo;
|
||||
import cn.fateverse.admin.query.MappingSwitchQuery;
|
||||
import cn.fateverse.common.core.result.page.TableDataInfo;
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package cn.fateverse.admin.service.impl;
|
||||
|
||||
import cn.fateverse.admin.dto.MappingSwitchDto;
|
||||
import cn.fateverse.admin.entity.dto.MappingSwitchDto;
|
||||
import cn.fateverse.admin.entity.vo.MappingSwitchVo;
|
||||
import cn.fateverse.admin.query.MappingSwitchQuery;
|
||||
import cn.fateverse.admin.service.MappingSwitchService;
|
||||
import cn.fateverse.common.core.constant.UserConstants;
|
||||
import cn.fateverse.common.core.entity.PageInfo;
|
||||
import cn.fateverse.common.core.exception.CustomException;
|
||||
import cn.fateverse.common.core.result.page.TableDataInfo;
|
||||
import cn.fateverse.common.core.utils.ReflectUserUtils;
|
||||
import cn.fateverse.common.core.utils.TableSupport;
|
||||
import cn.fateverse.common.log.enums.OperateType;
|
||||
import cn.fateverse.common.mybatis.utils.PageUtils;
|
||||
import cn.fateverse.common.security.entity.MappingSwitchInfo;
|
||||
import cn.fateverse.common.security.utils.SecurityUtils;
|
||||
@@ -19,7 +16,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.data.redis.core.Cursor;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ScanOptions;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ dubbo:
|
||||
protocol:
|
||||
name: dubbo
|
||||
port: -1
|
||||
serialization: fastjson2
|
||||
# serialization: fastjson2
|
||||
registry:
|
||||
address: nacos://${spring.cloud.nacos.discovery.server-addr}
|
||||
username: ${spring.cloud.nacos.discovery.username}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class CaptchaConfig {
|
||||
//鱼眼 com.google.code.kaptcha.impl.FishEyeGimpy
|
||||
//阴影 com.google.code.kaptcha.impl.ShadowGimpy
|
||||
// properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_STRING,"123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ#$!@&%");
|
||||
properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_STRING,"123456789#$@&%");
|
||||
properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_STRING,"0123456789");
|
||||
properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy");
|
||||
DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
|
||||
Config config = new Config(properties);
|
||||
|
||||
@@ -39,7 +39,7 @@ dubbo:
|
||||
protocol:
|
||||
name: dubbo
|
||||
port: -1
|
||||
serialization: fastjson2
|
||||
# serialization: fastjson2
|
||||
registry:
|
||||
address: nacos://${spring.cloud.nacos.discovery.server-addr}
|
||||
username: ${spring.cloud.nacos.discovery.username}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
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">
|
||||
<parent>
|
||||
<artifactId>visual</artifactId>
|
||||
<artifactId>fateverse</artifactId>
|
||||
<groupId>cn.fateverse</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
@@ -1,6 +1,5 @@
|
||||
package cn.fateverse.code.entity;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.fateverse.code.util.constant.CodeGenConstants;
|
||||
import cn.fateverse.common.core.annotaion.EnableAutoField;
|
||||
import cn.fateverse.common.core.entity.BaseEntity;
|
||||
@@ -34,7 +34,7 @@ dubbo:
|
||||
protocol:
|
||||
name: dubbo
|
||||
port: -1
|
||||
serialization: fastjson2
|
||||
# serialization: fastjson2
|
||||
registry:
|
||||
address: nacos://${spring.cloud.nacos.discovery.server-addr}
|
||||
username: ${spring.cloud.nacos.discovery.username}
|
||||
@@ -3,14 +3,14 @@ import { PlusCircleTwoTone, EditTwoTone, DeleteTwoTone, ExclamationCircleOutline
|
||||
import Table, { ColumnsType } from "antd/lib/table";
|
||||
import { TableRowSelection } from "antd/lib/table/interface";
|
||||
import React, { Fragment, useEffect, useReducer, useState } from "react";
|
||||
import { get${ClassName}List, get${ClassName}Details, add${ClassName}, edit${ClassName}, del${ClassName} } from "../../api/${businessName}";
|
||||
import { get${ClassName}List, get${ClassName}Details, add${ClassName}, edit${ClassName}, del${ClassName} } from "./view.tsx${businessName}";
|
||||
#if($table.hasDictSelect())
|
||||
import { DTag } from "../../components/DTag";
|
||||
import { getCacheType } from "../../utils/cache";
|
||||
#end
|
||||
import SearchForm from "../../components/SearchForm";
|
||||
import { IModalConfig, IResponse } from "../../type";
|
||||
import { DataType } from "../../type/${businessName}";
|
||||
import { DataType } from "./view.tsx${businessName}";
|
||||
import confirm from "antd/lib/modal/confirm";
|
||||
import { parseDateTime, queryReducer, reducerPagination } from "../../utils/tool";
|
||||
|
||||
@@ -228,4 +228,24 @@ public class JavaCodeEngine {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除类
|
||||
* @param className 删除类
|
||||
* @return 删除结果
|
||||
*/
|
||||
public Boolean remove(String className) {
|
||||
return SegmentLock.lock(className, () -> {
|
||||
classCache.remove(className);
|
||||
File javaFile = new File(CLASS_PATH + className + JAVA_SUFFIX);
|
||||
if (javaFile.exists()) {
|
||||
javaFile.delete();
|
||||
}
|
||||
File classFile = new File(CLASS_PATH + className + CLASS_SUFFIX);
|
||||
if (classFile.exists()) {
|
||||
classFile.delete();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,11 +59,7 @@ public class EncryptAspect {
|
||||
} else if (arg instanceof List) {
|
||||
try {
|
||||
List<String> list = (List<String>) arg;
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
String ciphertext = list.get(j);
|
||||
String decrypt = encryptService.decrypt(ciphertext);
|
||||
list.set(j, decrypt);
|
||||
}
|
||||
list.replaceAll(encryptService::decrypt);
|
||||
args[i] = list;
|
||||
} catch (Exception e) {
|
||||
throw new CustomException("接受参数类型错误,请使用String类型的泛型参数");
|
||||
@@ -117,7 +113,9 @@ public class EncryptAspect {
|
||||
String decrypt = encryptService.encrypt((String) value);
|
||||
ReflectionUtils.setField(field, data, decrypt);
|
||||
} else if (field.getType().getName().startsWith(BASE_PACKAGE)) {
|
||||
encrypt(value);
|
||||
if (!value.getClass().isEnum()){
|
||||
encrypt(value);
|
||||
}
|
||||
} else if (value instanceof Collection) {
|
||||
Collection<Object> collection = (Collection<Object>) value;
|
||||
for (Object item : collection) {
|
||||
@@ -148,7 +146,9 @@ public class EncryptAspect {
|
||||
String decrypt = encryptService.decrypt((String) value);
|
||||
ReflectionUtils.setField(field, arg, decrypt);
|
||||
} else if (field.getType().getName().startsWith(BASE_PACKAGE)) {
|
||||
decrypt(value);
|
||||
if (!value.getClass().isEnum()){
|
||||
decrypt(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.fateverse.common.decrypt.entity;
|
||||
|
||||
import cn.fateverse.common.decrypt.annotation.EncryptField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2024/4/15 12:23
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class EncryptOption {
|
||||
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
@EncryptField
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private String label;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.fateverse.common.decrypt.entity;
|
||||
|
||||
import cn.fateverse.common.core.entity.OptionTree;
|
||||
import cn.fateverse.common.decrypt.annotation.EncryptField;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2024/4/15 12:23
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EncryptOptionTree {
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
@EncryptField
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private Object label;
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<OptionTree> children;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.fateverse.common.security.handle;
|
||||
|
||||
import cn.fateverse.common.security.utils.ResponseRender;
|
||||
import cn.hutool.core.text.StrFormatter;
|
||||
import cn.fateverse.common.core.result.Result;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
@@ -35,24 +36,9 @@ public class AuthenticationEntryPointImpl implements AccessDeniedHandler, Authen
|
||||
|
||||
public void accessDenied(HttpServletRequest request, HttpServletResponse response) {
|
||||
String msg = StrFormatter.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI());
|
||||
renderString(response,Result.unauthorized(msg));
|
||||
ResponseRender.renderString(response,Result.unauthorized(msg));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将字符串渲染到客户端
|
||||
*
|
||||
* @param response 渲染对象
|
||||
* @param result 返回的错误对象
|
||||
*/
|
||||
public static void renderString(HttpServletResponse response, Result<String> result) {
|
||||
try {
|
||||
response.setStatus(result.getStatus().value());
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.getWriter().print(JSON.toJSONString(result));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.fateverse.common.security.utils;
|
||||
|
||||
import cn.fateverse.common.core.result.Result;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2024/4/19 9:09
|
||||
*/
|
||||
public class ResponseRender {
|
||||
/**
|
||||
* 将字符串渲染到客户端
|
||||
*
|
||||
* @param response 渲染对象
|
||||
* @param result 返回的错误对象
|
||||
*/
|
||||
public static void renderString(HttpServletResponse response, Result<Object> result) {
|
||||
try {
|
||||
response.setStatus(result.getStatus().value());
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.getWriter().print(JSON.toJSONString(result));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user