2022-04-19 01:26:59 +00:00
|
|
|
|
//@张宏伟
|
2023-05-23 09:42:59 +00:00
|
|
|
|
module SearchModule {
|
|
|
|
|
//获取DO的数量 该接口可以用于主页的DO数量
|
|
|
|
|
//也可用于全领监管->总体情况概览 里面的“仓库数量”,“DO数量” ,“DO分布情况”三项。
|
|
|
|
|
//可以增加一个参数用于过滤返回结果?比如模糊匹配上的就加到返回列表里。
|
|
|
|
|
//str.contains(arg..)
|
|
|
|
|
//输入参数,doId,如bdware.txte/Repo
|
|
|
|
|
//返回结果:一个数组,里面是doId"contains"这个参数的列表。
|
2023-07-04 02:49:09 +00:00
|
|
|
|
// res.addProperty("doCount", this.metaIndex.getDoCount());
|
2023-02-15 16:17:58 +00:00
|
|
|
|
|
2023-05-23 09:42:59 +00:00
|
|
|
|
export function getAllRepoCount() {
|
2023-07-04 02:49:09 +00:00
|
|
|
|
var data = executeContract("Registry", "getPageInfo", arg).result.data;
|
|
|
|
|
return {
|
|
|
|
|
"code" : 0, "data" : data.repoCount
|
|
|
|
|
};
|
2023-05-23 09:42:59 +00:00
|
|
|
|
}
|
|
|
|
|
export function getAllUserCount() {
|
2023-07-04 02:49:09 +00:00
|
|
|
|
return {
|
|
|
|
|
"code" : 0, "data" : 472
|
|
|
|
|
};
|
2023-05-23 09:42:59 +00:00
|
|
|
|
}
|
2023-07-04 02:49:09 +00:00
|
|
|
|
|
2023-05-23 09:42:59 +00:00
|
|
|
|
export function getAllSearchCount() {
|
2023-07-04 02:49:09 +00:00
|
|
|
|
var data = executeContract("Registry", "getPageInfo", arg).result.data;
|
|
|
|
|
return {
|
|
|
|
|
"code" : 0, "data" : data.searchCount
|
|
|
|
|
};
|
2023-05-23 09:42:59 +00:00
|
|
|
|
}
|
|
|
|
|
export function getAllUpdateCount() {
|
2023-07-04 02:49:09 +00:00
|
|
|
|
var data = executeContract("Registry", "getPageInfo", arg).result.data;
|
|
|
|
|
return {
|
|
|
|
|
"code" : 0, "data" : data.updateCount
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export function getPageInfo(arg) {
|
|
|
|
|
var data = executeContract("Registry", "getPageInfo", arg).result.data;
|
|
|
|
|
return {
|
|
|
|
|
"code" : 0, "data" :data
|
|
|
|
|
};
|
2023-05-23 09:42:59 +00:00
|
|
|
|
}
|
|
|
|
|
export function getAllDoCount() {
|
2023-07-04 02:49:09 +00:00
|
|
|
|
var data = executeContract("Registry", "getPageInfo", arg).result.data;
|
|
|
|
|
return {
|
|
|
|
|
"code" : 0, "data" : data.doCount
|
|
|
|
|
};
|
2023-05-23 09:42:59 +00:00
|
|
|
|
}
|
2023-07-04 02:49:09 +00:00
|
|
|
|
//TODO???
|
2023-05-23 09:42:59 +00:00
|
|
|
|
export function getAllIndexCount() {
|
2023-07-04 02:49:09 +00:00
|
|
|
|
var data = executeContract("Registry", "getPageInfo", arg).result.data;
|
|
|
|
|
return {
|
|
|
|
|
"code" : 0, "data" : data.updateCount
|
|
|
|
|
};
|
2023-05-23 09:42:59 +00:00
|
|
|
|
}
|
|
|
|
|
export function getDoCount(arg) {
|
|
|
|
|
var ret = executeContract("Registry", "getDoCount", arg);
|
2023-07-04 02:49:09 +00:00
|
|
|
|
if (arg.indexOf("shanxi/Repository") != - 1)
|
2023-05-23 09:42:59 +00:00
|
|
|
|
ret.result.data.push({
|
2023-07-04 02:49:09 +00:00
|
|
|
|
"doId" : "shanxi/Repository", "count" : 3
|
2023-05-23 09:42:59 +00:00
|
|
|
|
});
|
|
|
|
|
return ret.result;
|
|
|
|
|
}
|
2022-06-25 03:11:03 +00:00
|
|
|
|
|
2023-05-23 09:42:59 +00:00
|
|
|
|
export function testCount(arg) {
|
|
|
|
|
return {
|
2023-07-04 02:49:09 +00:00
|
|
|
|
"data" : "key"
|
2023-05-23 09:42:59 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
2023-02-15 16:17:58 +00:00
|
|
|
|
|
2023-05-23 09:42:59 +00:00
|
|
|
|
//=====全域监管:数字对象溯源 针对单个DO的,通过SQL查询来实现。
|
|
|
|
|
//根据 doId --> 找到“数字对象世系”
|
|
|
|
|
//86.500.1/Repo.1/Doab
|
|
|
|
|
//根据 doId+时间范围+interval+protocol --> 不同operation的统计数据 (AuditProxy)
|
|
|
|
|
//countDORecordByDate()
|
|
|
|
|
//{"doId":xxxx,"startTime","endTime","interval","eventPrefix":["doip_create","doip_update"]}
|
|
|
|
|
//{"eventxxx":[1,2,3],"event2":[1,2,3]}
|
2023-02-15 16:17:58 +00:00
|
|
|
|
|
2023-05-23 09:42:59 +00:00
|
|
|
|
//根据 doId +查找条件(时间范围 protocol operation user?) +offset/count -->总数+指定条数的数组(AuditProxy)
|
|
|
|
|
// queryDoRecordByDate
|
|
|
|
|
//{"doId":xxxx,"startTime","endTime","eventPrefix":["doip_create","doip_update"]}
|
|
|
|
|
//{"count":xx, "data":[{doip_request的某一行。},]}
|
|
|
|
|
// queryDoRecordByOffset
|
|
|
|
|
//{"doId":xxxx,"offset","count","eventPrefix":["doip_create","doip_update"]}
|
|
|
|
|
//{"total":xx,"count":xx, "data":[{doip_request的某一行。},]}
|
|
|
|
|
//==============
|
2023-02-15 16:17:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-23 09:42:59 +00:00
|
|
|
|
//DO的元数据
|
|
|
|
|
//{
|
|
|
|
|
// "date": "...",
|
|
|
|
|
// "owner": "...",
|
|
|
|
|
// "type": "...",
|
|
|
|
|
// "description": "...",
|
|
|
|
|
// "schema": "...",
|
|
|
|
|
//}
|
|
|
|
|
//做成可以根据创建时间范围;标识模糊
|
|
|
|
|
//{"type":"creatTime","count":10,"offset":"0","from":"1141363811328","to":"1941363811328"}
|
|
|
|
|
export function getDoFilter(arg) {
|
|
|
|
|
var res = executeContract("Registry", "searchByRange", arg);
|
|
|
|
|
return res.result;
|
|
|
|
|
}
|
2022-06-25 03:11:03 +00:00
|
|
|
|
|
2023-05-23 09:42:59 +00:00
|
|
|
|
//支持模糊查询、按创建时间查询。
|
|
|
|
|
//输入参数:
|
|
|
|
|
//type:要查询的字段
|
|
|
|
|
//keyword:要查询的关键字
|
|
|
|
|
//count:(可选项,缺省为20)
|
|
|
|
|
//offset:(可选项,缺省为0)
|
|
|
|
|
////{"params":[{"type":"owner","keyword":"说明"},{"type":"doid","keyword":"aibd"}],"count":"10","offset":"0"}
|
|
|
|
|
//返回:{"data":[{},{},{}],"count":3}
|
|
|
|
|
@ArgSchema({
|
2023-07-04 02:49:09 +00:00
|
|
|
|
"!params" : [{
|
|
|
|
|
"!type" : "string", "!keyword" : "integer"
|
|
|
|
|
}], "count" : "integer", "offset" : "integer"
|
2023-05-23 09:42:59 +00:00
|
|
|
|
})
|
|
|
|
|
export function search(arg) {
|
|
|
|
|
arg = convertArgToJson(arg);
|
2023-07-04 02:49:09 +00:00
|
|
|
|
var req = {"id":"","attributes":{},"body":""};
|
|
|
|
|
for (var i=0;i<arg.params.length;i++){
|
|
|
|
|
req.attributes[arg.params[i].type] = arg.params[i].keyword;
|
|
|
|
|
}
|
|
|
|
|
req.attributes["offset"] = arg.offset;
|
|
|
|
|
req.attributes["count"] = arg.count;
|
|
|
|
|
var res = executeContract("Registry", "search", arg);
|
2023-05-23 09:42:59 +00:00
|
|
|
|
return res.result;
|
2022-04-19 01:26:59 +00:00
|
|
|
|
//ret=[];
|
2023-02-15 16:17:58 +00:00
|
|
|
|
|
2022-04-19 01:26:59 +00:00
|
|
|
|
//ret.push({
|
|
|
|
|
// "doId":"bdware.ss/Repo1/Do.a","name":"数字对象a","meta":{},"owner":"zzz","createTime":1641885492715}
|
|
|
|
|
// );
|
|
|
|
|
//ret.push({
|
|
|
|
|
// "doId":"bdware.ss/Repo1/Do.b","name":"数字对象b","meta":{},"owner":"zzz","createTime":1641885322715}
|
|
|
|
|
// );
|
|
|
|
|
//ret.push({
|
|
|
|
|
// "doId":"bdware.ss/Repo1/Do.c","name":"数字对象c","meta":{},"owner":"zzz","createTime":1641875492715}
|
|
|
|
|
// );
|
|
|
|
|
//return {"data":ret,"total":3};
|
2023-05-23 09:42:59 +00:00
|
|
|
|
}
|
2022-04-19 01:26:59 +00:00
|
|
|
|
}
|