feat: support map rule
This commit is contained in:
parent
1957d163b5
commit
4974fb7a90
@ -78,7 +78,7 @@ task copyAssets(type: Copy) {
|
|||||||
into "./build/output/assets/"
|
into "./build/output/assets/"
|
||||||
}
|
}
|
||||||
|
|
||||||
def currVersion = "0.0.4"
|
def currVersion = "0.0.5"
|
||||||
task copyJar(type: Copy, dependsOn: [":backend:copyLibs",":backend:jar"]) {
|
task copyJar(type: Copy, dependsOn: [":backend:copyLibs",":backend:jar"]) {
|
||||||
from "./build/libs/$project.name-${project.version}.jar"
|
from "./build/libs/$project.name-${project.version}.jar"
|
||||||
into "./build/output/libs"
|
into "./build/output/libs"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"agentHttpAddr": "127.0.0.1:18000",
|
"agentHttpAddr": "127.0.0.1:18000",
|
||||||
"privKey": "589d94ee5688358a1c5c18430dd9c75097ddddebf769f139da36a807911d20f8",
|
"privKey": "589d94ee5688358a1c5c18430dd9c75097ddddebf769f139da36a807911d20f8",
|
||||||
"pubKey": "04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd",
|
"pubKey": "04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd",
|
||||||
"script": "./build/registry-0.0.1.ypk",
|
"script": "./build/registry-0.0.5.ypk",
|
||||||
"killContract": "Registry",
|
"killContract": "Registry",
|
||||||
"createParam": {
|
"createParam": {
|
||||||
"privateKey": "4616ff0e2a4f982364914f9be30b51c6bc6ccb6602114a9ee8792f2ccf67465b",
|
"privateKey": "4616ff0e2a4f982364914f9be30b51c6bc6ccb6602114a9ee8792f2ccf67465b",
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
package org.bdware.sc.registry;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import org.bdware.sc.ContractProcess;
|
||||||
|
import org.bdware.sc.boundry.JavaScriptEntry;
|
||||||
|
import org.bdware.sc.engine.JSONTool;
|
||||||
|
import wrp.jdk.nashorn.api.scripting.NashornScriptEngine;
|
||||||
|
import wrp.jdk.nashorn.api.scripting.ScriptObjectMirror;
|
||||||
|
import wrp.jdk.nashorn.internal.runtime.PropertyMap;
|
||||||
|
import wrp.jdk.nashorn.internal.runtime.ScriptFunction;
|
||||||
|
import wrp.jdk.nashorn.internal.scripts.JO;
|
||||||
|
|
||||||
|
public class RuleExecutor {
|
||||||
|
private static int executeCode;
|
||||||
|
|
||||||
|
public static Object executeRule(ScriptObjectMirror som) {
|
||||||
|
executeCode = 0;
|
||||||
|
JsonObject jo = JSONTool.convertMirrorToJson(som).getAsJsonObject();
|
||||||
|
Object val = som.get("localDataSample");
|
||||||
|
JsonObject rule = jo.get("mapRule").getAsJsonObject();
|
||||||
|
JO ret = new JO(PropertyMap.newMap());
|
||||||
|
for (String str : rule.keySet()) {
|
||||||
|
ret.put(str, getMapResult(val, rule.get(str).getAsString()), false);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
//{"localDataSample":{"owner":"abcdef","size":"1234"},"mapRule":{"所有者":"${val.owner}","大小":"${val.size*1000}","偏移过的大小":"${edp(val.size,30.0)}" }}
|
||||||
|
private static Object getMapResult(Object val, String fun) {
|
||||||
|
try {
|
||||||
|
NashornScriptEngine engine = ContractProcess.instance.engine.engine;
|
||||||
|
if (fun.matches("\\$\\{.*\\}")) {
|
||||||
|
fun = "function(val){ return " + fun.substring(2);
|
||||||
|
}
|
||||||
|
ScriptObjectMirror function = (ScriptObjectMirror) engine.eval(fun);
|
||||||
|
function.compileScriptFunction();
|
||||||
|
return JavaScriptEntry.executeFunction((ScriptFunction) function.getScriptObject(), val);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
//TODO GREP....
|
||||||
|
executeCode = 1;
|
||||||
|
return "exception:" + e.getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getLastExecuteStatus() {
|
||||||
|
return executeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
27
backend/src/main/java/org/bdware/sc/registry/RuleHelper.java
Normal file
27
backend/src/main/java/org/bdware/sc/registry/RuleHelper.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package org.bdware.sc.registry;
|
||||||
|
|
||||||
|
import com.alibaba.datax.transport.transformer.maskingMethods.differentialPrivacy.EpsilonDifferentialPrivacyImpl;
|
||||||
|
import com.alibaba.datax.transport.transformer.maskingMethods.irreversibleInterference.MD5EncryptionImpl;
|
||||||
|
|
||||||
|
public class RuleHelper {
|
||||||
|
public static String md5(Object obj) {
|
||||||
|
try {
|
||||||
|
MD5EncryptionImpl masker = new MD5EncryptionImpl();
|
||||||
|
return masker.execute(obj.toString());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "*****" + e.getMessage() + "****";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Object edp(Object obj, double epsilon) {
|
||||||
|
try {
|
||||||
|
EpsilonDifferentialPrivacyImpl masker = new EpsilonDifferentialPrivacyImpl();
|
||||||
|
double result = 0;
|
||||||
|
result = masker.maskOne(Double.valueOf(obj.toString()), epsilon);
|
||||||
|
return result;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return "***" + e.getMessage() + "***";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +1,17 @@
|
|||||||
import "User.yjs";
|
import "User.yjs";
|
||||||
import "metaDetail.yjs";
|
import "metaDetail.yjs";
|
||||||
oracle Register{
|
import "ruleHelper.yjs";
|
||||||
@ArgSchema({"!doId":"string","offset":"number","count":"number"})
|
oracle Register {
|
||||||
export function retrieve(){
|
@ArgSchema({"!doId":"string", "offset":"number", "count":"number"})
|
||||||
//executeContract去拿到Repo的原始结果
|
export function retrieve() {
|
||||||
//根据request进行判断,找到对应的rule
|
//executeContract去拿到Repo的原始结果
|
||||||
//将原始结果与rule做一个映射,得到转换后的结果
|
//根据request进行判断,找到对应的rule
|
||||||
//返回转换后的结果。
|
//将原始结果与rule做一个映射,得到转换后的结果
|
||||||
return Transform.trans(abc);
|
//返回转换后的结果。
|
||||||
|
return Transform.trans(abc);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onCreate(arg){
|
function onCreate(arg) {
|
||||||
Global.registerID = arg.registerID;
|
Global.registerID = arg.registerID;
|
||||||
org.bdware.sc.registry.RegistryDB.init(arg, requester);
|
org.bdware.sc.registry.RegistryDB.init(arg, requester);
|
||||||
}
|
}
|
||||||
|
@ -1,261 +1,165 @@
|
|||||||
module metaStandardDetail{
|
module metaStandardDetail {
|
||||||
export function getRegistryInfo(arg){
|
export function getRegistryInfo(arg) {
|
||||||
return {"code":0,"registryID":"macjw.ab","description":"这是xx市的注册表,添加更多Registry描述"};
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
);
|
export function verifyRule(arg) {
|
||||||
return {
|
return {
|
||||||
"total":10,"data":ret,"code":0};
|
"code":0, "msg":"success"
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateMetaStandardDetail(arg){
|
|
||||||
var ret =[];
|
|
||||||
//通知对应的远程注册表,需要更新这个关系。
|
}
|
||||||
return {
|
export function getFieldTypeList(arg) {
|
||||||
"total":10,"data":ret,"code":0};
|
return {
|
||||||
}
|
"code":0, "data":[
|
||||||
|
{
|
||||||
//{"offset":..,"count":,"localMetaStandardDoid":}
|
"typeName":"string", "lable":"字符串", "formDesc":{
|
||||||
export function listMetaStandardRelaction(arg){
|
"固定值":{
|
||||||
var ret = [];
|
"type":"input"
|
||||||
ret.push({
|
}, "默认值":{
|
||||||
"name":"煤矿传感数据映射",
|
"type":"input"
|
||||||
"localMetaStandardDoid":"xx.xx/adfa",
|
}, "最小长度":{
|
||||||
"remoteMetaStandardDoid":"ab.ccd/aaaaa-aaa",
|
"type":"input"
|
||||||
"createDate":167227222,
|
}, "最大长度":{
|
||||||
"updateDate":1111111,
|
"type":"input"
|
||||||
"creator":"aabbcc",
|
}, "必备项":{
|
||||||
"updater":"aabbcc",
|
"type":"select", "options":["是", "否"]
|
||||||
"mapRule":{
|
}, }
|
||||||
"owner":"${val.大小}",
|
}, {
|
||||||
"pubkey":"function(val){}",
|
"typeName":"boolean", "lable":"真假", "formDesc":{
|
||||||
}
|
"固定值":{
|
||||||
});
|
"type":"input"
|
||||||
return {
|
}, "默认值":{
|
||||||
"total":10,"data":ret,"code":0};
|
"type":"input"
|
||||||
}
|
}, "必备项":{
|
||||||
|
"type":"select", "options":["是", "否"]
|
||||||
//{"localMetaID":"xxx","mapRule":{},"remoteMetaID":"xxx"}
|
}, }
|
||||||
export function getPreviewMapResult(arg){
|
}, ]
|
||||||
return {"code":0, data:{"localData":{"大小":"500KB","姓名":"小东"},"remoteData":{"size":"500000Byte","name":"*东"}}};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
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 返回映射格式有误
|
//TODO 返回映射格式有误
|
||||||
// return {"code":1,"....."}
|
// return {"code":1,"....."}
|
||||||
}
|
}
|
||||||
//{"localDataSample":{},"mapRule":{},"remoteMetaID":"xxx"}
|
function convertArgToJson(arg) {
|
||||||
export function getMapResult(){
|
if (typeof(arg)=='string') return JSON.parse(arg);
|
||||||
return {"code":0, data: {"remoteData":{"size":"500000Byte","姓名":"*明"}}}
|
return arg;
|
||||||
}
|
}
|
||||||
|
//{"localDataSample":{},"mapRule":{},"remoteMetaID":"xxx"}
|
||||||
|
export function getMapResult(arg) {
|
||||||
|
arg = convertArgToJson(arg);
|
||||||
|
var ret = {
|
||||||
|
};
|
||||||
|
ret.data = org.bdware.sc.registry.RuleExecutor.executeRule(arg);
|
||||||
|
ret.code = org.bdware.sc.registry.RuleExecutor.getLastExecuteStatus();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
8
backend/yjs/ruleHelper.yjs
Executable file
8
backend/yjs/ruleHelper.yjs
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
module ruleHelper {
|
||||||
|
function md5(str) {
|
||||||
|
return org.bdware.sc.registry.RuleHelper.md5(str);
|
||||||
|
}
|
||||||
|
function edp(d1, d2) {
|
||||||
|
return org.bdware.sc.registry.RuleHelper.edp(d1, d2);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user