Merge pull request 'master' (#66) from master into gateway

Reviewed-on: http://git.feashow.cn/clay/fateverse/pulls/66
This commit is contained in:
clay
2024-04-23 01:05:54 +00:00
424 changed files with 5748 additions and 356 deletions

View File

@@ -94,7 +94,7 @@ trigger:
- log-biz - log-biz
- monitor - monitor
- code-gen - code-gen
- custom-query - custom-query-biz
- sentinel-dashboard - sentinel-dashboard
- workflow - workflow

View File

@@ -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)
### 核心依赖 ### 核心依赖
| 依赖 | 版本 | | 依赖 | 版本 |

View File

@@ -25,10 +25,5 @@
<artifactId>common-swagger</artifactId> <artifactId>common-swagger</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>cn.fateverse</groupId>
<artifactId>common-decrypt</artifactId>
<!-- <optional>true</optional>-->
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@@ -1,6 +1,6 @@
package cn.fateverse.admin.controller; 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.entity.vo.MappingSwitchVo;
import cn.fateverse.admin.query.MappingSwitchQuery; import cn.fateverse.admin.query.MappingSwitchQuery;
import cn.fateverse.admin.service.MappingSwitchService; import cn.fateverse.admin.service.MappingSwitchService;

View File

@@ -1,4 +1,4 @@
package cn.fateverse.admin.dto; package cn.fateverse.admin.entity.dto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;

View File

@@ -1,6 +1,6 @@
package cn.fateverse.admin.service; 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.entity.vo.MappingSwitchVo;
import cn.fateverse.admin.query.MappingSwitchQuery; import cn.fateverse.admin.query.MappingSwitchQuery;
import cn.fateverse.common.core.result.page.TableDataInfo; import cn.fateverse.common.core.result.page.TableDataInfo;

View File

@@ -1,16 +1,13 @@
package cn.fateverse.admin.service.impl; 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.entity.vo.MappingSwitchVo;
import cn.fateverse.admin.query.MappingSwitchQuery; import cn.fateverse.admin.query.MappingSwitchQuery;
import cn.fateverse.admin.service.MappingSwitchService; 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.entity.PageInfo;
import cn.fateverse.common.core.exception.CustomException; import cn.fateverse.common.core.exception.CustomException;
import cn.fateverse.common.core.result.page.TableDataInfo; 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.core.utils.TableSupport;
import cn.fateverse.common.log.enums.OperateType;
import cn.fateverse.common.mybatis.utils.PageUtils; import cn.fateverse.common.mybatis.utils.PageUtils;
import cn.fateverse.common.security.entity.MappingSwitchInfo; import cn.fateverse.common.security.entity.MappingSwitchInfo;
import cn.fateverse.common.security.utils.SecurityUtils; 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.Cursor;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ScanOptions; import org.springframework.data.redis.core.ScanOptions;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;

View File

@@ -36,7 +36,7 @@ dubbo:
protocol: protocol:
name: dubbo name: dubbo
port: -1 port: -1
serialization: fastjson2 # serialization: fastjson2
registry: registry:
address: nacos://${spring.cloud.nacos.discovery.server-addr} address: nacos://${spring.cloud.nacos.discovery.server-addr}
username: ${spring.cloud.nacos.discovery.username} username: ${spring.cloud.nacos.discovery.username}

View File

@@ -34,7 +34,7 @@ public class CaptchaConfig {
//鱼眼 com.google.code.kaptcha.impl.FishEyeGimpy //鱼眼 com.google.code.kaptcha.impl.FishEyeGimpy
//阴影 com.google.code.kaptcha.impl.ShadowGimpy //阴影 com.google.code.kaptcha.impl.ShadowGimpy
// properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_STRING,"123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ#$!@&%"); // 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"); properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy");
DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
Config config = new Config(properties); Config config = new Config(properties);

View File

@@ -39,7 +39,7 @@ dubbo:
protocol: protocol:
name: dubbo name: dubbo
port: -1 port: -1
serialization: fastjson2 # serialization: fastjson2
registry: registry:
address: nacos://${spring.cloud.nacos.discovery.server-addr} address: nacos://${spring.cloud.nacos.discovery.server-addr}
username: ${spring.cloud.nacos.discovery.username} username: ${spring.cloud.nacos.discovery.username}

View File

@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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">
<parent> <parent>
<artifactId>visual</artifactId> <artifactId>fateverse</artifactId>
<groupId>cn.fateverse</groupId> <groupId>cn.fateverse</groupId>
<version>1.0.0</version> <version>1.0.0</version>
</parent> </parent>

View File

@@ -1,6 +1,5 @@
package cn.fateverse.code.entity; package cn.fateverse.code.entity;
import cn.hutool.core.util.StrUtil;
import cn.fateverse.code.util.constant.CodeGenConstants; import cn.fateverse.code.util.constant.CodeGenConstants;
import cn.fateverse.common.core.annotaion.EnableAutoField; import cn.fateverse.common.core.annotaion.EnableAutoField;
import cn.fateverse.common.core.entity.BaseEntity; import cn.fateverse.common.core.entity.BaseEntity;

View File

@@ -34,7 +34,7 @@ dubbo:
protocol: protocol:
name: dubbo name: dubbo
port: -1 port: -1
serialization: fastjson2 # serialization: fastjson2
registry: registry:
address: nacos://${spring.cloud.nacos.discovery.server-addr} address: nacos://${spring.cloud.nacos.discovery.server-addr}
username: ${spring.cloud.nacos.discovery.username} username: ${spring.cloud.nacos.discovery.username}

View File

@@ -3,14 +3,14 @@ import { PlusCircleTwoTone, EditTwoTone, DeleteTwoTone, ExclamationCircleOutline
import Table, { ColumnsType } from "antd/lib/table"; import Table, { ColumnsType } from "antd/lib/table";
import { TableRowSelection } from "antd/lib/table/interface"; import { TableRowSelection } from "antd/lib/table/interface";
import React, { Fragment, useEffect, useReducer, useState } from "react"; 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()) #if($table.hasDictSelect())
import { DTag } from "../../components/DTag"; import { DTag } from "../../components/DTag";
import { getCacheType } from "../../utils/cache"; import { getCacheType } from "../../utils/cache";
#end #end
import SearchForm from "../../components/SearchForm"; import SearchForm from "../../components/SearchForm";
import { IModalConfig, IResponse } from "../../type"; import { IModalConfig, IResponse } from "../../type";
import { DataType } from "../../type/${businessName}"; import { DataType } from "./view.tsx${businessName}";
import confirm from "antd/lib/modal/confirm"; import confirm from "antd/lib/modal/confirm";
import { parseDateTime, queryReducer, reducerPagination } from "../../utils/tool"; import { parseDateTime, queryReducer, reducerPagination } from "../../utils/tool";

View File

@@ -228,4 +228,24 @@ public class JavaCodeEngine {
throw new RuntimeException(e); 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;
});
}
} }

View File

@@ -59,11 +59,7 @@ public class EncryptAspect {
} else if (arg instanceof List) { } else if (arg instanceof List) {
try { try {
List<String> list = (List<String>) arg; List<String> list = (List<String>) arg;
for (int j = 0; j < list.size(); j++) { list.replaceAll(encryptService::decrypt);
String ciphertext = list.get(j);
String decrypt = encryptService.decrypt(ciphertext);
list.set(j, decrypt);
}
args[i] = list; args[i] = list;
} catch (Exception e) { } catch (Exception e) {
throw new CustomException("接受参数类型错误,请使用String类型的泛型参数"); throw new CustomException("接受参数类型错误,请使用String类型的泛型参数");
@@ -117,7 +113,9 @@ public class EncryptAspect {
String decrypt = encryptService.encrypt((String) value); String decrypt = encryptService.encrypt((String) value);
ReflectionUtils.setField(field, data, decrypt); ReflectionUtils.setField(field, data, decrypt);
} else if (field.getType().getName().startsWith(BASE_PACKAGE)) { } else if (field.getType().getName().startsWith(BASE_PACKAGE)) {
encrypt(value); if (!value.getClass().isEnum()){
encrypt(value);
}
} else if (value instanceof Collection) { } else if (value instanceof Collection) {
Collection<Object> collection = (Collection<Object>) value; Collection<Object> collection = (Collection<Object>) value;
for (Object item : collection) { for (Object item : collection) {
@@ -148,7 +146,9 @@ public class EncryptAspect {
String decrypt = encryptService.decrypt((String) value); String decrypt = encryptService.decrypt((String) value);
ReflectionUtils.setField(field, arg, decrypt); ReflectionUtils.setField(field, arg, decrypt);
} else if (field.getType().getName().startsWith(BASE_PACKAGE)) { } else if (field.getType().getName().startsWith(BASE_PACKAGE)) {
decrypt(value); if (!value.getClass().isEnum()){
decrypt(value);
}
} }
} }
} }

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -1,5 +1,6 @@
package cn.fateverse.common.security.handle; package cn.fateverse.common.security.handle;
import cn.fateverse.common.security.utils.ResponseRender;
import cn.hutool.core.text.StrFormatter; import cn.hutool.core.text.StrFormatter;
import cn.fateverse.common.core.result.Result; import cn.fateverse.common.core.result.Result;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
@@ -35,24 +36,9 @@ public class AuthenticationEntryPointImpl implements AccessDeniedHandler, Authen
public void accessDenied(HttpServletRequest request, HttpServletResponse response) { public void accessDenied(HttpServletRequest request, HttpServletResponse response) {
String msg = StrFormatter.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI()); 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();
}
}
} }

View File

@@ -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