GWM:pd_errors
This commit is contained in:
parent
df4eac37f8
commit
2f66fe9bea
@ -18,11 +18,27 @@ exports.PullCreditPdData = async (req, res) => {
|
||||
CreditGeneralInformationDataExist = await CreditGeneralInformation.findOne({ where : { ref_no : req.body.pdid ,product:req.body.product,case_no :req.body.caseno, is_active : 1 }});
|
||||
if(CreditGeneralInformationDataExist)
|
||||
{
|
||||
res.send({'status':200, 'message': "data already exist." ,'data': "No data" });
|
||||
logMsg.info("CreditGeneralInformation data already exist.,PdId(ref_no)= "+req.body.pdid);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreditGeneralInformation.destroy({ where : { pd_id : CreditGeneralInformationDataExist.dataValues.pd_id},
|
||||
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: CreditFinalRemarks }, {model: CreditLoanDetail },
|
||||
{model: CreditGeneralBusinessInformation },
|
||||
{model: SupplierDetail }
|
||||
]
|
||||
});
|
||||
// res.send({'status':200, 'message': "data already exist." ,'data': "No data" });
|
||||
// logMsg.info("CreditGeneralInformation data already exist.,PdId(ref_no)= "+req.body.pdid);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
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));
|
||||
PDID = [];
|
||||
@ -45,7 +61,7 @@ exports.PullCreditPdData = async (req, res) => {
|
||||
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+ " ERR =" + err); });
|
||||
|
||||
Object.assign(tempData.data , {last_index : {}});
|
||||
PDID = await CreditGeneralInformation.findOne({ where : { ref_no : req.body.pdid ,case_no :req.body.caseno, is_active : 1 }});
|
||||
|
||||
for (var [OverallKey, OverallValue] of Object.entries(tempData.data)) {
|
||||
@ -80,7 +96,7 @@ exports.PullCreditPdData = async (req, res) => {
|
||||
}
|
||||
}
|
||||
// DB Insertion
|
||||
if (OverallKey == "Officer Details") { await CreditGeneralInformation.update(GenInfoObj , { where : { pd_id : PDID.dataValues.pd_id , is_active : 1}}); logMsg.info("CreditGeneralInformation update success ,PdId= "+PDID.dataValues.pd_id); }
|
||||
if (OverallKey == "last_index") { await CreditGeneralInformation.update(GenInfoObj , { where : { pd_id : PDID.dataValues.pd_id , is_active : 1}}); logMsg.info("CreditGeneralInformation update success ,PdId= "+PDID.dataValues.pd_id); }
|
||||
if (temp_array.length > 0)
|
||||
{
|
||||
temp_array.forEach(async(element) => {
|
||||
@ -351,9 +367,6 @@ exports.ReInsertImageData = async (req, res) =>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// exports.GetCreditPdData__1 = async (req, res) =>
|
||||
// {
|
||||
// try
|
||||
|
||||
@ -6,6 +6,8 @@ exports.Welcome = (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
const Msg = "Welcome....!";
|
||||
console.log(Msg);
|
||||
logMsg.info("Api Call Success");
|
||||
|
||||
@ -8,7 +8,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
{
|
||||
pd_id: { type: DataTypes.INTEGER },
|
||||
loan_type: { type: DataTypes.STRING },
|
||||
loan_amount: { type: DataTypes.INTEGER },
|
||||
loan_amount: { type: DataTypes.STRING },
|
||||
lender_name: { type: DataTypes.STRING },
|
||||
loan_taken_by: { type: DataTypes.STRING },
|
||||
instalment_amount: { type: DataTypes.STRING },
|
||||
|
||||
@ -19,13 +19,14 @@ module.exports = app => {
|
||||
* description: success
|
||||
*/
|
||||
router.get("/demo", Mycontroller.Welcome);
|
||||
|
||||
router.get("/test", Mycontroller.test);
|
||||
|
||||
|
||||
router.post("/ReInsertImageData", CreditPdController.ReInsertImageData);
|
||||
|
||||
|
||||
|
||||
|
||||
// Pull CreditPd Data
|
||||
/**
|
||||
* @swagger
|
||||
|
||||
@ -102,9 +102,22 @@ async function ARRAY(Array , GenInfoObj , OverallKey) {
|
||||
|
||||
//RoundOfValue = Math.round(element.numbers_of_years_business_running,2).toString();
|
||||
RoundOfValue = Number((element.numbers_of_years_business_running).toFixed(2).toString());
|
||||
console.log(RoundOfValue);
|
||||
Object.assign(ArrayObj,{ numbers_of_years_business_running : RoundOfValue });
|
||||
}
|
||||
}
|
||||
|
||||
if (OverallKey == "Borrower & Guarantor Details" && Key == "borrower_age" )
|
||||
{
|
||||
|
||||
if(typeof element.borrower_age === 'number')
|
||||
{
|
||||
//RoundOfValue = Math.round(element.numbers_of_years_business_running,2).toString();
|
||||
RoundOfAge = Number((element.borrower_age).toFixed(2).toString());
|
||||
console.log(RoundOfAge);
|
||||
Object.assign(ArrayObj,{ borrower_age : RoundOfAge });
|
||||
} else if(typeof element.borrower_age === 'string'){ Object.assign(ArrayObj,{ borrower_age : null }); }
|
||||
}
|
||||
}
|
||||
tempArr.push(ArrayObj)
|
||||
ArrayObj = { };
|
||||
|
||||
Loading…
Reference in New Issue
Block a user