moduleWiseCompletionStatus:GWM
This commit is contained in:
parent
be5526e790
commit
03a691c036
@ -1,6 +1,7 @@
|
|||||||
const { sequelize , LoanDetail , EntityDetails , ApplicantsDetails , ApplicantsRelationship , ResidenceAddressDetails , PropertyOwnershipIncomeConsidered , DueDiligenceCheck , TradeReferences , CheckTypeMaster , EnquiriesAndDisbursements , PropertyAndLtv , ATNWrelatedInputs , SalesPD , ATNWrelatedInputMaster ,ATNWrelationship , OtherParameterMaster ,OtherParameterMasterValue , OtherParameterRelationship , OtherParameters , ATNErelatedInputSubVal , DataFromLos , FormulaMaster , LoanAndLtvMaster , EntityApplicantMaster } = require('../models')
|
const { sequelize , LoanDetail , EntityDetails , ApplicantsDetails , ApplicantsRelationship , ResidenceAddressDetails , PropertyOwnershipIncomeConsidered , DueDiligenceCheck , TradeReferences , CheckTypeMaster , EnquiriesAndDisbursements , PropertyAndLtv , ATNWrelatedInputs , SalesPD , ATNWrelatedInputMaster ,ATNWrelationship , OtherParameterMaster ,OtherParameterMasterValue , OtherParameterRelationship , OtherParameters , ATNErelatedInputSubVal , DataFromLos , FormulaMaster , LoanAndLtvMaster , EntityApplicantMaster , ModuleWiseCompletionStatus} = require('../models')
|
||||||
const { logMsg } = require('../services/logger.js');
|
const { logMsg } = require('../services/logger.js');
|
||||||
const ApiCallHelper = require('../services/ApiCallHelper.js');
|
const ApiCallHelper = require('../services/ApiCallHelper.js');
|
||||||
|
const ModuleWiseStatusHelper = require('../services/ModuleWiseStatusData.helper.js');
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
|
|
||||||
|
|
||||||
@ -30,6 +31,8 @@ exports.mainLandingPage = async (req, res) =>
|
|||||||
// Loan Detail Create
|
// Loan Detail Create
|
||||||
LoanDetail.create(loanDetailObject).then(LoanDetailData =>
|
LoanDetail.create(loanDetailObject).then(LoanDetailData =>
|
||||||
{
|
{
|
||||||
|
//Module Wise Completion Status Data Creation Helper Call
|
||||||
|
ModuleWiseStatusHelper.moduleCompletionStatusDataCreationHelper(loanDetailData.loginNo);
|
||||||
// Final Response
|
// Final Response
|
||||||
LoanDetail.findAll({raw: true , where : { is_active : 1}}).then(data => { if(data.length > 0) { res.send({'status':200,'message':"success",'data':data}); } else { res.send({'status':404,'message':"failed",'data':"No data"}); } })
|
LoanDetail.findAll({raw: true , where : { is_active : 1}}).then(data => { if(data.length > 0) { res.send({'status':200,'message':"success",'data':data}); } else { res.send({'status':404,'message':"failed",'data':"No data"}); } })
|
||||||
|
|
||||||
@ -187,4 +190,38 @@ exports.mainLandingPage = async (req, res) =>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
exports.updateModuleCompletionStatus = async (req, res) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Losid = req.query.losid;
|
||||||
|
ModuleName = req.query.module_name;
|
||||||
|
|
||||||
|
ModuleWiseCompletionStatus.update({status:1},{ where: { losid:Losid , module_name:ModuleName }}).then(async(data) =>
|
||||||
|
{
|
||||||
|
StatusData = await ModuleWiseCompletionStatus.findAll({ where: { losid:Losid }});
|
||||||
|
count = 0;
|
||||||
|
for (const value of StatusData) {
|
||||||
|
count += value.status;
|
||||||
|
}
|
||||||
|
console.log(count);
|
||||||
|
if(count == 9)
|
||||||
|
{
|
||||||
|
LoanDetail.update({module_completion_status:1},{ where: { losid:Losid}});
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
res.send({'status':404,
|
||||||
|
message: err.message || "Some error occurred while retrieving statements." ,'data': "No data" });
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
} // end of try block
|
||||||
|
catch(err)
|
||||||
|
{
|
||||||
|
res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data" });
|
||||||
|
} //end of try catch
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ exports.Welcome = (req, res) =>
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
const Msg = "Welcome....!";
|
const Msg = "Welcome....!";
|
||||||
console.log(Msg);
|
console.log(Msg);
|
||||||
logMsg.info("Api Call Success");
|
logMsg.info("Api Call Success");
|
||||||
|
|||||||
@ -27,6 +27,7 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
purpose_of_loan: { type: DataTypes.INTEGER },
|
purpose_of_loan: { type: DataTypes.INTEGER },
|
||||||
emi_of_loan_applied_for: { type: DataTypes.INTEGER },
|
emi_of_loan_applied_for: { type: DataTypes.INTEGER },
|
||||||
pd_id: { type: DataTypes.INTEGER },
|
pd_id: { type: DataTypes.INTEGER },
|
||||||
|
module_completion_status : { type: DataTypes.INTEGER },
|
||||||
createdby: { type: DataTypes.INTEGER },
|
createdby: { type: DataTypes.INTEGER },
|
||||||
updatedby: { type: DataTypes.INTEGER },
|
updatedby: { type: DataTypes.INTEGER },
|
||||||
is_active: {type : DataTypes.INTEGER}
|
is_active: {type : DataTypes.INTEGER}
|
||||||
|
|||||||
32
app/models/ModuleWiseCompletionStatus.js
Normal file
32
app/models/ModuleWiseCompletionStatus.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
'use strict'
|
||||||
|
const { Model } = require('sequelize')
|
||||||
|
module.exports = (sequelize, DataTypes) => {
|
||||||
|
class ModuleWiseCompletionStatus extends Model {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
ModuleWiseCompletionStatus.init(
|
||||||
|
{
|
||||||
|
losid: { type: DataTypes.STRING },
|
||||||
|
module_name: { type: DataTypes.STRING },
|
||||||
|
status : { type: DataTypes.INTEGER },
|
||||||
|
createdAt : { type: DataTypes.DATE },
|
||||||
|
createdby : { type: DataTypes.INTEGER },
|
||||||
|
updatedAt : { type: DataTypes.DATE },
|
||||||
|
updatedby : { type: DataTypes.INTEGER }
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
tableName: 'module_wise_completion_status',
|
||||||
|
modelName: 'ModuleWiseCompletionStatus',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ModuleWiseCompletionStatus
|
||||||
|
}
|
||||||
@ -22,6 +22,32 @@ module.exports = app => {
|
|||||||
router.get("/demo", Testcontroller.Welcome);
|
router.get("/demo", Testcontroller.Welcome);
|
||||||
|
|
||||||
|
|
||||||
|
// Module Completion Status update api
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/UpdateModuleCompletionStatus:
|
||||||
|
* get:
|
||||||
|
* summary: Update Module Completion Status data
|
||||||
|
* description:
|
||||||
|
* parameters:
|
||||||
|
* - in: query
|
||||||
|
* name: losid
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* required: true
|
||||||
|
* example: MW112233
|
||||||
|
* - in: query
|
||||||
|
* name: module_name
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* required: true
|
||||||
|
* example: GST
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: success
|
||||||
|
*/
|
||||||
|
router.get("/UpdateModuleCompletionStatus", Loancontroller.updateModuleCompletionStatus);
|
||||||
|
|
||||||
// LoanDeatilList List Api
|
// LoanDeatilList List Api
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
|
|||||||
43
app/services/ModuleWiseStatusData.helper.js
Normal file
43
app/services/ModuleWiseStatusData.helper.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
const { ModuleWiseCompletionStatus } = require('../models')
|
||||||
|
const { logMsg } = require('./logger.js');
|
||||||
|
const request = require('request');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async function moduleCompletionStatusDataCreationHelper(losid) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
ModuleWiseStatusDataArray = [
|
||||||
|
{losid:losid , module_name : "MainApp"},
|
||||||
|
{losid:losid , module_name : "GST"},
|
||||||
|
{losid:losid , module_name : "Financial"},
|
||||||
|
{losid:losid , module_name : "Banking"},
|
||||||
|
{losid:losid , module_name : "OtherIncome"},
|
||||||
|
{losid:losid , module_name : "Obligation"},
|
||||||
|
{losid:losid , module_name : "SalesPD"},
|
||||||
|
{losid:losid , module_name : "CreditPD"},
|
||||||
|
{losid:losid , module_name : "Bureau"},
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
ModuleWiseCompletionStatus.bulkCreate(ModuleWiseStatusDataArray)
|
||||||
|
.then(Data =>
|
||||||
|
{
|
||||||
|
logMsg.info("ModuleWiseCompletionStatus Data Creation Success for Losid = "+losid);
|
||||||
|
})
|
||||||
|
.catch(err =>{
|
||||||
|
logMsg.info("ModuleWiseCompletionStatus Data Creation Failed for Losid= "+losid+" Error= "+err);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
moduleCompletionStatusDataCreationHelper : moduleCompletionStatusDataCreationHelper
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user