Compare commits

...

27 Commits

Author SHA1 Message Date
sriramv
bc944ee2dd GWM 2023-09-29 16:17:57 +05:30
sriramv
8052e2c519 gwm:probe42 2023-09-29 14:27:12 +05:30
sriramv
aca57a7fd7 probe42ApiEndpointChanges:GWM 2023-09-29 10:29:36 +05:30
sriramv
5104638810 susee:excel upload cin no chnge 2023-08-19 11:30:25 +05:30
sriramv
db085003d4 excel:GWM 2023-08-10 14:17:25 +05:30
sriramv
e2dab11335 excel:GWM 2023-08-10 14:12:27 +05:30
sriramv
74f3459e65 excel:GWM 2023-08-10 13:29:51 +05:30
sriramv
5a998b32d4 excel:GWM 2023-08-10 12:45:39 +05:30
sriramv
473ca2f44a excel:GWM 2023-08-10 12:37:12 +05:30
sriramv
dff610f8df GWM 2023-08-09 12:34:10 +05:30
sriramv
68147356ab partnership:GWm 2023-08-09 11:53:48 +05:30
sriramv
c639c62abe inr_value:GWM 2023-08-08 14:29:41 +05:30
sriramv
5bf6f37330 entity_type 2023-08-03 11:02:39 +05:30
sriramv
d4629c3b72 excel upload:GWM 2023-07-26 16:57:56 +05:30
sriramv
dd1181c179 excel upload:GWM 2023-07-26 16:52:50 +05:30
sriramv
d543b09a4f excel upload:GWM 2023-07-26 15:06:53 +05:30
sriramv
f0af65b494 updateFinancial:GWM 2023-07-21 18:45:16 +05:30
sriramv
51642489cd updateFinancial:GWM 2023-07-21 18:40:04 +05:30
sriramv
4e733b4da4 gwm 2023-07-21 10:47:23 +05:30
sriramv
6ff4052de8 Merge branch 'branch1' of bitbucket.org:venbainformationtechnology/smc_cet_financials_backend into branch1 2023-07-20 10:45:26 +05:30
sriramv
f487034430 catch issue:GWM 2023-07-20 10:45:09 +05:30
suseendhiran17
c5114fcbd2 susee:log 2023-07-19 18:05:43 +05:30
suseendhiran17
2cf8b3262b susee:log 2023-07-19 16:50:17 +05:30
suseendhiran17
49847ba4fc susee:log 2023-07-19 16:38:45 +05:30
suseendhiran17
ee71085eb5 susee:log 2023-07-19 16:23:57 +05:30
sriramv
a52a85d065 updateCin:GWM 2023-07-08 12:12:21 +05:30
suseendhiran17
eef1766c73 suseendhiran 2023-03-22 10:08:09 +05:30
13 changed files with 1261 additions and 175 deletions

View File

@ -0,0 +1,131 @@
const { sequelize, Entities , Financials , Statementsmaster , Sectionsmaster , Subsectionsmaster , Itemsmaster , Brokenperiods , Entityfinyear} = require('../models')
const { logMsg } = require('../services/logger.js')
const reader = require('xlsx');
var path = require('path');
const fs = require('fs');
//Master data List Api
exports.ImportExcelData = async (req, res , filename) =>
{
try
{
const losid = req.body.los_id;
console.log(losid);
var filePath = path.resolve('storage/uploads/'+filename);
const file = reader.readFile(filePath)
var ExcelDataConstruct = new Promise(async(resolve, reject) =>
{
let data = [];
const sheets = file.SheetNames;
for(let i = 0; i < sheets.length; i++)
{
const sheetName = req.body.cin;
const SheetLevelData = reader.utils.sheet_to_json(file.Sheets[file.SheetNames[i]]);
const resultArray = [];
if(SheetLevelData.length != 0)
{
if(sheetName.toUpperCase() == 'PROPRIETORSHIP'){
where_Condition = { losid : losid , entity_type : 'PROPRIETORSHIP', probe42_data_status: 2 }
}else if(sheetName.toUpperCase() == 'PARTNERSHIP'){
where_Condition = { losid : losid , entity_type : 'PARTNERSHIP', probe42_data_status: 2 }
}else{
where_Condition = { losid : losid , cin : sheetName , probe42_data_status: 2 }
}
EntityData = await Entities.findOne({raw:true, where: where_Condition }).catch(err => {});
if(EntityData)
{
for (const obj of SheetLevelData)
{
if(obj.hasOwnProperty('item_id'))
{
const itemid = obj.item_id;
delete obj.item_id;
delete obj.itemtext;
for (const key in obj)
{
const yearValue = obj[key];
const newObj = { entity_id:EntityData.id , itemid , fy:key , value:yearValue };
resultArray.push(newObj);
}
}else{ logMsg.info("Item id Not Exist For losid = "+losid+" CIN no = "+sheetName); }
}
}else{
logMsg.info("Cin Not Exist For losid = "+losid+" CIN no = "+sheetName);
}
}else{
logMsg.info("Empty Excel Uploaded For losid = "+losid);
}
data.push(resultArray);
if(i+1 == sheets.length){ resolve(data);}
}//end of for loop // this loop for sheet level loop
});
ExcelDataConstruct.then(async(DataArray)=>
{
if(DataArray.length > 0)
{
// Using the spread operator
const mergedArray = [].concat(...DataArray);
if(mergedArray.length > 0){
var FinancialsDataUpdate = new Promise(async(resolve, reject) =>
{
mergedArray.forEach(async(value, key , array)=>{
checkIfExist = await Financials.findOne({ raw:true, where: {fy:value.fy,entity_id:value.entity_id,itemid:value.itemid,is_active:1} }).catch(err=>{ logMsg.info(err); });
if(checkIfExist)
{
await Financials.update({ "value":value.value,"sub_value":value.value},{ where: { id:checkIfExist.id }}).catch(err=>{ logMsg.info(err); });
}
else
{
logMsg.info("Value not updated for - EntityId : "+value.entity_id+" , FY : "+value.fy+",ItemId : "+value.itemid);
}
if (key === array.length -1) { resolve(DataArray); }
});
});
FinancialsDataUpdate.then(async(data)=>
{
const filteredData = data.filter(subArray => subArray.length > 0);
filteredData.forEach(async(value, key , array)=>{
var entity_id = value[0]['entity_id'];
await Entities.update( {manual_data_status:1},{where:{id:entity_id}} ).then(data=>{}).catch(err=>{ logMsg.info(err); });
});
res.send({'status':200,'message':"success",'data':"No data"});
});
}else{
res.send({'status':404,'message':"Invalid Data or Empty Excel",'data':"No data"});
}
}else{
res.send({'status':404,'message':"Invalid Data or Empty Excel",'data':"No data"});
}
});
fs.unlink(filePath, (error) => {
if (error) {
console.error('Error deleting the file:', error);
} else {
console.log('File has been deleted successfully.');
}
});
} catch(err) {
res.send({'status':404,message: err.message || "Some error occurred while retrieving BankDetails." ,'data': "No data" });
} //end of try catch
};

View File

@ -6,10 +6,15 @@ const ApiCallHelper = require('../services/financials.apicall.helper.js');
const Probe42DataMappingHelper = require('../services/probe42lineitem.mapping.helper.js');
const Sync = require('sync');
const { Op } = require("sequelize");
const { Console } = require('winston/lib/winston/transports');
exports.checkProbeApi = async (req, res) => {
// call and get financial year wise data for entity (probe42 api call)
entity_identify_number = 'U72300DL2006PTC151811';
entity_identify_number_type = 'cin';
financials_data_api_response = ApiCallHelper.probe42ApiCall(entity_identify_number,entity_identify_number_type);
res.send({financials_data_api_response});
}
// all master data list for dropdown
exports.MasterDatas = async (req, res) => {
await Statementsmaster.findAll({
@ -56,8 +61,8 @@ exports.MasterDatas = async (req, res) => {
exports.MenuList = async (req, res) => {
Sync(function()
{
// Sync(function()
// {
try
{
const losid = req.query.losid;
@ -67,10 +72,10 @@ exports.MenuList = async (req, res) => {
{
//Redirection api call with losid
redirectionApi = ApiCallHelper.redirectionApiCall(losid);
redirectionApi.then(function(redirectionApiData){
if(redirectionApiData == false)
{
resolve();
logMsg.info("Redirection api data fetching failed for losid = "+losid);
}
@ -81,8 +86,9 @@ exports.MenuList = async (req, res) => {
redirectionApiData.forEach((Pro42Datavalue, key,array)=>{
let cin_number = Pro42Datavalue.ciN_LLPIN.toUpperCase();
// , cin : cin_number
// check if the Pro42Data (entity) already inserted
Entities.findOne({ where: { losid : Pro42Datavalue.loginNo , pan : Pro42Datavalue.pan , cin : cin_number } }).then(Entity => {
Entities.findOne({ where: { losid : Pro42Datavalue.loginNo , pan : Pro42Datavalue.pan } }).then(Entity => {
if(Entity)
{
// skip inserting
@ -90,30 +96,244 @@ exports.MenuList = async (req, res) => {
}
else
{
Entities.create({ "losid":Pro42Datavalue.loginNo,"pan":Pro42Datavalue.pan,"cin":cin_number,"bizname":Pro42Datavalue.entityName,"entity_type":Pro42Datavalue.entityType,"probe42_data_status":1,"is_verified":0,"createdby":Pro42Datavalue.createdby})
.then(Entitydata => {
logMsg.info("entity created , data:"+Entitydata);
const cin = Entitydata.dataValues.cin;
if(cin != "")
let entityid = Entitydata.dataValues.id;
if(Entitydata.dataValues.entity_type == 'COMPANY' || (Entitydata.dataValues.entity_type == 'PARTNERSHIP' && Entitydata.dataValues.bizname.slice(-3) == 'LLP'))
{
//process instance Id update
let cin = Entitydata.dataValues.cin;
if(cin == "" || cin == null)
{
entity_identify_number = Entitydata.dataValues.pan;
entity_identify_number_type = 'pan';
}
else
{
entity_identify_number = Entitydata.dataValues.cin;
if(Entitydata.dataValues.entity_type == 'COMPANY')
{
entity_identify_number_type = 'cin';
}else if(Entitydata.dataValues.entity_type == 'PARTNERSHIP' && Entitydata.dataValues.bizname.slice(-3) == 'LLP')
{
entity_identify_number_type = 'llp';
}
}
console.log("entity_identify_number = "+entity_identify_number);
console.log("entity_identify_number_type = "+entity_identify_number_type);
// call and get financial year wise data for entity (probe42 api call)
financials_data_api_response = ApiCallHelper.probe42ApiCall(entity_identify_number,entity_identify_number_type);
financials_data_api_response.then(function(result){
if(result == false)
{
console.log("probe42ApiCall failed");
// create skeleton here
financialControllerHelper.createSkeleton(losid,entityid);
}
else
{
// update cin/llp (if not get from redirection api)
if(cin == "" || cin == null)
{
if(Entitydata.dataValues.entity_type == 'COMPANY')
{
Entities.update({ "cin":result.company.cin}, {where : { id: entityid }});
}else if(Entitydata.dataValues.entity_type == 'PARTNERSHIP' && Entitydata.dataValues.bizname.slice(-3) == 'LLP')
{
Entities.update({ "cin":result.llp.llpin}, {where : { id: entityid }});
}
}
if(result.financials.length > 0)
{
console.log("probe42ApiCall success");
//filter lineitems from api responce and construct to needed format
lineItem_data = Probe42DataMappingHelper.lineItemFetching(result.financials);
lineItem_data.then(function(lineItem_result){
//create financial table and entityfinyear table record here
lineItem_result.forEach((value, key)=>{
Entityfinyear.create({ "losid":Entitydata.dataValues.losid,"entityid":Entitydata.dataValues.id,"FY":value.year,"st_type": 0 })
.then(Entityfinyearsdata => {
// create skeletion with itemmaster data (itemmaster(id) == financial(itemid))
Itemsmaster.findAll({ where :{pvtltd:1,is_active : 1},attributes: ['id'] , order: [['statement', 'ASC'],['section', 'ASC'],['pvtltd_itemorder', 'ASC']] })
.then(ItemsmasterData => {
//construct lineitem array for bulk insert using itemmaster primarykey (id)
var SkeletonInsert = new Promise((resolve, reject) => {
let fin_data_array = [];
ItemsmasterData.forEach( (itemvalue , index , itemvaluearray) => {
fin_data_obj = { "entity_id":Entityfinyearsdata.dataValues.entityid,"st_type":Entityfinyearsdata.dataValues.st_type,"itemid":itemvalue.dataValues.id,"fy":Entityfinyearsdata.dataValues.FY,"value":0,"is_active":1}
fin_data_array.push(fin_data_obj);
if (index === itemvaluearray.length -1) { resolve(fin_data_array); }
})
});
SkeletonInsert.then((Query_data)=>{
Financials.bulkCreate(Query_data).then(data=>{
//line item data update
// 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
}).catch(err=>(console.log(err))); //skeleton bulk create query
});
}).catch(err=>(console.log(err))); //itemmaster query
}).catch(err => {
res.status(404).send({'status':404,
message: err.message || "Some error occurred while insertinging statements." ,'data': "No data" });
}); // end of entity fin year table data insert
});//end of line item foreach
});//end of lineItem filter from api response helper call
}
else
{
// create skeleton here
financialControllerHelper.createSkeleton(losid,entityid);
// resolve here
if (key === array.length -1) { resolve(); }
}
} // end of probe42 api responce success else condition
});//end of probe42 api call
} else {
if(Entitydata.dataValues.entity_type == 'PROPRIETORSHIP')
{
// create skeleton here
financialControllerHelper.createSkeleton(losid,Entitydata.dataValues.id);
}else if(Entitydata.dataValues.entity_type == 'PARTNERSHIP' && Entitydata.dataValues.bizname.slice(-3) != 'LLP'){
// create skeleton here
financialControllerHelper.createSkeleton(losid,Entitydata.dataValues.id);
}
// resolve here
if (key === array.length -1) { resolve(); }
}
}).catch(err => {
res.status(404).send({'status':404,
message: err.message || "Some error occurred while insertinging statements." ,'data': "No data" });
}); // end of entity insert
} //end of else condition
}); // end of (losid,pan,cin) combination checking entity data exist or not
}); // end of Redirection api data foreach
} // end of redirectionApiData else condition
}) // end of Redirection api call
} else {
resolve();
logMsg.info("redirection api call not allowed because redirection_api_call = 0 ");
}
}); // end of promise
EntityInsert.then(async() => {
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' ,'is_verified','manual_data_status' ], order: [['id', 'ASC']] })
.then(async(EntitiesData) => {
let Time = 2000;
let data = [];
for(const value of EntitiesData)
{
obj_data = { ...value.dataValues , statementsmasterrData:MasterData }
data.push(obj_data);
} // end of for loop
if(data.length > 1)
{
// below code for overall sum object push process
sum_data = { ...{'losid':losid,'bizname':"Consolidated Financials Summary",'is_consolidated_api_call':1} , statementsmasterrData:MasterData };
data.push(sum_data);
// send respose to FE
res.send({'status':200,'message':"success",'data':data});
}
else if(data.length == 1)
{
// send respose to FE
res.send({'status':200,'message':"success",'data':data});
}
else
{
res.send({'status':404,'message':"failed",'data':"data not found"});
}
}).catch(err => { logMsg.info(err); }); // end of findall EntitiesData
}).catch(err => { logMsg.info(err); }); // end of findall masters datas
});
} catch(err) {
res.status(500).send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
}); } // end of try catch
// }); // end of sync function
};
exports.updateEntityCin = (req, res) => {
try
{
var EntityCINUpdate = new Promise((resolve, reject) => {
Entities.update({ "cin":req.body.cin}, {where : { id: req.body.id }}).then(async(data) => {
Entities.findOne({where : { id : req.body.id , losid : req.body.losid } })
.then(async(Entitydata) => {
const losid = Entitydata.dataValues.losid;
const cin = Entitydata.dataValues.cin;
const entityid = Entitydata.dataValues.id;
const user = "SMC";
processInstanceId = camundaHelper.startFinancialsProcessInstance(Entitydata.dataValues.losid,Entitydata.dataValues.pan,user);
processInstanceId.then(function(InstanceId){
Entities.update({ "process_instance_id":InstanceId },{ where: { id: entityid }}).then(processInstanceIdData =>{
// resolve here
if (key === array.length -1) { resolve(); } }).catch(err=>{ logMsg.info("camunda process_instance_id creation for entity_id= "+entityid); });
});
// call and get financial year wise data for entity (probe42 api call)
financials_data_api_response = ApiCallHelper.probe42ApiCall(cin);
financials_data_api_response.then(function(result){
financials_data_api_response = ApiCallHelper.probe42ApiCall(cin);
financials_data_api_response.then(function(result){
if(result == false)
{
// create skeleton here
financialControllerHelper.createSkeleton(losid,entityid);
//EntityCINUpdate resolve
resolve();
}
else
{
@ -147,6 +367,8 @@ exports.MenuList = async (req, res) => {
final_array.then(function(update_array_data){
// update mapped lineitem value here
Probe42DataMappingHelper.lineItemUpdate(update_array_data);
//EntityCINUpdate resolve
resolve();
});//end of lineItemUpdate helper call
}).catch(err=>(console.log(err))); //skeleton bulk create query
});
@ -162,114 +384,34 @@ exports.MenuList = async (req, res) => {
});//end of line item foreach
});//end of lineItem filter from api response helper call
} // end of probe42 api responce success else condition
});//end of probe42 api call
} else {
// resolve here
if (key === array.length -1) { resolve(); }
logMsg.info("CIN no not exist for losid = "+losid+" and entity name ="+Entitydata.dataValues.bizname);
}
});//end of probe42 api call
}).catch(err => {
res.status(404).send({'status':404,
message: err.message || "Some error occurred while insertinging statements." ,'data': "No data" });
}); // end of entity insert
}).catch(err => {res.status(404).send({'status':404,message: err.message || "Some error occurred while insertinging statements." ,'data': "No data" });}); // end of entity insert
}).catch(err => { res.status(404).send({'status':404,message: err.message || "Some error occurred while insertinging statements." ,'data': "No data" }); });
});
} //end of else condition
}); // end of (losid,pan,cin) combination checking entity data exist or not
}); // end of Redirection api data foreach
} // end of redirectionApiData else condition
}) // end of Redirection api call
} else {
resolve();
logMsg.info("redirection api call not allowed because redirection_api_call = 0 ");
}
}); // end of promise
EntityCINUpdate.then(async() => {
res.send({'status':200,'message':"success",'data':"No data"});
});
}catch(err) {
res.send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
}); }
EntityInsert.then(async() => {
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' ,'is_verified' ], order: [['id', 'ASC']] })
.then(async(EntitiesData) => {
let Time = 2000;
let data = [];
//EntitiesData.forEach((value, key)=>{
// Time = Time + 500;
// instancesid = value.dataValues.process_instance_id;
// taskid = camundaHelper.financialsListOfProcessInstances(instancesid);
// taskid.then(function(result){
// Time = Time + 500;
// formVariable = camundaHelper.financialsFormVariables(result);
// formVariable.then(function(form_result){
// formVariableResult = JSON.parse(form_result);
// if(formVariableResult.type){ camunda_status = {"process_status":"NULL"}; } else { camunda_status =JSON.parse(form_result); }
// obj_data = { ...value.dataValues ,status:camunda_status , statementsmasterrData:MasterData }
// data.push(obj_data);
// });
// });
//}); // end of EntitiesData foreach
for(const value of EntitiesData)
{
Time = Time + 500;
instancesid = value.dataValues.process_instance_id;
taskid = await camundaHelper.financialsListOfProcessInstances(instancesid);
Time = Time + 500;
formVariable = await camundaHelper.financialsFormVariables(taskid);
formVariableResult = JSON.parse(formVariable);
if(formVariableResult.type){ camunda_status = {"process_status":"NULL"}; } else { camunda_status =JSON.parse(formVariable); }
obj_data = { ...value.dataValues ,status:camunda_status , statementsmasterrData:MasterData }
data.push(obj_data);
} // end of for loop
setTimeout(()=>{
if(data.length > 1)
{
// below code for overall sum object push process
sum_data = { ...{'losid':losid,'bizname':"Consolidated Financials Summary",'is_consolidated_api_call':1} , statementsmasterrData:MasterData };
data.push(sum_data);
// send respose to FE
res.send({'status':200,'message':"success",'data':data});
}
else if(data.length == 1)
{
// send respose to FE
res.send({'status':200,'message':"success",'data':data});
}
else
{
res.send({'status':404,'message':"failed",'data':"data not found"});
}
},Time)
}); // end of findall EntitiesData
}); // end of findall masters datas
});
} catch(err) {
res.status(500).send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
}); } // end of try catch
}); // end of sync function
};
};
@ -377,6 +519,9 @@ exports.FinantialsSummary = async (req, res) => {
try
{
const id = req.query.entityid
if(id == null){
res.status(404).send({'status':404,message: "Entity id is null." ,'data': "No data" });
}else{
Entities.findOne({where : { id } , attributes: [ 'id','losid','process_instance_id' , 'entity_type' , 'probe42_data_status' ] })
.then(async(EntitiesData) => {
const instancesid = EntitiesData.dataValues.process_instance_id;
@ -419,10 +564,10 @@ sequelize.query("select a.losid,a.entityid,a.FY,a.st_type as st_type_id, b.state
var query = "Select a.entity_id,x.id as statement_id,x.statement as statement,y.id as section_id,y.section as section,w.subsection as subsection_id,w.itemkey,w.itemorder,w.pvtltd_itemorder,z.subsection as subsection , z.itemtext as subsection_itemtext ,a.itemid,w.itemtext as items,w.formula,w.is_calculated,w.is_summary,w.pvtltd,w.llp,w.others,a.st_type as Y1_st_type,a.fy as Y1,a.id as Y1_id ,a.is_editable as Y1_is_editable,a.value as Y1_value,a.sub_value as Y1_sub_value "+ select_items +",v.remarks , v.id as remarks_id FROM financials a LEFT JOIN ( SELECT id,entity_id,itemid,remarks FROM fin_remarks WHERE is_active = 1) v ON a.entity_id = v.entity_id and a.itemid = v.itemid JOIN ( SELECT id,itemtext,statement,section,subsection,itemkey,itemorder,pvtltd_itemorder,formula,is_calculated,is_summary,pvtltd,llp,others FROM itemsmaster ) w ON a.itemid = w.id JOIN ( SELECT id, statement FROM statementsmaster ) x ON w.statement = x.id JOIN ( SELECT id, section FROM sectionsmaster ) y ON w.section = y.id LEFT JOIN ( SELECT id, subsection , itemtext FROM subsectionsmaster ) z ON w.subsection = z.id "+ sub_query +"WHERE a.fy = '"+year_1+"' and a.entity_id = "+id+" and a.is_active = 1 order by w.statement asc , w.section asc , w.subsection ";
// get camunda status
taskid = await camundaHelper.financialsListOfProcessInstances(instancesid);
formVariable = await camundaHelper.financialsFormVariables(taskid);
formVariableResult = JSON.parse(formVariable);
if(formVariableResult.type){ camunda_status = {"process_status":"NULL"}; } else { camunda_status =JSON.parse(formVariable); }
// taskid = await camundaHelper.financialsListOfProcessInstances(instancesid);
// formVariable = await camundaHelper.financialsFormVariables(taskid);
// formVariableResult = JSON.parse(formVariable);
// if(formVariableResult.type){ camunda_status = {"process_status":"NULL"}; } else { camunda_status =JSON.parse(formVariable); }
// execute constructed financial summary query
sequelize.query(query).then(async(summary) => {
@ -438,7 +583,7 @@ sequelize.query("select a.losid,a.entityid,a.FY,a.st_type as st_type_id, b.state
});
res.send({'status':200,'message':"success",'data':{"years" : years , formula_obj : formula_obj ,"add_new_finyear_flag" : add_new_FY_flag , status:camunda_status,"summary" : is_summary_item_array , "fin_summary" : summary } });
res.send({'status':200,'message':"success",'data':{"years" : years , formula_obj : formula_obj ,"add_new_finyear_flag" : add_new_FY_flag,"summary" : is_summary_item_array , "fin_summary" : summary } });
}).catch(err => {
res.status(500).send({'status':404,
@ -451,7 +596,9 @@ sequelize.query("select a.losid,a.entityid,a.FY,a.st_type as st_type_id, b.state
}) // end of EntityfinyearData query
}) // end of EntitiesData query
} catch(err) {
}
} catch(err) {
res.status(500).send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
}); }
@ -659,12 +806,23 @@ exports.updateFinancials = (req, res) => {
const req_array_data = req.body;
try
{
req_array_data.forEach((value, key)=>{
const id = value.id;
Financials.update({ "entity_id":value.entity_id,"st_type":value.sy_type,"itemid":value.itemid,"fy":value.fy,"value":value.value,"is_active":value.is_active,"updatedby":value.updatedby },{ where: { id:id }})
req_array_data.forEach(async(value, key)=>{
await Financials.findOne({ where: { id : value.id , is_active : 1} }).then(async function(result) {
if(result.value == value.value)
{
logMsg.info("Value not updated for - EntityId : "+value.entity_id+" , FY : "+value.fy+",ItemId : "+value.itemid+",primary key :"+value.id);
}
else
{
Financials.update({ "value":value.value,"sub_value":value.sub_value},{ where: { id:value.id }})
}
});
});
res.send({'status':200,'message':"success",'data':"No data"});
logMsg.info("multiple financials update Success");
}catch(err) {
res.send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"

View File

@ -4,6 +4,8 @@ const { sequelize, Entities , Financials , Statementsmaster , Sectionsmaster ,
const { logMsg } = require('../services/logger.js');
const financialControllerHelper = require('../services/financial.controller.helper.js');
const camundaHelper = require('../services/camunda.helper.js');
const fs = require('fs');
const path = require('path');
@ -547,3 +549,119 @@ exports.MenuList = (req, res) => {
};
exports.readLogFileName = async (req , res) =>
{
try
{
folderName = req;
const logFilePath = 'storage/log';
const fileNames = fs.readdirSync(logFilePath);
// Remove the first element (0th index)
const [, ...data] = fileNames;
return data;
}
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.readLogFile = async (req , res) =>
{
try
{
folderName = req.body.folder;
fileName = req.body.file;
const logFilePath = 'storage/log/'+fileName;
fs.readFile(logFilePath, 'utf8', (err, data) => {
if (err) {
console.error(err);
res.status(500).send({'status':404,'message': err.message || "Error reading log file." ,'data': "No data"});
}
res.send({'status':200 , message:"Success." ,'data': data});
});
}
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.viewLandingPage = async (req , res) =>
{
try
{
moduleName = [ { "module":"FINANCIAL","folder":"smc_cet_financials_backend"} ];
img = []
for(const [index,val] of moduleName.entries())
{
fileName = await this.readLogFileName(val.folder);
for (let i = 0; i < fileName.length; i++)
{
filePath = 'storage/log/'+fileName[i];
const logData = fs.readFileSync(filePath);
// Convert the file content to Base64
const base64Data = logData.toString('base64');
// Create Base64 URL from Base64 data
const base64Url = `data:application/octet-stream;base64,${encodeURIComponent(base64Data)}`;
img.push(base64Url)
}
moduleName[index] = await Object.assign(val,{'file':fileName , 'img':img});
};
res.render( 'module' , { 'data' : moduleName } ,function (err, html ) {
res.send(html)
})
}
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.deleteLogFile = async (req , res) =>
{
try
{
folderName = req.body.folder;
fileName = req.body.file;
// folderName = 'smc_cet_creditpd_backend';
// fileName = 'msg.log.2023-07-10';
const logFilePath = 'storage/log/'+fileName;
fs.unlink(logFilePath, (err) => {
if (err) {
console.error(`Error deleting file: ${err}`);
return;
}
console.log('File deleted successfully.');
res.send({'status':200 , message:"Success." ,'data': 'No data'});
});
}
catch(err)
{
res.status(500).send({'status':404,
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
});
} //end of try catch
};

View File

@ -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 },

View File

@ -24,7 +24,8 @@ module.exports = (sequelize, DataTypes) => {
is_editable: { type: DataTypes.INTEGER },
is_active: { type: DataTypes.INTEGER },
value: { type: DataTypes.INTEGER },
sub_value: { type: DataTypes.STRING },
sub_value: { type: DataTypes.STRING },
inr_value: { type: DataTypes.INTEGER },
createdby: { type: DataTypes.INTEGER },
updatedby: { type: DataTypes.INTEGER },

View File

@ -4,9 +4,12 @@ module.exports = app => {
const financials = require("../controllers/financial.controller.js");
const master = require("../controllers/master.controller.js");
const test = require("../controllers/test.controller.js");
const ExcelController = require("../controllers/excel.controller.js");
const { logMsg } = require('../services/logger.js');
var router = require("express").Router();
router.get("/checkProbeApi", financials.checkProbeApi);
/**
* @swagger
@ -1110,7 +1113,36 @@ router.get("/deActivateFinancialsYear", financials.deActivateFinancialsYear);
* description: success
*/
router.get("/getFinancialsYears", financials.getFinancialsYears);
router.post("/updateEntityCin", financials.updateEntityCin);
router.post("/updateFinancials", financials.updateFinancials);
//excel data import
const multer = require('multer');
filename = "";
const storage = multer.diskStorage({
destination: (req, file, cb) => {
cb(null, 'storage/uploads/');
},
filename: (req, file, cb) => {
filename = "";
filename += Date.now()+'-'+file.originalname;
cb(null, filename);
}
});
const uploadExcel = multer({ storage });
router.post('/uploadExcel',uploadExcel.single('excel_file'),function(req,res){ExcelController.ImportExcelData(req,res,filename)});
// third party api call example
router.get('/third_party_api', (req, res) => {
// const options = {
@ -1130,6 +1162,16 @@ array.forEach((value, key)=>{
});
})
router.get("/getfilename", test.readLogFileName);
router.post("/readlogs", test.readLogFile);
router.get("/view", test.viewLandingPage);
router.post("/deletelog", test.deleteLogFile);
// routes started here
app.use('/api', router);

View File

@ -6,6 +6,7 @@ const URL = process.env.CAMUNDA_URL
{
try
{
console.log("1");
const start_url = URL+"process-definition/"+DEFINITION_ID+"/start";
const businessKey = losid+"-"+cin+"-"+user;
const myJSONObject = {
@ -22,6 +23,7 @@ const URL = process.env.CAMUNDA_URL
json: true,
body: myJSONObject
}, function (error, response, body){
console.log(body);
let data = body;
instancesid = data.id;
resolve(instancesid);
@ -39,6 +41,7 @@ const URL = process.env.CAMUNDA_URL
{
try
{
console.log("1");
const task_id_url = URL+"task";
const myJSONObject = { "processInstanceIdIn":[instancesid] };
return new Promise((resolve, reject) => {
@ -75,7 +78,7 @@ const URL = process.env.CAMUNDA_URL
{
try
{
console.log("1");
const task_complete_url = URL+"task/"+taskid+"/complete";
const myJSONObject = {"variables":{"review_status":{"value":value}}};
@ -100,6 +103,7 @@ const URL = process.env.CAMUNDA_URL
{
try
{
console.log("1");
const form_variable_url = URL+"task/"+taskid+"/form-variables";
return new Promise((resolve, reject) => {
request({

View File

@ -11,25 +11,33 @@ REDIRECTION_PASSWORD = process.env.REDIRECTION_PASSWORD
REDIRECTION_APPLICATION_NAME = process.env.REDIRECTION_APPLICATION_NAME
function probe42ApiCall(cin) {
function probe42ApiCall(entity_identify_number,entity_identify_number_type) {
try {
const probe_url = PROBE42_URL + "companycomprehensivedetails";
const probe_url = PROBE42_URL + "GetCompanyLlpComprehensiveDetails";
const myJSONObject = {
"UserId": PROBE42_USER_ID,
"Password": PROBE42_PASSWORD,
"ApplicationName": PROBE42_APPLICATION_NAME,
"Cin": cin
"Cin_Llpin_Or_Pan": entity_identify_number,
"Identifier_type" : entity_identify_number_type
};
// console.log(probe_url)
// console.log(myJSONObject)
return new Promise((resolve, reject) => {
request({
url: probe_url,
method: "POST",
json: true,
body: myJSONObject
}, function (error, response, body) {
}, function (error, response, body) {
if (body != undefined) {
if (response.statusCode == 200 && body.hasOwnProperty("data") && body.data.financials.length != 0) {
financial_data = body.data.financials;
// console.log(response.statusCode);
res = JSON.parse(body);
// console.log(res.data.company);
if (response.statusCode == 200 && res.hasOwnProperty("data") ) {
financial_data = res.data;
resolve(financial_data);
} else { resolve(false); }
} else { resolve(false); }
@ -60,7 +68,6 @@ function redirectionApiCall(losid) {
json: true,
body: myJSONObject
}, function (error, response, body) {
if (body != undefined) {
if (body.status == "Success" && body.data.length != 0) {
resolve(body.data);

View File

@ -87,51 +87,62 @@ const { logMsg } = require('../services/logger.js');
{
entityid = update_array_data[0].entityid;
fy = update_array_data[0].year;
var LineItemUpdate = new Promise((resolve, reject) => {
update_array_data.forEach((value,index) => {
if(value.value != null)
{
Financials.update( { value: value.value , is_editable : 0 } , { where: { entity_id: value.entityid , itemid: value.itemid , fy:value.year} })
.then(data => { logMsg.info("update success : "+ data); })
.catch(err => { logMsg.info("update failed : " + err); });
// Replace this with the INR value you want to convert
lakhsValue = convertINRtoLakhs(value.value);
Financials.update( { inr_value:value.value,value: lakhsValue , is_editable : 0 } , { where: { entity_id: value.entityid , itemid: value.itemid , fy:value.year} })
.then(data => { logMsg.info("update success : "+ data); })
.catch(err => { logMsg.info("update failed : " + err); });
}
if (index === update_array_data.length -1) { resolve(); }
if (index === update_array_data.length -1) { resolve(value.entityid); }
});
});
LineItemUpdate.then((Query_data)=>{
LineItemUpdate.then((entityid)=>{
//Entities.update({ "probe42_data_status": 0 },{ where: { id: entityid }});
Entityfinyear.update({ probe42_data_status : 1 } , {where : {entityid:entityid , FY :fy}})
.then(async (data) => {
logMsg.info("Probe42 data updated for EntityId = "+entityid+" Year = "+fy);
Entityfinyear.findAll({where : {entityid:300},rew:true})
.then(async (EntityfinyearData) =>{
let count = 0;
for(const value of EntityfinyearData)
{
count = count + value.probe42_data_status;
}
if(EntityfinyearData.length == count)
{
Entities.update({ "probe42_data_status": 0 },{ where: { id: entityid }});
}
else if(count >=1)
{
Entities.update({ "probe42_data_status": 3 },{ where: { id: entityid }});
}
});
// Entityfinyear.findAll({where : {entityid:entityid},rew:true})
// .then(async (EntityfinyearData) =>{
// let count = 0;
// for(const value of EntityfinyearData)
// {
// count = count + value.probe42_data_status;
// }
// if(EntityfinyearData.length == count)
// {
// Entities.update({ "probe42_data_status": 0 },{ where: { id: entityid }});
// }
// else if(count >=1)
// {
// Entities.update({ "probe42_data_status": 3 },{ where: { id: entityid }});
// }
// });
await Entities.update({ "probe42_data_status": 0 },{ where: { id: entityid }});
}).catch(err => { logMsg.info("Probe42 data update failed for EntityId = "+entityid+" Year = "+fy); });
});
});
}
catch (error)
{
console.log(error);
}
}
function convertINRtoLakhs(inrValue) {
return inrValue / 100000;
}
module.exports = {
lineItemFetching : lineItemFetching ,

346
app/views/module.ejs Normal file
View File

@ -0,0 +1,346 @@
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<style>
body {
background: #f3f3f3;
padding: 30px 20px;
}
/* Dashboard Cards */
.dashboard-cards {
position: relative;
padding-bottom: 50px;
margin: 0 !important;
}
.dashboard-cards .card {
background: #ffffff;
display: inline-block;
-webkit-perspective: 1000;
perspective: 1000;
z-index: 20;
padding: 0 !important;
margin: 5px 5px 10px 5px;
position: relative;
text-align: left;
-webkit-transition: all 0.3s 0s ease-in;
transition: all 0.3s 0s ease-in;
z-index: 1;
/* width: calc(33.33333333% - 10px); */
cursor: pointer;
transition: all 0.3s ease;
}
.dashboard-cards .card:hover {
box-shadow: 0 15px 10px -10px rgba(31, 31, 31, 0.5);
transition: all 0.3s ease;
}
.dashboard-cards .card .card-title {
background: #ffffff;
padding: 20px 15px;
position: relative;
z-index: 0;
}
.dashboard-cards .card .card-title h2 {
font-size: 24px;
letter-spacing: -0.05em;
margin: 0;
padding: 0;
}
.dashboard-cards .card .card-title h2 small {
display: block;
font-size: 14px;
margin-top: 8px;
letter-spacing: -0.025em;
}
.dashboard-cards .card .card-description {
position: relative;
font-size: 14px;
border-top: 1px solid #ddd;
padding: 10px 15px 0 15px;
}
.dashboard-cards .card .card-actions {
box-shadow: 0 2px 0px 0 rgba(0, 0, 0, 0.075);
padding: 10px;
text-align: center;
}
.dashboard-cards .card .card-flap {
background: #d9d9d9;
position: absolute;
width: 100%;
-webkit-transform-origin: top;
transform-origin: top;
/* -webkit-transform: rotateX(-90deg);
transform: rotateX(-90deg); */
}
.dashboard-cards .card .flap1 {
-webkit-transition: all 0.3s 0.3s ease-out;
transition: all 0.3s 0.3s ease-out;
z-index: -1;
}
.dashboard-cards .card .flap2 {
-webkit-transition: all 0.3s 0s ease-out;
transition: all 0.3s 0s ease-out;
z-index: -2;
}
.dashboard-cards.showing .card {
cursor: pointer;
opacity: 0.6;
-webkit-transform: scale(0.88);
transform: scale(0.88);
}
.dashboard-cards .no-touch .dashboard-cards.showing .card:hover {
opacity: 0.94;
-webkit-transform: scale(0.92);
transform: scale(0.92);
}
.dashboard-cards .card.d-card-show {
opacity: 1 !important;
-webkit-transform: scale(1) !important;
transform: scale(1) !important;
}
.dashboard-cards .card.d-card-show .card-flap {
background: #ffffff;
-webkit-transform: rotateX(0deg);
transform: rotateX(0deg);
}
.dashboard-cards .card.d-card-show .flap1 {
-webkit-transition: all 0.3s 0s ease-out;
transition: all 0.3s 0s ease-out;
}
.dashboard-cards .card.d-card-show .flap2 {
-webkit-transition: all 0.3s 0.2s ease-out;
transition: all 0.3s 0.2s ease-out;
}
.dashboard-cards .card .task-count {
width: 40px;
height: 40px;
position: absolute;
top: 14px;
right: 10px;
background: #ecf0f1;
text-align: center;
line-height: 40px;
border-radius: 100%;
color: #333333;
font-weight: 600;
transition: all .2s ease;
}
/* Task List */
.dashboard-cards .task-list {
padding: 0 !important;
}
.dashboard-cards .task-list li {
padding: 10px 0;
padding-left: 10px;
margin: 3px 0;
list-style-type: none;
border-bottom: 1px solid #e9ebed;
border-left: 3px solid #f36525;
transition: all .2s ease;
}
.dashboard-cards .task-list li:hover {
background: #ecf0f1;
transition: all .2s ease;
}
.dashboard-cards .task-list li span {
float: right;
color: #f36525;
margin-right: 5px;
}
.dashboard-cards.showing .card.d-card-show .task-count {
color: #ffffff;
background: #f36525;
transition: all .2s ease;
}
.dashboard-cards .card-actions .btn {
color: #333;
}
.dashboard-cards .card-actions .btn:hover {
color: #f36525;
}
.fileName{
display: inline-block;
}
.delete,.download{
float: right;
margin-top: 5px;
margin-right: 1rem;
}
.download{
font-size: 25px;
margin-top: 10px;
}
</style>
<body>
<div class='row dashboard-cards'>
<% for (let i = 0; i < data.length; i++) { %>
<div class='card col-md-2'></div>
<div class='card col-md-8'>
<div class='card-title'>
<h2>
LOGS
<!-- <small>You have 14 pending tasks</small> -->
</h2>
<div class='task-count'>
<%= data[i].file.length %>
</div>
</div>
<div class='card-flap flap1'>
<% for (let j = 0; j < data[i].file.length; j++) { %>
<div class='card-description'>
<ul class='task-list'>
<li id="<%= data[i].file[j]+'|'+data[i].folder %>" class="fileName">
<%= data[i].file[j] %>
</li>
<button type="button" id="<%= data[i].file[j]+'|'+data[i].folder %>" class="btn btn-danger delete">Delete</button>
<a onclick="downloadImage('<%= data[i].img[j] %>' , '<%= data[i].file[j] %>')"><i class="fa fa-download download"></i></a>
</ul>
</div>
<% } %>
<div class='card-flap flap2'>
<div class='card-actions'>
<a class='btn' href='#'>Close</a>
</div>
</div>
</div>
</div>
<div class='card col-md-2'></div>
<% } %>
</div>
<!-- Modal btn -->
<button type="button" style="display: none;" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Large Modal</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body" style="white-space: pre-wrap;">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</body>
<script>
$(document).ready(function () {
var zindex = 10;
$("div.card").click(function (e) {
e.preventDefault();
var isShowing = false;
if ($(this).hasClass("d-card-show")) {
isShowing = true;
}
if ($("div.dashboard-cards").hasClass("showing")) {
// a card is already in view
$("div.card.d-card-show").removeClass("d-card-show");
if (isShowing) {
// this card was showing - reset the grid
$("div.dashboard-cards").removeClass("showing");
} else {
// this card isn't showing - get in with it
$(this).css({ zIndex: zindex }).addClass("d-card-show");
}
zindex++;
} else {
// no dashboard-cards in view
$("div.dashboard-cards").addClass("showing");
$(this).css({ zIndex: zindex }).addClass("d-card-show");
zindex++;
}
});
});
$(".fileName").click(function(){
data = $(this).attr('id').split("|");
var getUrl = window.location;
path_name = getUrl.pathname.slice(0,-4)+'readlogs';
$.ajax({
type: "post",
url: path_name,
data: {'file' : data[0] , 'folder' : data[1]},
success: function(response) {
$('.modal-title').html(data[0]);
$('.modal-body').html(response.data);
$('#myModal').modal('show');
},
error: function(jqXHR, textStatus, err) {
alert('text status '+textStatus+', err '+err)
}
});
});
$(".delete").click(function(){
data = $(this).attr('id').split("|");
var getUrl = window.location;
path_name = getUrl.pathname.slice(0,-4)+'deletelog';
alert(path_name)
$.ajax({
type: "post",
url: path_name,
data: {'file' : data[0] , 'folder' : data[1]},
success: function(response) {
console.log(response);
location.reload();
},
error: function(jqXHR, textStatus, err) {
alert('text status '+textStatus+', err '+err)
}
});
});
function downloadImage(data,fileName)
{
const base64Image = data; // Replace this with your actual Base64 image data
const downloadLink = document.createElement('a');
downloadLink.href = base64Image;
downloadLink.download = fileName; // Replace with the desired file name and extension
downloadLink.click();
}
</script>
</html>

262
package-lock.json generated
View File

@ -477,6 +477,11 @@
}
}
},
"adler-32": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz",
"integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A=="
},
"agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
@ -564,7 +569,6 @@
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"requires": {
"color-convert": "^2.0.1"
}
@ -584,6 +588,11 @@
"picomatch": "^2.0.4"
}
},
"append-field": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz",
"integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw=="
},
"aproba": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
@ -827,6 +836,19 @@
"resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
"integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk="
},
"buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
},
"busboy": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
"integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==",
"requires": {
"streamsearch": "^1.1.0"
}
},
"bytes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
@ -880,6 +902,15 @@
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
},
"cfb": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz",
"integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
"requires": {
"adler-32": "~1.3.0",
"crc-32": "~1.2.0"
}
},
"chalk": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
@ -964,6 +995,11 @@
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
"optional": true
},
"codepage": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
"integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA=="
},
"color": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/color/-/color-3.0.0.tgz",
@ -992,7 +1028,6 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
@ -1043,6 +1078,33 @@
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"concat-stream": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
"requires": {
"buffer-from": "^1.0.0",
"inherits": "^2.0.3",
"readable-stream": "^2.2.2",
"typedarray": "^0.0.6"
},
"dependencies": {
"readable-stream": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
}
}
},
"configstore": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz",
@ -1100,6 +1162,11 @@
"vary": "^1"
}
},
"crc-32": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ=="
},
"crypto-random-string": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz",
@ -1233,6 +1300,14 @@
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"ejs": {
"version": "3.1.9",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.9.tgz",
"integrity": "sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ==",
"requires": {
"jake": "^10.8.5"
}
},
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
@ -1362,9 +1437,9 @@
"integrity": "sha512-MMMQ0ludy/nBs1/o0zVOiKTpG7qMbonKUzjJgQFEuvq6INZ1OraKPRAWkBq5vlKLOUMpmNYG1JoN3oDPUQ9m3Q=="
},
"fibers": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/fibers/-/fibers-5.0.0.tgz",
"integrity": "sha512-UpGv/YAZp7mhKHxDvC1tColrroGRX90sSvh8RMZV9leo+e5+EkRVgCEZPlmXeo3BUNQTZxUaVdLskq1Q2FyCPg==",
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/fibers/-/fibers-5.0.3.tgz",
"integrity": "sha512-/qYTSoZydQkM21qZpGLDLuCq8c+B8KhuCQ1kLPvnRNhxhVbvrpmH9l2+Lblf5neDuEsY4bfT7LeO553TXQDvJw==",
"requires": {
"detect-libc": "^1.0.3"
}
@ -1377,6 +1452,32 @@
"moment": "^2.11.2"
}
},
"filelist": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
"integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==",
"requires": {
"minimatch": "^5.0.1"
},
"dependencies": {
"brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"requires": {
"balanced-match": "^1.0.0"
}
},
"minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"requires": {
"brace-expansion": "^2.0.1"
}
}
}
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
@ -1435,11 +1536,21 @@
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="
},
"frac": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA=="
},
"fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"fs": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
"integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
},
"fs-constants": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
@ -1881,6 +1992,54 @@
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
"jake": {
"version": "10.8.7",
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz",
"integrity": "sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w==",
"requires": {
"async": "^3.2.3",
"chalk": "^4.0.2",
"filelist": "^1.0.4",
"minimatch": "^3.1.2"
},
"dependencies": {
"async": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
},
"minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"requires": {
"brace-expansion": "^1.1.7"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"js-yaml": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
@ -2220,6 +2379,21 @@
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"mkdirp": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
"integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
"requires": {
"minimist": "^1.2.6"
},
"dependencies": {
"minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="
}
}
},
"mkdirp-classic": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
@ -2286,6 +2460,20 @@
}
}
},
"multer": {
"version": "1.4.5-lts.1",
"resolved": "https://registry.npmjs.org/multer/-/multer-1.4.5-lts.1.tgz",
"integrity": "sha512-ywPWvcDMeH+z9gQq5qYHCCy+ethsk4goepZ45GLD63fOu0YcNecQxi64nDs3qluZB+murG3/D4dJ7+dGctcCQQ==",
"requires": {
"append-field": "^1.0.0",
"busboy": "^1.0.0",
"concat-stream": "^1.5.2",
"mkdirp": "^0.5.4",
"object-assign": "^4.1.1",
"type-is": "^1.6.4",
"xtend": "^4.0.0"
}
},
"napi-build-utils": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
@ -2480,6 +2668,15 @@
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
},
"path": {
"version": "0.12.7",
"resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
"integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==",
"requires": {
"process": "^0.11.1",
"util": "^0.10.3"
}
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
@ -2899,6 +3096,14 @@
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz",
"integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug=="
},
"ssf": {
"version": "0.11.2",
"resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz",
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
"requires": {
"frac": "~1.1.2"
}
},
"sshpk": {
"version": "1.16.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
@ -2960,6 +3165,11 @@
}
}
},
"streamsearch": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
"integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg=="
},
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
@ -3229,6 +3439,11 @@
"mime-types": "~2.1.24"
}
},
"typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
"integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA=="
},
"typedarray-to-buffer": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
@ -3309,6 +3524,14 @@
"prepend-http": "^2.0.0"
}
},
"util": {
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
"integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
"requires": {
"inherits": "2.0.3"
}
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
@ -3469,6 +3692,16 @@
"@types/node": "*"
}
},
"wmf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw=="
},
"word": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA=="
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
@ -3492,6 +3725,20 @@
"integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==",
"dev": true
},
"xlsx": {
"version": "0.18.5",
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz",
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
"requires": {
"adler-32": "~1.3.0",
"cfb": "~1.2.1",
"codepage": "~1.15.0",
"crc-32": "~1.2.1",
"ssf": "~0.11.2",
"wmf": "~1.0.1",
"word": "~0.3.0"
}
},
"xml2js": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
@ -3516,6 +3763,11 @@
"resolved": "https://registry.npmjs.org/xpath.js/-/xpath.js-1.1.0.tgz",
"integrity": "sha512-jg+qkfS4K8E7965sqaUl8mRngXiKb3WZGfONgE18pr03FUQiuSV6G+Ej4tS55B+rIQSFEIw3phdVAQ4pPqNWfQ=="
},
"xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",

View File

@ -13,16 +13,21 @@
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"dotenv": "^10.0.0",
"ejs": "^3.1.9",
"express": "^4.17.1",
"fs": "0.0.1-security",
"log4js": "^6.3.0",
"mssql": "^7.2.0",
"path": "^0.12.7",
"request": "^2.88.2",
"sequelize": "^6.6.5",
"swagger-jsdoc": "^6.1.0",
"swagger-ui-express": "^4.1.6",
"sync": "^0.2.5",
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.5"
"winston-daily-rotate-file": "^4.5.5",
"multer": "^1.4.5-lts.1",
"xlsx": "^0.18.5"
},
"devDependencies": {
"nodemon": "^2.0.12"

View File

@ -1,6 +1,12 @@
require('dotenv').config();
const express = require('express')
const app = express()
const app = express();
const path = require('path');
// Enable CORS for all routes
const cors = require('cors');
app.use(cors());
//it is used to clear cache
app.use(function(req, res, next) {
res.set("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0")
@ -10,6 +16,9 @@ app.use(function(req, res, next) {
})
const {logMsg} = require('./app/services/logger.js');
app.set('views', path.join(__dirname, 'app\\views'));
app.set('view engine', 'ejs');
const swaggerJsdoc = require('swagger-jsdoc');
const swaggerUi = require('swagger-ui-express');
@ -59,4 +68,5 @@ app.listen({ port: PORT_NUMBER }, async () => {
console.log('Server up on http://localhost:'+PORT_NUMBER)
//await sequelize.authenticate()
})
})