Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Synergy Courses
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Public Documentation
Synergy Courses
Commits
59631fd1
Commit
59631fd1
authored
Jan 30, 2026
by
Natalia Klimova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update route_setting.rst
parent
49508a67
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
152 additions
and
112 deletions
+152
-112
routes/route_setting.rst
routes/route_setting.rst
+152
-112
No files found.
routes/route_setting.rst
View file @
59631fd1
...
...
@@ -423,65 +423,98 @@ counter_number - код поля "Номер заявки"
var result = true;
var message = 'ok';
function getHttpClient(){
function getHttpClient() {
let client = new org.apache.commons.httpclient.HttpClient();
let creds = new org.apache.commons.httpclient.UsernamePasswordCredentials(login, password);
client.getParams().setAuthenticationPreemptive(true);
client.getState().setCredentials(org.apache.commons.httpclient.auth.AuthScope.ANY, creds);
return client;
}
function httpGetMethod(methods, type) {
let client = getHttpClient();
let get = new org.apache.commons.httpclient.methods.GetMethod("http://127.0.0.1:8080/Synergy/" + methods);
let get = new org.apache.commons.httpclient.methods.GetMethod(
"http://127.0.0.1:8080/Synergy/" + methods
);
get.setRequestHeader("Content-type", "application/json");
client.executeMethod(get);
let resp = get.getResponseBodyAsString();
get.releaseConnection();
return type == 'text' ? resp : JSON.parse(resp);
}
function httpPostMethod(methods, params, contentType) {
let client = getHttpClient();
let post = new org.apache.commons.httpclient.methods.PostMethod("http://127.0.0.1:8080/Synergy/" + methods);
if(contentType) post.setRequestBody(JSON.stringify(params));
else for(let key in params) post.addParameter(key, params[key]);
post.setRequestHeader("Content-type", contentType || "application/x-www-form-urlencoded; charset=utf-8");
let post = new org.apache.commons.httpclient.methods.PostMethod(
"http://127.0.0.1:8080/Synergy/" + methods
);
if (contentType) {
post.setRequestBody(JSON.stringify(params));
} else {
for (let key in params) post.addParameter(key, params[key]);
}
post.setRequestHeader(
"Content-type",
contentType || "application/x-www-form-urlencoded; charset=utf-8"
);
let resp = client.executeMethod(post);
if(contentType) resp = JSON.parse(post.getResponseBodyAsString());
if (contentType) {
resp = JSON.parse(post.getResponseBodyAsString());
}
post.releaseConnection();
return resp;
}
function getProcesses(documentID) {
return httpGetMethod("rest/api/workflow/get_execution_process?documentID=" + documentID);
}
function getWorkCompletionData(workID) {
return httpGetMethod("rest/api/workflow/work/get_completion_data?workID=" + workID);
}
function getFormData(asfDataId) {
return httpGetMethod("rest/api/asforms/data/" + asfDataId)
return httpGetMethod("rest/api/asforms/data/" + asfDataId);
}
function mergeFormData function(uuid, data) {
return httpPostMethod("rest/api/asforms/data/merge", {
function mergeFormData(uuid, data) {
return httpPostMethod(
"rest/api/asforms/data/merge",
{
uuid: uuid,
data: data
}, "application/json; charset=utf-8");
},
"application/json; charset=utf-8"
);
}
let UTILS = {
createField: function
(fieldData) {
createField: function
(fieldData) {
let field = {};
for (let key in fieldData) field[key] = fieldData[key];
return field;
},
getValue: function(data, cmpID) {
getValue: function (data, cmpID) {
data = data.data ? data.data : data;
for(let i = 0; i < data.length; i++)
for (let i = 0; i < data.length; i++) {
if (data[i].id === cmpID) return data[i];
}
return null;
},
setValue: function(asfData, cmpID, data) {
setValue: function (asfData, cmpID, data) {
let field = this.getValue(asfData, cmpID);
if(field) {
if (field) {
for (let key in data) {
if
(key === 'id' || key === 'type') continue;
if
(key === 'id' || key === 'type') continue;
field[key] = data[key];
}
return field;
...
...
@@ -493,36 +526,43 @@ counter_number - код поля "Номер заявки"
return field;
}
}
}
};
function processesFilter(processes) {
let result = [];
function search(p) {
p.forEach(function
(x) {
p.forEach(function
(x) {
if (x.typeID == 'ASSIGNMENT_ITEM' && x.finished) result.push(x);
if (x.subProcesses.length > 0) search(x.subProcesses);
});
}
search(processes);
return result.sort(function(a, b) {
return result.sort(function (a, b) {
return new Date(b.finished) - new Date(a.finished);
});
}
try {
let processes = processesFilter(getProcesses(documentID));
if
(!processes.length) throw new Error('Не найденно завершенной работы');
if
(!processes.length) throw new Error('Не найденно завершенной работы');
let resultFormWork = getWorkCompletionData(processes[0].actionID);
if(!resultFormWork || !resultFormWork.result.hasOwnProperty('dataUUID')) throw new Error('Не найдена форма завершения');
if (!resultFormWork || !resultFormWork.result.hasOwnProperty('dataUUID')) {
throw new Error('Не найдена форма завершения');
}
let completionFormData = getFormData(resultFormWork.result.dataUUID);
let newFormData = [];
let matching = [];
//
поля для сопоставления с фз на основную форму
matching.push({from: ‘поле на форме завершения’, to: ‘поле основной формы’
});
//
поля для сопоставления с фз на основную форму
matching.push({ from: 'поле на форме завершения', to: 'поле основной формы'
});
matching.forEach(function (id) {
let fromData = UTILS.getValue(completionFormData, id.from);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment