-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetPrNameFunc.js
94 lines (86 loc) · 3.54 KB
/
setPrNameFunc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
var redis = require("redis");
var client = redis.createClient({auth_pass:'here_dev'});
var client1 = redis.createClient({auth_pass:'here_dev'});
var config = require('./config');
var async = require('async');
client1.select(1, function(err){
if(err){
console.log(err);
}else{
}
});
exports.setEntyUserRelation = function(){
console.log('setEntyUserRelation');
client.hgetall(config.hash.userDtlsHash, function(err, reply){
if(err){
console.log(err);
}else{
for (var variable in reply) {
var user = reply[variable];
user = JSON.parse(user);
console.log('load '+user.UDT_USER_SRNO);
client1.lpush(user.UDT_ENTY_SRNO+'.entyUserlist', user.UDT_USER_SRNO, function(err, reply){
if(err){
console.log(err);
}
});
}
}
});
}
exports.setAssetPrName = function(){
client.hkeys('assetDtlsHash', function(err, reply){
reply.forEach(function(key){
client.hget('assetDtlsHash', key, function(err, reply){
reply = JSON.parse(reply);
for(var i=0; i<reply.abd_asset_shrt_desc.length;++i){
for(var j=i;j<reply.abd_asset_shrt_desc.length;++j){
var listStr = reply.abd_asset_shrt_desc.substr(i, j-i+1);
client1.lpush('asset.'+listStr, JSON.stringify({desc:reply.abd_asset_shrt_desc, assetSrno:reply.abd_asset_srno, assetCode:reply.abd_asset_encd_asset_code}), function(err){
if(err){
console.log(err);
}else{
console.log('set asset desc list');
}
});
}
}
});
});
});
}
exports.setEntyPrName = function(){
client.hkeys('entyBaseHash', function(err, reply){
reply.forEach(function(key){
console.log(key);
client.hget('entyBaseHash', key, function(err, reply){
reply = JSON.parse(reply);
console.log(reply.EMA_ENTY_SHRT_DESC);
for(var i=0; i<reply.EMA_ENTY_SHRT_DESC.length;++i){
for(var j=i;j<reply.EMA_ENTY_SHRT_DESC.length;++j){
var listStr = reply.EMA_ENTY_SHRT_DESC.substr(i, j-i+1);
client1.lpush('enty.'+listStr, JSON.stringify({desc:reply.EMA_ENTY_SHRT_DESC, entySrno:reply.EMA_ENTY_SRNO}), function(err){
if(err){
console.log(err);
}else{
console.log('set enty desc list');
}
});
}
}
if(reply.EMA_PNYN_CODE_SHRT_DESC !== null){
for(var i=0;i<reply.EMA_PNYN_CODE_SHRT_DESC.length;++i){
var listStr = reply.EMA_PNYN_CODE_SHRT_DESC.substr(0, i+1);
client1.lpush('enty.'+listStr, JSON.stringify({desc:reply.EMA_ENTY_SHRT_DESC, entySrno:reply.EMA_ENTY_SRNO}), function(err){
if(err){
console.log(err);
}else{
console.log('set enty desc list');
}
});
}
}
});
});
});
}