Skip to content

Commit

Permalink
Merge pull request #186 from erupts/develop
Browse files Browse the repository at this point in the history
1.12.1
  • Loading branch information
erupts committed Jul 29, 2023
2 parents 1f2fc4c + 301ded0 commit 040c08e
Show file tree
Hide file tree
Showing 42 changed files with 104 additions and 143 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.12.0</version>
<version>1.12.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

boolean enable() default true;

// @Comment("依赖其他表单的值")
// String[] dependFields();

@Comment("显示条件表达式,支持变量:item 该值表示其他字段的值")
String expr();

Expand All @@ -29,7 +26,7 @@ enum Type {
SHOW, //显示
HIDE, //隐藏
SHOW_NOTNULL, //显示且必填
SHOW_READONLY, //显示且制度
SHOW_READONLY, //显示且只读
}

}
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.12.0</version>
<version>1.12.1</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.12.0</version>
<version>1.12.1</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.12.0</version>
<version>1.12.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

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.12.0</version>
<version>1.12.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.util.StreamUtils;
Expand All @@ -32,7 +33,6 @@
import xyz.erupt.core.context.MetaUser;
import xyz.erupt.core.exception.EruptWebApiRuntimeException;
import xyz.erupt.core.module.MetaUserinfo;
import xyz.erupt.core.service.EruptCoreService;
import xyz.erupt.core.view.EruptBuildModel;
import xyz.erupt.core.view.EruptModel;
import xyz.erupt.security.interceptor.EruptSecurityInterceptor;
Expand Down Expand Up @@ -104,8 +104,12 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
if (erupt == null) {
return true;
}
if (!erupt.contains(".")) return true;
if (null != EruptCoreService.getErupt(erupt)) return true;
if (!erupt.contains(".")) {
return true;
}
// if (request.getServletPath().contains(EruptRestPath.ERUPT_FILE)) {
// return true;
// }
String token = eruptContextService.getCurrentToken();
if (null == token || null == eruptSessionService.get(SessionKey.TOKEN_OLINE + token)) {
response.setStatus(HttpStatus.UNAUTHORIZED.value());
Expand Down Expand Up @@ -188,7 +192,7 @@ public HttpResponse httpProxy(HttpServletRequest request, MetaNode metaNode, Str
String name = headerNames.nextElement();
headers.put(name, request.getHeader(name));
}
headers.remove("host");
headers.remove(HttpHeaders.HOST.toLowerCase());
headers.put(CloudCommonConst.HEADER_ACCESS_TOKEN, metaNode.getAccessToken());
headers.put(EruptMutualConst.TOKEN, eruptContextService.getCurrentToken());
headers.put(EruptMutualConst.ERUPT, eruptName);
Expand Down
2 changes: 1 addition & 1 deletion 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.12.0</version>
<version>1.12.1</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package xyz.erupt.core.constant;

import lombok.Getter;
import lombok.Setter;

/**
* @author YuePeng
* date 2023/7/21 21:29
*/
@Getter
@Setter
public class EruptReqHeader {

public static final String DRILL = "Drill";

public static final String DRILL_VALUE = "DrillValue";

public static final String DRILL_SOURCE_ERUPT = "DrillSourceErupt";


}

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package xyz.erupt.core.service;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import xyz.erupt.annotation.config.QueryExpression;
import xyz.erupt.annotation.fun.PowerObject;
import xyz.erupt.annotation.query.Condition;
import xyz.erupt.annotation.sub_erupt.Link;
import xyz.erupt.annotation.sub_erupt.LinkTree;
import xyz.erupt.core.constant.EruptReqHeader;
import xyz.erupt.core.exception.EruptNoLegalPowerException;
import xyz.erupt.core.exception.EruptWebApiRuntimeException;
import xyz.erupt.core.invoke.DataProcessorManager;
import xyz.erupt.core.invoke.DataProxyInvoke;
import xyz.erupt.core.query.EruptQuery;
Expand All @@ -19,10 +23,15 @@
import xyz.erupt.core.view.Page;
import xyz.erupt.core.view.TableQueryVo;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.stream.Stream;

/**
* @author YuePeng
Expand All @@ -32,6 +41,9 @@
@Slf4j
public class EruptService {

@Resource
private HttpServletRequest request;

/**
* @param eruptModel eruptModel
* @param tableQueryVo 前端查询对象
Expand All @@ -49,9 +61,10 @@ public Page getEruptData(EruptModel eruptModel, TableQueryVo tableQueryVo, List<
if (dependTree.dependNode()) return new Page();
} else {
EruptModel treeErupt = EruptCoreService.getErupt(ReflectUtil.findClassField(eruptModel.getClazz(), dependTree.field()).getType().getSimpleName());
conditionStrings.add(dependTree.field() + "." + treeErupt.getErupt().primaryKeyCol() + " = '" + tableQueryVo.getLinkTreeVal() + "'");
conditionStrings.add(String.format("%s = '%s'", dependTree.field() + "." + treeErupt.getErupt().primaryKeyCol(), tableQueryVo.getLinkTreeVal()));
}
}
this.drillProcess(eruptModel, (link, val) -> conditionStrings.add(String.format("%s = '%s'", link.linkErupt().getSimpleName() + "." + link.joinColumn(), val)));
conditionStrings.addAll(Arrays.asList(customCondition));
DataProxyInvoke.invoke(eruptModel, (dataProxy -> Optional.ofNullable(dataProxy.beforeFetch(legalConditions)).ifPresent(conditionStrings::add)));
Optional.ofNullable(serverCondition).ifPresent(legalConditions::addAll);
Expand All @@ -63,6 +76,29 @@ public Page getEruptData(EruptModel eruptModel, TableQueryVo tableQueryVo, List<
return page;
}

@SneakyThrows
public void drillProcess(EruptModel eruptModel, BiConsumer<Link, Object> consumer) {
String drill = request.getHeader(EruptReqHeader.DRILL);
if (null != drill) {
String drillValue = request.getHeader(EruptReqHeader.DRILL_VALUE);
String sourceErupt = request.getHeader(EruptReqHeader.DRILL_SOURCE_ERUPT);
if (null == drillValue || null == sourceErupt) {
throw new EruptWebApiRuntimeException("Drill Header Illegal ,Lack:" + EruptReqHeader.DRILL_VALUE + "," + EruptReqHeader.DRILL_SOURCE_ERUPT);
}
EruptModel sourceModel = EruptCoreService.getErupt(sourceErupt);
Link link = Stream.of(sourceModel.getErupt().drills()).filter(it -> drill.equals(it.code()))
.findFirst().orElseThrow(EruptNoLegalPowerException::new).link();
if (!link.linkErupt().getSimpleName().equals(eruptModel.getEruptName())) {
throw new EruptWebApiRuntimeException("Illegal erupt from " + drill);
}
Object data = DataProcessorManager.getEruptDataProcessor(sourceModel.getClazz()).findDataById(sourceModel, EruptUtil.toEruptId(sourceModel, drillValue));
Field field = ReflectUtil.findClassField(sourceModel.getClazz(), link.column());
field.setAccessible(true);
Object val = field.get(data);
consumer.accept(link, val);
}
}

/**
* 校验id使用权限
*
Expand Down
2 changes: 1 addition & 1 deletion erupt-data/erupt-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.0</version>
<version>1.12.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-data/erupt-mongodb/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.12.0</version>
<version>1.12.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-excel/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.12.0</version>
<version>1.12.1</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void exportData(@PathVariable("erupt") String eruptName,
@EruptRecordOperate(value = "Import Excel", dynamicConfig = EruptRecordNaming.class)
@EruptRouter(authIndex = 2, verifyType = EruptRouter.VerifyType.ERUPT)
@Transactional(rollbackOn = Exception.class)
public EruptApiModel importExcel(@PathVariable("erupt") String eruptName, @RequestParam("file") MultipartFile file, HttpServletRequest request) {
public EruptApiModel importExcel(@PathVariable("erupt") String eruptName, @RequestParam("file") MultipartFile file) {
EruptModel eruptModel = EruptCoreService.getErupt(eruptName);
Erupts.powerLegal(eruptModel, PowerObject::isImportable, "Not import permission");
if (file.isEmpty() || null == file.getOriginalFilename()) return EruptApiModel.errorApi("上传失败,请选择文件");
Expand Down
2 changes: 1 addition & 1 deletion erupt-extra/erupt-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.0</version>
<version>1.12.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-extra/erupt-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.0</version>
<version>1.12.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-extra/erupt-job/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.12.0</version>
<version>1.12.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-extra/erupt-magic-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.0</version>
<version>1.12.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-extra/erupt-monitor/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.12.0</version>
<version>1.12.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Loading

0 comments on commit 040c08e

Please sign in to comment.