Skip to content

Commit

Permalink
Merge pull request #129 from erupts/develop
Browse files Browse the repository at this point in the history
1.10.15
  • Loading branch information
erupts authored Nov 6, 2022
2 parents 42bd1a7 + afe48fa commit af47285
Show file tree
Hide file tree
Showing 91 changed files with 572 additions and 313 deletions.
2 changes: 1 addition & 1 deletion erupt-annotation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.10.14</version>
<version>1.10.15</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
15 changes: 10 additions & 5 deletions erupt-annotation/src/main/java/xyz/erupt/annotation/Erupt.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,10 @@
@Comment("操作权限配置")
Power power() default @Power;

// @Comment("多页签配置")
// Tab[] tabs() default {};

@Comment("自定义功能按钮")
RowOperation[] rowOperation() default {};

@Comment("数据钻取功能")
@Comment("数据钻取")
Drill[] drills() default {};

@Transient
Expand All @@ -57,13 +54,21 @@
@Comment("数据行为代理接口,对增、删、改、查等行为做逻辑处理")
Class<? extends DataProxy<?>>[] dataProxy() default {};

@Comment("树节点配置")
@Comment("树视图配置")
Tree tree() default @Tree;

@Match("#value.field() != ''")
@Comment("左树右表配置项")
LinkTree linkTree() default @LinkTree(field = "");

@Comment("自定义页头")
@Match("#value.path() != ''")
Tpl header() default @Tpl(path = "");

// @Comment("画册视图定义")
// @Match("#value.enable() == true")
// Card cardView() default @Card(enable = false, galleryField = "", viewFields = {});

@ToMap(key = "key")
@Comment("自定义扩展参数")
KV[] param() default {};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package xyz.erupt.annotation.sub_erupt;

import xyz.erupt.annotation.config.Comment;

import java.beans.Transient;

/**
* 画册视图
*
* @author YuePeng
* date 2022/10/9 23:52
*/
public @interface Card {

@Transient
boolean enable() default true;

@Comment("封面字段")
String galleryField();

@Comment("封面效果")
GalleryCover galleryCover() default GalleryCover.CLIP;

@Comment("字段")
String[] viewFields();

enum GalleryCover {
FIT, //适应
CLIP, //剪裁
}

}
2 changes: 1 addition & 1 deletion erupt-cloud/erupt-cloud-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.10.14</version>
<version>1.10.15</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-cloud/erupt-cloud-node-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.10.14</version>
<version>1.10.15</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-cloud/erupt-cloud-node/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.10.14</version>
<version>1.10.15</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package xyz.erupt.cloud.node.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.erupt.cloud.common.consts.CloudRestApiConst;

Expand All @@ -11,7 +11,7 @@
@RestController
public class NodeController {

@RequestMapping(CloudRestApiConst.NODE_HEALTH)
@GetMapping(CloudRestApiConst.NODE_HEALTH)
public void health() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ViaMenuValueNodeCtrl implements ExprBool.ExprHandler {

@Override
public boolean handler(boolean expr, String[] params) {
return serverRemoteService.getMenuCodePermission(params[0], MetaContext.getToken());
return serverRemoteService.getMenuCodePermission(params[0]);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public class ServerRemoteService {
private EruptNodeProp eruptNodeProp;

//校验菜单权限
public boolean getMenuCodePermission(String menuValue, String token) {
public boolean getMenuCodePermission(String menuValue) {
String permissionResult =
HttpUtil.createGet(eruptNodeProp.getBalanceAddress() + EruptRestPath.ERUPT_CODE_PERMISSION + "/" + menuValue)
.header(EruptMutualConst.TOKEN, token).execute().body();
.header(EruptMutualConst.TOKEN, MetaContext.getToken()).execute().body();
return Boolean.parseBoolean(permissionResult);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void run() {
HttpResponse httpResponse = HttpUtil.createPost(address + CloudRestApiConst.REGISTER_NODE)
.body(gson.toJson(nodeInfo)).execute();
if (!httpResponse.isOk()) {
log.error(httpResponse.body());
log.error(address + " -> " + httpResponse.body());
}
if (this.errorConnect) {
this.errorConnect = false;
Expand Down
2 changes: 1 addition & 1 deletion erupt-cloud/erupt-cloud-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.10.14</version>
<version>1.10.15</version>
<relativePath>../../pom.xml</relativePath>
</parent>

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

import lombok.AllArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import xyz.erupt.cloud.common.consts.CloudRestApiConst;
Expand All @@ -29,7 +29,7 @@ public class EruptMicroserviceController {

private final EruptNodeMicroservice eruptNodeMicroservice;

@RequestMapping(CloudRestApiConst.REGISTER_NODE)
@PostMapping(CloudRestApiConst.REGISTER_NODE)
public R registerNode(@RequestBody MetaNode metaNode, HttpServletRequest request, HttpServletResponse response) {
CloudNode cloudNode = eruptNodeMicroservice.findNodeByAppName(metaNode.getNodeName(), metaNode.getAccessToken());
if (!cloudNode.getStatus()) {
Expand All @@ -42,7 +42,7 @@ public R registerNode(@RequestBody MetaNode metaNode, HttpServletRequest request
}

//移除实例
@RequestMapping(CloudRestApiConst.REMOVE_INSTANCE_NODE)
@PostMapping(CloudRestApiConst.REMOVE_INSTANCE_NODE)
public void removeInstanceNode(@RequestParam String nodeName, @RequestParam String accessToken, HttpServletRequest request) {
Optional.ofNullable(CloudServerUtil.findEruptCloudServerAnnotation()).ifPresent(it -> it.removeNode(nodeName, request));
eruptNodeMicroservice.removeInstance(nodeName, accessToken);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package xyz.erupt.cloud.server.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import xyz.erupt.annotation.fun.PowerObject;
import xyz.erupt.cloud.common.consts.CloudRestApiConst;
Expand Down Expand Up @@ -33,8 +34,8 @@ public class EruptServerApi {
@Resource
private EruptDao eruptDao;

@RequestMapping(CloudRestApiConst.ERUPT_POWER)
public PowerObject eruptPower(String eruptName, String nodeName) {
@GetMapping(CloudRestApiConst.ERUPT_POWER)
public PowerObject eruptPower(@RequestParam String eruptName,@RequestParam String nodeName) {
PowerObject powerObject = new PowerObject();
List<String> values = eruptSessionService.getMapKeys(SessionKey.MENU_VALUE_MAP + eruptContextService.getCurrentToken());
Map<String, Boolean> permissionMap = values.stream().collect(Collectors.toMap(it -> it, it -> true));
Expand All @@ -50,16 +51,16 @@ public PowerObject eruptPower(String eruptName, String nodeName) {
return powerObject;
}

@RequestMapping(CloudRestApiConst.NODE_CONFIG + "/{nodeName}")
public String getNodeConfig(@PathVariable String nodeName, String accessToken) {
@GetMapping(CloudRestApiConst.NODE_CONFIG + "/{nodeName}")
public String getNodeConfig(@PathVariable String nodeName,@RequestParam String accessToken) {
return (String) eruptDao.getEntityManager()
.createQuery("select config from CloudNode where nodeName = :nodeName and accessToken = :accessToken")
.setParameter("nodeName", nodeName)
.setParameter("accessToken", accessToken).getSingleResult();
}

@RequestMapping(CloudRestApiConst.NODE_GROUP_CONFIG + "/{nodeName}")
public String getNodeGroupConfig(@PathVariable String nodeName, String accessToken) {
@GetMapping(CloudRestApiConst.NODE_GROUP_CONFIG + "/{nodeName}")
public String getNodeGroupConfig(@PathVariable String nodeName,@RequestParam String accessToken) {
return (String) eruptDao.getEntityManager()
.createQuery("select cloudNodeGroup.config from CloudNode where nodeName = :nodeName and accessToken = :accessToken")
.setParameter("nodeName", nodeName)
Expand Down
12 changes: 1 addition & 11 deletions erupt-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.10.14</version>
<version>1.10.15</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand All @@ -24,10 +24,6 @@
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
<dependency>
<groupId>${erupt.groupId}</groupId>
<artifactId>erupt-annotation</artifactId>
Expand All @@ -36,7 +32,6 @@
<dependency>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand All @@ -57,11 +52,6 @@
<artifactId>jansi</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>6.2.2</version>
</dependency>
</dependencies>

<build>
Expand Down
20 changes: 20 additions & 0 deletions erupt-core/src/main/java/xyz/erupt/core/cache/EruptCache.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package xyz.erupt.core.cache;

import java.util.Optional;
import java.util.function.Supplier;

/**
* @author YuePeng
* date 2021/3/23 14:09
*/
public interface EruptCache<V> {

V put(String key, V v, long ttl);

V get(String key);

default V getAndSet(String key, long timeout, Supplier<V> supplier) {
return Optional.ofNullable(this.get(key)).orElseGet(() -> this.put(key, supplier.get(), timeout));
}

}
Loading

0 comments on commit af47285

Please sign in to comment.