From 473ca2f44a9313bae1abd6a96e7d2ac2fce8f61c Mon Sep 17 00:00:00 2001 From: sriramv Date: Thu, 10 Aug 2023 12:37:12 +0530 Subject: [PATCH] excel:GWM --- app/controllers/excel.controller.js | 12 ++++++++---- app/models/Entities.js | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/controllers/excel.controller.js b/app/controllers/excel.controller.js index d9757df..50ad8f5 100644 --- a/app/controllers/excel.controller.js +++ b/app/controllers/excel.controller.js @@ -28,11 +28,11 @@ exports.ImportExcelData = async (req, res , filename) => if(SheetLevelData.length != 0) { if(sheetName.toUpperCase() == 'PROPRIETORSHIP'){ - where_Condition = { losid : losid , entity_type : 'PROPRIETORSHIP' } + where_Condition = { losid : losid , entity_type : 'PROPRIETORSHIP', probe42_data_status: 2 } }else if(sheetName.toUpperCase() == 'PARTNERSHIP'){ - where_Condition = { losid : losid , entity_type : 'PARTNERSHIP' } + where_Condition = { losid : losid , entity_type : 'PARTNERSHIP', probe42_data_status: 2 } }else{ - where_Condition = { losid : losid , cin : sheetName } + where_Condition = { losid : losid , cin : sheetName , probe42_data_status: 2 } } EntityData = await Entities.findOne({raw:true, where: where_Condition }).catch(err => {}); @@ -89,11 +89,15 @@ exports.ImportExcelData = async (req, res , filename) => logMsg.info("Value not updated for - EntityId : "+value.entity_id+" , FY : "+value.fy+",ItemId : "+value.itemid); } - if (key === array.length -1) { resolve(); } + if (key === array.length -1) { resolve(DataArray); } }); }); FinancialsDataUpdate.then(async(data)=> { + data.forEach(async(value, key , array)=>{ + var entity_id = value[0].entity_id; + await Financials.update( {manual_data_status:1},{where:{id:entity_id}} ).catch(err=>{ logMsg.info(err); }); + }); res.send({'status':200,'message':"success",'data':"No data"}); }); diff --git a/app/models/Entities.js b/app/models/Entities.js index 79f96f7..08adce6 100644 --- a/app/models/Entities.js +++ b/app/models/Entities.js @@ -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}, + manual_data_status : {type : DataTypes.INTEGER}, is_verified : {type : DataTypes.INTEGER}, createdby: { type: DataTypes.INTEGER }, updatedby: { type: DataTypes.INTEGER },