is_verified:GWM
This commit is contained in:
parent
d9729b4e9c
commit
4958cf4033
@ -80,7 +80,7 @@ exports.MenuList = (req, res) => {
|
||||
else
|
||||
{
|
||||
|
||||
Entities.create({ "losid":Pro42Datavalue.loginNo,"pan":Pro42Datavalue.pan,"cin":Pro42Datavalue.ciN_LLPIN,"bizname":Pro42Datavalue.entityName,"entity_type":Pro42Datavalue.entityType,"probe42_data_status":1,"createdby":Pro42Datavalue.createdby})
|
||||
Entities.create({ "losid":Pro42Datavalue.loginNo,"pan":Pro42Datavalue.pan,"cin":Pro42Datavalue.ciN_LLPIN,"bizname":Pro42Datavalue.entityName,"entity_type":Pro42Datavalue.entityType,"probe42_data_status":1,"is_verified":0,"createdby":Pro42Datavalue.createdby})
|
||||
.then(Entitydata => {
|
||||
|
||||
const cin = Entitydata.dataValues.cin;
|
||||
@ -177,7 +177,7 @@ exports.MenuList = (req, res) => {
|
||||
setTimeout(()=>{
|
||||
Statementsmaster.findAll({ where :{is_active : 1} , include: { all: true, nested: true , where :{is_active : 1} , required:false}})
|
||||
.then(MasterData => {
|
||||
Entities.findAll({where : { losid } , attributes: [ 'id', 'losid' , 'pan' , 'cin' , 'bizname' , 'entity_type' , 'activity_group' , 'biz_act_desc' , 'process_instance_id' , 'probe42_data_status' ] })
|
||||
Entities.findAll({where : { losid } , attributes: [ 'id', 'losid' , 'pan' , 'cin' , 'bizname' , 'entity_type' , 'activity_group' , 'biz_act_desc' , 'process_instance_id' , 'probe42_data_status' ,'is_verified' ] })
|
||||
.then(EntitiesData => {
|
||||
|
||||
let Time = 2000;
|
||||
@ -577,7 +577,7 @@ exports.updateFinancials = (req, res) => {
|
||||
res.send({'status':200,'message':"success",'data':"No data"});
|
||||
logMsg.info("multiple financials update Success");
|
||||
}catch(err) {
|
||||
res.status(500).send({'status':404,
|
||||
res.send({'status':404,
|
||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||
}); }
|
||||
|
||||
@ -672,52 +672,68 @@ exports.refreshApi = (req, res) => {
|
||||
financials_data_api_response.then(function(result){
|
||||
if(result == false)
|
||||
{
|
||||
res.status(404).send({'status':404,message: "Failed" ,'data': "No data for this cin number from probe42" });
|
||||
res.send({'status':404,message: "Failed" ,'data': "No data for this cin number from probe42" });
|
||||
}
|
||||
else
|
||||
{
|
||||
//filter lineitems from api responce and construct to needed format
|
||||
lineItem_data = Probe42DataMappingHelper.lineItemFetching(result);
|
||||
lineItem_data.then(function(lineItem_result){
|
||||
|
||||
var SkeletonUpdate = new Promise((resolve, reject) => {
|
||||
//create financial table and entityfinyear table record here
|
||||
lineItem_result.forEach((value, key)=>{
|
||||
lineItem_result.forEach((value, index)=>{
|
||||
|
||||
// mapping of probe42 api lineItem with itemMaster primary key
|
||||
final_array = Probe42DataMappingHelper.lineItemMapping(value,entityid);
|
||||
final_array.then(function(update_array_data){
|
||||
|
||||
// update mapped lineitem value here
|
||||
Probe42DataMappingHelper.lineItemUpdate(update_array_data);
|
||||
});//end of lineItemUpdate helper call
|
||||
|
||||
});//end of line item foreach
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
res.status(200).send({'status':200,message: "success" ,'data': "No data" });
|
||||
}, 5000);
|
||||
});//end of lineItem filter from api response helper call
|
||||
} // end of probe42 api responce success else condition
|
||||
});//end of probe42 api call
|
||||
|
||||
|
||||
}//try
|
||||
|
||||
catch (error)
|
||||
{
|
||||
// mapping of probe42 api lineItem with itemMaster primary key
|
||||
final_array = Probe42DataMappingHelper.lineItemMapping(value,entityid);
|
||||
final_array.then(function(update_array_data){
|
||||
|
||||
// update mapped lineitem value here
|
||||
Probe42DataMappingHelper.lineItemUpdate(update_array_data);
|
||||
// promise resolve check
|
||||
if (index === update_array_data.length -1) { resolve(); }
|
||||
});//end of lineItemUpdate helper call
|
||||
|
||||
});//end of line item foreach
|
||||
|
||||
});
|
||||
SkeletonUpdate.then((Query_data)=>{
|
||||
setTimeout(() => {
|
||||
res.status(200).send({'status':200,message: "success" ,'data': "No data" });
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
});//end of lineItem filter from api response helper call
|
||||
} // end of probe42 api responce success else condition
|
||||
});//end of probe42 api call
|
||||
|
||||
|
||||
}catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data"});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
exports.demo = (req, res) => {
|
||||
try
|
||||
{
|
||||
// const probe42_data_status = req.body.probe42_data_status;
|
||||
// const entityid = req.body.entityid;
|
||||
var today = new Date();
|
||||
var year = today.getFullYear();
|
||||
console.log(year)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}catch(err) {
|
||||
res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data"});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@ -662,6 +662,8 @@ exports.makerComplete = (req, res) => {
|
||||
{
|
||||
value = true;
|
||||
camundaHelper.financialsTaskComplete(task_id,value);
|
||||
// update is_verified = 1
|
||||
Entities.update({ "is_verified": 1 },{ where: { id: AllEntityData.id }});
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -686,6 +688,8 @@ exports.makerComplete = (req, res) => {
|
||||
{
|
||||
value = true;
|
||||
camundaHelper.financialsTaskComplete(task_id,value);
|
||||
// update is_verified key = 1
|
||||
Entities.update({ "is_verified": 1 },{ where: { id: entityid }});
|
||||
setTimeout(()=>{
|
||||
res.send({'status':200,'message':"success",'data':"No data"});
|
||||
},1000)
|
||||
|
||||
@ -25,6 +25,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
activity_group: { type: DataTypes.STRING },
|
||||
biz_act_desc: { type: DataTypes.STRING },
|
||||
probe42_data_status : {type : DataTypes.INTEGER},
|
||||
is_verified : {type : DataTypes.INTEGER},
|
||||
createdby: { type: DataTypes.INTEGER },
|
||||
updatedby: { type: DataTypes.INTEGER },
|
||||
|
||||
|
||||
@ -7,7 +7,43 @@ module.exports = app => {
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
var router = require("express").Router();
|
||||
|
||||
|
||||
router.get("/demo", financials.demo);
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* RefreshApiCall:
|
||||
* type: object
|
||||
* properties:
|
||||
* losid:
|
||||
* type: string
|
||||
* description: losid
|
||||
* example: MW00075486
|
||||
* entityid:
|
||||
* type: integer
|
||||
* description: entityid
|
||||
* example: 279
|
||||
* cin:
|
||||
* type: integer
|
||||
* description: cin number
|
||||
* example: U45209DL2007PTC162603
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
* /api/refreshApi:
|
||||
* post:
|
||||
* summary: RefreshApi
|
||||
* description: once again calling probe42 data Api for financial data update
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/definitions/RefreshApiCall'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: RefreshApi called and data updated
|
||||
* 500:
|
||||
* description: failure in fetching probe42 data for the cin number
|
||||
*/
|
||||
router.post("/refreshApi", financials.refreshApi);
|
||||
/**
|
||||
* @swagger
|
||||
@ -176,9 +212,8 @@ module.exports = app => {
|
||||
|
||||
router.post("/createFinancials", financials.createFinancials);
|
||||
|
||||
// create new FinancialYear skeletion
|
||||
//post_object = {"losid":"MW12233","entityid":6,"fy":2022,"st_type":2}
|
||||
/**
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* NewFinancialYear:
|
||||
|
||||
@ -36,7 +36,9 @@ function createSkeleton(losid,entityid)
|
||||
// create skeletion with itemmaster data (itemmaster(id) == financial(itemid))
|
||||
Itemsmaster.findAll({ where :{is_active : 1},attributes: ['id'] , order: [['id', 'ASC']] })
|
||||
.then(ItemsmasterData => {
|
||||
year_data = [{fy:2021},{fy:2020},{fy:2019}];
|
||||
var today = new Date();
|
||||
var year = today.getFullYear();
|
||||
year_data = [{fy:year - 1},{fy:year - 2},{fy:year - 3}];
|
||||
year_data.forEach(year_value => {
|
||||
|
||||
Entityfinyear.create({ "losid":losid,"entityid":entityid,"FY":year_value.fy,"st_type": 1 })
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
const { sequelize, Financials , Itemsmaster , Entities} = require('../models')
|
||||
const { Op } = require("sequelize");
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
|
||||
function lineItemFetching(financials_data)
|
||||
{
|
||||
try
|
||||
|
||||
Loading…
Reference in New Issue
Block a user