feat: add admin at onCreate
This commit is contained in:
parent
3ab45488df
commit
1957d163b5
3
backend/.gitignore
vendored
3
backend/.gitignore
vendored
@ -1,5 +1,7 @@
|
|||||||
/.DS_Store/
|
/.DS_Store/
|
||||||
/build/
|
/build/
|
||||||
|
/ContractDB/
|
||||||
|
debugconf.json
|
||||||
/cplibs/
|
/cplibs/
|
||||||
cplibs
|
cplibs
|
||||||
# Compiled class file
|
# Compiled class file
|
||||||
@ -25,3 +27,4 @@ cplibs
|
|||||||
|
|
||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
hs_err_pid*
|
hs_err_pid*
|
||||||
|
deployconfig.json
|
@ -1,11 +1,13 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories{
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.bdware.bdcontract:simple-ypk-packer:0.3.0"
|
classpath "org.bdware.bdcontract:simple-ypk-packer:0.3.0"
|
||||||
classpath "org.bdware.bdcontract:ypk-deploy-tool:0.4.0"
|
classpath "org.bdware.bdcontract:ypk-deploy-tool:0.4.0"
|
||||||
|
classpath 'org.apache.logging.log4j:log4j-core:2.17.2'
|
||||||
|
classpath 'org.apache.logging.log4j:log4j-api:2.17.2'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,10 +41,8 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// api 'org.apache.logging.log4j:log4j-core:2.14.1'
|
|
||||||
// api 'org.apache.logging.log4j:log4j-api:2.14.1'
|
|
||||||
implementation fileTree(dir: 'cplibs', include: '*.jar')
|
implementation fileTree(dir: 'cplibs', include: '*.jar')
|
||||||
// implementation fileTree(dir: 'cplibs/lib/', include: '*.jar')
|
implementation fileTree(dir: 'cplibs/libs/', include: '*.jar')
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
// api project(":datanet-search-engine-backend")
|
// api project(":datanet-search-engine-backend")
|
||||||
implementation 'org.postgresql:postgresql:42.3.1'
|
implementation 'org.postgresql:postgresql:42.3.1'
|
||||||
@ -52,12 +52,15 @@ dependencies {
|
|||||||
// from configurations.runtimeClasspath
|
// from configurations.runtimeClasspath
|
||||||
// into "./build/output/libs/"
|
// into "./build/output/libs/"
|
||||||
//}
|
//}
|
||||||
|
def reltivePath = "./backend"
|
||||||
task copyLibs(type: Copy ) {
|
task grepCP(dependsOn: ["copyLibs"]) {
|
||||||
from configurations.runtimeClasspath
|
doLast {
|
||||||
exclude {
|
org.bdware.datanet.YPKPacker.grepCPLibWithFilter("${reltivePath}/cplibs/libs", "${reltivePath}/build/output/libs", "${reltivePath}/grepcp.list")
|
||||||
details-> details.file.getAbsolutePath().contains("cplibs")
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyLibs(type: Copy) {
|
||||||
|
from configurations.runtimeClasspath
|
||||||
into "./build/output/libs/"
|
into "./build/output/libs/"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,37 +77,31 @@ task copyAssets(type: Copy) {
|
|||||||
from "../front"
|
from "../front"
|
||||||
into "./build/output/assets/"
|
into "./build/output/assets/"
|
||||||
}
|
}
|
||||||
task mergeJar(dependsOn: ["sourcesJar", "jar"]) {
|
|
||||||
doLast {
|
|
||||||
org.bdware.datanet.YPKPacker.mergeJar("./backend/build/libs/$project.name-${project.version}.jar",
|
|
||||||
"./backend/build/libs/$project.name-${project.version}-sources.jar",
|
|
||||||
"./backend/build/libs/$project.name-${project.version}-all.jar")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task copyJar(type: Copy, dependsOn: ["mergeJar", ":backend:copyLibs"]) {
|
def currVersion = "0.0.4"
|
||||||
from "./build/libs/$project.name-${project.version}-all.jar"
|
task copyJar(type: Copy, dependsOn: [":backend:copyLibs",":backend:jar"]) {
|
||||||
into "./build/output"
|
from "./build/libs/$project.name-${project.version}.jar"
|
||||||
rename { String fileName -> "sc-example.jar" }
|
into "./build/output/libs"
|
||||||
|
rename { String fileName -> "registry-${currVersion}.jar" }
|
||||||
doFirst {
|
doFirst {
|
||||||
println "copyJar start"
|
println "copyJar start"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task buildZip(type: Zip, dependsOn: ["copyAssets", "copyJar", "copyYJS"]) {
|
task buildZip(type: Zip, dependsOn: ["copyAssets", "copyJar", "copyYJS", "grepCP"]) {
|
||||||
from './build/output/'
|
from './build/output/'
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||||
archiveFileName = 'registry.zip'
|
archiveFileName = 'registry.zip'
|
||||||
destinationDirectory = file('build/')
|
destinationDirectory = file('build/')
|
||||||
}
|
}
|
||||||
def currVersion = "0.0.1"
|
|
||||||
task buildYPK(dependsOn: ["buildZip"]) {
|
task buildYPK(dependsOn: ["buildZip"]) {
|
||||||
doLast {
|
doLast {
|
||||||
org.bdware.datanet.YPKPacker.staticPack("./backend/build/registry.zip", "./backend/build/registry${currVersion}.ypk")
|
org.bdware.datanet.YPKPacker.staticPack("./backend/build/registry.zip", "./backend/build/registry-${currVersion}.ypk")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task deploy(dependsOn: ["buildYPK"]){
|
task deploy(dependsOn: ["buildYPK"]) {
|
||||||
doLast {
|
doLast {
|
||||||
org.bdware.ypkdeploy.HTTPTool.batchRun("./backend/deployconfig.json", true)
|
org.bdware.ypkdeploy.HTTPTool.batchRun("./backend/deployconfig.json", true)
|
||||||
}
|
}
|
||||||
|
16
backend/debugconf.json
Executable file
16
backend/debugconf.json
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"agentHttpAddr": "127.0.0.1:18000",
|
||||||
|
"privKey": "589d94ee5688358a1c5c18430dd9c75097ddddebf769f139da36a807911d20f8",
|
||||||
|
"pubKey": "04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd",
|
||||||
|
"script": "./build/registry-0.0.1.ypk",
|
||||||
|
"killContract": "Registry",
|
||||||
|
"createParam": {
|
||||||
|
"privateKey": "4616ff0e2a4f982364914f9be30b51c6bc6ccb6602114a9ee8792f2ccf67465b",
|
||||||
|
"publicKey": "04f9b9b8f324908464f78a6235e2dd93e4dfdaf045e9b1b5cfd57374516cc61a79a86fc2b42d3321a5b49a0f25381a7bed61901b40b729f72354e716673d551e98",
|
||||||
|
"registerID": "DBTest.test.test/registry",
|
||||||
|
"auditURI": "tcp://127.0.0.1:2051",
|
||||||
|
"DBUrl": "jdbc:postgresql://iodlog.demo.internetapi.cn:5432/iodlog?useServerPrepStmts=true",
|
||||||
|
"username": "iodlog",
|
||||||
|
"password": "iodlog1107"
|
||||||
|
}
|
||||||
|
}
|
1
backend/grepcp.list
Executable file
1
backend/grepcp.list
Executable file
@ -0,0 +1 @@
|
|||||||
|
yjs.jar
|
105
backend/src/main/java/org/bdware/sc/registry/DBConnector.java
Executable file
105
backend/src/main/java/org/bdware/sc/registry/DBConnector.java
Executable file
@ -0,0 +1,105 @@
|
|||||||
|
package org.bdware.sc.registry;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.bdware.sc.util.ExceptionUtil;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class DBConnector {
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger(DBConnector.class);
|
||||||
|
public static Connection jdbcConnection;
|
||||||
|
public static String url;
|
||||||
|
public static String userName;
|
||||||
|
public static String password;
|
||||||
|
|
||||||
|
|
||||||
|
public static void init() throws SQLException {
|
||||||
|
try {
|
||||||
|
JsonObject ret = new JsonObject();
|
||||||
|
ret.addProperty("success", "yes");
|
||||||
|
System.out.println(ret.get("success"));
|
||||||
|
Class.forName("org.postgresql.Driver");
|
||||||
|
connClose(jdbcConnection);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error(e.getMessage());
|
||||||
|
LOGGER.debug(ExceptionUtil.exceptionToString(e));
|
||||||
|
}
|
||||||
|
jdbcConnection = DriverManager.getConnection(url, userName, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void connect() throws SQLException {
|
||||||
|
if (url == null) init();
|
||||||
|
if (jdbcConnection == null || jdbcConnection.isClosed())
|
||||||
|
jdbcConnection = DriverManager.getConnection(url, userName, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void connClose(Connection conn) {
|
||||||
|
if (conn == null) return;
|
||||||
|
try {
|
||||||
|
if (conn != null && !conn.isClosed()) conn.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error(e.getMessage());
|
||||||
|
LOGGER.debug(ExceptionUtil.exceptionToString(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void pstmtClose(PreparedStatement pstmt) {
|
||||||
|
if (pstmt == null) return;
|
||||||
|
try {
|
||||||
|
if (pstmt != null && !pstmt.isClosed()) pstmt.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error(e.getMessage());
|
||||||
|
LOGGER.debug(ExceptionUtil.exceptionToString(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void insert(String schema, String table, Map<String, Object> items) {
|
||||||
|
// if (!items.containsKey("time") || items.get("time").equals("0")) return; // If time is null, do nothing.
|
||||||
|
// prepare columns and values needed in sql
|
||||||
|
StringBuilder columns = new StringBuilder();
|
||||||
|
StringBuilder values = new StringBuilder();
|
||||||
|
|
||||||
|
List<Map.Entry<String, Object>> list = new ArrayList<>(items.entrySet());
|
||||||
|
list.forEach(item -> {
|
||||||
|
columns.append("\"").append(item.getKey()).append("\",");
|
||||||
|
values.append("?,");
|
||||||
|
});
|
||||||
|
columns.deleteCharAt(columns.lastIndexOf(","));
|
||||||
|
values.deleteCharAt(values.lastIndexOf(","));
|
||||||
|
|
||||||
|
// generate sql
|
||||||
|
// example:
|
||||||
|
// INSERT INTO "public"."doip_request" ("op","server_doid","status_code","client_doid","do_prefix",
|
||||||
|
// "response_hash","server_pubkey","do_data_id","do_repo","request_hash","client_pubkey","server_ip",
|
||||||
|
// "client_ip","time","record_hash") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
||||||
|
String sql = "INSERT INTO \"" + schema + "\".\"" + table + "\" (" + columns + ") VALUES (" + values + ")";
|
||||||
|
|
||||||
|
// execute sql
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
try {
|
||||||
|
connect();
|
||||||
|
pstmt = jdbcConnection.prepareStatement(sql);
|
||||||
|
int i = 1;
|
||||||
|
for (Map.Entry<String, Object> item : list) {
|
||||||
|
pstmt.setObject(i, item.getValue());
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
System.out.println(pstmt);
|
||||||
|
pstmt.executeUpdate();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error(e.getMessage());
|
||||||
|
LOGGER.debug(ExceptionUtil.exceptionToString(e));
|
||||||
|
}
|
||||||
|
pstmtClose(pstmt);
|
||||||
|
connClose(jdbcConnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
2
backend/src/main/java/org/bdware/sc/contractexample/Hello.java → backend/src/main/java/org/bdware/sc/registry/Hello.java
Normal file → Executable file
2
backend/src/main/java/org/bdware/sc/contractexample/Hello.java → backend/src/main/java/org/bdware/sc/registry/Hello.java
Normal file → Executable file
@ -1,4 +1,4 @@
|
|||||||
package org.bdware.sc.contractexample;
|
package org.bdware.sc.registry;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
32
backend/src/main/java/org/bdware/sc/registry/RegistryDB.java
Executable file
32
backend/src/main/java/org/bdware/sc/registry/RegistryDB.java
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
package org.bdware.sc.registry;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import org.bdware.sc.engine.JSONTool;
|
||||||
|
import wrp.jdk.nashorn.api.scripting.ScriptObjectMirror;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public class RegistryDB {
|
||||||
|
public static void init(ScriptObjectMirror arg, String requester) {
|
||||||
|
try {
|
||||||
|
JsonObject jsonData = JSONTool.convertMirrorToJson(arg).getAsJsonObject();
|
||||||
|
DBConnector.url = jsonData.get("DBUrl").getAsString();
|
||||||
|
DBConnector.password = jsonData.get("password").getAsString();
|
||||||
|
DBConnector.userName = jsonData.get("username").getAsString();
|
||||||
|
DBConnector.init();
|
||||||
|
DBConnector.connect();
|
||||||
|
|
||||||
|
Map<String, Object> item = new HashMap<>();
|
||||||
|
item.put("pubkey", requester);
|
||||||
|
item.put("type", "admin");
|
||||||
|
item.put("username", jsonData.get("adminName").getAsString());
|
||||||
|
DBConnector.insert("registry", "user", item);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,15 +0,0 @@
|
|||||||
filter.threshold.type=ThresholdFilter
|
|
||||||
filter.threshold.level=debug
|
|
||||||
appender.console.type=Console
|
|
||||||
appender.console.name=STDOUT
|
|
||||||
appender.console.layout.type=PatternLayout
|
|
||||||
appender.console.layout.pattern=%highlight{[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n}{FATAL=Bright Red,ERROR=Red,WARN=Yellow,INFO=Green,DEBUG=Blue,TRACE=White}
|
|
||||||
appender.rolling.type=File
|
|
||||||
appender.rolling.name=log
|
|
||||||
appender.rolling.append=true
|
|
||||||
appender.rolling.fileName=./log/gateway.log
|
|
||||||
appender.rolling.layout.type=PatternLayout
|
|
||||||
appender.rolling.layout.pattern=%d-%m%n
|
|
||||||
rootLogger.level=info
|
|
||||||
rootLogger.appenderRef.stdout.ref=STDOUT
|
|
||||||
rootLogger.appenderRef.log.ref=log
|
|
7
backend/src/test/java/StartRegistry.java
Normal file
7
backend/src/test/java/StartRegistry.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import org.bdware.sc.debugger.DebugMain;
|
||||||
|
|
||||||
|
public class StartRegistry {
|
||||||
|
public static void main(String[] args){
|
||||||
|
DebugMain.main(args);
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +0,0 @@
|
|||||||
filter.threshold.type=ThresholdFilter
|
|
||||||
filter.threshold.level=debug
|
|
||||||
appender.console.type=Console
|
|
||||||
appender.console.name=STDOUT
|
|
||||||
appender.console.layout.type=PatternLayout
|
|
||||||
appender.console.layout.pattern=%highlight{[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n}{FATAL=Bright Red,ERROR=Red,WARN=Yellow,INFO=Green,DEBUG=Blue,TRACE=White}
|
|
||||||
appender.rolling.type=File
|
|
||||||
appender.rolling.name=log
|
|
||||||
appender.rolling.append=true
|
|
||||||
appender.rolling.fileName=./log/gateway.log
|
|
||||||
appender.rolling.layout.type=PatternLayout
|
|
||||||
appender.rolling.layout.pattern=%d-%m%n
|
|
||||||
rootLogger.level=info
|
|
||||||
rootLogger.appenderRef.stdout.ref=STDOUT
|
|
||||||
rootLogger.appenderRef.log.ref=log
|
|
17
backend/yjs/Register.yjs
Executable file
17
backend/yjs/Register.yjs
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
import "User.yjs";
|
||||||
|
import "metaDetail.yjs";
|
||||||
|
oracle Register{
|
||||||
|
@ArgSchema({"!doId":"string","offset":"number","count":"number"})
|
||||||
|
export function retrieve(){
|
||||||
|
//executeContract去拿到Repo的原始结果
|
||||||
|
//根据request进行判断,找到对应的rule
|
||||||
|
//将原始结果与rule做一个映射,得到转换后的结果
|
||||||
|
//返回转换后的结果。
|
||||||
|
return Transform.trans(abc);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onCreate(arg){
|
||||||
|
Global.registerID = arg.registerID;
|
||||||
|
org.bdware.sc.registry.RegistryDB.init(arg, requester);
|
||||||
|
}
|
||||||
|
}
|
27
backend/yjs/User.yjs
Executable file
27
backend/yjs/User.yjs
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
module User{
|
||||||
|
export function getRole(){
|
||||||
|
//{"role":"anymo...","code":0}
|
||||||
|
return {"role":"admin","code": 0};
|
||||||
|
}
|
||||||
|
export function getUserInfo(arg){
|
||||||
|
return {"pubkey":"xxx","name":"xx","phone":"xxx","descripstion":"","permission":"admin,user,"};
|
||||||
|
}
|
||||||
|
//{"pubkey":"xxx","name":"xx","phone":"xxx","description":"","permission":"admin,user,"}
|
||||||
|
export function updateUserInfo(arg){
|
||||||
|
return {"code":1};
|
||||||
|
}
|
||||||
|
export function addUserInfo(arg){
|
||||||
|
return {"code":1};
|
||||||
|
}
|
||||||
|
//...
|
||||||
|
export function getUserList(arg){
|
||||||
|
var ret = [];
|
||||||
|
ret.push(
|
||||||
|
{"pubkey":"xxx","name":"xx","phone":"xxx","description":"xxxxxxx","permission":"admin,user"},
|
||||||
|
{"pubkey":"xxx","name":"xx","phone":"xxx","description":"xxxxxxx","permission":"admin"},
|
||||||
|
{"pubkey":"xxx","name":"xx","phone":"xxx","description":"xxxxxxx","permission":"user"}
|
||||||
|
);
|
||||||
|
return {"total":10,"data":ret,"code":0};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
BIN
backend/yjs/assets/logo.png
Executable file
BIN
backend/yjs/assets/logo.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 316 B |
17
backend/yjs/main.yjs
Normal file → Executable file
17
backend/yjs/main.yjs
Normal file → Executable file
@ -1,12 +1,11 @@
|
|||||||
|
|
||||||
oracle ContractExample {
|
oracle ContractExample {
|
||||||
function onCreate(){
|
function onCreate() {
|
||||||
Global.owner = requester;
|
Global.owner = requester;
|
||||||
|
}
|
||||||
|
export function callHello(arg) {
|
||||||
|
return Hello.call()+requester;
|
||||||
|
}
|
||||||
|
export function getOwner() {
|
||||||
|
return Global.owner;
|
||||||
}
|
}
|
||||||
export function callHello(arg){
|
|
||||||
return Hello.call()+requester;
|
|
||||||
}
|
|
||||||
export function getOwner(){
|
|
||||||
return Global.owner;
|
|
||||||
}
|
|
||||||
}
|
}
|
10
backend/yjs/manifest.json
Normal file → Executable file
10
backend/yjs/manifest.json
Normal file → Executable file
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"main": "main.yjs",
|
"main": "Register.yjs",
|
||||||
"memory": "kill,init",
|
"doi": "Contract_-1259280471",
|
||||||
"doi": "Contract_1172400934",
|
|
||||||
"insnLimit": 0,
|
"insnLimit": 0,
|
||||||
"buildTime": 1635385270646,
|
"buildTime": 1651497662646,
|
||||||
"builder": "ContractEngine",
|
"builder": "ContractEngine",
|
||||||
"startAtUnpack": true
|
"startAtUnpack": false,
|
||||||
|
"sourcePath": "public/Register"
|
||||||
}
|
}
|
261
backend/yjs/metaDetail.yjs
Executable file
261
backend/yjs/metaDetail.yjs
Executable file
@ -0,0 +1,261 @@
|
|||||||
|
module metaStandardDetail{
|
||||||
|
export function getRegistryInfo(arg){
|
||||||
|
return {"code":0,"registryID":"macjw.ab","description":"这是xx市的注册表,添加更多Registry描述"};
|
||||||
|
}
|
||||||
|
export function verifyRule(arg){
|
||||||
|
return {"code":0,"msg":"success"}
|
||||||
|
}
|
||||||
|
export function getFieldTypeList(arg){
|
||||||
|
return {"code":0, "data":[
|
||||||
|
{
|
||||||
|
"typeName":"string",
|
||||||
|
"lable":"字符串",
|
||||||
|
"formDesc":{
|
||||||
|
"固定值":{
|
||||||
|
"type":"input"
|
||||||
|
},
|
||||||
|
"默认值":{
|
||||||
|
"type":"input"
|
||||||
|
},
|
||||||
|
"最小长度":{
|
||||||
|
"type":"input"
|
||||||
|
},
|
||||||
|
"最大长度":{
|
||||||
|
"type":"input"
|
||||||
|
},
|
||||||
|
"必备项":{
|
||||||
|
"type":"select",
|
||||||
|
"options":["是","否"]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"typeName":"boolean",
|
||||||
|
"lable":"真假",
|
||||||
|
"formDesc":{
|
||||||
|
"固定值":{
|
||||||
|
"type":"input"
|
||||||
|
},
|
||||||
|
"默认值":{
|
||||||
|
"type":"input"
|
||||||
|
},
|
||||||
|
"必备项":{
|
||||||
|
"type":"select",
|
||||||
|
"options":["是","否"]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function listRemoteRegistry(){
|
||||||
|
var ret = [
|
||||||
|
{"registryID":"macjw","name":"jw市市级注册"},
|
||||||
|
{"registryID":"macjw.de.cd","name":"jw市de县cd镇注册表"}
|
||||||
|
];
|
||||||
|
return {
|
||||||
|
"total":10,"data":ret,"code":0};
|
||||||
|
|
||||||
|
}
|
||||||
|
//{如果是offset+count,就按顺序,
|
||||||
|
// controlType=过滤
|
||||||
|
// createStartDate createEndDate
|
||||||
|
// updateStartDate updateEndDate
|
||||||
|
// 如果是keyword:... 就模糊搜索}
|
||||||
|
// registryID
|
||||||
|
//{"createStartDate":16111,"createEndDate":12222,"offset":0,"count":5}
|
||||||
|
export function listMetaStandard(arg){
|
||||||
|
var ret =[];
|
||||||
|
ret.push({
|
||||||
|
"name":"CO传感数据",
|
||||||
|
"createDate":167227222,
|
||||||
|
"updateDate":1111111,
|
||||||
|
"creator":"xxx",
|
||||||
|
"updater":"aabbcc",
|
||||||
|
"registryID":"macjw.ab",
|
||||||
|
"controlType":"private",
|
||||||
|
"typeList":["public","private"],
|
||||||
|
"status":"off",
|
||||||
|
"version":"2.1",
|
||||||
|
"doId":"ab.ccd/aaaaa-aaa",
|
||||||
|
"desc":"元数据标准说明",
|
||||||
|
"fields":[
|
||||||
|
{
|
||||||
|
"name":"owner",
|
||||||
|
"type":"string",
|
||||||
|
"description":"简要的说明",
|
||||||
|
"constraint":{
|
||||||
|
"固定值":"xxxxx",
|
||||||
|
"最大长度":50,
|
||||||
|
"必备项":"是",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"pubkey",
|
||||||
|
"type":"string",
|
||||||
|
"description":"pubkey简要的说明2",
|
||||||
|
"constraint":{
|
||||||
|
"固定值":"jjjjjjj",
|
||||||
|
"最大长度":50
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"BF传感数据",
|
||||||
|
"createDate":167226222,
|
||||||
|
"updateDate":1111311,
|
||||||
|
"creator":"xxx",
|
||||||
|
"updater":"aabbcc",
|
||||||
|
"registryID":"macjw",
|
||||||
|
"controlType":"public",
|
||||||
|
"typeList":["public","private"],
|
||||||
|
"status":"on",
|
||||||
|
"version":"2.1",
|
||||||
|
"doId":"ab.ccd/aabbbaa-aaa",
|
||||||
|
"desc":"元数据标准说明",
|
||||||
|
"fields":[
|
||||||
|
{
|
||||||
|
"name":"repository",
|
||||||
|
"type":"string",
|
||||||
|
"description":"简要的说明",
|
||||||
|
"constraint":{
|
||||||
|
"固定值":"xxx",
|
||||||
|
"最大长度":50,
|
||||||
|
"必备项":"是",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"format",
|
||||||
|
"type":"boolean",
|
||||||
|
"description":"简要的说明2",
|
||||||
|
"constraint":{
|
||||||
|
"必备项":"否"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"registertime",
|
||||||
|
"type":"string",
|
||||||
|
"description":"registertime简要的说明333333333",
|
||||||
|
"constraint":{
|
||||||
|
"固定值":"ooooo",
|
||||||
|
"默认值":"hhhhhhhh",
|
||||||
|
"最小长度":10,
|
||||||
|
"必备项":"否",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"AA传感数据",
|
||||||
|
"createDate":167227222,
|
||||||
|
"updateDate":1111111,
|
||||||
|
"creator":"xxx",
|
||||||
|
"updater":"aabbcc",
|
||||||
|
"registryID":"macjw.ab",
|
||||||
|
"controlType":"private",
|
||||||
|
"typeList":["public","private"],
|
||||||
|
"status":"off",
|
||||||
|
"version":"2.1",
|
||||||
|
"doId":"ab.ccd/adddda-aaa",
|
||||||
|
"desc":"元数据标准说明",
|
||||||
|
"fields":[
|
||||||
|
{
|
||||||
|
"name":"owner",
|
||||||
|
"type":"string",
|
||||||
|
"description":"简要的说明",
|
||||||
|
"constraint":{
|
||||||
|
"固定值":"xxxxx",
|
||||||
|
"最大长度":50,
|
||||||
|
"必备项":"是",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"pubkey",
|
||||||
|
"type":"string",
|
||||||
|
"description":"pubkey简要的说明2",
|
||||||
|
"constraint":{
|
||||||
|
"固定值":"jjjjjjj",
|
||||||
|
"最大长度":50
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"HHH传感数据",
|
||||||
|
"createDate":167227222,
|
||||||
|
"updateDate":1111111,
|
||||||
|
"creator":"xxx",
|
||||||
|
"updater":"aabbcc",
|
||||||
|
"registryID":"macjw.ac",
|
||||||
|
"controlType":"private",
|
||||||
|
"typeList":["public","private"],
|
||||||
|
"status":"on",
|
||||||
|
"version":"2.1",
|
||||||
|
"doId":"ab.ccd/aggga-aaa",
|
||||||
|
"desc":"元数据标准说明",
|
||||||
|
"fields":[
|
||||||
|
{
|
||||||
|
"name":"owner",
|
||||||
|
"type":"string",
|
||||||
|
"description":"简要的说明",
|
||||||
|
"constraint":{
|
||||||
|
"固定值":"xxxxx",
|
||||||
|
"最大长度":50,
|
||||||
|
"必备项":"是",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"pubkey",
|
||||||
|
"type":"string",
|
||||||
|
"description":"pubkey简要的说明2",
|
||||||
|
"constraint":{
|
||||||
|
"固定值":"jjjjjjj",
|
||||||
|
"最大长度":50
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
"total":10,"data":ret,"code":0};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateMetaStandardDetail(arg){
|
||||||
|
var ret =[];
|
||||||
|
//通知对应的远程注册表,需要更新这个关系。
|
||||||
|
return {
|
||||||
|
"total":10,"data":ret,"code":0};
|
||||||
|
}
|
||||||
|
|
||||||
|
//{"offset":..,"count":,"localMetaStandardDoid":}
|
||||||
|
export function listMetaStandardRelaction(arg){
|
||||||
|
var ret = [];
|
||||||
|
ret.push({
|
||||||
|
"name":"煤矿传感数据映射",
|
||||||
|
"localMetaStandardDoid":"xx.xx/adfa",
|
||||||
|
"remoteMetaStandardDoid":"ab.ccd/aaaaa-aaa",
|
||||||
|
"createDate":167227222,
|
||||||
|
"updateDate":1111111,
|
||||||
|
"creator":"aabbcc",
|
||||||
|
"updater":"aabbcc",
|
||||||
|
"mapRule":{
|
||||||
|
"owner":"${val.大小}",
|
||||||
|
"pubkey":"function(val){}",
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
"total":10,"data":ret,"code":0};
|
||||||
|
}
|
||||||
|
|
||||||
|
//{"localMetaID":"xxx","mapRule":{},"remoteMetaID":"xxx"}
|
||||||
|
export function getPreviewMapResult(arg){
|
||||||
|
return {"code":0, data:{"localData":{"大小":"500KB","姓名":"小东"},"remoteData":{"size":"500000Byte","name":"*东"}}};
|
||||||
|
//TODO 返回映射格式有误
|
||||||
|
// return {"code":1,"....."}
|
||||||
|
}
|
||||||
|
//{"localDataSample":{},"mapRule":{},"remoteMetaID":"xxx"}
|
||||||
|
export function getMapResult(){
|
||||||
|
return {"code":0, data: {"remoteData":{"size":"500000Byte","姓名":"*明"}}}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user