Skip to content

Commit

Permalink
Merge pull request #24 from dromara/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
lijiahangmax authored Jun 12, 2024
2 parents 72695af + f618aef commit 19c7e31
Show file tree
Hide file tree
Showing 60 changed files with 269 additions and 289 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@
</a>
<a target="_blank"
style="text-decoration: none !important;"
href="https://github.com/lijiahangmax/orion-visor/releases">
href="https://github.com/dromara/orion-visor/releases">
<img src="https://img.shields.io/github/v/release/lijiahangmax/orion-visor" alt="release" />
</a>
<a target="_blank"
style="text-decoration: none !important;"
href="https://gitee.com/lijiahangmax/orion-visor/stargazers">
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/star.svg?theme=dark" alt="star" />
href="https://gitee.com/dromara/orion-visor/stargazers">
<img src="https://gitee.com/dromara/orion-visor/badge/star.svg?theme=dark" alt="star" />
</a>
<a target="_blank"
style="text-decoration: none !important;"
href="https://gitee.com/lijiahangmax/orion-visor/members">
<img src="https://gitee.com/lijiahangmax/orion-visor/badge/fork.svg?theme=dark" alt="fork" />
href="https://gitee.com/dromara/orion-visor/members">
<img src="https://gitee.com/dromara/orion-visor/badge/fork.svg?theme=dark" alt="fork" />
</a>
<a target="_blank"
style="text-decoration: none !important;"
href="https://github.com/lijiahangmax/orion-visor">
href="https://github.com/dromara/orion-visor">
<img src="https://img.shields.io/github/stars/lijiahangmax/orion-visor" alt="star" />
</a>
<a target="_blank"
style="text-decoration: none !important;"
href="https://github.com/lijiahangmax/orion-visor">
href="https://github.com/dromara/orion-visor">
<img src="https://img.shields.io/github/forks/lijiahangmax/orion-visor" alt="star" />
</a>
</p>
Expand All @@ -53,7 +53,7 @@

* 🔗 演示地址: http://101.43.254.243:1081/
* 🔏 演示账号: admin/admin
* ⭐ 体验后可以点一下 `star` 这对我很重要! [github](https://github.com/lijiahangmax/orion-visor) [gitee](https://gitee.com/lijiahangmax/orion-visor)
* ⭐ 体验后可以点一下 `star` 这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor)
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
* 🎭 演示环境部分功能不可用, 完整功能请本地部署!
* 📛 演示环境请不要随便删除数据!
Expand All @@ -63,7 +63,7 @@

```bash
# clone
git clone https://github.com/lijiahangmax/orion-visor
git clone https://github.com/dromara/orion-visor
cd orion-visor
# 启动
docker compose up -d
Expand Down Expand Up @@ -131,8 +131,8 @@ docker compose up -d

## 免责声明

在使用本项目之前, 请确保您已经了解并同意相关的使用协议和隐私政策。[免责声明](https://github.com/lijiahangmax/orion-visor/blob/main/DISCLAIMER.md)
在使用本项目之前, 请确保您已经了解并同意相关的使用协议和隐私政策。[免责声明](https://github.com/dromara/orion-visor/blob/main/DISCLAIMER.md)

## License

本项目遵循 [Apache-2.0](https://github.com/lijiahangmax/orion-visor/blob/main/LICENSE) 开源许可证。
本项目遵循 [Apache-2.0](https://github.com/dromara/orion-visor/blob/main/LICENSE) 开源许可证。
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.3'
services:
orion-visor-service:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.7
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.8
ports:
- 1081:80
environment:
Expand All @@ -20,7 +20,7 @@ services:
- orion-visor-mysql
- orion-visor-redis
orion-visor-mysql:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.7
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.8
privileged: true
ports:
- 3307:3306
Expand All @@ -34,7 +34,7 @@ services:
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/var-lib-mysql-files:/var/lib/mysql-files
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/etc-mysql:/etc/mysql
orion-visor-redis:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.7
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.8
privileged: true
ports:
- 6380:6379
Expand Down
1 change: 0 additions & 1 deletion docker-upgrade.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#/bin/bash
docker compose down
sh ./pull.sh
# demo 启动
if [ "$1" == "demo" ]; then
sed -i 's/DEMO_MODE=false/DEMO_MODE=true/g' docker-compose.yml
Expand Down
2 changes: 1 addition & 1 deletion docker/orion-visor-mysql/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.0.7
version=2.0.8
cp -r ../../sql ./sql
docker build -t orion-visor-mysql:${version} .
rm -rf ./sql
Expand Down
2 changes: 1 addition & 1 deletion docker/orion-visor-redis/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.0.7
version=2.0.8
docker build -t orion-visor-redis:${version} .
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
2 changes: 1 addition & 1 deletion docker/orion-visor-service/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.0.7
version=2.0.8
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
mv ../../orion-visor-ui/dist ./dist
docker build -t orion-visor-service:${version} .
Expand Down
4 changes: 2 additions & 2 deletions orion-visor-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<name>${project.artifactId}</name>

<description>项目所有依赖</description>
<url>https://github.com/lijiahangmax/orion-visor</url>
<url>https://github.com/dromara/orion-visor</url>

<properties>
<revision>2.0.7</revision>
<revision>2.0.8</revision>
<spring.boot.version>2.7.17</spring.boot.version>
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
Expand Down
2 changes: 1 addition & 1 deletion orion-visor-framework/orion-visor-framework-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<packaging>jar</packaging>

<description>项目公共基准包</description>
<url>https://github.com/lijiahangmax/orion-visor</url>
<url>https://github.com/dromara/orion-visor</url>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ public interface AppConst extends OrionConst {
/**
* 同 ${orion.version} 迭代时候需要手动更改
*/
String VERSION = "2.0.7";
String VERSION = "2.0.8";

String ORION_VISOR = "orion-visor";

String GITHUB = "https://github.com/lijiahangmax/orion-visor";
String GITHUB = "https://github.com/dromara/orion-visor";

String GITEE = "https://gitee.com/lijiahangmax/orion-visor";
String GITEE = "https://gitee.com/dromara/orion-visor";

String ISSUES = "https://github.com/lijiahangmax/orion-visor/issues";
String ISSUES = "https://github.com/dromara/orion-visor/issues";

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.orion.visor.framework.common.handler.data;

import com.alibaba.fastjson.JSON;
import com.orion.spring.SpringHolder;
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;
import com.orion.visor.framework.common.handler.data.strategy.MapDataStrategy;
import com.orion.visor.framework.common.handler.data.strategy.GenericsDataStrategy;

/**
* 标准数据定义
Expand All @@ -12,45 +11,50 @@
* @version 1.0.0
* @since 2023/12/21 0:07
*/
@SuppressWarnings("unchecked")
public interface GenericsDataDefinition {

/**
* 获取数据模型类型
*
* @return class
*/
Class<? extends GenericsDataModel> getModel();

/**
* 获取数据处理策略
*
* @return class
*/
Class<? extends MapDataStrategy<? extends GenericsDataModel>> getStrategy();
Class<? extends GenericsDataStrategy<? extends GenericsDataModel>> getStrategyClass();

/**
* 获取数据模型策略处理器
*
* @param <Model> Model
* @param <Strategy> Strategy
* @return StrategyBean
* @param <M> Model
* @param <S> Strategy
* @return Strategy Bean
*/
@SuppressWarnings("unchecked")
default <Model extends GenericsDataModel, Strategy extends MapDataStrategy<Model>> Strategy getStrategyBean() {
return (Strategy) SpringHolder.getBean(this.getStrategy());
default <M extends GenericsDataModel, S extends GenericsDataStrategy<M>> S getStrategy() {
return (S) SpringHolder.getBean(this.getStrategyClass());
}

/**
* 反序列化对象
*
* @param json json
* @param <Model> Model
* @param serialModel serialModel
* @param <M> Model
* @return object
*/
@SuppressWarnings("unchecked")
default <Model extends GenericsDataModel> Model parse(String json) {
return (Model) JSON.parseObject(json, this.getModel());
default <M extends GenericsDataModel> M parse(String serialModel) {
return (M) this.getStrategy().parse(serialModel);
}

/**
* 转为视图对象
*
* @param serialModel serialModel
* @param <M> Model
* @return viewModel
*/
default <M extends GenericsDataModel> M toView(String serialModel) {
GenericsDataStrategy<GenericsDataModel> strategy = this.getStrategy();
GenericsDataModel model = strategy.parse(serialModel);
strategy.toView(model);
return (M) model;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.alibaba.fastjson.JSON;

import java.util.Map;

/**
* 标准数据模型
*
Expand All @@ -20,4 +22,14 @@ default String serial() {
return JSON.toJSONString(this);
}


/**
* 转为 map
*
* @return map
*/
default Map<String, Object> toMap() {
return JSON.parseObject(this.serial());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package com.orion.visor.framework.common.handler.data.strategy;

import com.alibaba.fastjson.JSON;
import com.orion.visor.framework.common.handler.data.model.GenericsDataModel;

/**
* 标准数据处理策略 基类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/6/11 21:44
*/
public abstract class AbstractGenericsDataStrategy<M extends GenericsDataModel> implements GenericsDataStrategy<M> {

protected final Class<M> modelClass;

public AbstractGenericsDataStrategy(Class<M> modelClass) {
this.modelClass = modelClass;
}

/**
* 更新填充
*
* @param beforeModel 修改前的配置
* @param afterModel 修改后的配置
*/
protected void updateFill(M beforeModel, M afterModel) {
}

/**
* 预校验参数
*
* @param model model
*/
protected void preValid(M model) {
}

/**
* 校验参数
*
* @param model model
*/
protected void valid(M model) {
}

@Override
public void doValid(M beforeModel, M afterModel) {
// 预校验参数
this.preValid(afterModel);
// 更新填充
this.updateFill(beforeModel, afterModel);
// 校验参数
this.valid(afterModel);
}

@Override
public M parse(String serialModel) {
return JSON.parseObject(serialModel, modelClass);
}

@Override
public void toView(M model) {
}

}
Loading

0 comments on commit 19c7e31

Please sign in to comment.