Merge branch 'master' of bitbucket.org:venbainformationtechnology/smc_cet_creditpd_backend
This commit is contained in:
commit
8f5918b066
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,3 +1,7 @@
|
||||
/node_modules
|
||||
/storage
|
||||
.env
|
||||
/node_modules
|
||||
/storage/log/
|
||||
/storage/uploads/
|
||||
!storage
|
||||
storage/*
|
||||
!storage/uploads/
|
||||
|
||||
395
app/controllers/creditpd.controller.js
Normal file
395
app/controllers/creditpd.controller.js
Normal file
@ -0,0 +1,395 @@
|
||||
const { keys, values, forEach } = require('lodash');
|
||||
const { sequelize,Test,CreditGeneralInformation,SizeAndGeographicalResearch,CreditProfile,ProductAndProcess,PortFolioHealth,TotalOverallDebit,OverallPlanOfAction,ValidationPoint,
|
||||
CreditLoanDetail,CreditFinalRemarks,CreditGeneralBusinessInformation,CreditKeyProductBusinessContribution,EmployeeStrength,CreditBusinessAndPersonalBankingDetails,CreditFinancialInformation,
|
||||
SupplierDetail ,ClientDetail,CreditFuturePlans,CreditExistingLoanObligation,FamilyMemberInvolvedInBusiness,CreditManager,CreditBorrowerAndGuarantorDetails,CreditFinancialAnalysis,CreditAddressDetail,
|
||||
CreditKeyShareholder,Covid19Questions,StockDetail,BusinessAsset,CreditFilterTable,Photograph} = require('../models')
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
const Credit_PdHelper = require('../services/CreditPdHelper.js');
|
||||
const request = require('request');
|
||||
const moment = require('moment');
|
||||
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 ]
|
||||
|
||||
exports.Welcome = (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
const Msg = "Welcome....!";
|
||||
console.log(Msg);
|
||||
logMsg.info("Api Call Success");
|
||||
res.send({'status':200 , message:"Success." ,'data': Msg});
|
||||
} catch(err) {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
}); } //end of try catch
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
exports.PullCreditPdData = async (req, res) =>
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
const tempData = JSON.parse(JSON.stringify(req.body.data));
|
||||
var obj = { };
|
||||
var temp_obj = [ ];
|
||||
var arr_ObjKey = [ ]
|
||||
var creditFilter_obj_key = [ ];
|
||||
var creditFilter_table_name = [ ];
|
||||
var key_for_arrays = [ ];
|
||||
var name;
|
||||
var loan_amount;
|
||||
var pd_id = [ ];
|
||||
var resPonse = [ ];
|
||||
|
||||
|
||||
// create creditGeneralInormationData
|
||||
resPonse.length = 0 ; // clear array datas
|
||||
for (const [key, value] of Object.entries(tempData)) {
|
||||
if (key == "Loan details" || key =="Borrower & Guarantor Details" || key == "Officer Details") {
|
||||
for (var [keys, element] of Object.entries(value)) {
|
||||
if ( Array.isArray(element) == true ) {
|
||||
element.forEach(async(element , index) => {
|
||||
if ( keys == 'borrower_details' && index == 0 ) {
|
||||
Object.assign( obj , {name : element['borrower_name']})
|
||||
Object.assign(obj, { ref_no: req.body.pdid , product :req.body.product , case_no :req.body.caseno});
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( key == "Borrower & Guarantor Details" && keys == 'common_remarks') { Object.assign( obj , {remarks : element}) }
|
||||
if ( keys == 'loan_amount') { { Object.assign( obj , { loan_amount : element })} };
|
||||
if ( key == "Officer Details") {
|
||||
if (moment(element, "DD/MM/YYYY hh:mm:ss A", true).isValid() == true) {
|
||||
var mydate = moment(element, "DD/MM/YYYY hh:MM:ss A"); // convert dd/mm/yyyy to yyyy/mm/dd
|
||||
var my_date = moment(mydate).format("YYYY-MM-DD HH:mm:ss A")
|
||||
Object.assign( obj, { [keys] : my_date });
|
||||
}
|
||||
else{
|
||||
Object.assign(obj, { [ keys ] : element });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Object.assign( obj , { ref_no : req.body.pdid });
|
||||
console.log(obj);
|
||||
pd_id = await CreditGeneralInformation.create(obj)
|
||||
// .then((successData)=>{logMsg.info("GeneralInformation insert success ,PdId= "+successData.dataValues.pd_id);})
|
||||
// .catch((err)=>{ logMsg.info("GeneralInformation insert failed ,PdId(ref_no)= "+req.body.pdid); });
|
||||
// pd_id = await CreditGeneralInformation.findOne({ where : { ref_no : req.body.pdid , is_active : 1 }});
|
||||
|
||||
|
||||
// loop to check if the data is array or nestedObject or objects
|
||||
for (const [key, value] of Object.entries(tempData)) {
|
||||
console.log(key);
|
||||
creditFilter_obj_key = await CreditFilterTable.findAll({ raw: true , attributes: [ 'mul_key' ], where : { section : key , is_active : 1 , is_mul : 1}})
|
||||
creditFilter_table_name = await CreditFilterTable.findAll({ raw: true, attributes: [ 'table_name' ,'section' ,'ques_key'], where : { section : key , is_active : 1 } , group: ['table_name' , 'section' ,'ques_key']})
|
||||
for (let index = 0; index < creditFilter_obj_key.length; index++)
|
||||
{
|
||||
arr_ObjKey.push(creditFilter_obj_key[index].mul_key) // store nested obj keys
|
||||
}
|
||||
if (key == creditFilter_table_name[0].section) {
|
||||
temp_obj.length = 0 ; // clear array datas
|
||||
obj = { }; // clear obj datas
|
||||
|
||||
// Check if the data is array or not
|
||||
for (var [arr_keys, arr_of_element] of Object.entries(value)) {
|
||||
if ( Array.isArray(arr_of_element) == true )
|
||||
{
|
||||
arr_of_element.forEach(async(iter_element , index) => {
|
||||
if (Object.keys(iter_element)[0] == '0') {
|
||||
Object.assign( obj, { [arr_keys] : iter_element });
|
||||
}
|
||||
// assign array of objects
|
||||
else {
|
||||
key_for_arrays = Object.keys(iter_element);
|
||||
Object.values(iter_element).forEach( async (element_ele , index ) => {
|
||||
if ( typeof element_ele === "object" && ( element_ele !== null ))
|
||||
{
|
||||
delete element_ele.display_data;
|
||||
delete value.display_data;
|
||||
await Credit_PdHelper.CreditPd( key_for_arrays[index] , element_ele , arr_ObjKey , obj )
|
||||
}
|
||||
else
|
||||
{
|
||||
// temp_obj.push(iter_element) ;
|
||||
Object.assign( obj, { [key_for_arrays[index]] : element_ele });
|
||||
}
|
||||
});
|
||||
}
|
||||
temp_obj.push(obj)
|
||||
obj = { }; // clear obj datas
|
||||
});
|
||||
}
|
||||
// end of array
|
||||
// assign nestedObject datas
|
||||
else if( typeof arr_of_element === "object" && ( arr_of_element !== null ) )
|
||||
{
|
||||
delete arr_of_element.display_data;
|
||||
delete value.display_data;
|
||||
await Credit_PdHelper.CreditPd( arr_keys , arr_of_element , arr_ObjKey , obj )
|
||||
}
|
||||
// assign object data
|
||||
else
|
||||
{
|
||||
if (moment(arr_of_element, "DD-MM-YYYY", true).isValid() == true) {
|
||||
var mydate = moment(arr_of_element, "DD-MM-YYYY"); // convert dd/mm/yyyy to yyyy/mm/dd
|
||||
var my_date = moment(mydate).format("YYYY-MM-DD")
|
||||
Object.assign( obj, { [arr_keys] : my_date });
|
||||
} else {
|
||||
Object.assign( obj, { [arr_keys] : arr_of_element });
|
||||
}
|
||||
}
|
||||
}// end of inner forLoop
|
||||
// DB insertion
|
||||
// insert array of object datas
|
||||
|
||||
if (temp_obj.length != 0 )
|
||||
{
|
||||
temp_obj.forEach( async (temp_obj_element) =>
|
||||
{
|
||||
Object.assign( obj,{ pd_id : pd_id.pd_id} );
|
||||
Object.assign( obj,temp_obj_element );
|
||||
var index = creditFilter_table_name[0].table_name;
|
||||
var tableName = arr[index]
|
||||
await tableName.create( obj )
|
||||
.then((successData)=>{logMsg.info(` ${tableName} insert success ,PdId= `+pd_id.pd_id);})
|
||||
.catch((err)=>{ logMsg.info(` ${tableName} insert failed ,PdId= `+pd_id.pd_id); });
|
||||
});
|
||||
}
|
||||
// insert nestedObject and object datas
|
||||
else
|
||||
{
|
||||
Object.assign( obj,{ pd_id : pd_id.pd_id} );
|
||||
var index = creditFilter_table_name[0].table_name;
|
||||
var tableName = arr[index]
|
||||
await tableName.create( obj )
|
||||
.then((successData)=>{logMsg.info(` ${tableName} insert success ,PdId= `+pd_id.pd_id);})
|
||||
.catch((err)=>{ logMsg.info(` ${tableName} insert failed ,PdId= `+pd_id.pd_id); });
|
||||
}
|
||||
} // if end
|
||||
} // end of outer forLoop
|
||||
res.send({'status':200,'message':"success"});
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
exports.PullCreditPdPhotographsData = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// fetch SMC PdId from DB
|
||||
GeneralSectionData = await CreditGeneralInformation.findOne({ where : { ref_no : req.body.pdid ,case_no :req.body.caseno, is_active : 1 }});
|
||||
PdId = GeneralSectionData.dataValues.pd_id;
|
||||
// convert image file to base64 code
|
||||
// path = "storage/uploads/"
|
||||
// file = path+img_name;
|
||||
// base64_data = "data:image/png;base64," + fs.readFileSync(file, 'base64');
|
||||
// insert photograph data here
|
||||
|
||||
await Photograph.create({pd_id: PdId , ref_no :req.body.pdid , img_name :req.body.img_name , img : img_name})
|
||||
.then((successData)=>{logMsg.info("Photograph insert success ,PdId= "+PdId);})
|
||||
.catch((err)=>{ logMsg.info("Photograph insert failed ,PdId= "+PdId+" ERROR : "+err);});
|
||||
// responce to FE
|
||||
setTimeout(() => {
|
||||
res.send({'status':200,'message':"success",'data':"INSERT INTO sales_photograph (pd_id,ref_no,img_name,img) VALUES ("+PdId+","+req.body.pdid+","+req.body.img_name+")"}); //,"+base64_data+"
|
||||
}, 300);
|
||||
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
// MWISE00840
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
exports.imageView = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
const filePath = "storage/uploads/"+req.query.img_name;
|
||||
const { dirname } = require('path');
|
||||
const appDir = dirname(require.main.filename);
|
||||
|
||||
res.sendFile(filePath , { root: appDir });
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" }) ;
|
||||
} //end of try catch
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
exports.DownloadPdReport = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
pd_id = req.query.ref_no;
|
||||
DownloadPdReportUrl = process.env.PD_REPORT_URL;
|
||||
url = DownloadPdReportUrl+"getCreditPDReportforCETApp?credit_pd_id="+pd_id;
|
||||
|
||||
request({
|
||||
url: url,
|
||||
method: "GET"
|
||||
|
||||
}, function (error, response, body) { console.log(body);
|
||||
if (body != undefined) {
|
||||
data = JSON.parse(body);
|
||||
if ( data.status == 200) {
|
||||
|
||||
link = data.records;
|
||||
res.send({'status':200,'message':"success",'data':link});
|
||||
}else{
|
||||
res.send({'status':404,'message':"failed",'data':"No data"});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
exports.GetCreditPdData = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
applicantDetails = await Credit_PdHelper.MainApplicantDetails(req.query.losid);
|
||||
MainApplicantDetails = JSON.parse(applicantDetails);
|
||||
if(MainApplicantDetails.status == 200)
|
||||
{
|
||||
var resData = await CreditGeneralInformation.findAll({ where : { name : MainApplicantDetails.data.name,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 }
|
||||
]
|
||||
})
|
||||
res.send({'status':200,'message':"success",'data':resData});
|
||||
}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"
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// // test
|
||||
|
||||
// exports.testGetCreditPdData = async (req, res) =>
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var resData = await CreditGeneralInformation.findAll({ where : { pd_id : req.query.pdid ,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 }
|
||||
// ]
|
||||
// })
|
||||
// res.send({'status':200,'message':"success",'data':resData});
|
||||
// }
|
||||
// catch(err) {
|
||||
// res.status(500).send({'status':404,
|
||||
// message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
// });
|
||||
// }
|
||||
|
||||
// };
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
const { sequelize,Test,CreditGeneralInformation,SizeAndGeographicalResearch,CreditProfile,ProductAndProcess,PortFolioHealth,TotalOverallDebit,OverallPlanOfAction,ValidationPoint,
|
||||
CreditLoanDetail,CreditFinalRemarks,CreditGeneralBusinessInformation,CreditKeyProductBusinessContribution,EmployeeStrength,CreditBusinessAndPersonalBankingDetails,CreditFinancialInformation,
|
||||
SupplierDetail ,ClientDetail,CreditFuturePlans,CreditExistingLoanObligation,FamilyMemberInvolvedInBusiness,CreditManager,CreditBorrowerAndGuarantorDetails,CreditFinancialAnalysis,CreditAddressDetail,
|
||||
CreditKeyShareholder,Covid19Questions,StockDetail,BusinessAsset} = require('../models')
|
||||
const { sequelize,Test} = require('../models')
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
|
||||
|
||||
exports.Welcome = (req, res) =>
|
||||
{
|
||||
try
|
||||
@ -21,88 +17,15 @@ exports.Welcome = (req, res) =>
|
||||
|
||||
};
|
||||
|
||||
exports.CreditPd = async (req, res) =>
|
||||
|
||||
exports.PullCreditPdData = async (req, res) =>
|
||||
{
|
||||
// try
|
||||
// {
|
||||
const tempData = {"Address details":{"initiated_address":"Subhash Colony Plot No 21 A Bhagat K J Kothi Jodhpur, Jodhpur, Rajasthan - 342001","is_pd_done_on_initiated_address":"Yes","address_type":{"address_type_id":"2","address_type":"Clinic","isactive":"1","is_others":"0"},"pd_locality":{"locality_id":"5","locality_name":"Mix Use Area","isactive":"1","is_others":"1"},"pd_location":{"pd_location_approach_id":"2","description":"Easy to locate & Reach",
|
||||
"createdon":"2018-10-17 10:15:43","fk_createdby":"1","updatedon":"2019-02-04 07:11:14","fk_updatedby":"1",
|
||||
"isactive":"1","is_others":"0"},"comment_locality":{"comments_on_locality_id":"2","rating":"Good",
|
||||
"createdon":"2018-10-17 10:35:29","fk_createdby":"1","updatedon":null,"fk_updatedby":null,
|
||||
"isactive":"1","is_others":"0"},"business_estimated_area":"108","uom":"Square Yards",
|
||||
"uom_searchControl":null,"common_remarks":"nil","alternative_address":""} }
|
||||
|
||||
// var count = 0;
|
||||
// var generalInformation = [ ];
|
||||
// var storeData = [ ];
|
||||
// const len = Object.keys(tempData).length - 1;
|
||||
|
||||
|
||||
for (const [keys, values] of Object.entries(tempData)) {
|
||||
|
||||
Object.values(values).forEach( async (element) => {
|
||||
// Object.keys(element).forEach( async (elementKey) => {
|
||||
// if (typeof values.elementKey === "object" && values.elementKey !== null ) {
|
||||
// console.log("object" , element.elementKey);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// console.log("not a object" , element.elementKey);
|
||||
// }
|
||||
// });
|
||||
if (typeof element === "object" && element !== null ) {
|
||||
console.log("object" , element);
|
||||
}
|
||||
else
|
||||
try
|
||||
{
|
||||
console.log("not a object" , element);
|
||||
}
|
||||
});
|
||||
res.send({'status':200,'message':"success",'data':req.body});
|
||||
|
||||
} catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while retrieving data." ,'data': "No data" });
|
||||
} //end of try catch
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// if (keys == 'General Information') { generalInformation = await CreditGeneralInformation.create( values ); storeId = await CreditGeneralInformation.findOne({ where : { pd_id : generalInformation.pd_id , is_active : 1 }}); };
|
||||
// if (keys == 'Profile') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditProfile.create( values ) };
|
||||
// if (keys == 'Size and Geographical Reach') { Object.assign(values, { pd_id: storeId.pd_id }); await SizeAndGeographicalResearch.create( values) };
|
||||
// if (keys == 'Product and Process') { Object.assign(values, { pd_id: storeId.pd_id }); await ProductAndProcess.create( values) };
|
||||
// if (keys == 'Portfolio Health') { Object.assign(values, { pd_id: storeId.pd_id }); await PortFolioHealth.create( values) };
|
||||
// if (keys == 'Total Overall Debt/Equity Profile') { Object.assign(values, { pd_id: storeId.pd_id }); await TotalOverallDebit.create( values) };
|
||||
// if (keys == 'Financial analysis') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditFinancialAnalysis.create( values) };
|
||||
// if (keys == 'Overall Plan of Action') { Object.assign(values, { pd_id: storeId.pd_id }); await OverallPlanOfAction.create( values) };
|
||||
// if (keys == 'Validation Points vide Systems and Books at HQ and Branches') { Object.assign(values, { pd_id: storeId.pd_id }); await ValidationPoint.create( values) };
|
||||
// if (keys == 'Final remarks') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditFinalRemarks.create( values) };
|
||||
// if (keys == 'Address details') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditAddressDetail.create( values) };
|
||||
// if (keys == 'Loan details') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditLoanDetail.create( values ) };
|
||||
// if (keys == 'General Business Information') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditGeneralBusinessInformation.create( values) };
|
||||
// if (keys == 'Key Products and Business Contribution') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditKeyProductBusinessContribution.create( values) };
|
||||
// if (keys == 'Employee Strength') { Object.assign(values, { pd_id: storeId.pd_id }); await EmployeeStrength.create( values) };
|
||||
// if (keys == 'Business and Personal Banking') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditBusinessAndPersonalBankingDetails.create( values) };
|
||||
// if (keys == 'Financial Information') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditFinancialInformation.create( values) };
|
||||
// if (keys == 'Supplier details') { Object.assign(values, { pd_id: storeId.pd_id }); await SupplierDetail.create( values) };
|
||||
// if (keys == 'Clients details') { Object.assign(values, { pd_id: storeId.pd_id }); await ClientDetail.create( values) };
|
||||
// if (keys == 'Future Plans & Business Environments') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditFuturePlans.create( values) };
|
||||
// if (keys == 'Existing Loan Obligations') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditExistingLoanObligation.create( values) };
|
||||
// if (keys == 'Family Members Involved in Business') { Object.assign(values, { pd_id: storeId.pd_id }); await FamilyMemberInvolvedInBusiness.create( values ) };
|
||||
// if (keys == 'Credit manager specific queries') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditManager.create( values) };
|
||||
// if (keys == 'Borrower & Guarantor Details') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditBorrowerAndGuarantorDetails.create( values) };
|
||||
// if (keys == 'Key Stakeholders in Business') { Object.assign(values, { pd_id: storeId.pd_id }); await CreditKeyShareholder.create( values) };
|
||||
// if (keys == 'Covid 19 Questions') { Object.assign(values, { pd_id: storeId.pd_id }); await Covid19Questions.create( values) };
|
||||
// if (keys == 'Stock details') { Object.assign(values, { pd_id: storeId.pd_id }); await StockDetail.create( values) };
|
||||
// if (keys == 'Business Assets') { Object.assign(values, { pd_id: storeId.pd_id }); await BusinessAsset.create( values) };
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@ -24,6 +24,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
business_assets_mode: { type: DataTypes.STRING },
|
||||
other_asset_description: { type: DataTypes.STRING },
|
||||
company_name: { type: DataTypes.STRING },
|
||||
business_assets_mode_name: { type: DataTypes.STRING },
|
||||
business_owner_name: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
|
||||
|
||||
@ -12,18 +12,21 @@ module.exports = (sequelize, DataTypes) => {
|
||||
provider_name: { type: DataTypes.STRING },
|
||||
client_name: { type: DataTypes.INTEGER },
|
||||
contact_person_name: { type: DataTypes.STRING },
|
||||
contact_person_designation: { type: DataTypes.STRING },
|
||||
contact_person_mobile_no: { type: DataTypes.INTEGER },
|
||||
contact_person_designation: { type: DataTypes.INTEGER },
|
||||
contact_person_mobile_no: { type: DataTypes.STRING },
|
||||
person_stdcode: { type: DataTypes.INTEGER },
|
||||
person_landline: { type: DataTypes.INTEGER },
|
||||
payment_type: { type: DataTypes.STRING },
|
||||
payment_type: { type: DataTypes.INTEGER },
|
||||
credit_period_no: { type: DataTypes.INTEGER },
|
||||
credit_total_purchase: { type: DataTypes.INTEGER },
|
||||
payment_mode: { type: DataTypes.STRING },
|
||||
company_name: { type: DataTypes.STRING },
|
||||
company_name: { type: DataTypes.INTEGER },
|
||||
common_remarks: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
type_of_payment : { type: DataTypes.STRING }, // new
|
||||
name_of_the_company: { type: DataTypes.STRING }, // new
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
@ -14,7 +14,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
address_type_others: { type: DataTypes.STRING },
|
||||
pd_locality: { type: DataTypes.STRING },
|
||||
locality_other: { type: DataTypes.STRING },
|
||||
pd_location: { type: DataTypes.STRING },
|
||||
pd_location: { type: DataTypes.STRING }, // gen info
|
||||
comment_locality: { type: DataTypes.STRING },
|
||||
business_estimated_area: { type: DataTypes.INTEGER },
|
||||
uom: { type: DataTypes.STRING },
|
||||
|
||||
31
app/models/CreditFilterTable.js
Normal file
31
app/models/CreditFilterTable.js
Normal file
@ -0,0 +1,31 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class CreditFilterTable extends Model {
|
||||
|
||||
}
|
||||
CreditFilterTable.init(
|
||||
{
|
||||
pd_id: { type: DataTypes.INTEGER },
|
||||
section: { type: DataTypes.STRING },
|
||||
ques_key: { type: DataTypes.STRING },
|
||||
is_obj: { type: DataTypes.INTEGER },
|
||||
obj_key: { type: DataTypes.STRING },
|
||||
is_mul: { type: DataTypes.INTEGER },
|
||||
mul_key: { type: DataTypes.STRING },
|
||||
temp_key: { type: DataTypes.STRING },
|
||||
table_name: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'credit_filter_table',
|
||||
modelName: 'CreditFilterTable',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
return CreditFilterTable
|
||||
}
|
||||
@ -12,6 +12,8 @@ module.exports = (sequelize, DataTypes) => {
|
||||
business_location_suited: { type: DataTypes.STRING },
|
||||
pd_officer_recommendation: { type: DataTypes.STRING },
|
||||
pd_officer_recommendation_other: { type: DataTypes.STRING },
|
||||
pd_officer_recommendation_name: { type: DataTypes.STRING },
|
||||
customer_behaviour_name: { type: DataTypes.STRING },
|
||||
reason: { type: DataTypes.STRING },
|
||||
final_form_remarks: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
|
||||
@ -28,12 +28,12 @@ module.exports = (sequelize, DataTypes) => {
|
||||
sales_revenue: { type: DataTypes.STRING },
|
||||
net_profit: { type: DataTypes.STRING },
|
||||
net_profit_sales_percent: { type: DataTypes.STRING },
|
||||
sales_py: { type: DataTypes.INTEGER },
|
||||
netprofit_py: { type: DataTypes.INTEGER },
|
||||
netprofit_py_percent: { type: DataTypes.INTEGER },
|
||||
debtor_days_cet: { type: DataTypes.INTEGER },
|
||||
creditor_days_cet: { type: DataTypes.INTEGER },
|
||||
inventory_days_cet: { type: DataTypes.INTEGER },
|
||||
sales_py: { type: DataTypes.STRING },
|
||||
netprofit_py: { type: DataTypes.STRING },
|
||||
netprofit_py_percent: { type: DataTypes.STRING },
|
||||
debtor_days_cet: { type: DataTypes.STRING },
|
||||
creditor_days_cet: { type: DataTypes.STRING },
|
||||
inventory_days_cet: { type: DataTypes.STRING },
|
||||
company_name: { type: DataTypes.STRING },
|
||||
no_of_financial_years: { type: DataTypes.INTEGER },
|
||||
common_remarks: { type: DataTypes.STRING },
|
||||
|
||||
@ -16,7 +16,9 @@ module.exports = (sequelize, DataTypes) => {
|
||||
low_sale_month: { type: DataTypes.STRING },
|
||||
common_remarks: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
name_of_the_company: { type: DataTypes.STRING }, // new
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
@ -6,11 +6,23 @@ module.exports = (sequelize, DataTypes) => {
|
||||
}
|
||||
CreditGeneralInformation.init(
|
||||
{
|
||||
pd_id: { type: DataTypes.INTEGER },
|
||||
pd_id: {
|
||||
type: DataTypes.INTEGER,
|
||||
autoIncrement : true,
|
||||
primaryKey: true
|
||||
},
|
||||
name: { type: DataTypes.STRING },
|
||||
loan_amount: { type: DataTypes.INTEGER },
|
||||
product: { type: DataTypes.STRING },
|
||||
location: { type: DataTypes.STRING },
|
||||
ref_no: { type: DataTypes.INTEGER },
|
||||
case_no: { type: DataTypes.STRING },
|
||||
officer_id: { type: DataTypes.INTEGER },
|
||||
email: { type: DataTypes.STRING },
|
||||
mobile_no: { type: DataTypes.INTEGER },
|
||||
officer: { type: DataTypes.STRING },
|
||||
remarks: { type: DataTypes.STRING },
|
||||
pd_visit_date: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
},
|
||||
@ -20,7 +32,84 @@ module.exports = (sequelize, DataTypes) => {
|
||||
modelName: 'CreditGeneralInformation',
|
||||
}
|
||||
)
|
||||
|
||||
CreditGeneralInformation.associate = models => {
|
||||
CreditGeneralInformation.hasMany(models.CreditAddressDetail, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.CreditFuturePlans, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.CreditBorrowerAndGuarantorDetails, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.CreditBusinessAndPersonalBankingDetails, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.BusinessAsset, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.CreditFinancialInformation, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.CreditKeyShareholder, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.CreditKeyProductBusinessContribution, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.EmployeeStrength, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.ClientDetail, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.StockDetail, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.CreditExistingLoanObligation, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.FamilyMemberInvolvedInBusiness, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.CreditManager, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.CreditFinalRemarks, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.CreditLoanDetail, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.CreditGeneralBusinessInformation, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.SupplierDetail, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
CreditGeneralInformation.hasMany(models.Photograph, {
|
||||
foreignKey: 'pd_id',
|
||||
sourceKey : 'pd_id'
|
||||
});
|
||||
}
|
||||
|
||||
return CreditGeneralInformation
|
||||
}
|
||||
@ -7,14 +7,16 @@ module.exports = (sequelize, DataTypes) => {
|
||||
CreditKeyProductBusinessContribution.init(
|
||||
{
|
||||
pd_id: { type: DataTypes.INTEGER },
|
||||
product_name: { type: DataTypes.STRING },
|
||||
product_name: { type: DataTypes.STRING }, // gen info
|
||||
contribution_business_product: { type: DataTypes.STRING },
|
||||
remarks: { type: DataTypes.STRING },
|
||||
company_name: { type: DataTypes.STRING },
|
||||
business_process: { type: DataTypes.STRING },
|
||||
common_remarks: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
name_of_the_company: { type: DataTypes.STRING }, // new
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
@ -17,7 +17,9 @@ module.exports = (sequelize, DataTypes) => {
|
||||
started_biz: { type: DataTypes.STRING },
|
||||
common_remarks: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
name_of_the_company: { type: DataTypes.STRING }, // new
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
@ -7,7 +7,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
CreditLoanDetail.init(
|
||||
{
|
||||
pd_id: { type: DataTypes.INTEGER },
|
||||
loan_amount: { type: DataTypes.INTEGER },
|
||||
loan_amount: { type: DataTypes.INTEGER }, // gen info
|
||||
remarks_fund_source_balance: { type: DataTypes.STRING },
|
||||
loan_tenure: { type: DataTypes.INTEGER },
|
||||
sub_product: { type: DataTypes.STRING },
|
||||
|
||||
@ -16,7 +16,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'crredit_credit_manager_specific_queries',
|
||||
tableName: 'credit_credit_manager_specific_queries',
|
||||
modelName: 'CreditManager',
|
||||
}
|
||||
)
|
||||
|
||||
25
app/models/Photograph.js
Normal file
25
app/models/Photograph.js
Normal file
@ -0,0 +1,25 @@
|
||||
'use strict'
|
||||
const { Model } = require('sequelize')
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
class Photograph extends Model {
|
||||
|
||||
}
|
||||
Photograph.init(
|
||||
{
|
||||
pd_id: { type: DataTypes.INTEGER },
|
||||
ref_no: { type: DataTypes.INTEGER },
|
||||
img: { type: DataTypes.STRING },
|
||||
img_name: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'credit_photograph',
|
||||
modelName: 'Photograph',
|
||||
}
|
||||
)
|
||||
|
||||
return Photograph
|
||||
}
|
||||
@ -18,6 +18,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
estimated_stock_value: { type: DataTypes.INTEGER },
|
||||
company_name: { type: DataTypes.STRING },
|
||||
common_remarks: { type: DataTypes.STRING },
|
||||
name_of_the_company: { type: DataTypes.STRING }, // new
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
|
||||
|
||||
@ -7,20 +7,21 @@ module.exports = (sequelize, DataTypes) => {
|
||||
SupplierDetail.init(
|
||||
{
|
||||
pd_id: { type: DataTypes.INTEGER },
|
||||
stock_info_available: { type: DataTypes.STRING },
|
||||
stock_not_available_reason: { type: DataTypes.STRING },
|
||||
supplier_info_available: { type: DataTypes.STRING },
|
||||
supplier_not_available_reason: { type: DataTypes.STRING },
|
||||
provider_name: { type: DataTypes.STRING },
|
||||
supplier_name: { type: DataTypes.STRING },
|
||||
contact_person_name: { type: DataTypes.STRING },
|
||||
contact_person_designation: { type: DataTypes.STRING },
|
||||
contact_person_mobile_no: { type: DataTypes.INTEGER },
|
||||
contact_person_designation: { type: DataTypes.INTEGER },
|
||||
contact_person_mobile_no: { type: DataTypes.STRING },
|
||||
person_stdcode: { type: DataTypes.INTEGER },
|
||||
person_landline: { type: DataTypes.INTEGER },
|
||||
payment_type: { type: DataTypes.STRING },
|
||||
type_of_payment : { type: DataTypes.STRING }, // new
|
||||
payment_mode: { type: DataTypes.STRING },
|
||||
credit_period_no: { type: DataTypes.INTEGER },
|
||||
credit_total_purchase: { type: DataTypes.INTEGER },
|
||||
company_name: { type: DataTypes.STRING },
|
||||
company_name: { type: DataTypes.INTEGER },
|
||||
name_of_the_company: { type: DataTypes.STRING }, // new
|
||||
common_remarks: { type: DataTypes.STRING },
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER }
|
||||
|
||||
@ -2,6 +2,7 @@ module.exports = app => {
|
||||
const request = require("request");
|
||||
const cors=require('cors');
|
||||
const Mycontroller = require("../controllers/test.controller.js");
|
||||
const CreditPdController = require("../controllers/creditpd.controller.js");
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
var router = require("express").Router();
|
||||
|
||||
@ -19,10 +20,225 @@ module.exports = app => {
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/demo", Mycontroller.Welcome);
|
||||
router.get("/demo", CreditPdController.Welcome);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Pull CreditPd Data
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* PullCreditPdData:
|
||||
* type: object
|
||||
* properties:
|
||||
* pdid:
|
||||
* type: integer
|
||||
* description: pdid
|
||||
* example: 6646
|
||||
* product:
|
||||
* type: string
|
||||
* description: product
|
||||
* example: LFMP
|
||||
* caseno:
|
||||
* type: string
|
||||
* description: case no
|
||||
* example: MW30
|
||||
* data:
|
||||
* type: string
|
||||
* description: json string
|
||||
* example:
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /api/PullCreditPdData:
|
||||
* post:
|
||||
* summary: Pull CreditPd Data
|
||||
* description: Pull CreditPd Data
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/definitions/PullCreditPdData'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
* 500:
|
||||
* description: failed
|
||||
*/
|
||||
router.post("/PullCreditPdData", CreditPdController.PullCreditPdData);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// photograph upload
|
||||
const multer = require('multer');
|
||||
img_name = "";
|
||||
const storage = multer.diskStorage({
|
||||
destination: (req, file, cb) => {
|
||||
cb(null, 'storage/uploads/');
|
||||
},
|
||||
filename: (req, file, cb) => {
|
||||
img_name = "";
|
||||
img_name += Date.now()+'-'+file.originalname;
|
||||
cb(null, img_name);
|
||||
}
|
||||
});
|
||||
const upload = multer({ storage });
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* PullCreditPdPhotographsData:
|
||||
* type: object
|
||||
* properties:
|
||||
* pdid:
|
||||
* type: integer
|
||||
* description: pdid
|
||||
* example: 6646
|
||||
* product:
|
||||
* type: string
|
||||
* description: product
|
||||
* example: LFMP
|
||||
* caseno:
|
||||
* type: string
|
||||
* description:
|
||||
* example: MW53315
|
||||
* img:
|
||||
* type: file
|
||||
* description: image file
|
||||
* example:
|
||||
* img_name:
|
||||
* type: string
|
||||
* description: image file
|
||||
* example: sample
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /api/PullCreditPdPhotographsData:
|
||||
* post:
|
||||
* summary: Pull CreditPd Photographs Data
|
||||
* description: Pull CreditPd Photographs Data
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/definitions/PullCreditPdPhotographsData'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
* 500:
|
||||
* description: failed
|
||||
*/
|
||||
router.post('/PullCreditPdPhotographsData', upload.single('img'),function(req,res){ CreditPdController.PullCreditPdPhotographsData(req,res,img_name); } );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// view image
|
||||
/**
|
||||
* @swagger
|
||||
* /api/imageView:
|
||||
* get:
|
||||
* summary: view image file api
|
||||
* description:
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: img_name
|
||||
* schema:
|
||||
* type: string
|
||||
* required: true
|
||||
* example: 1652702282873-tree-736885__480
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get('/imageView',CreditPdController.imageView);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//get credit pd data List Api
|
||||
/**
|
||||
* @swagger
|
||||
* /api/GetCreditPdData:
|
||||
* get:
|
||||
* summary: Get CreditPdData Data List
|
||||
* description: Get CreditPdData Data List
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: losid
|
||||
* schema:
|
||||
* type: string
|
||||
* required: true
|
||||
* example: MW112233
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get('/GetCreditPdData',CreditPdController.GetCreditPdData)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// DownloadPdReport
|
||||
/**
|
||||
* @swagger
|
||||
* /api/DownloadPdReport:
|
||||
* get:
|
||||
* summary: Download Pd Report as pdf file
|
||||
* description: Download Pd Report as pdf file
|
||||
* parameters:
|
||||
* - in: query
|
||||
* name: ref_no
|
||||
* schema:
|
||||
* type: integer
|
||||
* required: true
|
||||
* example: 614
|
||||
* responses:
|
||||
* 200:
|
||||
* description: success
|
||||
*/
|
||||
router.get("/DownloadPdReport", CreditPdController.DownloadPdReport);
|
||||
|
||||
|
||||
// // test
|
||||
|
||||
// //get credit pd data List Api
|
||||
// /**
|
||||
// * @swagger
|
||||
// * /api/testGetCreditPdData:
|
||||
// * get:
|
||||
// * summary: Get testGetCreditPdData Data List
|
||||
// * description: Get testGetCreditPdData Data List
|
||||
// * parameters:
|
||||
// * - in: query
|
||||
// * name: pdid
|
||||
// * schema:
|
||||
// * type: integer
|
||||
// * required: true
|
||||
// * example: 206
|
||||
// * responses:
|
||||
// * 200:
|
||||
// * description: success
|
||||
// */
|
||||
// router.get('/testGetCreditPdData',CreditPdController.testGetCreditPdData)
|
||||
|
||||
|
||||
router.get('/creditPd',Mycontroller.CreditPd)
|
||||
|
||||
|
||||
// routes started here
|
||||
|
||||
41
app/services/CreditPdHelper.js
Normal file
41
app/services/CreditPdHelper.js
Normal file
@ -0,0 +1,41 @@
|
||||
const { keys, values } = require('lodash');
|
||||
const { sequelize,Test,CreditGeneralInformation,SizeAndGeographicalResearch,CreditProfile,ProductAndProcess,PortFolioHealth,TotalOverallDebit,OverallPlanOfAction,ValidationPoint,
|
||||
CreditLoanDetail,CreditFinalRemarks,CreditGeneralBusinessInformation,CreditKeyProductBusinessContribution,EmployeeStrength,CreditBusinessAndPersonalBankingDetails,CreditFinancialInformation,
|
||||
SupplierDetail ,ClientDetail,CreditFuturePlans,CreditExistingLoanObligation,FamilyMemberInvolvedInBusiness,CreditManager,CreditBorrowerAndGuarantorDetails,CreditFinancialAnalysis,CreditAddressDetail,
|
||||
CreditKeyShareholder,Covid19Questions,StockDetail,BusinessAsset} = require('../models')
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
const request = require('request');
|
||||
|
||||
|
||||
exports.CreditPd = async ( credit_key , credit_value ,credit_temp_array ,credit_obj) => {
|
||||
for (let i = 0; i < credit_temp_array.length; i++) {
|
||||
if ( Object.keys(credit_value).includes(credit_temp_array[i]) ) {
|
||||
await Object.assign( credit_obj, { [credit_key] : credit_value[credit_temp_array[i]] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
exports.MainApplicantDetails = async(losid) => {
|
||||
|
||||
try {
|
||||
const url = "https://demo.devopsmcfinance.com/cet_mainapp/api/MainApplicantDetailsList?losid="+losid;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: url,
|
||||
method: "GET"
|
||||
|
||||
}, function (error, response, body) {
|
||||
resolve(body);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -11,11 +11,17 @@
|
||||
"dependencies": {
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"date-and-time": "^2.3.1",
|
||||
"dateformat": "^5.0.3",
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "^4.17.1",
|
||||
"global": "^4.4.0",
|
||||
"lodash": "^4.17.21",
|
||||
"log4js": "^6.3.0",
|
||||
"moment": "^2.29.3",
|
||||
"mssql": "^7.2.0",
|
||||
"multer": "^1.4.4",
|
||||
"parse": "^3.4.2",
|
||||
"request": "^2.88.2",
|
||||
"sequelize": "^6.6.5",
|
||||
"swagger-jsdoc": "^6.1.0",
|
||||
|
||||
@ -19,7 +19,7 @@ const options = {
|
||||
definition: {
|
||||
openapi: '3.0.0',
|
||||
info: {
|
||||
title: 'Smc_cet_financials',
|
||||
title: 'Smc_cet_creditPd',
|
||||
version: '1.0.0',
|
||||
},
|
||||
},
|
||||
@ -56,8 +56,9 @@ require("./app/routes/routes.js")(app);
|
||||
|
||||
const PORT_NUMBER = process.env.SERVER_PORT
|
||||
app.listen({ port: PORT_NUMBER }, async () => {
|
||||
console.log('Server up on http://localhost:8080')
|
||||
console.log('Server up on http://localhost:'+PORT_NUMBER)
|
||||
|
||||
//await sequelize.authenticate()
|
||||
})
|
||||
|
||||
|
||||
|
||||
0
storage/uploads/.gitkeep
Normal file
0
storage/uploads/.gitkeep
Normal file
BIN
storage/uploads/1652702282873-tree-736885__480.jpg
Normal file
BIN
storage/uploads/1652702282873-tree-736885__480.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
BIN
storage/uploads/1652702321006-tree-736885__480.jpg
Normal file
BIN
storage/uploads/1652702321006-tree-736885__480.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
BIN
storage/uploads/1652765011227-download.jpg
Normal file
BIN
storage/uploads/1652765011227-download.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
BIN
storage/uploads/1652771595904-download.jpg
Normal file
BIN
storage/uploads/1652771595904-download.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
BIN
storage/uploads/1652771661979-download.jpg
Normal file
BIN
storage/uploads/1652771661979-download.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
BIN
storage/uploads/1652771695177-download.jpg
Normal file
BIN
storage/uploads/1652771695177-download.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
Loading…
Reference in New Issue
Block a user