优化:1、meta 业务配置页面,其他界面改善
2、元数据记录到内存缺少id的处理
3、设置platid为不可修改字段
This commit is contained in:
@@ -11,10 +11,11 @@ import net.tccn.plat.MPlat;
|
||||
import net.tccn.qtask.TaskKit;
|
||||
import net.tccn.user.MUser;
|
||||
import org.redkale.annotation.Resource;
|
||||
import org.redkale.convert.json.JsonConvert;
|
||||
import org.redkale.service.AbstractService;
|
||||
import org.redkale.source.DataJdbcSource;
|
||||
import org.redkale.source.DataSource;
|
||||
import org.redkale.source.FilterNode;
|
||||
import org.redkale.source.Flipper;
|
||||
import org.redkale.util.AnyValue;
|
||||
import org.redkale.util.Comment;
|
||||
|
||||
@@ -48,9 +49,11 @@ public class MetaKit extends AbstractService {
|
||||
@Getter
|
||||
private static List<Dict> dicts;
|
||||
|
||||
protected static String dcate = "db";
|
||||
protected static String dataPath;
|
||||
private static final JsonConvert convert = JsonConvert.root();
|
||||
@Resource(name = "property.dataCate")
|
||||
protected String dcate = "db";
|
||||
@Resource(name = "property.dataPath")
|
||||
protected String dataPath;
|
||||
// private static final JsonConvert convert = JsonConvert.root();
|
||||
|
||||
@Resource(name = "meta")
|
||||
protected DataSource metaSource;
|
||||
@@ -124,7 +127,7 @@ public class MetaKit extends AbstractService {
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
public static void init() {
|
||||
/*public static void init() {
|
||||
// reload(MetaTable.class);
|
||||
// reload(MLink.class);
|
||||
// reload(MetaService.class);
|
||||
@@ -134,16 +137,15 @@ public class MetaKit extends AbstractService {
|
||||
// reload(DbTask.class);
|
||||
// reload(Dict.class);
|
||||
|
||||
/*
|
||||
同步 本地文件配置数据到 数据库
|
||||
// 同步 本地文件配置数据到 数据库
|
||||
List<List<? extends Doc>> list = asList(metaTables, metaLinks, metaServices, dbPlats, sysPlats, users, taskEntities, dicts);
|
||||
for (List<? extends Doc> docs : list) {
|
||||
for (Doc doc : docs) {
|
||||
doc.save();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
/*public static <T extends Doc> void reload(Class<T> clazz) {
|
||||
reload(clazz, null);
|
||||
@@ -665,7 +667,10 @@ public class MetaKit extends AbstractService {
|
||||
public void save(MTable table) {
|
||||
if (table.getTableid() == null || table.getTableid() == 0) {
|
||||
metaSource.insert(table);
|
||||
mTables.add(table);
|
||||
// 查询回来带id的记录
|
||||
FilterNode node = FilterNode.create("alias", table.getAlias()); // alias 唯一
|
||||
MTable _table = metaSource.find(MTable.class, node);
|
||||
mTables.add(_table);
|
||||
} else {
|
||||
metaSource.update(table);
|
||||
|
||||
@@ -687,7 +692,10 @@ public class MetaKit extends AbstractService {
|
||||
public void save(MService mservice) {
|
||||
if (mservice.getServid() == 0) {
|
||||
metaSource.insert(mservice);
|
||||
metaServices.add(mservice);
|
||||
// 查询回来带id的记录
|
||||
FilterNode node = FilterNode.create("name", mservice.getName()).and("platid", mservice.getPlatid());
|
||||
MService _mservice = metaSource.find(MService.class, node);
|
||||
metaServices.add(_mservice);
|
||||
} else {
|
||||
metaSource.update(mservice);
|
||||
|
||||
@@ -708,7 +716,9 @@ public class MetaKit extends AbstractService {
|
||||
public void save(MLink link) {
|
||||
if (link.getLinkid() == 0) {
|
||||
metaSource.insert(link);
|
||||
metaLinks.add(link);
|
||||
// 查询回来带id的记录 (暂未考虑多人并发操作)
|
||||
List<MLink> _links = metaSource.queryList(MLink.class, new Flipper("linkid DESC"));
|
||||
metaLinks.add(_links.get(0));
|
||||
} else {
|
||||
metaSource.update(link);
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package net.tccn.base;
|
||||
|
||||
import org.redkale.annotation.Resource;
|
||||
import org.redkale.boot.Application;
|
||||
import org.redkale.boot.ApplicationListener;
|
||||
import org.redkale.util.ResourceFactory;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@@ -13,12 +13,12 @@ import java.util.concurrent.CompletableFuture;
|
||||
*/
|
||||
public class MetaListenter implements ApplicationListener {
|
||||
|
||||
@Resource(name = "property.dataCate")
|
||||
/*@Resource(name = "property.dataCate")
|
||||
private String dcate;
|
||||
@Resource(name = "property.dataPath")
|
||||
private String dataPath;*/
|
||||
@Resource(name = "property.tplPath")
|
||||
private String tplPath;
|
||||
@Resource(name = "property.dataPath")
|
||||
private String dataPath;
|
||||
|
||||
public static ResourceFactory resourceFactory;
|
||||
|
||||
@@ -29,9 +29,8 @@ public class MetaListenter implements ApplicationListener {
|
||||
resourceFactory = rf;
|
||||
rf.inject(this);
|
||||
|
||||
MetaKit.dcate = dcate;
|
||||
MetaKit.dataPath = dataPath;
|
||||
MetaKit.init();
|
||||
/*MetaKit.dcate = dcate;
|
||||
MetaKit.dataPath = dataPath;*/
|
||||
TplKit.use(true).addTpl(new File(FileKit.rootPath(), tplPath));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ public class MService extends BaseEntity {
|
||||
@Column(length = 64, comment = "[业务标识]")
|
||||
private String name;
|
||||
|
||||
@Column(length = 15, comment = "[主体表别名]")
|
||||
@Column(updatable = false, length = 15, comment = "[主体表别名]")
|
||||
private String tablealias;
|
||||
|
||||
@Column(length = 64, comment = "[业务中文名]")
|
||||
private String comment;
|
||||
|
||||
@Column(comment = "[平台id]")
|
||||
@Column(updatable = false, comment = "[平台id]")
|
||||
private Integer platid;
|
||||
|
||||
@Column(comment = "[SHOWS]")
|
||||
|
||||
@@ -43,7 +43,7 @@ public class MTable extends BaseEntity {
|
||||
@Column(comment = "[状态]0 默认, 9删除'")
|
||||
private int status;
|
||||
|
||||
@Column(comment = "[所属系统平台]")
|
||||
@Column(updatable = false,comment = "[所属系统平台]")
|
||||
private Integer platid;
|
||||
|
||||
@Column(comment = "[所属数据平台]")
|
||||
|
||||
@@ -307,7 +307,7 @@ public class MetadataService extends BaseService { //arango
|
||||
@RestMapping(name = "refresh", comment = "刷新服务端缓存数据")
|
||||
public JBean refresh() {
|
||||
JBean jBean = new JBean();
|
||||
MetaKit.init();
|
||||
metaKit.init(null);
|
||||
return jBean;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.tccn.qtask;
|
||||
import dev.zhub.mk.qtask.QTask;
|
||||
import net.tccn.base.BaseService;
|
||||
import net.tccn.base.JBean;
|
||||
import net.tccn.base.Utils;
|
||||
import org.redkale.net.http.RestBody;
|
||||
import org.redkale.net.http.RestHeader;
|
||||
import org.redkale.net.http.RestParam;
|
||||
@@ -36,9 +37,16 @@ public class _QtaskService extends BaseService {
|
||||
public RetResult create(@RestHeader(name = "plattoken") String token,
|
||||
@RestBody QTask task) {
|
||||
|
||||
if (Utils.isEmpty(task.getName())) {
|
||||
return retError("任务KEY 不能为空");
|
||||
}
|
||||
if (Utils.isEmpty(task.getTitle())) {
|
||||
return retError("任务名称 不能为空");
|
||||
}
|
||||
|
||||
FilterNode node = FilterNode.create("name", task.getName()).and("platid", platId(token));
|
||||
if (metaSource.exists(QTask.class, node)) {
|
||||
return retError("qtask 标识不能重复");
|
||||
return retError("任务KEY 不能重复");
|
||||
}
|
||||
task.setPlatid(platId(token));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user