Fix 3.7.5 (#786)

* fix: 记录转换

* be: if nav unshare

* be: db AppBuild

* bump netty
This commit is contained in:
REBUILD 企业管理系统 2024-07-22 21:11:25 +08:00 committed by GitHub
parent 608e1b79e4
commit 764830a60b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 69 additions and 54 deletions

19
pom.xml
View file

@ -10,7 +10,7 @@
</parent>
<groupId>com.rebuild</groupId>
<artifactId>rebuild</artifactId>
<version>3.7.4</version>
<version>3.7.5</version>
<name>rebuild</name>
<description>Building your business-systems freely!</description>
<url>https://getrebuild.com/</url>
@ -548,15 +548,20 @@
<artifactId>woodstox-core</artifactId>
<version>6.6.1</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.108.Final</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.1.0-jre</version>
<version>33.2.1-jre</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.112.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns</artifactId>
<version>4.1.112.Final</version>
</dependency>
</dependencies>
</project>

View file

@ -15,7 +15,6 @@ import cn.devezhao.persist4j.Query;
import cn.devezhao.persist4j.engine.ID;
import cn.devezhao.persist4j.engine.StandardRecord;
import cn.devezhao.persist4j.query.QueryedRecord;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
@ -75,11 +74,11 @@ public class Application implements ApplicationListener<ApplicationStartedEvent>
/**
* Rebuild Version
*/
public static final String VER = "3.7.4";
public static final String VER = "3.7.5";
/**
* Rebuild Build [MAJOR]{1}[MINOR]{2}[PATCH]{2}[BUILD]{2}
*/
public static final int BUILD = 3070410;
public static final int BUILD = 3070511;
static {
// Driver for DB
@ -210,16 +209,13 @@ public class Application implements ApplicationListener<ApplicationStartedEvent>
return false;
}
// H2 no filters
if (Installer.isUseH2()) _CONTEXT.getBean(DruidDataSource.class).clearFilters();
// 升级数据库
new UpgradeDatabase().upgradeQuietly();
// 版本升级会清除缓存
int lastBuild = ObjectUtils.toInt(RebuildConfiguration.get(ConfigurationItem.AppBuild, true), 0);
if (lastBuild > 0 && lastBuild != BUILD) {
log.warn("Clean up the cache once when upgrading : {}", BUILD);
if (lastBuild != BUILD) {
log.warn("Clean up the cache once when upgrading : {} from {}", BUILD, lastBuild);
Installer.clearAllCache();
RebuildConfiguration.set(ConfigurationItem.AppBuild, BUILD);
}

View file

@ -100,7 +100,15 @@ public class NavBuilder extends NavManager {
ID useNavId;
if ((useNavId = MetadataHelper.checkSpecEntityId(useNav, EntityHelper.LayoutConfig)) != null) {
Object[][] cached = getAllConfig(null, TYPE_NAV);
config = findConfigBean(cached, useNavId);
// fix: 3.7.5 原本可见现在不可见了
for (Object[] c : cached) {
if (c[0].equals(useNavId)) {
if (!isShareTo((String) c[1], user)) useNavId = null;
break;
}
}
if (useNavId != null) config = findConfigBean(cached, useNavId);
}
}
@ -343,7 +351,7 @@ public class NavBuilder extends NavManager {
ID user = AppUtils.getRequestUser(request);
String useNav = ServletUtils.readCookie(request, "AppHome.Nav");
JSONArray navs = License.isCommercial()
JSONArray navs = License.isRbvAttached()
? NavBuilder.instance.getUserNav(user, useNav)
: NavBuilder.instance.getUserNav(user);

View file

@ -170,7 +170,7 @@ public class AutoFillinManager implements ConfigManager {
// v3.7 附加过滤条件
if (value instanceof ID && tfEasy.getDisplayType() == DisplayType.REFERENCE) {
if (!FieldValueHelper.checkRefDataFilter(tfEasy, (ID) value)) {
log.info("Mismatch `referenceDataFilter`, ignored : {}", value);
log.info("Not meeting the `referenceDataFilter`, ignored : {}", value);
continue;
}
} else if (value instanceof JSONArray && tfEasy.getDisplayType() == DisplayType.N2NREFERENCE) {
@ -181,7 +181,7 @@ public class AutoFillinManager implements ConfigManager {
if (FieldValueHelper.checkRefDataFilter(tfEasy, ID.valueOf(id))) {
value2.add(item);
} else {
log.info("Mismatch `referenceDataFilter`, ignored : {}", value);
log.info("Not meeting the `referenceDataFilter`, ignored : {}", value);
}
}
value = value2.isEmpty() ? null : value2;

View file

@ -67,7 +67,7 @@ public class Entity2Schema extends Field2Schema {
* @return Returns 实体名称
*/
public String createEntity(String entityName, String entityLabel, String comments, String mainEntity, boolean haveNameField, boolean haveSeriesField) {
if (!License.isCommercial() && MetadataHelper.getEntities().length >= 100) {
if (!License.isRbvAttached() && MetadataHelper.getEntities().length >= 100) {
throw new NeedRbvException(Language.L("实体数量超出免费版限制"));
}

View file

@ -81,7 +81,7 @@ public class UserService extends BaseService {
* @return
*/
private Record create(Record record, boolean notifyUser) {
if (!License.isCommercial() && Application.getUserStore().getAllUsers().length >= 100) {
if (!License.isRbvAttached() && Application.getUserStore().getAllUsers().length >= 100) {
throw new NeedRbvException(Language.L("用户数量超出免费版限制"));
}

View file

@ -50,7 +50,7 @@ public abstract class ObservableService extends SafeObservable implements Servic
@Override
public void addObserver(SafeObserver o) {
log.info("Add observer : {} for [ {} ] ", o, getEntityCode());
log.info("Add observer : {} for [ {} ] ", o, getEntityCode() == 0 ? "*" : getEntityCode());
super.addObserver(o);
}

View file

@ -70,23 +70,11 @@ public class RecordTransfomer37 extends RecordTransfomer {
Entity dTargetEntity = fmdEntity[0];
Entity dSourceEntity = fmdEntity[1];
// 明细 > 明细
String sql = String.format(
"select %s from %s where %s = '%s' and (1=1) order by autoId asc",
dSourceEntity.getPrimaryField().getName(), dSourceEntity.getName(),
MetadataHelper.getDetailToMainField(dSourceEntity).getName(), sourceRecordId);
// 明细 > +明细
if (dSourceEntity.getEntityCode().equals(sourceRecordId.getEntityCode())) {
sql = String.format(
"select %s from %s where %s = '%s' and (1=1) order by autoId asc",
dSourceEntity.getPrimaryField().getName(), dSourceEntity.getName(),
dSourceEntity.getPrimaryField().getName(), sourceRecordId);
}
String querySourceSql = buildDetailsSourceSql(dSourceEntity, sourceRecordId);
String filter = appendFilter(fmd);
if (filter != null) sql = sql.replace("(1=1)", filter);
if (filter != null) querySourceSql = querySourceSql.replace("(1=1)", filter);
Object[][] dArray = Application.createQueryNoFilter(sql).array();
Object[][] dArray = Application.createQueryNoFilter(querySourceSql).array();
for (Object[] d : dArray) {
detailsList.add(transformRecord(
dSourceEntity, dTargetEntity, fmd, (ID) d[0], null, false, false, checkNullable));
@ -151,4 +139,29 @@ public class RecordTransfomer37 extends RecordTransfomer {
}
return null;
}
/**
* @param sourceEntity
* @param sourceId
* @return
*/
protected static String buildDetailsSourceSql(Entity sourceEntity, ID sourceId) {
String querySourceSql = null;
if (sourceEntity.getMainEntity() != null) {
querySourceSql = String.format(
"select %s from %s where %s = '%s' and (1=1) order by autoId asc",
sourceEntity.getPrimaryField().getName(), sourceEntity.getName(),
MetadataHelper.getDetailToMainField(sourceEntity).getName(), sourceId);
}
// 明细 > +明细
if (querySourceSql == null || sourceEntity.getEntityCode().equals(sourceId.getEntityCode())) {
querySourceSql = String.format(
"select %s from %s where %s = '%s' and (1=1) order by autoId asc",
sourceEntity.getPrimaryField().getName(), sourceEntity.getName(),
sourceEntity.getPrimaryField().getName(), sourceId);
}
return querySourceSql;
}
}

View file

@ -63,6 +63,7 @@ public class TransformerPreview37 extends TransformerPreview {
JSONArray detailModels = new JSONArray();
// 明细
for (Object o : fieldsMappingDetails) {
JSONObject fmd = (JSONObject) o;
Entity[] fmdEntity = RecordTransfomer37.checkEntity(fmd);
@ -74,18 +75,7 @@ public class TransformerPreview37 extends TransformerPreview {
// ND 指定明细的
if (!detailName.equalsIgnoreCase(dTargetEntity.getName())) continue;
String querySourceSql = "select %s from %s where %s = '%s' and (1=1) order by autoId asc";
// =明细 && 目标=
if (dSourceEntity.getMainEntity() != null && dTargetEntity.getDetailEntity() != null) {
querySourceSql = String.format(querySourceSql,
dSourceEntity.getPrimaryField().getName(), dSourceEntity.getName(),
MetadataHelper.getDetailToMainField(dSourceEntity).getName(), sourceId);
} else {
querySourceSql = String.format(querySourceSql,
dSourceEntity.getPrimaryField().getName(), dSourceEntity.getName(),
dSourceEntity.getPrimaryField().getName(), sourceId);
}
String querySourceSql = RecordTransfomer37.buildDetailsSourceSql(dSourceEntity, sourceId);
String filter = RecordTransfomer37.appendFilter(fmd);
if (filter != null) querySourceSql = querySourceSql.replace("(1=1)", filter);

View file

@ -138,7 +138,7 @@ public class SMSender {
htmlContent = htmlContent.replace("%TIME%", CalendarUtils.getUTCDateTimeFormat().format(CalendarUtils.now()));
htmlContent = htmlContent.replace("%APPURL%", RebuildConfiguration.getHomeUrl());
htmlContent = htmlContent.replace("%APPLOGO%", RebuildConfiguration.getHomeUrl("commons/theme/use-logo"));
if (License.isCommercial()) {
if (License.isRbvAttached()) {
htmlContent = htmlContent.replace("%APPNAME%", RebuildConfiguration.get(ConfigurationItem.AppName));
} else {
htmlContent = htmlContent.replace("%APPNAME%", "REBUILD");

View file

@ -48,7 +48,7 @@ public class DatabaseFixer {
// 最新升级过的
final int dbVer = RebuildConfiguration.getInt(ConfigurationItem.DBVer);
if (dbVer == 41 && !BooleanUtils.toBoolean(KVStorage.getCustomValue(KEY_41))) {
if (dbVer <= 41 && !BooleanUtils.toBoolean(KVStorage.getCustomValue(KEY_41))) {
log.info("Database fixing `#41` ...");
ThreadPool.exec(() -> {
try {

View file

@ -60,7 +60,9 @@ import java.util.Map;
import java.util.Properties;
import java.util.TimeZone;
import static com.rebuild.core.support.ConfigurationItem.*;
import static com.rebuild.core.support.ConfigurationItem.CacheHost;
import static com.rebuild.core.support.ConfigurationItem.CachePassword;
import static com.rebuild.core.support.ConfigurationItem.CachePort;
/**
* 系统安装
@ -211,6 +213,7 @@ public class Installer implements InstallState {
License.siteApiNoCache("api/authority/query");
}
// 初始化
Application.init();
System.setProperty("SN", StringUtils.EMPTY);

View file

@ -67,7 +67,7 @@ public class TriggerAdminController extends BaseController {
Entity sourceEntity = MetadataHelper.getEntity((String) config[0]);
ActionType actionType = ActionType.valueOf((String) config[1]);
if (!License.isCommercial() && actionType.getActionClass().contains(".rbv.")) {
if (!License.isRbvAttached() && actionType.getActionClass().contains(".rbv.")) {
response.sendError(404,
Language.L("免费版不支持此功能 [(查看详情)](https://getrebuild.com/docs/rbv-features)"));
return null;

View file

@ -123,7 +123,7 @@ public class LoginController extends LoginAction {
mv.getModel().put("mobileUrl", RebuildConfiguration.getHomeUrl("h5app-download"));
}
if (License.isCommercial()) {
if (License.isRbvAttached()) {
// DingTalk
mv.getModel().put("ssoDingtalk", RebuildConfiguration.get(ConfigurationItem.DingtalkAppkey));
// WxWork