|
@@ -1,9 +1,10 @@
|
|
import { map, Observable, of, Subject } from "rxjs";
|
|
import { map, Observable, of, Subject } from "rxjs";
|
|
import { ErrorTrigger, MessageAuditorServiceInterface, MessageSynchronisationServiceSetting } from "../type/datatype";
|
|
import { ErrorTrigger, MessageAuditorServiceInterface, MessageSynchronisationServiceSetting } from "../type/datatype";
|
|
import { MessageLog } from "../dependencies/log/type/datatype";
|
|
import { MessageLog } from "../dependencies/log/type/datatype";
|
|
-import { _ } from 'lodash'
|
|
|
|
|
|
+import * as _ from 'lodash'
|
|
import { LoggingService } from "../dependencies/log/interface/export";
|
|
import { LoggingService } from "../dependencies/log/interface/export";
|
|
import { BaseMessage } from "../dependencies/log/dependencies/msgutil/interface/export";
|
|
import { BaseMessage } from "../dependencies/log/dependencies/msgutil/interface/export";
|
|
|
|
+require('dotenv').config();
|
|
|
|
|
|
export class MessageAuditorService implements MessageAuditorServiceInterface {
|
|
export class MessageAuditorService implements MessageAuditorServiceInterface {
|
|
private settings: MessageSynchronisationServiceSetting
|
|
private settings: MessageSynchronisationServiceSetting
|
|
@@ -89,7 +90,20 @@ export class MessageAuditorService implements MessageAuditorServiceInterface {
|
|
this.acquireData().then((data: { arr1: MessageLog[], arr2: MessageLog[] }) => {
|
|
this.acquireData().then((data: { arr1: MessageLog[], arr2: MessageLog[] }) => {
|
|
// In the case where there are differences in the array length, then extensive comparison
|
|
// In the case where there are differences in the array length, then extensive comparison
|
|
// will be carried out to filters out the differences. Differences are the missing data.
|
|
// will be carried out to filters out the differences. Differences are the missing data.
|
|
|
|
+
|
|
|
|
+ if(process.env.CheckAudit)
|
|
|
|
+ {
|
|
|
|
+ console.log("Record set 1: ", _.keys(_.countBy(data.arr1,function(data:MessageLog){return data.appData['msgId']})).length);
|
|
|
|
+ console.log("Record set 2: ", _.keys(_.countBy(data.arr2,function(data:MessageLog){return data.appData['msgId']})).length);
|
|
|
|
+ }
|
|
|
|
+
|
|
this.checkArrayDifferences(data).then((data: MessageLog[]) => {
|
|
this.checkArrayDifferences(data).then((data: MessageLog[]) => {
|
|
|
|
+
|
|
|
|
+ if(process.env.CheckAudit)
|
|
|
|
+ {
|
|
|
|
+ console.log("Difference: ",data.length);
|
|
|
|
+ }
|
|
|
|
+
|
|
data.forEach(msgElement => {
|
|
data.forEach(msgElement => {
|
|
let refined = JSON.parse(JSON.stringify(msgElement))
|
|
let refined = JSON.parse(JSON.stringify(msgElement))
|
|
// Once the missing data has been weeded out, it is then passed into the Subject
|
|
// Once the missing data has been weeded out, it is then passed into the Subject
|