suseendhiran
This commit is contained in:
parent
5208f4ff9b
commit
30e05d13eb
@ -3,6 +3,7 @@ const { logMsg } = require('../services/logger.js');
|
|||||||
const Credit_PdHelper = require('../services/CreditPdHelper.js');
|
const Credit_PdHelper = require('../services/CreditPdHelper.js');
|
||||||
const request = require('request');
|
const request = require('request');
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
|
const { json } = require('body-parser');
|
||||||
// var global = require('global');
|
// var global = require('global');
|
||||||
// global.arr = [ CreditAddressDetail , CreditBorrowerAndGuarantorDetails , CreditBusinessAndPersonalBankingDetails, BusinessAsset , ClientDetail , Covid19Questions , EmployeeStrength , CreditExistingLoanObligation , FamilyMemberInvolvedInBusiness , CreditFinalRemarks , CreditFinancialAnalysis , CreditFinancialInformation , CreditFuturePlans , CreditGeneralBusinessInformation , CreditGeneralInformation , CreditKeyProductBusinessContribution , CreditKeyShareholder , CreditLoanDetail , OverallPlanOfAction , PortFolioHealth , ProductAndProcess , CreditProfile , SizeAndGeographicalResearch , StockDetail , SupplierDetail , TotalOverallDebit , ValidationPoint , CreditManager , Photograph ]
|
// global.arr = [ CreditAddressDetail , CreditBorrowerAndGuarantorDetails , CreditBusinessAndPersonalBankingDetails, BusinessAsset , ClientDetail , Covid19Questions , EmployeeStrength , CreditExistingLoanObligation , FamilyMemberInvolvedInBusiness , CreditFinalRemarks , CreditFinancialAnalysis , CreditFinancialInformation , CreditFuturePlans , CreditGeneralBusinessInformation , CreditGeneralInformation , CreditKeyProductBusinessContribution , CreditKeyShareholder , CreditLoanDetail , OverallPlanOfAction , PortFolioHealth , ProductAndProcess , CreditProfile , SizeAndGeographicalResearch , StockDetail , SupplierDetail , TotalOverallDebit , ValidationPoint , CreditManager , Photograph ]
|
||||||
|
|
||||||
@ -13,15 +14,16 @@ exports.PullCreditPdData = async (req, res) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const arr = [ CreditAddressDetail , CreditBorrowerAndGuarantorDetails , CreditBusinessAndPersonalBankingDetails, BusinessAsset , ClientDetail , Covid19Questions , EmployeeStrength , CreditExistingLoanObligation , FamilyMemberInvolvedInBusiness , CreditFinalRemarks , CreditFinancialAnalysis , CreditFinancialInformation , CreditFuturePlans , CreditGeneralBusinessInformation , CreditGeneralInformation , CreditKeyProductBusinessContribution , CreditKeyShareholder , CreditLoanDetail , OverallPlanOfAction , PortFolioHealth , ProductAndProcess , CreditProfile , SizeAndGeographicalResearch , StockDetail , SupplierDetail , TotalOverallDebit , ValidationPoint , CreditManager , Photograph ] ;
|
const arr = [ CreditAddressDetail , CreditBorrowerAndGuarantorDetails , CreditBusinessAndPersonalBankingDetails, BusinessAsset , ClientDetail , Covid19Questions , EmployeeStrength , CreditExistingLoanObligation , FamilyMemberInvolvedInBusiness , CreditFinalRemarks , CreditFinancialAnalysis , CreditFinancialInformation , CreditFuturePlans , CreditGeneralBusinessInformation , CreditGeneralInformation , CreditKeyProductBusinessContribution , CreditKeyShareholder , CreditLoanDetail , OverallPlanOfAction , PortFolioHealth , ProductAndProcess , CreditProfile , SizeAndGeographicalResearch , StockDetail , SupplierDetail , TotalOverallDebit , ValidationPoint , CreditManager , Photograph ] ;
|
||||||
const tempData = JSON.parse(JSON.stringify(req.body));
|
const tempData = JSON.parse(JSON.stringify(req.body));
|
||||||
obj = {};
|
obj = {};
|
||||||
GenInfoObj = {};
|
GenInfoObj = {};
|
||||||
temp_array = [];
|
temp_array = [];
|
||||||
// create creditGeneralInormationData
|
// create creditGeneralInormationData
|
||||||
Object.assign(obj, { ref_no: tempData[0].pdid , product :tempData[0].product , case_no :tempData[0].caseno});
|
Object.assign(obj, { ref_no: tempData.pdid , product : tempData.product , case_no : tempData.caseno});
|
||||||
PDID = await CreditGeneralInformation.create(obj);
|
PDID = await CreditGeneralInformation.create(obj);
|
||||||
logMsg.info("GeneralInformation insert success ,PdId= "+PDID.dataValues.pd_id);
|
logMsg.info("GeneralInformation insert success ,PdId= "+PDID.dataValues.pd_id);
|
||||||
for (var [OverallKey, OverallValue] of Object.entries(tempData[0].data)) {
|
for (var [OverallKey, OverallValue] of Object.entries(tempData.data)) {
|
||||||
|
if(OverallKey != "Officer Details")
|
||||||
table_name = await CreditFilterTable.findAll({ raw: true, attributes: [ 'table_name'], where : { section : OverallKey , is_active : 1 } , group: ['table_name']})
|
table_name = await CreditFilterTable.findAll({ raw: true, attributes: [ 'table_name'], where : { section : OverallKey , is_active : 1 } , group: ['table_name']})
|
||||||
obj = { };
|
obj = { };
|
||||||
temp_array.length = 0 ;
|
temp_array.length = 0 ;
|
||||||
@ -57,6 +59,7 @@ exports.PullCreditPdData = async (req, res) => {
|
|||||||
Object.assign(element , {pd_id : PDID.dataValues.pd_id} ); Object.assign(element ,obj );
|
Object.assign(element , {pd_id : PDID.dataValues.pd_id} ); Object.assign(element ,obj );
|
||||||
var index = table_name[0].table_name;
|
var index = table_name[0].table_name;
|
||||||
var tableName = arr[index];
|
var tableName = arr[index];
|
||||||
|
console.log(tableName);
|
||||||
await tableName.create(element); logMsg.info(OverallKey+" insert success ,PdId= "+PDID.dataValues.pd_id);
|
await tableName.create(element); logMsg.info(OverallKey+" insert success ,PdId= "+PDID.dataValues.pd_id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -65,6 +68,7 @@ exports.PullCreditPdData = async (req, res) => {
|
|||||||
Object.assign(obj , {pd_id : PDID.dataValues.pd_id} );
|
Object.assign(obj , {pd_id : PDID.dataValues.pd_id} );
|
||||||
var index = table_name[0].table_name;
|
var index = table_name[0].table_name;
|
||||||
var tableName = arr[index];
|
var tableName = arr[index];
|
||||||
|
console.log(tableName);
|
||||||
await tableName.create(obj);logMsg.info(OverallKey+" insert success ,PdId= "+PDID.dataValues.pd_id);
|
await tableName.create(obj);logMsg.info(OverallKey+" insert success ,PdId= "+PDID.dataValues.pd_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,6 +190,7 @@ exports.GetCreditPdData = async (req, res) =>
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
console.log(req.query.losid);
|
||||||
applicantDetails = await Credit_PdHelper.MainApplicantDetails(req.query.losid);
|
applicantDetails = await Credit_PdHelper.MainApplicantDetails(req.query.losid);
|
||||||
MainApplicantDetails = JSON.parse(applicantDetails);
|
MainApplicantDetails = JSON.parse(applicantDetails);
|
||||||
if(MainApplicantDetails.status == 200)
|
if(MainApplicantDetails.status == 200)
|
||||||
@ -242,60 +247,3 @@ exports.GetCreditPdData = async (req, res) =>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// exports.GetCreditPdData__1 = async (req, res) =>
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// // applicantDetails = await Credit_PdHelper.MainApplicantDetails(req.query.losid);
|
|
||||||
// // MainApplicantDetails = JSON.parse(applicantDetails);
|
|
||||||
// // if(MainApplicantDetails.status == 200)
|
|
||||||
// // {
|
|
||||||
// CreditGeneralInformation.findAll({ where : { pd_id :410,is_active : 1},
|
|
||||||
// include : [
|
|
||||||
// {model: CreditAddressDetail }, {model: CreditFuturePlans },
|
|
||||||
// {model : CreditBorrowerAndGuarantorDetails },
|
|
||||||
// {model: CreditBusinessAndPersonalBankingDetails }, {model: BusinessAsset },
|
|
||||||
// {model: CreditFinancialInformation }, {model: CreditKeyShareholder },
|
|
||||||
// {model: CreditKeyProductBusinessContribution }, {model: EmployeeStrength },
|
|
||||||
// {model: ClientDetail }, {model: StockDetail },
|
|
||||||
// {model: CreditExistingLoanObligation },
|
|
||||||
// {model: FamilyMemberInvolvedInBusiness },
|
|
||||||
// {model : CreditManager },
|
|
||||||
// {model: Photograph },
|
|
||||||
// {model: CreditFinalRemarks }, {model: CreditLoanDetail },
|
|
||||||
// {model: CreditGeneralBusinessInformation },
|
|
||||||
// {model: SupplierDetail }
|
|
||||||
// ]
|
|
||||||
// })
|
|
||||||
// .then((data)=>{
|
|
||||||
// if (data.length > 0)
|
|
||||||
// {
|
|
||||||
// res.send({'status':200,'message':"success",'data':data});
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// res.send({'status':404,'message':"failed",'data':"No data"});
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
|
|
||||||
// // }
|
|
||||||
// // else
|
|
||||||
// // {
|
|
||||||
// // res.send({'status':404,'message':"failed",'data':"No data"});
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// } catch(err) {
|
|
||||||
// res.status(500).send({'status':404,
|
|
||||||
// message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// };
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -188,9 +188,6 @@ router.get('/imageView',CreditPdController.imageView);
|
|||||||
*/
|
*/
|
||||||
router.get('/GetCreditPdData',CreditPdController.GetCreditPdData)
|
router.get('/GetCreditPdData',CreditPdController.GetCreditPdData)
|
||||||
|
|
||||||
|
|
||||||
// router.get('/GetCreditPdData__1',CreditPdController.GetCreditPdData__1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// DownloadPdReport
|
// DownloadPdReport
|
||||||
|
|||||||
@ -15,7 +15,7 @@ async function CreditPd(credit_key , credit_value ,credit_temp_array ,credit_ob
|
|||||||
|
|
||||||
async function MainApplicantDetails(losid) {
|
async function MainApplicantDetails(losid) {
|
||||||
try {
|
try {
|
||||||
const url = "https://demo.devopsmcfinance.com/cet_mainapp/api/MainApplicantDetailsList?losid="+losid;
|
const url = `${ process.env.MAIN_APPLICANT_DETAIL }/MainApplicantDetailsList?losid=`+losid;
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
request({
|
request({
|
||||||
@ -89,10 +89,10 @@ async function ARRAY(Array , GenInfoObj , OverallKey) {
|
|||||||
if (typeof Value === "object" && ( Value !== null )) {
|
if (typeof Value === "object" && ( Value !== null )) {
|
||||||
Obj = await OBJECT( element, Key , Value );
|
Obj = await OBJECT( element, Key , Value );
|
||||||
Object.assign(ArrayObj, Obj )
|
Object.assign(ArrayObj, Obj )
|
||||||
if (OverallKey == "Borrower & Guarantor Details" && Key == "borrower_name" && element.borrower_type == "Main Applicant") { Object.assign(GenInfoObj,{borrower_name : element.borrower_name}) }
|
if (OverallKey == "Borrower & Guarantor Details" && Key == "borrower_name" && element.borrower_type == "Main Applicant") { Object.assign(GenInfoObj,{name : element.borrower_name}); }
|
||||||
} else {
|
} else {
|
||||||
Object.assign(ArrayObj,{ [Key] : Value })
|
Object.assign(ArrayObj,{ [Key] : Value })
|
||||||
if (OverallKey == "Borrower & Guarantor Details" && Key == "borrower_name" && element.borrower_type == "Main Applicant") { Object.assign(GenInfoObj,{borrower_name : element.borrower_name}) }
|
if (OverallKey == "Borrower & Guarantor Details" && Key == "borrower_name" && element.borrower_type == "Main Applicant") { Object.assign(GenInfoObj,{name : element.borrower_name}); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tempArr.push(ArrayObj)
|
tempArr.push(ArrayObj)
|
||||||
|
|||||||
BIN
storage/uploads/1673011131265-company-logo.png
Normal file
BIN
storage/uploads/1673011131265-company-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in New Issue
Block a user