Surya: merge
This commit is contained in:
parent
a1b71ab08f
commit
f921b47917
@ -4,8 +4,9 @@
|
||||
|
||||
|
||||
|
||||
const {sequelize , Statementsmaster ,Sectionsmaster , Subsectionsmaster,Itemsmaster ,Fin_remarks,Fin_masters_history,Statement_type,Entityfinyears} = require('../models')
|
||||
const {Entities,sequelize , Statementsmaster ,Sectionsmaster , Subsectionsmaster,Itemsmaster ,Fin_remarks,Fin_masters_history,Statement_type,Entityfinyears} = require('../models')
|
||||
const { logMsg } = require('../services/logger.js');
|
||||
const camundaHelper = require('../services/camunda.helper.js');
|
||||
|
||||
|
||||
//statementmaster
|
||||
@ -469,6 +470,92 @@ exports.Statementtype_insert = (req, res) => {
|
||||
|
||||
|
||||
|
||||
// API: Cheker Complete
|
||||
|
||||
|
||||
exports.MakerSubmit = (req, res) => {
|
||||
const req_data = req.body;
|
||||
try
|
||||
{
|
||||
const losid = req_data.losid;
|
||||
const pan = req_data.pan;
|
||||
const cin = req_data.cin;
|
||||
Entities.findOne({where : { losid : losid,pan : pan,cin : cin },attributes: [ 'id','process_instance_id'] })
|
||||
.then(data => {
|
||||
console.log(data.dataValues.process_instance_id)
|
||||
|
||||
const processInstanceId = data.dataValues.process_instance_id;
|
||||
|
||||
task_id = camundaHelper.financialsListOfProcessInstances(processInstanceId);
|
||||
console.log(task_id)
|
||||
setTimeout(()=>{
|
||||
makercomplete_status = camundaHelper.financialsTaskComplete(task_id);
|
||||
},1000)
|
||||
});
|
||||
|
||||
res.send({'status':200,'message':"success",'data':"No data"});
|
||||
logMsg.info("Cheker Completed Success");
|
||||
}
|
||||
catch(err) {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while Cheker Complete." ,'data': "No data"
|
||||
}); }
|
||||
|
||||
};
|
||||
|
||||
exports.camunda = async (req, res) => {
|
||||
const losid = req.query.losid;
|
||||
try
|
||||
{
|
||||
const losid = "fb37c1e4-271e-11ec-a4f4-42010a800002";
|
||||
const cin = "test";
|
||||
const user = "test";
|
||||
|
||||
|
||||
instancesid = "33f6a13d-272f-11ec-a4f4-42010a800002";
|
||||
taskid = camundaHelper.financialsListOfProcessInstances(instancesid);
|
||||
res.send({'status':200,'message':"success",'data':"No data"});
|
||||
logMsg.info("Cheker Completed Success");
|
||||
}
|
||||
catch(err) {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while Cheker Complete." ,'data': "No data"
|
||||
}); }
|
||||
|
||||
};
|
||||
|
||||
exports.test = (req, res) => {
|
||||
|
||||
try
|
||||
{
|
||||
const processInstanceId = "fb2b8cd9-271e-11ec-a4f4-42010a800002";
|
||||
|
||||
task_id = camundaHelper.financialsListOfProcessInstances(processInstanceId);
|
||||
|
||||
res.send({'status':200,'message':"success",'data':"No data"});
|
||||
logMsg.info("Cheker Completed Success");
|
||||
}
|
||||
catch(err) {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while Cheker Complete." ,'data': "No data"
|
||||
}); }
|
||||
|
||||
};
|
||||
|
||||
const doWorkPromise = new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve([7, 4, 1])
|
||||
// reject('Things went wrong!')
|
||||
}, 2000)
|
||||
})
|
||||
|
||||
doWorkPromise.then((result) => {
|
||||
console.log('Success!', result)
|
||||
}).catch((error) => {
|
||||
console.log('Error!', error)
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -250,7 +250,7 @@ exports.test = (req, res) => {
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
exports.test2 = async (req, res) => {
|
||||
const losid = req.query.losid
|
||||
|
||||
@ -263,6 +263,7 @@ exports.test = (req, res) => {
|
||||
// p1(losid).then((losid) => {
|
||||
|
||||
promise(losid).then((losid) => {
|
||||
|
||||
console.log(losid)
|
||||
//pro 42 api call using losid
|
||||
const Pro42Data = [
|
||||
@ -332,7 +333,7 @@ exports.test = (req, res) => {
|
||||
|
||||
}) // end of pro42 data foreach
|
||||
|
||||
return ({'losid':losid,'status':200,'message':"success",'data':"No data"}); // success message
|
||||
return ({'losid':losid,'status':201,'message':"success",'data':"No data"}); // success message
|
||||
//end of try catch
|
||||
|
||||
|
||||
@ -342,9 +343,9 @@ exports.test = (req, res) => {
|
||||
//.then((value) => {
|
||||
.then(function(value){
|
||||
// writeToBody(topic);
|
||||
console.log(value)
|
||||
|
||||
setTimeout(function(){
|
||||
console.log(value)
|
||||
|
||||
try {
|
||||
|
||||
if(value.status == 200)
|
||||
@ -382,7 +383,7 @@ exports.test = (req, res) => {
|
||||
console.log(data)
|
||||
logMsg.info("MenuList api working")
|
||||
Promise.resolve(res.send({'losid':losid,'status':200,'message':"success",'data':data}))
|
||||
return (data);
|
||||
// return (data);
|
||||
}); // end of findall EntitiesData
|
||||
}); // end of findall masters datas
|
||||
} // end of starter function if condition
|
||||
|
||||
@ -842,8 +842,9 @@ module.exports = app => {
|
||||
* description: success
|
||||
*/
|
||||
router.get("/Historyapi", master.Historyapi);
|
||||
|
||||
router.get("/test2", test.test2);
|
||||
router.post("/MakerSubmit", master.MakerSubmit);
|
||||
router.post("/doWorkPromise", master.doWorkPromise);
|
||||
router.get("/test", master.test);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ const URL = process.env.CAMUNDA_URL
|
||||
"user":{"value": user }
|
||||
},"businessKey": businessKey
|
||||
};
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: start_url,
|
||||
method: "POST",
|
||||
@ -23,9 +24,10 @@ const URL = process.env.CAMUNDA_URL
|
||||
}, function (error, response, body){
|
||||
let data = body;
|
||||
instancesid = data.id;
|
||||
return instancesid;
|
||||
resolve(instancesid);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
@ -33,12 +35,13 @@ const URL = process.env.CAMUNDA_URL
|
||||
}
|
||||
}
|
||||
|
||||
function financialsListOfProcessInstances(instancesid)
|
||||
function financialsListOfProcessInstances(instancesid,req,res)
|
||||
{
|
||||
try
|
||||
{
|
||||
const task_id_url = URL+"task";
|
||||
const myJSONObject = { "processInstanceIdIn":[instancesid] };
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: task_id_url,
|
||||
method: "POST",
|
||||
@ -46,10 +49,11 @@ const URL = process.env.CAMUNDA_URL
|
||||
body: myJSONObject
|
||||
}, function (error, response, body){
|
||||
let data = body;
|
||||
task_id =data[0].id;
|
||||
return task_id;
|
||||
task_id = data[0].id;
|
||||
resolve(task_id);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
@ -86,12 +90,15 @@ const URL = process.env.CAMUNDA_URL
|
||||
try
|
||||
{
|
||||
const form_variable_url = URL+"task/"+taskid+"/form-variables";
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: form_variable_url,
|
||||
method: "GET"
|
||||
}, function (error, response, body){
|
||||
|
||||
return body;
|
||||
resolve(body);
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user