增强服务配置文件启动功能,支持文件配置仍然可以修改

This commit is contained in:
2019-04-29 16:32:26 +08:00
parent a255c52cc0
commit 52f4d459a0
10 changed files with 36 additions and 30 deletions

13
pom.xml
View File

@@ -41,10 +41,11 @@
<version>3.3</version>
</dependency>
<!-- poi支持 -->
<dependency>
<groupId>com.lxyer</groupId>
<artifactId>excel</artifactId>
<version>0.1.1</version>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
@@ -54,12 +55,6 @@
<scope>provided</scope>
</dependency>
<!--<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.4</version>
</dependency>-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@@ -40,7 +40,7 @@
<button class="btn btn-default" type="button">添加过滤条件</button>
</span>
<select class="form-control" v-model="addFilter" style="width: 130px;">
<option v-for="f in cfg.filters" :value="f.name" :disabled="f.checked">{{f.label}}</option>
<option v-for="f in cfg.filters" :value="f.name" v-show="!f.checked">{{f.label}}</option>
</select>
<span class="input-group-btn">

View File

@@ -98,7 +98,7 @@
</div>
<div class="modal-body" style="text-align: center">
<select class="form-control" v-model="newLinkTable">
<option v-for="x in tables" :value="x" v-text="x.name + ' --- ' + x.comment" :disabled="isDisable(x)"></option>
<option v-for="x in tables" :value="x" v-text="x.name + ' --- ' + x.comment" v-show="!isDisable(x)"></option>
</select>
</div>
<div class="modal-footer">

View File

@@ -63,7 +63,7 @@
</div>
<div class="modal-footer">
<button @click="row={}" type="button" class="btn btn-default" data-dismiss="modal">重置</button>
<button @click="login(row)" type="button" class="btn btn-primary">确定</button>
<button @click="login(row)" type="button" class="btn btn-primary">登录</button>
</div>
</div>
</div>

View File

@@ -482,17 +482,34 @@ public final class MetaKit {
// ---------------------- repository -------------------
public static <T extends Doc> void save(T ... ts) {
Set<Class<T>> clazzs = new HashSet<>();
if (ts == null || ts.length == 0) return;
for (T t : ts) {
if ("file".equals(dcate)) {
if (t.getKey() == null) { //数据新增异常提示
throw new UnsupportedOperationException("数据文件形式启动服务,不支持配置新增!");
}
cacheSave(t.getClass());
return;
}
if (t.getKey() == null) {
t.save();
} else {
t.update();
if (t instanceof MetaLink) {
//避免删除属性无效
if (((MetaLink) t).getLink() != null && ((MetaLink) t).getLink().size() > 0) {
t.find(String.format("UPDATE '%s' WITH { link:null } IN MetaLink", t.getKey()), Map.class);
}
}
clazzs.add((Class<T>) t.getClass());
t.update();
}
clazzs.forEach(x -> reload(x));
}
reload(ts[0].getClass());
}
public static <T extends Doc> T findFirst(T t) {

View File

@@ -1,6 +1,5 @@
package net.tccn.base;
import com.lxyer.excel.poi.ExcelKit;
import org.apache.poi.ss.usermodel.Workbook;
import org.redkale.convert.Convert;
import org.redkale.net.http.*;

View File

@@ -256,11 +256,6 @@ public class MetadataService extends BaseService { //arango
@RestMapping(name = "link_save", comment = "实体关系列表")
public JBean linkSave(MetaLink link, @RestParam(name = "platToken") String token) {
if (link.getKey() != null) {
link.find(String.format("UPDATE '%s' WITH { link:null } IN MetaLink", link.getKey()), Map.class); //避免删除属性无效
// fixme: 将逻辑迁移到 MetaKit中:
}
MetaKit.save(link);
return JBean.OK;
}

View File

@@ -1,6 +1,6 @@
package net.tccn.service;
import com.lxyer.excel.poi.ExcelKit;
import net.tccn.base.ExcelKit;
import net.tccn.base.JBean;
import net.tccn.base.Kv;
import net.tccn.dbq.Field;

View File

@@ -67,6 +67,9 @@ public class BaseServlet extends HttpServlet {
} catch (ArangoDBException e) {
logger.log(Level.INFO, "arangodb init!", e);
ArangoSource.init();
} catch (UnsupportedOperationException e) {
e.printStackTrace();
response.finish(JBean.by(-1, e.getMessage()));
}
}

View File

@@ -20,10 +20,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import static java.util.Arrays.asList;
@@ -122,7 +119,7 @@ public class RunTest<T> {
}
@Test
//@Test
public void buildeDetailTest() {
Kv kv = MetaKit.buildeDetail(MetaKit.getMetaService("user_service", "3421432"));
@@ -196,7 +193,7 @@ public class RunTest<T> {
}
@Test
//@Test
public void T() {
List<MetaTable> metaTables = MetaKit.getMetaTables();
@@ -234,7 +231,7 @@ public class RunTest<T> {
return str.substring(0, 1).toUpperCase() + str.substring(1);
}
@Test
//@Test
public void taskRunTest() {
TaskEntity entity = TaskEntity.dao.findByKey("23074420");