flit-modulo-exportacoes 2.0.29 → 2.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dao/contas-elastic.js +30 -104
- package/dist/dao/elastic-base.js +31 -103
- package/dist/dao/empresas-elastic.js +36 -110
- package/dist/dao/empresas-feriado-elastic.js +37 -113
- package/dist/dao/eventos-exportacoes-elastic.js +39 -116
- package/dist/dao/feriados-elastic.js +46 -122
- package/dist/dao/jornadas-elastic.js +73 -151
- package/dist/dao/usuarios-elastic.js +29 -103
- package/dist/eventos-exportacoes-model.d.ts +49 -0
- package/dist/eventos-exportacoes-model.js +19 -0
- package/dist/index.js +214 -274
- package/dist/models.d.ts +0 -49
- package/dist/models.js +1 -17
- package/dist/unificacao-eventos-repetidos.js +63 -94
- package/dist/utils.js +98 -155
- package/package.json +6 -6
|
@@ -1,122 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
3
|
exports.EventosExportacoesElastic = void 0;
|
|
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
|
-
match: {
|
|
82
|
-
i_id: tabelaEventosId
|
|
83
|
-
}
|
|
84
|
-
}, {
|
|
85
|
-
match: {
|
|
86
|
-
excluido: false
|
|
87
|
-
}
|
|
88
|
-
}]
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
sort: [{
|
|
92
|
-
i_id: 'asc'
|
|
93
|
-
}]
|
|
94
|
-
})];
|
|
95
|
-
case 1: return [2 /*return*/, _b.sent()];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
EventosExportacoesElastic.prototype.getEventosExportacoesElastic = function (_a) {
|
|
101
|
-
var contaId = _a.contaId, tabelaEventosId = _a.tabelaEventosId;
|
|
102
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
-
var retorno, _b;
|
|
104
|
-
return __generator(this, function (_c) {
|
|
105
|
-
switch (_c.label) {
|
|
106
|
-
case 0:
|
|
107
|
-
_b = this.retornaTodosDadosPaginacaoElastic;
|
|
108
|
-
return [4 /*yield*/, this.internalGetEventosExportacoesElastic({
|
|
109
|
-
contaId: contaId,
|
|
110
|
-
tabelaEventosId: tabelaEventosId
|
|
111
|
-
})];
|
|
112
|
-
case 1: return [4 /*yield*/, _b.apply(this, [_c.sent()])];
|
|
113
|
-
case 2:
|
|
114
|
-
retorno = _c.sent();
|
|
115
|
-
return [2 /*return*/, retorno[0]];
|
|
4
|
+
const elastic_base_1 = require("./elastic-base");
|
|
5
|
+
class EventosExportacoesElastic extends elastic_base_1.ElasticBase {
|
|
6
|
+
async internalGetEventosExportacoesElastic({ contaId, tabelaEventosId }) {
|
|
7
|
+
return await this.elasticClient.search({
|
|
8
|
+
scroll: '1m',
|
|
9
|
+
index: 'contas_eventosexportacoes',
|
|
10
|
+
size: this.totalRegistrosFiltradosElastic,
|
|
11
|
+
_source: [
|
|
12
|
+
'eventos',
|
|
13
|
+
'forma_envio_faltas'
|
|
14
|
+
],
|
|
15
|
+
query: {
|
|
16
|
+
bool: {
|
|
17
|
+
must: [{
|
|
18
|
+
match: {
|
|
19
|
+
i_parent_id: contaId
|
|
20
|
+
}
|
|
21
|
+
}, {
|
|
22
|
+
match: {
|
|
23
|
+
i_id: tabelaEventosId
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
match: {
|
|
27
|
+
excluido: false
|
|
28
|
+
}
|
|
29
|
+
}]
|
|
116
30
|
}
|
|
117
|
-
}
|
|
31
|
+
},
|
|
32
|
+
sort: [{
|
|
33
|
+
i_id: 'asc'
|
|
34
|
+
}]
|
|
118
35
|
});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
36
|
+
}
|
|
37
|
+
async getEventosExportacoesElastic({ contaId, tabelaEventosId }) {
|
|
38
|
+
const retorno = await this.retornaTodosDadosPaginacaoElastic(await this.internalGetEventosExportacoesElastic({
|
|
39
|
+
contaId: contaId,
|
|
40
|
+
tabelaEventosId: tabelaEventosId
|
|
41
|
+
}));
|
|
42
|
+
return retorno[0];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
122
45
|
exports.EventosExportacoesElastic = EventosExportacoesElastic;
|
|
@@ -1,132 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
4
|
};
|
|
56
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
6
|
exports.FeriadosElastic = void 0;
|
|
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
|
-
match: {
|
|
90
|
-
excluido: false
|
|
91
|
-
}
|
|
92
|
-
}, {
|
|
93
|
-
range: {
|
|
94
|
-
data: {
|
|
95
|
-
gte: (0, moment_1.default)(dataInicial).format('YYYY-MM-DDTHH:mm:ss.SSS'),
|
|
96
|
-
lte: (0, moment_1.default)(dataFinal).format('YYYY-MM-DDTHH:mm:ss.SSS')
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}]
|
|
7
|
+
const moment_1 = __importDefault(require("moment"));
|
|
8
|
+
const elastic_base_1 = require("./elastic-base");
|
|
9
|
+
class FeriadosElastic extends elastic_base_1.ElasticBase {
|
|
10
|
+
async internalGetFeriadosElastic({ contaId, dataFinal, dataInicial }) {
|
|
11
|
+
return await this.elasticClient.search({
|
|
12
|
+
scroll: '1m',
|
|
13
|
+
index: 'contas_feriados',
|
|
14
|
+
size: this.totalRegistrosFiltradosElastic,
|
|
15
|
+
_source: [
|
|
16
|
+
'uf',
|
|
17
|
+
'i_id',
|
|
18
|
+
'tipo',
|
|
19
|
+
'data',
|
|
20
|
+
'municipio',
|
|
21
|
+
'todas_empresas'
|
|
22
|
+
],
|
|
23
|
+
query: {
|
|
24
|
+
bool: {
|
|
25
|
+
must: [{
|
|
26
|
+
match: {
|
|
27
|
+
i_parent_id: contaId
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
match: {
|
|
31
|
+
excluido: false
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
range: {
|
|
35
|
+
data: {
|
|
36
|
+
gte: (0, moment_1.default)(dataInicial).format('YYYY-MM-DDTHH:mm:ss.SSS'),
|
|
37
|
+
lte: (0, moment_1.default)(dataFinal).format('YYYY-MM-DDTHH:mm:ss.SSS')
|
|
100
38
|
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
data: 'asc'
|
|
104
|
-
}]
|
|
105
|
-
})];
|
|
106
|
-
case 1: return [2 /*return*/, _b.sent()];
|
|
39
|
+
}
|
|
40
|
+
}]
|
|
107
41
|
}
|
|
108
|
-
}
|
|
42
|
+
},
|
|
43
|
+
sort: [{
|
|
44
|
+
data: 'asc'
|
|
45
|
+
}]
|
|
109
46
|
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return [4 /*yield*/, this.internalGetFeriadosElastic({
|
|
120
|
-
contaId: contaId,
|
|
121
|
-
dataFinal: dataFinal,
|
|
122
|
-
dataInicial: dataInicial
|
|
123
|
-
})];
|
|
124
|
-
case 1: return [4 /*yield*/, _b.apply(this, [_c.sent()])];
|
|
125
|
-
case 2: return [2 /*return*/, _c.sent()];
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
return FeriadosElastic;
|
|
131
|
-
}(elastic_base_1.ElasticBase));
|
|
47
|
+
}
|
|
48
|
+
async getFeriadosElastic({ contaId, dataFinal, dataInicial }) {
|
|
49
|
+
return await this.retornaTodosDadosPaginacaoElastic(await this.internalGetFeriadosElastic({
|
|
50
|
+
contaId: contaId,
|
|
51
|
+
dataFinal: dataFinal,
|
|
52
|
+
dataInicial: dataInicial
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
132
56
|
exports.FeriadosElastic = FeriadosElastic;
|
|
@@ -1,163 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
4
|
};
|
|
56
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
6
|
exports.JornadasElastic = void 0;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
});
|
|
78
|
-
queryMust.push({
|
|
79
|
-
match: {
|
|
80
|
-
'usuario.empresa.uid': empresaId
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
if (usuarioId) {
|
|
84
|
-
queryMust.push({
|
|
85
|
-
match: {
|
|
86
|
-
'usuario.uid': usuarioId
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
queryMust.push({
|
|
91
|
-
range: {
|
|
92
|
-
data_hora: {
|
|
93
|
-
gte: (0, moment_1.default)(inicio).format('YYYY-MM-DDTHH:mm:ss.SSS'),
|
|
94
|
-
lte: (0, moment_1.default)(fim).format('YYYY-MM-DDTHH:mm:ss.SSS')
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
return [4 /*yield*/, this.elasticClient.search({
|
|
99
|
-
scroll: '1m',
|
|
100
|
-
index: 'contas_jornadas',
|
|
101
|
-
size: this.totalRegistrosFiltradosElastic,
|
|
102
|
-
_source: [
|
|
103
|
-
'data_hora',
|
|
104
|
-
'usuario.uid',
|
|
105
|
-
'usuario.cpf',
|
|
106
|
-
'usuario.pis',
|
|
107
|
-
'horas_extras',
|
|
108
|
-
'horas_normais',
|
|
109
|
-
'horas_noturnas',
|
|
110
|
-
'horas_negativas',
|
|
111
|
-
'jornada_prevista',
|
|
112
|
-
'jornada_realizada',
|
|
113
|
-
'regime_compensacao',
|
|
114
|
-
'usuario.cargo.nome',
|
|
115
|
-
'usuario.empresa.uf',
|
|
116
|
-
'faixas_horas_extras',
|
|
117
|
-
'usuario.empresa.uid',
|
|
118
|
-
'marcacoes_ignoradas',
|
|
119
|
-
'usuario.empresa.cnpj',
|
|
120
|
-
'horas_noturnas_extras',
|
|
121
|
-
'usuario.empresa.cidade',
|
|
122
|
-
'horas_extras_intrajornada',
|
|
123
|
-
'usuario.parametros.codigo_externo',
|
|
124
|
-
'usuario.empresa.parametros.codigo_externo'
|
|
125
|
-
],
|
|
126
|
-
query: {
|
|
127
|
-
bool: {
|
|
128
|
-
must: queryMust
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
sort: [{
|
|
132
|
-
data_hora: 'asc'
|
|
133
|
-
}]
|
|
134
|
-
})];
|
|
135
|
-
case 1: return [2 /*return*/, _b.sent()];
|
|
7
|
+
const moment_1 = __importDefault(require("moment"));
|
|
8
|
+
const elastic_base_1 = require("./elastic-base");
|
|
9
|
+
class JornadasElastic extends elastic_base_1.ElasticBase {
|
|
10
|
+
async internalGetJornadasElastic({ fim, inicio, contaId, empresaId, usuarioId }) {
|
|
11
|
+
const queryMust = new Array();
|
|
12
|
+
queryMust.push({
|
|
13
|
+
match: {
|
|
14
|
+
i_parent_id: contaId
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
queryMust.push({
|
|
18
|
+
match: {
|
|
19
|
+
'usuario.empresa.uid': empresaId
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
if (usuarioId) {
|
|
23
|
+
queryMust.push({
|
|
24
|
+
match: {
|
|
25
|
+
'usuario.uid': usuarioId
|
|
136
26
|
}
|
|
137
27
|
});
|
|
28
|
+
}
|
|
29
|
+
queryMust.push({
|
|
30
|
+
range: {
|
|
31
|
+
data_hora: {
|
|
32
|
+
gte: (0, moment_1.default)(inicio).format('YYYY-MM-DDTHH:mm:ss.SSS'),
|
|
33
|
+
lte: (0, moment_1.default)(fim).format('YYYY-MM-DDTHH:mm:ss.SSS')
|
|
34
|
+
}
|
|
35
|
+
}
|
|
138
36
|
});
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
37
|
+
return await this.elasticClient.search({
|
|
38
|
+
scroll: '1m',
|
|
39
|
+
index: 'contas_jornadas',
|
|
40
|
+
size: this.totalRegistrosFiltradosElastic,
|
|
41
|
+
_source: [
|
|
42
|
+
'data_hora',
|
|
43
|
+
'usuario.uid',
|
|
44
|
+
'usuario.cpf',
|
|
45
|
+
'usuario.pis',
|
|
46
|
+
'horas_extras',
|
|
47
|
+
'horas_normais',
|
|
48
|
+
'horas_noturnas',
|
|
49
|
+
'horas_negativas',
|
|
50
|
+
'jornada_prevista',
|
|
51
|
+
'jornada_realizada',
|
|
52
|
+
'regime_compensacao',
|
|
53
|
+
'usuario.cargo.nome',
|
|
54
|
+
'usuario.empresa.uf',
|
|
55
|
+
'faixas_horas_extras',
|
|
56
|
+
'usuario.empresa.uid',
|
|
57
|
+
'marcacoes_ignoradas',
|
|
58
|
+
'usuario.empresa.cnpj',
|
|
59
|
+
'horas_noturnas_extras',
|
|
60
|
+
'usuario.empresa.cidade',
|
|
61
|
+
'horas_extras_intrajornada',
|
|
62
|
+
'usuario.parametros.codigo_externo',
|
|
63
|
+
'usuario.empresa.parametros.codigo_externo'
|
|
64
|
+
],
|
|
65
|
+
query: {
|
|
66
|
+
bool: {
|
|
67
|
+
must: queryMust
|
|
157
68
|
}
|
|
158
|
-
}
|
|
69
|
+
},
|
|
70
|
+
sort: [{
|
|
71
|
+
data_hora: 'asc'
|
|
72
|
+
}]
|
|
159
73
|
});
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
74
|
+
}
|
|
75
|
+
async getJornadasElastic({ contaId, dataFinal, usuarioId, empresaId, dataInicial }) {
|
|
76
|
+
return await this.retornaTodosDadosPaginacaoElastic(await this.internalGetJornadasElastic({
|
|
77
|
+
fim: dataFinal,
|
|
78
|
+
contaId: contaId,
|
|
79
|
+
inicio: dataInicial,
|
|
80
|
+
empresaId: empresaId,
|
|
81
|
+
usuarioId: usuarioId
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
163
85
|
exports.JornadasElastic = JornadasElastic;
|