From 07fb6e29ad0b128f9852015c96163c9e57d04e6a Mon Sep 17 00:00:00 2001 From: sriramv Date: Thu, 4 Aug 2022 12:35:26 +0530 Subject: [PATCH] GWM --- app/controllers/cibil.controller.js | 55 ++- app/models/BorrowerProfile.js | 20 +- app/models/ConAccountTranscation.js | 6 +- app/models/ConDPDTranscationDetail.js | 2 +- app/models/ConIDDetail.js | 6 +- app/models/ConPhoneDetail.js | 8 +- app/models/ConScoreDetail.js | 2 +- app/services/cibil.controller.helper.js | 2 +- app/services/cibil.datainsert.helper.js | 631 ++++++++++++++---------- 9 files changed, 428 insertions(+), 304 deletions(-) diff --git a/app/controllers/cibil.controller.js b/app/controllers/cibil.controller.js index a2d8141..f55a327 100644 --- a/app/controllers/cibil.controller.js +++ b/app/controllers/cibil.controller.js @@ -579,7 +579,7 @@ exports.ConsolidatedActiveAndClosedLoansReviewAction =async (req, res) => }else{ subValue = await OutputActiveAndClosedLoans.findAll({raw:true,where:{losid:value.losid,grp_str:value.grp_str}}) .catch(err=>{ }); - Object.assign(value , {children : subValue.map(v => ({...v, children: null})) }); + Object.assign(value , {children : subValue.map(v => ({...v, children: []})) }); FinalLoanData.push(value); if (index === LoanData[0].length -1) { resolve(FinalLoanData); } } @@ -645,6 +645,15 @@ exports.LoansDetailsMergeUnmergeApi =async (req, res) => console.log(Value.refno); }); } + else if(mergeValue.type == 'GROUP_TO_GROUP') + { + let Unique_Group_string = mergeValue.mergeable_grp_str; + mergeValue.data.forEach(async(Value,Index,Array) => { + await InCreditFacility.update({grp_str:Unique_Group_string},{where:{losid:request_object.losid,ReferenceNumber:Value.refno,grp_str:Value.grp_str}}).catch(err=>{}); + await OutputActiveAndClosedLoans.update({grp_str:Unique_Group_string},{where:{losid:request_object.losid,ref_no:Value.refno,grp_str:Value.grp_str}}).catch(err=>{}); + console.log(Value.refno); + }); + } else { let Unique_Group_string = Math.random().toString(36).slice(2, 10).toUpperCase()+"-"+Math.random().toString(36).slice(2, 6)+"-"+Math.random().toString(36).slice(2, 6)+"-"+Math.random().toString(36).slice(2, 12).toUpperCase(); @@ -749,9 +758,13 @@ exports.starter = async (req, res) => CibilData = await Helper.cibilInputDataApiCall(PanListData.losid,PanListData.PAN,PanListData.cibil_type); ref_no = CibilData.lstConsumerBorrowersDetails[0].memberReferenceNumber; //insert cibil data in to input tables - DataInsertHelper.consumerDataInsert(CibilData); - //move cibil data from input table to intermediate table - DataInsertHelper.consumerIntermediateDataInsert(PanListData.losid,ref_no); + consumerInputDataInsert = await DataInsertHelper.consumerDataInsert(CibilData); + if(consumerInputDataInsert == true) + { + //move cibil data from input table to intermediate table + DataInsertHelper.consumerIntermediateDataInsert(PanListData.losid,ref_no); + } + } else { @@ -759,9 +772,13 @@ exports.starter = async (req, res) => CibilData = await Helper.cibilInputDataApiCall(PanListData.losid,PanListData.PAN,PanListData.cibil_type); ref_no = CibilData.lstborrowerProfiles[0].applicationRefno; //insert cibil data in to input tables - DataInsertHelper.commercialDataInsert(CibilData); - //move cibil data from input table to intermediate table - DataInsertHelper.commercialIntermediateDataInsert(PanListData.losid,ref_no); + commercialInputDataInsert = await DataInsertHelper.commercialDataInsert(CibilData); + if(commercialInputDataInsert == true) + { + //move cibil data from input table to intermediate table + DataInsertHelper.commercialIntermediateDataInsert(PanListData.losid,ref_no); + } + } //resolve here if (PanListIndex === PanListArray.length -1) { resolve(req.query.losid); } @@ -773,6 +790,7 @@ exports.starter = async (req, res) => });//end of pan list foreach });//end of promises + CibilDataInsert.then(async(losid)=>{ var OutputDataGenerator = new Promise(async(resolve, reject) => { BorrowerDetailDataArray = await InBorrowerDetail.findAll({where:{losid:losid}}); @@ -826,15 +844,20 @@ exports.test = async (req, res) => try { - - - x = null; - data = { - "date" : await Helper.convertDateFormat(x) - }; - - console.log(data); - res.send({"data":data}); + + // CibilData = await Helper.cibilInputDataApiCall('MW55904793','AORPK5766N',1); + // res.send(CibilData); + // input_data = await DataInsertHelper.consumerDataInsert(CibilData); + // console.log(input_data); + // DataInsertHelper.consumerIntermediateDataInsert(PanListData.losid,ref_no); + + + CibilData = await Helper.cibilInputDataApiCall('MW25003190','BKCPS3299C',2); + res.send(CibilData); +// input_data = await DataInsertHelper.commercialDataInsert(CibilData); +// console.log(input_data); +// DataInsertHelper.commercialIntermediateDataInsert(PanListData.losid,ref_no); + } catch(err) { res.status(500).send({'status':404, diff --git a/app/models/BorrowerProfile.js b/app/models/BorrowerProfile.js index de90003..a8411ee 100644 --- a/app/models/BorrowerProfile.js +++ b/app/models/BorrowerProfile.js @@ -62,8 +62,8 @@ module.exports = (sequelize, DataTypes) => { CPSInstOpenCF : { type: DataTypes.INTEGER }, CPSInsTotalOutstandingBorrower : { type: DataTypes.INTEGER }, CPSInsTotalOutstandingGuarantor : { type: DataTypes.INTEGER }, - CPSInsTotalOutstandingBP : { type: DataTypes.INTEGER }, - CPSInsTotalOutstandingGP : { type: DataTypes.INTEGER }, + CPSInsTotalOutstandingBP : { type: DataTypes.STRING }, + CPSInsTotalOutstandingGP : { type: DataTypes.STRING }, CPSInsLtstCFOpndDate : { type: DataTypes.STRING }, CPSInsDCFBorrower : { type: DataTypes.INTEGER }, CPSInsDCFGuarantor : { type: DataTypes.INTEGER }, @@ -71,15 +71,15 @@ module.exports = (sequelize, DataTypes) => { CPSInsDCFGP : { type: DataTypes.STRING }, CPSInsDOSBorrower : { type: DataTypes.INTEGER }, CPSInsDOSGuarantor : { type: DataTypes.INTEGER }, - CPSInsDOSBP : { type: DataTypes.INTEGER }, - CPSInsDOSGP : { type: DataTypes.INTEGER }, + CPSInsDOSBP : { type: DataTypes.STRING }, + CPSInsDOSGP : { type: DataTypes.STRING }, CPSOutMsg : { type: DataTypes.STRING }, CPSOutOPSBMsg : { type: DataTypes.STRING }, CPSOutOPSBTotalLenders : { type: DataTypes.INTEGER }, CPSOutOPSBTotalCFBorrower : { type: DataTypes.INTEGER }, CPSOutOPSBTotalCFGuarantor : { type: DataTypes.INTEGER }, CPSOutOPSBTotalCFBP : { type: DataTypes.STRING }, - CPSOutOPSBTotalCFGP : { type: DataTypes.INTEGER }, + CPSOutOPSBTotalCFGP : { type: DataTypes.STRING }, CPSOutOPSBOpenCF : { type: DataTypes.INTEGER }, CPSOutOPSBTOBorrower : { type: DataTypes.INTEGER }, CPSOutOPSBTOGuarantor : { type: DataTypes.INTEGER }, @@ -89,7 +89,7 @@ module.exports = (sequelize, DataTypes) => { CPSOutOPSBDCFBorrower : { type: DataTypes.INTEGER }, CPSOutOPSBDCFGuarantor : { type: DataTypes.INTEGER }, CPSOutOPSBDCFBP : { type: DataTypes.STRING }, - CPSOutOPSBDCFGP : { type: DataTypes.INTEGER }, + CPSOutOPSBDCFGP : { type: DataTypes.STRING }, CPSOutOPSBDOSBorrower : { type: DataTypes.INTEGER }, CPSOutOPSBDOSGuarantor : { type: DataTypes.INTEGER }, CPSOutOPSBDOSBP : { type: DataTypes.STRING }, @@ -143,8 +143,8 @@ module.exports = (sequelize, DataTypes) => { CPSOutOutsideTotalOpenCF : { type: DataTypes.INTEGER }, CPSOutOutsideTotalTOSBorrower : { type: DataTypes.INTEGER }, CPSOutOutsideTotalTOSGuarantor : { type: DataTypes.INTEGER }, - CPSOutOutsideTotalTOSBP : { type: DataTypes.INTEGER }, - CPSOutOutsideTotalTOSGP : { type: DataTypes.INTEGER }, + CPSOutOutsideTotalTOSBP : { type: DataTypes.STRING }, + CPSOutOutsideTotalTOSGP : { type: DataTypes.STRING }, CPSOutOutsideTotalLtstCFOpndDate : { type: DataTypes.STRING }, CPSOutOutsideTotalDCFBorrower : { type: DataTypes.INTEGER }, CPSOutOutsideTotalDCFGuarantor : { type: DataTypes.INTEGER }, @@ -152,8 +152,8 @@ module.exports = (sequelize, DataTypes) => { CPSOutOutsideTotalDCFGP : { type: DataTypes.STRING }, CPSOutOutsideTotalDOSBorrower : { type: DataTypes.INTEGER }, CPSOutOutsideTotalDOSGuarantor : { type: DataTypes.INTEGER }, - CPSOutOutsideTotalDOSBP : { type: DataTypes.INTEGER }, - CPSOutOutsideTotalDOSGP : { type: DataTypes.INTEGER }, + CPSOutOutsideTotalDOSBP : { type: DataTypes.STRING }, + CPSOutOutsideTotalDOSGP : { type: DataTypes.STRING }, CPSTotalTotalLenders : { type: DataTypes.INTEGER }, CPSTotalTotalCF : { type: DataTypes.INTEGER }, CPSTotalOpenCF : { type: DataTypes.INTEGER }, diff --git a/app/models/ConAccountTranscation.js b/app/models/ConAccountTranscation.js index c9c5dee..e5908d8 100644 --- a/app/models/ConAccountTranscation.js +++ b/app/models/ConAccountTranscation.js @@ -38,11 +38,11 @@ module.exports = (sequelize, DataTypes) => { SettlementAmount: { type: DataTypes.INTEGER }, PaymentFrequency: { type: DataTypes.STRING }, ActualPaymentAmount: { type: DataTypes.INTEGER }, - DateOfEntryForErrorCode: { type: DataTypes.STRING }, + DateOfEntryForErrorCode: { type: DataTypes.DATE }, ErrorCode: { type: DataTypes.STRING }, // - DateOfEntryForCIBILRemarksCode: { type: DataTypes.STRING },// + DateOfEntryForCIBILRemarksCode: { type: DataTypes.DATE },// CIBILRemarksCode: { type: DataTypes.STRING }, - DateOfEntryForErrorDisputeRemarksCode: { type: DataTypes.STRING }, + DateOfEntryForErrorDisputeRemarksCode: { type: DataTypes.DATE }, ErrorDisputeRemarksCode1: { type: DataTypes.STRING }, ErrorDisputeRemarksCode2: { type: DataTypes.STRING }, diff --git a/app/models/ConDPDTranscationDetail.js b/app/models/ConDPDTranscationDetail.js index 3fd4c81..74e82bf 100644 --- a/app/models/ConDPDTranscationDetail.js +++ b/app/models/ConDPDTranscationDetail.js @@ -11,7 +11,7 @@ module.exports = (sequelize, DataTypes) => { AccountTranDetailsID: { type: DataTypes.INTEGER }, MemberRefNo: { type: DataTypes.INTEGER }, // StartDate: { type: DataTypes.DATE }, - Code: { type: DataTypes.INTEGER }, // + Code: { type: DataTypes.STRING }, // EntryDate: { type: DataTypes.DATE } }, { diff --git a/app/models/ConIDDetail.js b/app/models/ConIDDetail.js index 1e800a4..3ed81e9 100644 --- a/app/models/ConIDDetail.js +++ b/app/models/ConIDDetail.js @@ -9,12 +9,12 @@ module.exports = (sequelize, DataTypes) => { { IDDetailsID: { type: DataTypes.INTEGER }, - MemberReferenceNumber: { type: DataTypes.INTEGER }, // + MemberReferenceNumber: { type: DataTypes.INTEGER }, IDType: { type: DataTypes.STRING }, - IDNumber: { type: DataTypes.STRING }, // + IDNumber: { type: DataTypes.STRING }, IssueDate: { type: DataTypes.DATE }, ExpirationDate: { type: DataTypes.DATE }, - EnrichedThroughEnquiry: { type: DataTypes.DATE }, // + EnrichedThroughEnquiry: { type: DataTypes.STRING }, }, { sequelize, diff --git a/app/models/ConPhoneDetail.js b/app/models/ConPhoneDetail.js index fb80b07..083c5a4 100644 --- a/app/models/ConPhoneDetail.js +++ b/app/models/ConPhoneDetail.js @@ -9,15 +9,15 @@ module.exports = (sequelize, DataTypes) => { { PhoneDetailsID: { type: DataTypes.INTEGER }, - MemberReferenceNumber: { type: DataTypes.STRING }, // - TelephoneNumber: { type: DataTypes.INTEGER }, - TelephoneExtension: { type: DataTypes.INTEGER }, + MemberReferenceNumber: { type: DataTypes.INTEGER }, + TelephoneNumber: { type: DataTypes.STRING }, + TelephoneExtension: { type: DataTypes.STRING }, TelephoneType: { type: DataTypes.STRING }, EnrichedThroughEnquiry: { type: DataTypes.STRING } }, { sequelize, - tableName: 'emp_details', + tableName: 'con_phone_detail', modelName: 'ConPhoneDetail', } ) diff --git a/app/models/ConScoreDetail.js b/app/models/ConScoreDetail.js index 621a5fd..8cfe7b8 100644 --- a/app/models/ConScoreDetail.js +++ b/app/models/ConScoreDetail.js @@ -34,7 +34,7 @@ module.exports = (sequelize, DataTypes) => { }, { sequelize, - tableName: 'emp_details', + tableName: 'con_score_detail', modelName: 'ConScoreDetail', } ) diff --git a/app/services/cibil.controller.helper.js b/app/services/cibil.controller.helper.js index 9842495..d70b795 100644 --- a/app/services/cibil.controller.helper.js +++ b/app/services/cibil.controller.helper.js @@ -181,7 +181,7 @@ function getLoginToken() { function convertDateFormat(DateValue) { try { return new Promise((resolve, reject) => { - if(DateValue == null) + if(DateValue == null || DateValue == "") { resolve(null); }else{ diff --git a/app/services/cibil.datainsert.helper.js b/app/services/cibil.datainsert.helper.js index 462180e..1c3d815 100644 --- a/app/services/cibil.datainsert.helper.js +++ b/app/services/cibil.datainsert.helper.js @@ -65,7 +65,9 @@ function consumerDataInsert(data) }); ConsumerBorrowersDetailsDataInsert.then(async(BorrowersDetailsArray)=>{ - await ConBorrowDetail.bulkCreate(BorrowersDetailsArray).catch(err=>{ }); + await ConBorrowDetail.bulkCreate(BorrowersDetailsArray) + .then(data=>{ logMsg.info("ConBorrowDetail data Inserted successfully for losid = "+data.losid+" Data count = "+BorrowersDetailsArray.length); }) + .catch(err=>{ logMsg.info("ConBorrowDetail data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("lstConsumerBorrowersDetails array data not available for losid = "+data.losid); } @@ -81,23 +83,23 @@ function consumerDataInsert(data) data.lstAccountTransactionDetail.forEach(async(value,index,array) => { AccountTransactionDetailObj = { - AccountTranDetailsID:accountTranDetailsID , + AccountTranDetailsID:value.accountTranDetailsID , MemberReferenceNumber: value.memberReferenceNumber, ReportingMemberShortName: value.reportingMemberShortName, AccountNumber: value.accountNumber, AccountType: value.accountType, OwnershipIndicator: value.ownershipIndicator, - DateOpenedDisbursed: value.dateOpenedDisbursed, - DateOfLastPayment: value.dateOfLastPayment, - DateClosed: value.dateClosed, - DateReportedAndCertified: value.dateReportedAndCertified, + DateOpenedDisbursed: await Helper.convertDateFormat( value.dateOpenedDisbursed), + DateOfLastPayment: await Helper.convertDateFormat( value.dateOfLastPayment), + DateClosed: await Helper.convertDateFormat( value.dateClosed), + DateReportedAndCertified: await Helper.convertDateFormat( value.dateReportedAndCertified) , HighCreditSanctionedAmount: value.highCreditSanctionedAmount, CurrentBalance: value.currentBalance, AmountOverdue: value.amountOverdue, PaymentHistory1: value.paymentHistory1, PaymentHistory2: value.paymentHistory2, - PaymentHistoryStartDate: value.paymentHistoryStartDate, - PaymentHistoryEndDate: value.paymentHistoryEndDate, + PaymentHistoryStartDate: await Helper.convertDateFormat( value.paymentHistoryStartDate), + PaymentHistoryEndDate: await Helper.convertDateFormat( value.paymentHistoryEndDate), SuitFiledWilfulDefault: value.suitFiledWilfulDefault, WrittenOffAndSettledStatus: value.writtenOffAndSettledStatus, ValueOfCollateral: value.valueOfCollateral, @@ -112,11 +114,11 @@ function consumerDataInsert(data) SettlementAmount: value.settlementAmount, PaymentFrequency: value.paymentFrequency, ActualPaymentAmount: value.actualPaymentAmount, - DateOfEntryForErrorCode: value.dateOfEntryForErrorCode, + DateOfEntryForErrorCode: await Helper.convertDateFormat( value.dateOfEntryForErrorCode), ErrorCode: value.errorCode, - DateOfEntryForCIBILRemarksCode: value.dateOfEntryForCIBILRemarksCode, + DateOfEntryForCIBILRemarksCode: await Helper.convertDateFormat(value.dateOfEntryForCIBILRemarksCode), CIBILRemarksCode: value.cibilRemarksCode, - DateOfEntryForErrorDisputeRemarksCode: value.dateOfEntryForErrorDisputeRemarksCode, + DateOfEntryForErrorDisputeRemarksCode: await Helper.convertDateFormat( value.dateOfEntryForErrorDisputeRemarksCode), ErrorDisputeRemarksCode1: value.errorDisputeRemarksCode1, ErrorDisputeRemarksCode2: value.errorDisputeRemarksCode2, } @@ -127,8 +129,11 @@ function consumerDataInsert(data) }); AccountTransactionDetailDataInsert.then(async(AccountTransactionDetailArray)=>{ - await ConAccountTranscation.bulkCreate(AccountTransactionDetailArray).catch(err=>{ }); - }); + await ConAccountTranscation.bulkCreate(AccountTransactionDetailArray) + .then(data=>{ logMsg.info("ConAccountTranscation data Inserted successfully for losid = "+data.losid+" Data count = "+AccountTransactionDetailArray.length); }) + .catch(err=>{ logMsg.info("ConAccountTranscation data Insertion Failed for losid = "+data.losid+" Error = "+err); }); + + }); }else { logMsg.info("AccountTransactionDetailArray array data not available for losid = "+data.losid); } @@ -143,12 +148,12 @@ function consumerDataInsert(data) data.lstDPDTransactionDetail.forEach(async(value,index,array) => { DPDTransactionDetailObj = { - // DetailID: , - AccountTranDetailsID:accountTranDetailsID , + + AccountTranDetailsID:value.accountTranDetailsID , MemberRefNo: value.memberRefNo, - StartDate: value.startDate, + StartDate: await Helper.convertDateFormat( value.startDate), Code: value.code, - EntryDate: value.entryDate + EntryDate: await Helper.convertDateFormat( value.entryDate) } DPDTransactionDetailArray.push(DPDTransactionDetailObj); @@ -156,8 +161,10 @@ function consumerDataInsert(data) }); }); DPDTransactionDetailDataInsert.then(async(DPDTransactionDetailArray)=>{ - console.log(DPDTransactionDetailArray); - await ConDPDTranscation.bulkCreate(DPDTransactionDetailArray).catch(err=>{ }); + + await ConDPDTranscation.bulkCreate(DPDTransactionDetailArray) + .then(data=>{ logMsg.info("ConDPDTranscation data Inserted successfully for losid = "+data.losid+" Data count = "+DPDTransactionDetailArray.length); }) + .catch(err=>{ logMsg.info("ConDPDTranscation data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("DPDTransactionDetail array data not available for losid = "+data.losid); } @@ -176,9 +183,9 @@ function consumerDataInsert(data) losid :data.losid, //EnquiryID:, MemberReferenceNumber: value.memberReferenceNumber, - DateOfEnquiry: value.dateOfEnquiry, + DateOfEnquiry: await Helper.convertDateFormat( value.dateOfEnquiry), EnquiringMemberShortName: value.enquiringMemberShortName, - ExpirationDate : value.expirationDate, + ExpirationDate : await Helper.convertDateFormat( value.expirationDate), EnquiryPurpose: value.enquiryPurpose, EnquiryAmount: value.enquiryAmount @@ -190,7 +197,9 @@ function consumerDataInsert(data) }); EnquiryDetailDataInsert.then(async(EnquiryDetailArray)=>{ - await ConEnquiryDetail.bulkCreate(EnquiryDetailArray).catch(err=>{ }); + await ConEnquiryDetail.bulkCreate(EnquiryDetailArray) + .then(data=>{ logMsg.info("ConEnquiryDetail data Inserted successfully for losid = "+data.losid+" Data count = "+EnquiryDetailArray.length); }) + .catch(err=>{ logMsg.info("ConEnquiryDetail data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("EnquiryDetail array data not available for losid = "+data.losid); } @@ -217,7 +226,7 @@ function consumerDataInsert(data) PINCode: value.pinCode, AddressCategory: value.addressCategory, ResidenceCode: value.residenceCode, - DateReported: value.dateReported, + DateReported: await Helper.convertDateFormat( value.dateReported), MemberShortName: value.memberShortName, EnrichedThroughEnquiry: value.enrichedThroughEnquiry } @@ -228,7 +237,9 @@ function consumerDataInsert(data) }); AddressDetailDataInsert.then(async(AddressDetailArray)=>{ - await ConAddressDetail.bulkCreate(AddressDetailArray).catch(err=>{ }); + await ConAddressDetail.bulkCreate(AddressDetailArray) + .then(data=>{ logMsg.info("ConAddressDetail data Inserted successfully for losid = "+data.losid+" Data count = "+AddressDetailArray.length); }) + .catch(err=>{ logMsg.info("ConAddressDetail data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("AddressDetailArray array data not available for losid = "+data.losid); } @@ -247,8 +258,8 @@ function consumerDataInsert(data) MemberReferenceNumber: value.memberReferenceNumber, IDType: value.idType, IDNumber: value.idNumber, - IssueDate: value.issueDate, - ExpirationDate: value.expirationDate, + IssueDate: await Helper.convertDateFormat( value.issueDate), + ExpirationDate: await Helper.convertDateFormat( value.expirationDate), EnrichedThroughEnquiry:value.enrichedThroughEnquiry, } IDDetailArray.push(IDDetailObj); @@ -258,7 +269,9 @@ function consumerDataInsert(data) }); IDDetailDataInsert.then(async(IDDetailArray)=>{ - await ConIDDetail.bulkCreate(IDDetailArray).catch(err=>{ }); + await ConIDDetail.bulkCreate(IDDetailArray) + .then(data=>{ logMsg.info("ConIDDetail data Inserted successfully for losid = "+data.losid+" Data count = "+IDDetailArray.length); }) + .catch(err=>{ logMsg.info("ConIDDetail data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("IDDetail array data not available for losid = "+data.losid); } @@ -287,7 +300,9 @@ function consumerDataInsert(data) }); PhoneDetailDataInsert.then(async(PhoneDetailArray)=>{ - await ConPhoneDetail.bulkCreate(PhoneDetailArray).catch(err=>{ }); + await ConPhoneDetail.bulkCreate(PhoneDetailArray) + .then(data=>{ logMsg.info("ConPhoneDetail data Inserted successfully for losid = "+data.losid+" Data count = "+PhoneDetailArray.length); }) + .catch(err=>{ logMsg.info("ConPhoneDetail data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("PhoneDetail array data not available for losid = "+data.losid); } @@ -307,7 +322,7 @@ function consumerDataInsert(data) ScoreName: value.scoreName, ScoreCardName: value.scoreCardName, ScoreCardVersion: value.scoreCardVersion, - ScoreDate: value.scoreDate, + ScoreDate: await Helper.convertDateFormat( value.scoreDate), Score: value.score, ExclusionCode1: value.exclusionCode1, ExclusionCode2: value.exclusionCode2, @@ -333,13 +348,32 @@ function consumerDataInsert(data) }); ScoreDetailDataInsert.then(async(ScoreDetailArray)=>{ - await ConScoreDetail.bulkCreate(ScoreDetailArray).catch(err=>{ }); + await ConScoreDetail.bulkCreate(ScoreDetailArray) + .then(data=>{ logMsg.info("ConScoreDetail data Inserted successfully for losid = "+data.losid+" Data count = "+ScoreDetailArray.length); }) + .catch(err=>{ logMsg.info("ConScoreDetail data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("ScoreDetail array data not available for losid = "+data.losid); } + return new Promise(async(resolve, reject) => { + Promise.all([ConsumerBorrowersDetailsDataInsert, AccountTransactionDetailDataInsert, DPDTransactionDetailDataInsert,EnquiryDetailDataInsert]) + .then((values) => { + setTimeout(() => { + resolve(true) + }, 3500); + + }); + }); +// delete from con_borrower_detail where MemberReferenceNumber = '202103162003537752009' +// delete from con_account_transaction_detail where MemberReferenceNumber = '202103162003537752009' +// delete from con_address_detail where MemberReferenceNumber = '202103162003537752009' +// delete from con_dpd_transaction_detail where MemberRefNo = '202103162003537752009' +// delete from con_id_detail where MemberReferenceNumber = '202103162003537752009' +// delete from con_enquiry_detail where MemberReferenceNumber = '202103162003537752009' +// delete from con_phone_detail where MemberReferenceNumber = '202103162003537752009' +// delete from con_score_detail where MemberReferenceNumber = '202103162003537752009' } catch (error) { @@ -395,18 +429,19 @@ function commercialDataInsert(data) data.lstborrowerProfiles.forEach(async(value,index,array) => { BorrowerProfileDataObj = { + losid : data.losid, ApplicationRefno : value.applicationRefno, ReportIssuesCode : value.reportIssuesCode, ReportIssuesMsg : value.reportIssuesMsg, ReportIssuesDescription : value.reportIssuesDescription, ReportHeaderDaysPasswrdToExpire : value.reportHeaderDaysPasswrdToExpire, ReportHeaderReportOrderNo : value.reportHeaderReportOrderNo, - ReportHeaderReportOrderDate : moment(new Date(value.reportHeaderReportOrder)).format("YYYY-MM-DD"), + ReportHeaderReportOrderDate : await Helper.convertDateFormat( value.reportHeaderReportOrder), ReportHeaderReportOrderedBy : value.reportHeaderReportOrderedBy, ReportHeaderMemberDetails : value.reportHeaderMemberDetails, ReportHeaderApplicationRefNo : value.reportHeaderApplicationRefNo, EnqInfoBorrowerName : value.enqInfoBorrowerName, - EnqInfoDateOfReg : moment(new Date(value.enqInfoDateOfReg)).format("YYYY-MM-DD"), + EnqInfoDateOfReg : await Helper.convertDateFormat( value.enqInfoDateOfReg), EnqInfoPan : value.enqInfoPan, EnqInfoCin : value.enqInfoCin, EnqInfoTin : value.enqInfoTin, @@ -423,7 +458,7 @@ function commercialDataInsert(data) BorrowerProfileBDBusinessIndustryType : value.borrowerProfileBDBusinessIndustryType, BorrowerProfileBDSalesFigure : value.borrowerProfileBDSalesFigure, BorrowerProfileBDNoOfEmp : value.borrowerProfileBDNoOfEmp, - BorrowerProfileBDDOI : moment(new Date( value.borrowerProfileBDDOI)).format("YYYY-MM-DD"), + BorrowerProfileBDDOI : await Helper.convertDateFormat( value.borrowerProfileBDDOI), BorrowerProfileBDYear : value.borrowerProfileBDYear, BorrowerProfileBACDRegaddress : value.borrowerProfileBACDRegaddress, BorrowerProfileBACDTelephoneNo : value.borrowerProfileBACDTelephoneNo, @@ -438,212 +473,212 @@ function commercialDataInsert(data) RankExclusionReason : value.rankExclusionReason, RankMessage : value.rankMessage, CPSInstMsg : value.cpsInstMsg, - CPSInstTotalLenders : value.cpsInstTotalLenders, - CPSInsttotalCFBorrower : value.cpsInsttotalCFBorrower, - CPSInsttotalCFGuarantor : value.cpsInsttotalCFGuarantor, - CPSInsttotalCFBP : value.cpsInsttotalCFBP, - CPSInstTotalCFGP : value.cpsInstTotalCFGP, - CPSInstOpenCF : value.cpsInstOpenCF, - CPSInsTotalOutstandingBorrower : value.cpsInsTotalOutstandingBorrower, - CPSInsTotalOutstandingGuarantor : value.cpsInsTotalOutstandingGuarantor, - CPSInsTotalOutstandingBP : value.cpsInsTotalOutstandingBP, - CPSInsTotalOutstandingGP : value.cpsInsTotalOutstandingGP, - CPSInsLtstCFOpndDate : moment(new Date( value.cpsInsLtstCFOpndDate)).format("YYYY-MM-DD"), - CPSInsDCFBorrower : value.cpsInsDCFBorrower, - CPSInsDCFGuarantor : value.cpsInsDCFGuarantor, - CPSInsDCFBP : value.cpsInsDCFBP, - CPSInsDCFGP : value.cpsInsDCFGP, - CPSInsDOSBorrower : value.cpsInsDOSBorrower, - CPSInsDOSGuarantor : value.cpsInsDOSGuarantor, - CPSInsDOSBP : value.cpsInsDOSBP, - CPSInsDOSGP : value.cpsInsDOSGP, - CPSOutMsg : value.cpsOutMsg, - CPSOutOPSBMsg : value.cpsOutOPSBMsg, - CPSOutOPSBTotalLenders : value.cpsOutOPSBTotalLenders, - CPSOutOPSBTotalCFBorrower : value.cpsOutOPSBTotalCFBorrower, - CPSOutOPSBTotalCFGuarantor : value.cpsOutOPSBTotalCFGuarantor, - CPSOutOPSBTotalCFBP : value.cpsOutOPSBTotalCFBP, - CPSOutOPSBTotalCFGP : value.cpsOutOPSBTotalCFGP, - CPSOutOPSBOpenCF : value.cpsOutOPSBOpenCF, - CPSOutOPSBTOBorrower : value.cpsOutOPSBTOBorrower, - CPSOutOPSBTOGuarantor : value.cpsOutOPSBTOGuarantor, - CPSOutOPSBTOBP : value.cpsOutOPSBTOBP, - CPSOutOPSBTOGP : value.cpsOutOPSBTOGP, - CPSOutOPSBLtstCFOpndDate : value.cpsOutOPSBLtstCFOpndDate, - CPSOutOPSBDCFBorrower : value.cpsOutOPSBDCFBorrower, - CPSOutOPSBDCFGuarantor : value.cpsOutOPSBDCFGuarantor, - CPSOutOPSBDCFBP : value.cpsOutOPSBDCFBP, - CPSOutOPSBDCFGP : value.cpsOutOPSBDCFGP, - CPSOutOPSBDOSBorrower : value.cpsOutOPSBDOSBorrower, - CPSOutOPSBDOSGuarantor : value.cpsOutOPSBDOSGuarantor, - CPSOutOPSBDOSBP : value.cpsOutOPSBDOSBP, - CPSOutOPSBDOSGP : value.cpsOutOPSBDOSGP, - CPSOutOPFBMsg : value.cpsOutOPFBMsg, - CPSOutOPFBTotalLenders : value.cpsOutOPFBTotalLenders, - CPSOutOPFBTCFBorrower : value.cpsOutOPFBTCFBorrower, - CPSOutOPFBTCFGuarantor : value.cpsOutOPFBTCFGuarantor, - CPSOutOPFBTCFBP : value.cpsOutOPFBTCFBP, - CPSOutOPFBTCFGP : value.cpsOutOPFBTCFGP, - CPSOutOPFBOpenCF : value.cpsOutOPFBOpenCF, - CPSOutOPFBTOSBorrower : value.cpsOutOPFBTOSBorrower, - CPSOutOPFBTOSGuarantor : value.cpsOutOPFBTOSGuarantor, - CPSOutOPFBTOSBP : value.cpsOutOPFBTOSBP, - CPSOutOPFBTOSGP : value.cpsOutOPFBTOSGP, - CPSOutOPFBLtstCFOpndDate : moment(new Date( value.cpsOutOPFBLtstCFOpndDate)).format("YYYY-MM-DD"), - CPSOutOPFBDCFBorrower : value.cpsOutOPFBDCFBorrower, - CPSOutOPFBDCFGuarantor : value.cpsOutOPFBDCFGuarantor, - CPSOutOPFBDCFBP : value.cpsOutOPFBDCFBP, - CPSOutOPFBDCFGP : value.cpsOutOPFBDCFGP, - CPSOutOPFBDOSBorrower : value.cpsOutOPFBDOSBorrower, - CPSOutOPFBDOSGuarantor : value.cpsOutOPFBDOSGuarantor, - CPSOutOPFBDOSBP : value.cpsOutOPFBDOSBP, - CPSOutOPFBDOSGP : value.cpsOutOPFBDOSGP, - CPSOutNBFCMsg : value.cpsOutNBFCMsg, - CPSOutNBFCTotalLenders : value.cpsOutNBFCTotalLenders, - CPSOutNBFCTCFBorrower : value.cpsOutNBFCTCFBorrower, - CPSOutNBFCTCFGuarantor : value.cpsOutNBFCTCFGuarantor, - CPSOutNBFCTCFBP : value.cpsOutNBFCTCFBP, - CPSOutNBFCTCFGP : value.cpsOutNBFCTCFGP, - CPSOutNBFCOpenCF : value.cpsOutNBFCOpenCF, - CPSOutNBFCTOSBorrower : value.cpsOutNBFCTOSBorrower, - CPSOutNBFCTOSGuarantor : value.cpsOutNBFCTOSGuarantor, - CPSOutNBFCTOSBP : value.cpsOutNBFCTOSBP, - CPSOutNBFCTOSGP : value.cpsOutNBFCTOSGP, - CPSOutNBFCLtstCFOpndDate : moment(new Date( value.cpsOutNBFCLtstCFOpndDate )).format("YYYY-MM-DD"), - CPSOutNBFCDCFBorrower : value.cpsOutNBFCDCFBorrower, - CPSOutNBFCDCFGuarantor : value.cpsOutNBFCDCFGuarantor, - CPSOutNBFCDCFBP : value.cpsOutNBFCDCFBP, - CPSOutNBFCDCFGP : value.cpsOutNBFCDCFGP, - CPSOutNBFCDOSBorrower : value.cpsOutNBFCDOSBorrower, - CPSOutNBFCDOSGuarantor : value.cpsOutNBFCDOSGuarantor, - CPSOutNBFCDOSBP : value.cpsOutNBFCDOSBP, - CPSOutNBFCDOSGP : value.cpsOutNBFCDOSGP, - CPSOutOutsideTotalMsg : value.cpsOutOutsideTotalMsg, - CPSOutOutsideTotalTotalLenders : value.cpsOutOutsideTotalTotalLenders, - CPSOutOutsideTotalTCFBorrower : value.cpsOutOutsideTotalTCFBorrower, - CPSOutOutsideTotalTCFGuarantor : value.cpsOutOutsideTotalTCFGuarantor, - CPSOutOutsideTotalTCFBP : value.cpsOutOutsideTotalTCFBP, - CPSOutOutsideTotalTCFGP : value.cpsOutOutsideTotalTCFGP, - CPSOutOutsideTotalOpenCF : value.cpsOutOutsideTotalOpenCF, - CPSOutOutsideTotalTOSBorrower : value.cpsOutOutsideTotalTOSBorrower, - CPSOutOutsideTotalTOSGuarantor : value.cpsOutOutsideTotalTOSGuarantor, - CPSOutOutsideTotalTOSBP : value.cpsOutOutsideTotalTOSBP, - CPSOutOutsideTotalTOSGP : value.cpsOutOutsideTotalTOSGP, - CPSOutOutsideTotalLtstCFOpndDate : value.cpsOutOutsideTotalLtstCFOpndDate, - CPSOutOutsideTotalDCFBorrower : value.cpsOutOutsideTotalDCFBorrower, - CPSOutOutsideTotalDCFGuarantor : value.cpsOutOutsideTotalDCFGuarantor, - CPSOutOutsideTotalDCFBP : value.cpsOutOutsideTotalDCFBP, - CPSOutOutsideTotalDCFGP : value.cpsOutOutsideTotalDCFGP, - CPSOutOutsideTotalDOSBorrower : value.cpsOutOutsideTotalDOSBorrower, - CPSOutOutsideTotalDOSGuarantor : value.cpsOutOutsideTotalDOSGuarantor, - CPSOutOutsideTotalDOSBP : value.cpsOutOutsideTotalDOSBP, - CPSOutOutsideTotalDOSGP : value.cpsOutOutsideTotalDOSGP, - CPSTotalTotalLenders : value.cpsTotalTotalLenders, - CPSTotalTotalCF : value.cpsTotalTotalCF, - CPSTotalOpenCF : value.cpsTotalOpenCF, - CPSTotalTotalOutstanding : value.cpsTotalTotalOutstanding, - CPSTotalLtstCFOpndDate : value.cpsTotalLtstCFOpndDate, - CPSTotalDCF : value.cpsTotalDCF, - CPSTotalDOS : value.cpsTotalDOS, - EnqSSMsg : value.enqSSMsg, - EnqSSInstNOEMnths1 : value.enqSSInstNOEMnths1, - EnqSSInstNOEMnths2to3 : value.enqSSInstNOEMnths2to3, - EnqSSInstNOEMnths4to6 : value.enqSSInstNOEMnths4to6, - EnqSSInstNOEMnths7to12 : value.enqSSInstNOEMnths7to12, - EnqSSInstNOEMnths12to24 : value.enqSSInstNOEMnths12to24, - EnqSSInstNOEGrtrThan24Mnths : value.enqSSInstNOEGrtrThan24Mnths, - EnqSSInstNOETotal : value.enqSSInstNOETotal, - EnqSSInstNOEMstRecentDate : value.enqSSInstNOEMstRecentDate, - EnqSSOutNOEMnths1 : value.enqSSOutNOEMnths1, - EnqSSOutNOEMnths2to3 : value.enqSSOutNOEMnths2to3, - EnqSSOutNOEMnths4to6 : value.enqSSOutNOEMnths4to6, - EnqSSOutNOEMnths7to12 : value.enqSSOutNOEMnths7to12, - EnqSSOutNOEMnthsGrtrThan24Mnths : value.enqSSOutNOEMnthsGrtrThan24Mnths, - EnqSSOutNOETotal : value.enqSSOutNOETotal, - EnqSSOutNOEMstRecentDate : moment(new Date( value.enqSSOutNOEMstRecentDate)).format("YYYY-MM-DD"), - EnqSSETMnths1 : value.enqSSETMnths1, - EnqSSETMnths2to3 : value.enqSSETMnths2to3, - EnqSSETMnths4to6 : value.enqSSETMnths4to6, - EnqSSETMnths7to12 : value.enqSSETMnths7to12, - EnqSSETMnths12to24 : value.enqSSETMnths12to24, - EnqSSETGrtrThan24Mnths : value.enqSSETGrtrThan24Mnths, - EnqSSETTotal : value.enqSSETTotal, - EnqSSETMstRecentDate : value.enqSSETMstRecentDate, - DISMsg : value.disMsg, - DISMsgOfBorrower : value.disMsgOfBorrower, - DISMsgOfBorrowerInst : value.disMsgOfBorrowerInst, - DISMsgOfBorrowerOut : value.disMsgOfBorrowerOut, - DISMsgOfRelatedPartie : value.disMsgOfRelatedPartie, - DISMsgOfRelatedPartiesInst : value.disMsgOfRelatedPartiesInst, - DISMsgOfRelatedPartiesOut : value.disMsgOfRelatedPartiesOut, - DISMsgOfGuarantedParties : value.disMsgOfGuarantedParties, - DISDIBInstWilfulDefault : value.disdibInstWilfulDefault, - DISDIBInstSFNOS : value.disdibInstSFNOS, - DISDIBInstSFAmt : value.disdibInstSFAmt, - DISDIBInstWOffNOS : value.disdibInstWOffNOS, - DISDIBInstWOffAmt : value.disdibInstWOffAmt, - DISDIBInstSettledNOS : value.disdibInstSettledNOS, - DISDIBInstSettledAmt : value.disdibInstSettledAmt, - DISDIBInstInvokedNOS : value.disdibInstInvokedNOS, - DISDIBInstInvokedAmt : value.disdibInstInvokedAmt, - DISDIBInstOverdueCFNOS : value.disdibInstOverdueCFNOS, - DISDIBInstOverdueCFAmt : value.disdibInstOverdueCFAmt, - DISDIBInstDishonoredCheque : value.disdibInstDishonoredCheque, - DISDIBOutWilfulDefault : value.disdibOutWilfulDefault, - DISDIBOutSFNOS : value.disdibOutSFNOS, - DISDIBOutWOffNOS : value.disdibOutWOffNOS, - DISDIBOutWOffAmt : value.disdibOutWOffAmt, - DISDIBOutSettledNOS : value.disdibOutSettledNOS, - DISDIBOutSettledAmt : value.disdibOutSettledAmt, - DISDIBOutInvokedNOS : value.disdibOutInvokedNOS, - DISDIBOutInvokedAmt : value.disdibOutInvokedAmt, - DISDIBOutOverdueCFNOS : value.disdibOutOverdueCFNOS, - DISDIBOutOverdueCFAmt : value.disdibOutOverdueCFAmt, - DISDIBOutDishonoredCheque : value.disdibOutDishonoredCheque, - DISDIBTotalWilfulDefault : value.disdibTotalWilfulDefault, - DISDIBTotalSFNOS : value.disdibTotalSFNOS, - DISDIBTotalSFAmt : value.disdibTotalSFAmt, - DISDIBTotalWOffAmt : value.disdibTotalWOffAmt, - DISDIBTotalSettledNOS : value.disdibTotalSettledNOS, - DISDIBTotalSettledAmt : value.disdibTotalSettledAmt, - DISDIBTotalInvokedNOS : value.disdibTotalInvokedNOS, - DISDIBTotalInvokedAmt : value.disdibTotalInvokedAmt, - DISDIBTotalOverdueCFNOS : value.disdibTotalOverdueCFNOS, - DISDIBTotalOverdueCFAmt : value.disdibTotalOverdueCFAmt, - DISDIBTotalDishonoredCheque : value.disdibTotalDishonoredCheque, - DISGOBInstWilfulDefault : value.disgobInstWilfulDefault, - DISGOBInstSFNOS : value.disgobInstSFNOS, - DISGOBInstSFAmt : value.disgobInstSFAmt, - DISGOBInstWOffNOS : value.disgobInstWOffNOS, - DISGOBInstWOffAmt : value.disgobInstWOffAmt, - DISGOBInstSettledNOS : value.disgobInstSettledNOS, - DISGOBInstSettledAmt : value.disgobInstSettledAmt, - DISGOBInstOverdueCFNOS : value.disgobInstOverdueCFNOS, - DISGOBInstOverdueCFAmt : value.disgobInstOverdueCFAmt, - DISGOBInstDishonoredCheque : value.disgobInstDishonoredCheque, - DISGOBOutWilfulDefault : value.disgobOutWilfulDefault, - DISGOBOutSFNOS : value.disgobOutSFNOS, - DISGOBOutSFAmt : value.disgobOutSFAmt, - DISGOBOutWOffNOS : value.disgobOutWOffNOS, - DISGOBOutWOffAmt : value.disgobOutWOffAmt, - DISGOBOutSettledNOS : value.disgobOutSettledNOS, - DISGOBOutSettledAmt : value.disgobOutSettledAmt, - DISGOBOutInvokedNOS : value.disgobOutInvokedNOS, - DISGOBOutInvokedAmt : value.disgobOutInvokedAmt, - DISGOBOutOverdueCFNOS : value.disgobOutOverdueCFNOS, - DISGOBOutOverdueCFAmt : value.disgobOutOverdueCFAmt, - DISGOBOutDishonoredCheque : value.disgobOutDishonoredCheque, - DISGOBTotalWilfulDefault : value.disgobTotalWilfulDefault, - DISGOBTotalSFNOS : value.disgobTotalSFNOS, - DISGOBTotalSFAmt : value.disgobTotalSFAmt, - DISGOBTotalWOffNOS : value.disgobTotalWOffNOS, - DISGOBTotalWOffAmt : value.disgobTotalWOffAmt, - DISGOBTotalSettledNOS : value.disgobTotalSettledNOS, - DISGOBTotalSettledAmt : value.disgobTotalSettledAmt, - DISGOBTotalInvokedNOS : value.disgobTotalInvokedNOS, - DISGOBTotalInvokedAmt : value.disgobTotalInvokedAmt, - DISGOBTotalOverdueCFNOS : value.disgobTotalOverdueCFNOS, - // temp_id : value.temp_id + // CPSInstTotalLenders : value.cpsInstTotalLenders, + // CPSInsttotalCFBorrower : value.cpsInsttotalCFBorrower, + // CPSInsttotalCFGuarantor : value.cpsInsttotalCFGuarantor, + // CPSInsttotalCFBP : value.cpsInsttotalCFBP, + // CPSInstTotalCFGP : value.cpsInstTotalCFGP, + // CPSInstOpenCF : value.cpsInstOpenCF, + // CPSInsTotalOutstandingBorrower : value.cpsInsTotalOutstandingBorrower, + // CPSInsTotalOutstandingGuarantor : value.cpsInsTotalOutstandingGuarantor, + // CPSInsTotalOutstandingBP : value.cpsInsTotalOutstandingBP, + // CPSInsTotalOutstandingGP : value.cpsInsTotalOutstandingGP, + // CPSInsLtstCFOpndDate : await Helper.convertDateFormat( value.cpsInsLtstCFOpndDate), + // CPSInsDCFBorrower : value.cpsInsDCFBorrower, + // CPSInsDCFGuarantor : value.cpsInsDCFGuarantor, + // CPSInsDCFBP : value.cpsInsDCFBP, + // CPSInsDCFGP : value.cpsInsDCFGP, + // CPSInsDOSBorrower : value.cpsInsDOSBorrower, + // CPSInsDOSGuarantor : value.cpsInsDOSGuarantor, + // CPSInsDOSBP : value.cpsInsDOSBP, + // CPSInsDOSGP : value.cpsInsDOSGP, + // CPSOutMsg : value.cpsOutMsg, + // CPSOutOPSBMsg : value.cpsOutOPSBMsg, + // CPSOutOPSBTotalLenders : value.cpsOutOPSBTotalLenders, + // CPSOutOPSBTotalCFBorrower : value.cpsOutOPSBTotalCFBorrower, + // CPSOutOPSBTotalCFGuarantor : value.cpsOutOPSBTotalCFGuarantor, + // CPSOutOPSBTotalCFBP : value.cpsOutOPSBTotalCFBP, + // CPSOutOPSBTotalCFGP : value.cpsOutOPSBTotalCFGP, + // CPSOutOPSBOpenCF : value.cpsOutOPSBOpenCF, + // CPSOutOPSBTOBorrower : value.cpsOutOPSBTOBorrower, + // CPSOutOPSBTOGuarantor : value.cpsOutOPSBTOGuarantor, + // CPSOutOPSBTOBP : value.cpsOutOPSBTOBP, + // CPSOutOPSBTOGP : value.cpsOutOPSBTOGP, + // CPSOutOPSBLtstCFOpndDate : value.cpsOutOPSBLtstCFOpndDate, + // CPSOutOPSBDCFBorrower : value.cpsOutOPSBDCFBorrower, + // CPSOutOPSBDCFGuarantor : value.cpsOutOPSBDCFGuarantor, + // CPSOutOPSBDCFBP : value.cpsOutOPSBDCFBP, + // CPSOutOPSBDCFGP : value.cpsOutOPSBDCFGP, + // CPSOutOPSBDOSBorrower : value.cpsOutOPSBDOSBorrower, + // CPSOutOPSBDOSGuarantor : value.cpsOutOPSBDOSGuarantor, + // CPSOutOPSBDOSBP : value.cpsOutOPSBDOSBP, + // CPSOutOPSBDOSGP : value.cpsOutOPSBDOSGP, + // CPSOutOPFBMsg : value.cpsOutOPFBMsg, + // CPSOutOPFBTotalLenders : value.cpsOutOPFBTotalLenders, + // CPSOutOPFBTCFBorrower : value.cpsOutOPFBTCFBorrower, + // CPSOutOPFBTCFGuarantor : value.cpsOutOPFBTCFGuarantor, + // CPSOutOPFBTCFBP : value.cpsOutOPFBTCFBP, + // CPSOutOPFBTCFGP : value.cpsOutOPFBTCFGP, + // CPSOutOPFBOpenCF : value.cpsOutOPFBOpenCF, + // CPSOutOPFBTOSBorrower : value.cpsOutOPFBTOSBorrower, + // CPSOutOPFBTOSGuarantor : value.cpsOutOPFBTOSGuarantor, + // CPSOutOPFBTOSBP : value.cpsOutOPFBTOSBP, + // CPSOutOPFBTOSGP : value.cpsOutOPFBTOSGP, + // CPSOutOPFBLtstCFOpndDate : await Helper.convertDateFormat( value.cpsOutOPFBLtstCFOpndDate), + // CPSOutOPFBDCFBorrower : value.cpsOutOPFBDCFBorrower, + // CPSOutOPFBDCFGuarantor : value.cpsOutOPFBDCFGuarantor, + // CPSOutOPFBDCFBP : value.cpsOutOPFBDCFBP, + // CPSOutOPFBDCFGP : value.cpsOutOPFBDCFGP, + // CPSOutOPFBDOSBorrower : value.cpsOutOPFBDOSBorrower, + // CPSOutOPFBDOSGuarantor : value.cpsOutOPFBDOSGuarantor, + // CPSOutOPFBDOSBP : value.cpsOutOPFBDOSBP, + // CPSOutOPFBDOSGP : value.cpsOutOPFBDOSGP, + // CPSOutNBFCMsg : value.cpsOutNBFCMsg, + // CPSOutNBFCTotalLenders : value.cpsOutNBFCTotalLenders, + // CPSOutNBFCTCFBorrower : value.cpsOutNBFCTCFBorrower, + // CPSOutNBFCTCFGuarantor : value.cpsOutNBFCTCFGuarantor, + // CPSOutNBFCTCFBP : value.cpsOutNBFCTCFBP, + // CPSOutNBFCTCFGP : value.cpsOutNBFCTCFGP, + // CPSOutNBFCOpenCF : value.cpsOutNBFCOpenCF, + // CPSOutNBFCTOSBorrower : value.cpsOutNBFCTOSBorrower, + // CPSOutNBFCTOSGuarantor : value.cpsOutNBFCTOSGuarantor, + // CPSOutNBFCTOSBP : value.cpsOutNBFCTOSBP, + // CPSOutNBFCTOSGP : value.cpsOutNBFCTOSGP, + // CPSOutNBFCLtstCFOpndDate : await Helper.convertDateFormat( value.cpsOutNBFCLtstCFOpndDate), + // CPSOutNBFCDCFBorrower : value.cpsOutNBFCDCFBorrower, + // CPSOutNBFCDCFGuarantor : value.cpsOutNBFCDCFGuarantor, + // CPSOutNBFCDCFBP : value.cpsOutNBFCDCFBP, + // CPSOutNBFCDCFGP : value.cpsOutNBFCDCFGP, + // CPSOutNBFCDOSBorrower : value.cpsOutNBFCDOSBorrower, + // CPSOutNBFCDOSGuarantor : value.cpsOutNBFCDOSGuarantor, + // CPSOutNBFCDOSBP : value.cpsOutNBFCDOSBP, + // CPSOutNBFCDOSGP : value.cpsOutNBFCDOSGP, + // CPSOutOutsideTotalMsg : value.cpsOutOutsideTotalMsg, + // CPSOutOutsideTotalTotalLenders : value.cpsOutOutsideTotalTotalLenders, + // CPSOutOutsideTotalTCFBorrower : value.cpsOutOutsideTotalTCFBorrower, + // CPSOutOutsideTotalTCFGuarantor : value.cpsOutOutsideTotalTCFGuarantor, + // CPSOutOutsideTotalTCFBP : value.cpsOutOutsideTotalTCFBP, + // CPSOutOutsideTotalTCFGP : value.cpsOutOutsideTotalTCFGP, + // CPSOutOutsideTotalOpenCF : value.cpsOutOutsideTotalOpenCF, + // CPSOutOutsideTotalTOSBorrower : value.cpsOutOutsideTotalTOSBorrower, + // CPSOutOutsideTotalTOSGuarantor : value.cpsOutOutsideTotalTOSGuarantor, + // CPSOutOutsideTotalTOSBP : value.cpsOutOutsideTotalTOSBP, + // CPSOutOutsideTotalTOSGP : value.cpsOutOutsideTotalTOSGP, + // CPSOutOutsideTotalLtstCFOpndDate : value.cpsOutOutsideTotalLtstCFOpndDate, + // CPSOutOutsideTotalDCFBorrower : value.cpsOutOutsideTotalDCFBorrower, + // CPSOutOutsideTotalDCFGuarantor : value.cpsOutOutsideTotalDCFGuarantor, + // CPSOutOutsideTotalDCFBP : value.cpsOutOutsideTotalDCFBP, + // CPSOutOutsideTotalDCFGP : value.cpsOutOutsideTotalDCFGP, + // CPSOutOutsideTotalDOSBorrower : value.cpsOutOutsideTotalDOSBorrower, + // CPSOutOutsideTotalDOSGuarantor : value.cpsOutOutsideTotalDOSGuarantor, + // CPSOutOutsideTotalDOSBP : value.cpsOutOutsideTotalDOSBP, + // CPSOutOutsideTotalDOSGP : value.cpsOutOutsideTotalDOSGP, + // CPSTotalTotalLenders : value.cpsTotalTotalLenders, + // CPSTotalTotalCF : value.cpsTotalTotalCF, + // CPSTotalOpenCF : value.cpsTotalOpenCF, + // CPSTotalTotalOutstanding : value.cpsTotalTotalOutstanding, + // CPSTotalLtstCFOpndDate : value.cpsTotalLtstCFOpndDate, + // CPSTotalDCF : value.cpsTotalDCF, + // CPSTotalDOS : value.cpsTotalDOS, + // EnqSSMsg : value.enqSSMsg, + // EnqSSInstNOEMnths1 : value.enqSSInstNOEMnths1, + // EnqSSInstNOEMnths2to3 : value.enqSSInstNOEMnths2to3, + // EnqSSInstNOEMnths4to6 : value.enqSSInstNOEMnths4to6, + // EnqSSInstNOEMnths7to12 : value.enqSSInstNOEMnths7to12, + // EnqSSInstNOEMnths12to24 : value.enqSSInstNOEMnths12to24, + // EnqSSInstNOEGrtrThan24Mnths : value.enqSSInstNOEGrtrThan24Mnths, + // EnqSSInstNOETotal : value.enqSSInstNOETotal, + // EnqSSInstNOEMstRecentDate : value.enqSSInstNOEMstRecentDate, + // EnqSSOutNOEMnths1 : value.enqSSOutNOEMnths1, + // EnqSSOutNOEMnths2to3 : value.enqSSOutNOEMnths2to3, + // EnqSSOutNOEMnths4to6 : value.enqSSOutNOEMnths4to6, + // EnqSSOutNOEMnths7to12 : value.enqSSOutNOEMnths7to12, + // EnqSSOutNOEMnthsGrtrThan24Mnths : value.enqSSOutNOEMnthsGrtrThan24Mnths, + // EnqSSOutNOETotal : value.enqSSOutNOETotal, + // EnqSSOutNOEMstRecentDate : await Helper.convertDateFormat( value.enqSSOutNOEMstRecentDate) , + // EnqSSETMnths1 : value.enqSSETMnths1, + // EnqSSETMnths2to3 : value.enqSSETMnths2to3, + // EnqSSETMnths4to6 : value.enqSSETMnths4to6, + // EnqSSETMnths7to12 : value.enqSSETMnths7to12, + // EnqSSETMnths12to24 : value.enqSSETMnths12to24, + // EnqSSETGrtrThan24Mnths : value.enqSSETGrtrThan24Mnths, + // EnqSSETTotal : value.enqSSETTotal, + // EnqSSETMstRecentDate : value.enqSSETMstRecentDate, + // DISMsg : value.disMsg, + // DISMsgOfBorrower : value.disMsgOfBorrower, + // DISMsgOfBorrowerInst : value.disMsgOfBorrowerInst, + // DISMsgOfBorrowerOut : value.disMsgOfBorrowerOut, + // DISMsgOfRelatedPartie : value.disMsgOfRelatedPartie, + // DISMsgOfRelatedPartiesInst : value.disMsgOfRelatedPartiesInst, + // DISMsgOfRelatedPartiesOut : value.disMsgOfRelatedPartiesOut, + // DISMsgOfGuarantedParties : value.disMsgOfGuarantedParties, + // DISDIBInstWilfulDefault : value.disdibInstWilfulDefault, + // DISDIBInstSFNOS : value.disdibInstSFNOS, + // DISDIBInstSFAmt : value.disdibInstSFAmt, + // DISDIBInstWOffNOS : value.disdibInstWOffNOS, + // DISDIBInstWOffAmt : value.disdibInstWOffAmt, + // DISDIBInstSettledNOS : value.disdibInstSettledNOS, + // DISDIBInstSettledAmt : value.disdibInstSettledAmt, + // DISDIBInstInvokedNOS : value.disdibInstInvokedNOS, + // DISDIBInstInvokedAmt : value.disdibInstInvokedAmt, + // DISDIBInstOverdueCFNOS : value.disdibInstOverdueCFNOS, + // DISDIBInstOverdueCFAmt : value.disdibInstOverdueCFAmt, + // DISDIBInstDishonoredCheque : value.disdibInstDishonoredCheque, + // DISDIBOutWilfulDefault : value.disdibOutWilfulDefault, + // DISDIBOutSFNOS : value.disdibOutSFNOS, + // DISDIBOutWOffNOS : value.disdibOutWOffNOS, + // DISDIBOutWOffAmt : value.disdibOutWOffAmt, + // DISDIBOutSettledNOS : value.disdibOutSettledNOS, + // DISDIBOutSettledAmt : value.disdibOutSettledAmt, + // DISDIBOutInvokedNOS : value.disdibOutInvokedNOS, + // DISDIBOutInvokedAmt : value.disdibOutInvokedAmt, + // DISDIBOutOverdueCFNOS : value.disdibOutOverdueCFNOS, + // DISDIBOutOverdueCFAmt : value.disdibOutOverdueCFAmt, + // DISDIBOutDishonoredCheque : value.disdibOutDishonoredCheque, + // DISDIBTotalWilfulDefault : value.disdibTotalWilfulDefault, + // DISDIBTotalSFNOS : value.disdibTotalSFNOS, + // DISDIBTotalSFAmt : value.disdibTotalSFAmt, + // DISDIBTotalWOffAmt : value.disdibTotalWOffAmt, + // DISDIBTotalSettledNOS : value.disdibTotalSettledNOS, + // DISDIBTotalSettledAmt : value.disdibTotalSettledAmt, + // DISDIBTotalInvokedNOS : value.disdibTotalInvokedNOS, + // DISDIBTotalInvokedAmt : value.disdibTotalInvokedAmt, + // DISDIBTotalOverdueCFNOS : value.disdibTotalOverdueCFNOS, + // DISDIBTotalOverdueCFAmt : value.disdibTotalOverdueCFAmt, + // DISDIBTotalDishonoredCheque : value.disdibTotalDishonoredCheque, + // DISGOBInstWilfulDefault : value.disgobInstWilfulDefault, + // DISGOBInstSFNOS : value.disgobInstSFNOS, + // DISGOBInstSFAmt : value.disgobInstSFAmt, + // DISGOBInstWOffNOS : value.disgobInstWOffNOS, + // DISGOBInstWOffAmt : value.disgobInstWOffAmt, + // DISGOBInstSettledNOS : value.disgobInstSettledNOS, + // DISGOBInstSettledAmt : value.disgobInstSettledAmt, + // DISGOBInstOverdueCFNOS : value.disgobInstOverdueCFNOS, + // DISGOBInstOverdueCFAmt : value.disgobInstOverdueCFAmt, + // DISGOBInstDishonoredCheque : value.disgobInstDishonoredCheque, + // DISGOBOutWilfulDefault : value.disgobOutWilfulDefault, + // DISGOBOutSFNOS : value.disgobOutSFNOS, + // DISGOBOutSFAmt : value.disgobOutSFAmt, + // DISGOBOutWOffNOS : value.disgobOutWOffNOS, + // DISGOBOutWOffAmt : value.disgobOutWOffAmt, + // DISGOBOutSettledNOS : value.disgobOutSettledNOS, + // DISGOBOutSettledAmt : value.disgobOutSettledAmt, + // DISGOBOutInvokedNOS : value.disgobOutInvokedNOS, + // DISGOBOutInvokedAmt : value.disgobOutInvokedAmt, + // DISGOBOutOverdueCFNOS : value.disgobOutOverdueCFNOS, + // DISGOBOutOverdueCFAmt : value.disgobOutOverdueCFAmt, + // DISGOBOutDishonoredCheque : value.disgobOutDishonoredCheque, + // DISGOBTotalWilfulDefault : value.disgobTotalWilfulDefault, + // DISGOBTotalSFNOS : value.disgobTotalSFNOS, + // DISGOBTotalSFAmt : value.disgobTotalSFAmt, + // DISGOBTotalWOffNOS : value.disgobTotalWOffNOS, + // DISGOBTotalWOffAmt : value.disgobTotalWOffAmt, + // DISGOBTotalSettledNOS : value.disgobTotalSettledNOS, + // DISGOBTotalSettledAmt : value.disgobTotalSettledAmt, + // DISGOBTotalInvokedNOS : value.disgobTotalInvokedNOS, + // DISGOBTotalInvokedAmt : value.disgobTotalInvokedAmt, + // DISGOBTotalOverdueCFNOS : value.disgobTotalOverdueCFNOS, + } BorrowerDataArray.push(BorrowerProfileDataObj); @@ -653,7 +688,9 @@ function commercialDataInsert(data) }); BorrowerProfileDataInsert.then(async(BorrowerDataArray)=>{ // console.log(BorrowerDataArray.length); - await BorrowerProfile.bulkCreate(BorrowerDataArray).catch(err=>{ }); + await BorrowerProfile.bulkCreate(BorrowerDataArray) + .then(data=>{ logMsg.info("BorrowerProfile data Inserted successfully for losid = "+data.losid+" Data count = "+BorrowerDataArray.length); }) + .catch(err=>{ logMsg.info("BorrowerProfile data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("BorrowerProfile(Commercial) array data not available for losid = "+data.losid); } @@ -674,7 +711,7 @@ function commercialDataInsert(data) BorrowerProfileBIDTin: value.borrowerProfileBIDTin, BorrowerProfileBIDRegistrationNo: value.borrowerProfileBIDRegistrationNo, BorrowerProfileBIDServiceTaxNo: value.borrowerProfileBIDServiceTaxNo, - BorrowerProfileLastReportedDate: moment(new Date( value.borrowerProfileLastReportedDate)).format("YYYY-MM-DD"), + BorrowerProfileLastReportedDate:await Helper.convertDateFormat( value.borrowerProfileLastReportedDate) , } BorroweIDDetailArray.push(BorroweIDDetailObj); @@ -684,7 +721,9 @@ function commercialDataInsert(data) }); BorroweIDDetailDataInsert.then(async(BorroweIDDetailArray)=>{ //console.log(BorroweIDDetailArray.length); - await BorrowidDetail.bulkCreate(BorroweIDDetailArray).catch(err=>{ }); + await BorrowidDetail.bulkCreate(BorroweIDDetailArray) + .then(data=>{ logMsg.info("BorrowidDetail data Inserted successfully for losid = "+data.losid+" Data count = "+BorroweIDDetailArray.length); }) + .catch(err=>{ logMsg.info("BorrowidDetail data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("BorrowidDetail(Commercial) array data not available for losid = "+data.losid); } @@ -703,7 +742,7 @@ function commercialDataInsert(data) BorrowerCurrentDetailsID: value.borrowerCurrentDetailsID, GuarantorDetailsName: value.guarantorDetailsName, GuarantorDetailsRelatedType: value.guarantorDetailsRelatedType, - GuarantorDetailsDOB: moment(new Date( value.guarantorDetailsDOB)).format("YYYY-MM-DD"), + GuarantorDetailsDOB: await Helper.convertDateFormat( value.guarantorDetailsDOB) , GuarantorDetailsGender: value.guarantorDetailsGender, GuarantorDetailsDOI: value.guarantorDetailsDOI, GuarantorDetailsBusinessCateg: value.guarantorDetailsBusinessCateg, @@ -720,8 +759,10 @@ function commercialDataInsert(data) }); }); GuarantorDetailDataInsert.then(async(GuarantorDetailArray)=>{ - // console.log(GuarantorDetailArray.length); - await GuarantorDetail.bulkCreate(GuarantorDetailArray).catch(err=>{ }); + //console.log(GuarantorDetailArray.length); + await GuarantorDetail.bulkCreate(GuarantorDetailArray) + .then(data=>{ logMsg.info("GuarantorDetail data Inserted successfully for losid = "+data.losid+" Data count = "+GuarantorDetailArray.length); }) + .catch(err=>{ logMsg.info("GuarantorDetail data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("GuarantorDetail(Commercial) array data not available for losid = "+data.losid); } @@ -748,8 +789,8 @@ function commercialDataInsert(data) CreditFacilityCDcfMember : value.creditFacilityCDcfMember, CreditFacilityCDAssetCDPDueDpd : value.creditFacilityCDAssetCDPDueDpd, CreditFacilityCDStatus : value.creditFacilityCDStatus, - CreditFacilityCDStatusDate : moment(new Date( value.creditFacilityCDStatusDate)).format("YYYY-MM-DD"), - CreditFacilityCDLstReportedDate : moment(new Date( value.creditFacilityCDLstReportedDate)).format("YYYY-MM-DD"), + CreditFacilityCDStatusDate : await Helper.convertDateFormat( value.creditFacilityCDStatusDate), + CreditFacilityCDLstReportedDate : await Helper.convertDateFormat( value.creditFacilityCDLstReportedDate), CreditFacilityCDAmtCurrency : value.creditFacilityCDAmtCurrency, CreditFacilityCDAmtSanctionedAmt : value.creditFacilityCDAmtSanctionedAmt, CreditFacilityCDAmtSanctionedAmtDP : value.creditFacilityCDAmtSanctionedAmtDP , @@ -765,10 +806,10 @@ function commercialDataInsert(data) CreditFacilityCDAmtNaorc : value.creditFacilityCDAmtNaorc, CreditFacilityCDAmtContrctCAsNPA : value.creditFacilityCDAmtContrctCAsNPA, CreditFacilityCDAmtNAmtOfContracts : value.creditFacilityCDAmtNAmtOfContracts, - CreditFacilityCDDatesSanctionedDt : moment(new Date( value.creditFacilityCDDatesSanctionedDt)).format("YYYY-MM-DD"), - CreditFacilityCDDatesLoanExpiryDt :moment(new Date( value.creditFacilityCDDatesLoanExpiryDt)).format("YYYY-MM-DD"), - CreditFacilityCDDatesLoanRenewalDt : moment(new Date( value.creditFacilityCDDatesLoanRenewalDt)).format("YYYY-MM-DD"), - CreditFacilityCDDatesSuitFiledDt : moment(new Date( value.creditFacilityCDDatesSuitFiledDt)).format("YYYY-MM-DD"), + CreditFacilityCDDatesSanctionedDt :await Helper.convertDateFormat( value.creditFacilityCDDatesSanctionedDt) , + CreditFacilityCDDatesLoanExpiryDt :await Helper.convertDateFormat( value.creditFacilityCDDatesLoanExpiryDt), + CreditFacilityCDDatesLoanRenewalDt :await Helper.convertDateFormat( value.creditFacilityCDDatesLoanRenewalDt) , + CreditFacilityCDDatesSuitFiledDt :await Helper.convertDateFormat( value.creditFacilityCDDatesSuitFiledDt), CreditFacilityCDDatesWilfulDefault : value.creditFacilityCDDatesWilfulDefault, CreditFacilityCDODRepaymentFrequency : value.creditFacilityCDODRepaymentFrequency, CreditFacilityCDODTenure : value.creditFacilityCDODTenure, @@ -798,7 +839,9 @@ function commercialDataInsert(data) }); CreditFacilityCurrentDertailDataInsert.then(async(CreditFacilityArray)=>{ //console.log(CreditFacilityArray.length); - await CreditFacilityCurrentDetail.bulkCreate(CreditFacilityArray).catch(err=>{ }); + await CreditFacilityCurrentDetail.bulkCreate(CreditFacilityArray) + .then(data=>{ logMsg.info("CreditFacilityCurrentDetail data Inserted successfully for losid = "+data.losid+" Data count = "+CreditFacilityArray.length); }) + .catch(err=>{ logMsg.info("CreditFacilityCurrentDetail data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("CreditFacilityCurrentDetail(Commercial) array data not available for losid = "+data.losid); } @@ -816,7 +859,7 @@ function commercialDataInsert(data) AcHistoryandDPDObj = { ApplicationRefno: value.applicationRefno, BorrowerCurrentDetailsID: value.borrowerCurrentDetailsID, - CFHistory24Monthsmonth: moment(new Date( value.cfHistory24Monthsmonth)).format("YYYY-MM-DD"), + CFHistory24Monthsmonth: await Helper.convertDateFormat( value.cfHistory24Monthsmonth), CFHistory24MonthsACorDPD: value.cfHistory24MonthsACorDPD, CFHistory24MonthsOSAmount: value.cfHistory24MonthsOSAmount, } @@ -827,7 +870,9 @@ function commercialDataInsert(data) }); AcHistoryandDPDDataInsert.then(async(AcHistoryandDPDArray)=>{ //console.log(AcHistoryandDPDArray.length); - await AcHistoryAndDPD.bulkCreate(AcHistoryandDPDArray).catch(err=>{ }); + await AcHistoryAndDPD.bulkCreate(AcHistoryandDPDArray) + .then(data=>{ logMsg.info("AcHistoryAndDPD data Inserted successfully for losid = "+data.losid+" Data count = "+AcHistoryandDPDArray.length); }) + .catch(err=>{ logMsg.info("AcHistoryAndDPD data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("AcHistoryAndDPD(Commercial) array data not available for losid = "+data.losid); } @@ -845,7 +890,7 @@ function commercialDataInsert(data) losid :data.losid, ApplicationRefno: value.applicationRefno, EnquiryDetailsCreditLender: value.enquiryDetailsCreditLender, - EnquiryDetailsEnquiryDt: moment(new Date( value.enquiryDetailsEnquiryDt)).format("YYYY-MM-DD"), + EnquiryDetailsEnquiryDt: await Helper.convertDateFormat( value.enquiryDetailsEnquiryDt), EnquiryDetailsEnquiryPurpose: value.enquiryDetailsEnquiryPurpose, EnquiryDetailsEnquiryAmt: value.enquiryDetailsEnquiryAmt, //temp_id: value. @@ -857,7 +902,9 @@ function commercialDataInsert(data) }); EnquiryDetailDataInsert.then(async(EnquiryDetailArray)=>{ //console.log(EnquiryDetailArray.length); - await EnquiryDetail.bulkCreate(EnquiryDetailArray).catch(err=>{ }); + await EnquiryDetail.bulkCreate(EnquiryDetailArray) + .then(data=>{ logMsg.info("EnquiryDetail data Inserted successfully for losid = "+data.losid+" Data count = "+EnquiryDetailArray.length); }) + .catch(err=>{ logMsg.info("EnquiryDetail data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("EnquiryDetail(Commercial) array data not available for losid = "+data.losid); } @@ -875,8 +922,8 @@ function commercialDataInsert(data) LocationDetailObj = { ApplicationRefno: value.applicationRefno, LocationType: value.locationType, - firstReportedDate: moment(new Date( value.firstReportedDate)).format("YYYY-MM-DD"), - LastReportedDate: moment(new Date( value.lastReportedDate)).format("YYYY-MM-DD"), + firstReportedDate: await Helper.convertDateFormat( value.firstReportedDate), + LastReportedDate: await Helper.convertDateFormat( value.lastReportedDate), Address: value.address, NoOfInstitutions: value.noOfInstitutions, contactNumber: value.contactNumber, @@ -890,7 +937,9 @@ function commercialDataInsert(data) }); LocationDetailDataInsert.then(async(LocationDetailArray)=>{ //console.log(LocationDetailArray.length); - await LocationDetail.bulkCreate(LocationDetailArray).catch(err=>{ }); + await LocationDetail.bulkCreate(LocationDetailArray) + .then(data=>{ logMsg.info("LocationDetail data Inserted successfully for losid = "+data.losid+" Data count = "+LocationDetailArray.length); }) + .catch(err=>{ logMsg.info("LocationDetail data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("LocationDetail(Commercial) array data not available for losid = "+data.losid); } @@ -913,8 +962,8 @@ function commercialDataInsert(data) CFSecurityDetailsClassification: value.cfSecurityDetailsClassification, CFSecurityDetailsValue: value.cfSecurityDetailsValue, CFSecurityDetailsCurrency: value.cfSecurityDetailsCurrency, - CFSecurityDetailsvalidationDt: moment(new Date( value.cfSecurityDetailsvalidationDt)).format("YYYY-MM-DD"), - CFSecurityDetailslastReportedDt: moment(new Date( value.cfSecurityDetailslastReportedDt)).format("YYYY-MM-DD"), + CFSecurityDetailsvalidationDt: await Helper.convertDateFormat( value.cfSecurityDetailsvalidationDt), + CFSecurityDetailslastReportedDt: await Helper.convertDateFormat( value.cfSecurityDetailslastReportedDt), } SecurityDetailArray.push(SecurityDetailObj); @@ -924,7 +973,9 @@ function commercialDataInsert(data) }); SecurityDetailDataInsert.then(async(SecurityDetailArray)=>{ //console.log(SecurityDetailArray.length); - await SecurityDetail.bulkCreate(SecurityDetailArray).catch(err=>{ }); + await SecurityDetail.bulkCreate(SecurityDetailArray) + .then(data=>{ logMsg.info("SecurityDetail data Inserted successfully for losid = "+data.losid+" Data count = "+SecurityDetailArray.length); }) + .catch(err=>{ logMsg.info("SecurityDetail data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("SecurityDetail(Commercial) array data not available for losid = "+data.losid); } @@ -947,7 +998,7 @@ function commercialDataInsert(data) Relationship: value.relationship, PercentageOfControl: value.percentageOfControl, RDDOI: value.rddoi, - RDDOB: moment(new Date( value.rddob)).format("YYYY-MM-DD"), + RDDOB: await Helper.convertDateFormat( value.rddob), RDGender: value.rdGender, RDBusinessCatg: value.rdBusinessCatg, RDBusinessIndustryType: value.rdBusinessIndustryType, @@ -956,7 +1007,7 @@ function commercialDataInsert(data) RDBACDTelephoneNo: value.rdbacdTelephoneNo, RDBACDfaxNo: value.rdbacDfaxNo, RDBACDMobileNo: value.rdbacdMobileNo, - RDlastReportedDate: moment(new Date( value.rDlastReportedDate )).format("YYYY-MM-DD"), + RDlastReportedDate: await Helper.convertDateFormat( value.rDlastReportedDate) , // temp_id: { type: DataTypes.INTEGER } @@ -968,12 +1019,35 @@ function commercialDataInsert(data) }); RelationshipDetailDataInsert.then(async(RelationshipDetailArray)=>{ //console.log(RelationshipDetailArray.length); - await RelationshipDetail.bulkCreate(RelationshipDetailArray).catch(err=>{ }); + await RelationshipDetail.bulkCreate(RelationshipDetailArray) + .then(data=>{ logMsg.info("RelationshipDetail data Inserted successfully for losid = "+data.losid+" Data count = "+RelationshipDetailArray.length); }) + .catch(err=>{ logMsg.info("RelationshipDetail data Insertion Failed for losid = "+data.losid+" Error = "+err); }); }); }else { logMsg.info("RelationshipDetail(Commercial) array data not available for losid = "+data.losid); } + return new Promise(async(resolve, reject) => { + Promise.all([BorrowerProfileDataInsert, CreditFacilityCurrentDertailDataInsert, AcHistoryandDPDDataInsert,EnquiryDetailDataInsert]) + .then((values) => { + setTimeout(() => { + resolve(true) + }, 3500); + + }); + }); + +// delete from com_borrower_profile where ApplicationRefno = '202103161839215166303' +// delete from com_borrower_id_detail where ApplicationRefno = '202103161839215166303' +// delete from com_guarantor_detail where ApplicationRefno = '202103161839215166303' +// delete from com_ac_history_and_dpd where ApplicationRefno = '202103161839215166303' +// delete from com_credit_facility_current_detail where ApplicationRefno = '202103161839215166303' +// delete from com_enquiry_detail where ApplicationRefno = '202103161839215166303' +// delete from com_location_detail where ApplicationRefno = '202103161839215166303' +// delete from com_security_detail where ApplicationRefno = '202103161839215166303' +// delete from com_relationship_detail where ApplicationRefno = '202103161839215166303' + + } catch (error) { @@ -993,6 +1067,33 @@ function commercialDataInsert(data) + + + + + + + + + + + + + + + + + + + + + + + + + + + const { InBorrowerDetail,InEnquiryDetail,InCreditFacility,InDpdTranscationTable} = require('../models') async function consumerIntermediateDataInsert(losid,refNo)