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 { logMsg } = require('../services/logger.js');
|
||||||
|
const camundaHelper = require('../services/camunda.helper.js');
|
||||||
|
|
||||||
|
|
||||||
//statementmaster
|
//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) => {
|
exports.test2 = async (req, res) => {
|
||||||
const losid = req.query.losid
|
const losid = req.query.losid
|
||||||
|
|
||||||
@ -263,6 +263,7 @@ exports.test = (req, res) => {
|
|||||||
// p1(losid).then((losid) => {
|
// p1(losid).then((losid) => {
|
||||||
|
|
||||||
promise(losid).then((losid) => {
|
promise(losid).then((losid) => {
|
||||||
|
|
||||||
console.log(losid)
|
console.log(losid)
|
||||||
//pro 42 api call using losid
|
//pro 42 api call using losid
|
||||||
const Pro42Data = [
|
const Pro42Data = [
|
||||||
@ -332,7 +333,7 @@ exports.test = (req, res) => {
|
|||||||
|
|
||||||
}) // end of pro42 data foreach
|
}) // 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
|
//end of try catch
|
||||||
|
|
||||||
|
|
||||||
@ -342,9 +343,9 @@ exports.test = (req, res) => {
|
|||||||
//.then((value) => {
|
//.then((value) => {
|
||||||
.then(function(value){
|
.then(function(value){
|
||||||
// writeToBody(topic);
|
// writeToBody(topic);
|
||||||
console.log(value)
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
console.log(value)
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(value.status == 200)
|
if(value.status == 200)
|
||||||
@ -382,7 +383,7 @@ exports.test = (req, res) => {
|
|||||||
console.log(data)
|
console.log(data)
|
||||||
logMsg.info("MenuList api working")
|
logMsg.info("MenuList api working")
|
||||||
Promise.resolve(res.send({'losid':losid,'status':200,'message':"success",'data':data}))
|
Promise.resolve(res.send({'losid':losid,'status':200,'message':"success",'data':data}))
|
||||||
return (data);
|
// return (data);
|
||||||
}); // end of findall EntitiesData
|
}); // end of findall EntitiesData
|
||||||
}); // end of findall masters datas
|
}); // end of findall masters datas
|
||||||
} // end of starter function if condition
|
} // end of starter function if condition
|
||||||
|
|||||||
@ -842,8 +842,9 @@ module.exports = app => {
|
|||||||
* description: success
|
* description: success
|
||||||
*/
|
*/
|
||||||
router.get("/Historyapi", master.Historyapi);
|
router.get("/Historyapi", master.Historyapi);
|
||||||
|
router.post("/MakerSubmit", master.MakerSubmit);
|
||||||
router.get("/test2", test.test2);
|
router.post("/doWorkPromise", master.doWorkPromise);
|
||||||
|
router.get("/test", master.test);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@ const URL = process.env.CAMUNDA_URL
|
|||||||
"user":{"value": user }
|
"user":{"value": user }
|
||||||
},"businessKey": businessKey
|
},"businessKey": businessKey
|
||||||
};
|
};
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
request({
|
request({
|
||||||
url: start_url,
|
url: start_url,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@ -23,9 +24,10 @@ const URL = process.env.CAMUNDA_URL
|
|||||||
}, function (error, response, body){
|
}, function (error, response, body){
|
||||||
let data = body;
|
let data = body;
|
||||||
instancesid = data.id;
|
instancesid = data.id;
|
||||||
return instancesid;
|
resolve(instancesid);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (error)
|
catch (error)
|
||||||
{
|
{
|
||||||
@ -33,23 +35,25 @@ const URL = process.env.CAMUNDA_URL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function financialsListOfProcessInstances(instancesid)
|
function financialsListOfProcessInstances(instancesid,req,res)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const task_id_url = URL+"task";
|
const task_id_url = URL+"task";
|
||||||
const myJSONObject = { "processInstanceIdIn":[instancesid] };
|
const myJSONObject = { "processInstanceIdIn":[instancesid] };
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
request({
|
request({
|
||||||
url: task_id_url,
|
url: task_id_url,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
json: true,
|
json: true,
|
||||||
body: myJSONObject
|
body: myJSONObject
|
||||||
}, function (error, response, body){
|
}, function (error, response, body){
|
||||||
let data = body;
|
let data = body;
|
||||||
task_id =data[0].id;
|
task_id = data[0].id;
|
||||||
return task_id;
|
resolve(task_id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (error)
|
catch (error)
|
||||||
{
|
{
|
||||||
@ -86,13 +90,16 @@ const URL = process.env.CAMUNDA_URL
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
const form_variable_url = URL+"task/"+taskid+"/form-variables";
|
const form_variable_url = URL+"task/"+taskid+"/form-variables";
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
request({
|
request({
|
||||||
url: form_variable_url,
|
url: form_variable_url,
|
||||||
method: "GET"
|
method: "GET"
|
||||||
}, function (error, response, body){
|
}, function (error, response, body){
|
||||||
|
|
||||||
return body;
|
resolve(body);
|
||||||
});
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (error)
|
catch (error)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user