Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
Import registry records
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
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
develop
Import registry records
Commits
baa12c9e
Commit
baa12c9e
authored
Jul 21, 2020
by
Alina Habibulina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] работа над прогресс баром
parent
55dc8b47
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
122 additions
and
61 deletions
+122
-61
src/main/java/kz/arta/ext/sap/service/UnsecuredProxyService.java
...n/java/kz/arta/ext/sap/service/UnsecuredProxyService.java
+4
-0
src/main/java/kz/arta/ext/sap/util/ImportBean.java
src/main/java/kz/arta/ext/sap/util/ImportBean.java
+1
-2
src/main/webapp/index.html
src/main/webapp/index.html
+16
-8
src/main/webapp/index.js
src/main/webapp/index.js
+101
-51
No files found.
src/main/java/kz/arta/ext/sap/service/UnsecuredProxyService.java
View file @
baa12c9e
...
...
@@ -80,6 +80,10 @@ public class UnsecuredProxyService {
try
{
if
(
formcode
==
null
||
registryCode
==
null
){
return
Response
.
status
(
Response
.
Status
.
BAD_REQUEST
).
entity
(
"You need to enter \"formcode\" and \"registrycode\" params"
).
build
();
}
String
auth
=
req
.
getHeader
(
"Authorization"
);
auth
=
auth
.
replace
(
"Basic "
,
""
);
String
decoded
=
new
String
(
Base64
.
decode
(
auth
));
...
...
src/main/java/kz/arta/ext/sap/util/ImportBean.java
View file @
baa12c9e
...
...
@@ -64,7 +64,6 @@ public class ImportBean {
}
}
if
(
searchString
!=
null
&&
!
searchString
.
equals
(
"none"
)){
String
[]
ss
=
searchString
.
split
(
", "
);
for
(
int
i
=
0
;
i
<
ss
.
length
;
i
++){
...
...
@@ -359,7 +358,7 @@ public class ImportBean {
}
if
(
rowFF
!=
null
&&
!
rowFF
.
isEmpty
())
{
String
data
=
formateRequestData
(
rowFF
,
registryCode
);
String
data
=
formateRequestData
(
rowFF
,
registryCode
);
String
answer
=
HTTPRequestUtils
.
sendPost
(
BASE_URL
+
"rest/api/registry/create_doc_rcc"
,
data
,
login
,
password
);
JsonParser
answrPars
=
new
JsonParser
();
JsonElement
jsonAnswr
=
answrPars
.
parse
(
answer
);
...
...
src/main/webapp/index.html
View file @
baa12c9e
...
...
@@ -63,13 +63,6 @@
<div
class=
"uk-text-large"
style=
"width: 100%; text-align: center;"
>
Импорт файлов
</div>
<div
id=
"my-id"
uk-modal
>
<div
class=
"uk-modal-dialog uk-modal-body"
>
<h2
class=
"uk-modal-title"
></h2>
<button
class=
"uk-modal-close"
type=
"button"
></button>
</div>
</div>
<div
class=
"wrapper"
>
<div
class=
"settings"
>
<div
class=
"uk-text-large"
style=
"width: 100%; text-align: center;"
>
Настройки
</div>
...
...
@@ -106,7 +99,22 @@
<button
class=
"uk-button uk-button-default"
type=
"button"
tabindex=
"-1"
>
Выбрать файл
</button>
</div>
<button
id=
"start_import"
style=
"width: 250px;"
class=
"uk-button uk-button-default"
>
Импортировать
</button>
<button
class=
"uk-button uk-button-default start_import"
style=
"width: 250px;"
>
Импортировать
</button>
<div
id=
"modal-center"
class=
"uk-flex-top"
uk-modal
>
<div
class=
"uk-modal-dialog uk-modal-body uk-margin-auto-vertical"
>
<button
class=
"uk-modal-close-default"
type=
"button"
uk-close
></button>
<div
class=
"uk-form-label"
>
Прогресс импорта записей:
</div>
<progress
id=
"js-progressbar"
class=
"uk-progress"
value=
"0"
max=
"100"
></progress>
<div
class=
"uk-form-label"
>
Сообщения и ошибки:
</div>
<div
class=
"uk-margin"
>
<textarea
class=
"uk-textarea"
id=
"errors-area"
rows=
"8"
placeholder=
"..."
></textarea>
</div>
</div>
</div>
<span
id=
"spin"
uk-spinner=
"ratio: 4.5"
></span>
...
...
src/main/webapp/index.js
View file @
baa12c9e
var
isInProcess
=
false
;
function
showProcess
(
firstmessage
,
iserror
){
UIkit
.
modal
(
$
(
"
#modal-center
"
)).
alert
.
show
();
if
(
firstmessage
)
$
(
"
#errors-area
"
).
val
(
firstmessage
);
if
(
!
iserror
){
//отправляем запрос за прогрессом и возникшими ошибками каждые n секунд, пока прогресс обработки записей не достигнет 100%
var
persentage
=
0
;
do
{
$
.
ajax
({
url
:
window
.
location
.
origin
+
"
/import/api/registry/import_file?formcode=
"
+
formCode
+
"
®istrycode=
"
+
regCode
+
"
&activate=
"
+
isActivate
+
"
&action=
"
+
action
+
"
&defaultValue=
"
+
defaultValue
+
"
&searchString=
"
+
searchString
+
"
&shouldPasteMeaningValue=
"
+
shouldPasteMeaningValue
,
data
:
fd
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"
Authorization
"
,
"
Basic
"
+
btoa
(
log
+
"
:
"
+
pass
));
},
processData
:
false
,
contentType
:
false
,
type
:
'
POST
'
,
success
:
function
(
data
)
{
$
(
"
#spin
"
).
hide
();
showProcess
(
data
.
toString
());
isInProcess
=
true
;
},
error
:
function
(
error
)
{
$
(
"
#spin
"
).
hide
();
showProcess
(
"
Импорт не начался в связи с ощибкой:
"
+
error
.
responseText
);
isInProcess
=
false
;
}
});
}
while
(
percentage
!==
100
);
}
};
$
(
document
).
ready
(
function
(){
$
(
"
#spin
"
).
hide
();
...
...
@@ -19,65 +59,75 @@ $(document).ready(function(){
});
$
(
"
#instructions-button
"
).
click
(
function
(){
if
(
$
(
"
#instructions-block
"
).
hasClass
(
"
ib-open
"
)){
$
(
"
#instructions-block
"
).
removeClass
(
"
ib-open
"
);
$
(
"
#instructions-block
"
).
addClass
(
"
ib-close
"
);
var
instblock
=
$
(
"
#instructions-block
"
);
if
(
instblock
.
hasClass
(
"
ib-open
"
)){
instblock
.
removeClass
(
"
ib-open
"
);
instblock
.
addClass
(
"
ib-close
"
);
}
else
{
$
(
"
#instructions-block
"
)
.
removeClass
(
"
ib-close
"
);
$
(
"
#instructions-block
"
)
.
addClass
(
"
ib-open
"
);
instblock
.
removeClass
(
"
ib-close
"
);
instblock
.
addClass
(
"
ib-open
"
);
}
});
$
(
"
#
start_import
"
).
click
(
function
(){
$
(
"
.
start_import
"
).
click
(
function
(){
$
(
"
#spin
"
).
show
();
var
formCode
=
$
(
"
#formCode
"
).
val
();
var
regCode
=
$
(
"
#registryCode
"
).
val
();
var
log
=
$
(
"
#login
"
).
val
();
var
pass
=
$
(
"
#password
"
).
val
();
var
action
=
$
(
'
input[name=radio1]:checked
'
).
val
();
var
defaultValue
=
$
(
'
#default-value
'
).
val
();
var
searchString
=
$
(
'
#search-value
'
).
val
();
var
shouldPasteMeaningValue
=
$
(
'
#shouldPasteMeaningValue
'
).
is
(
'
:checked
'
);
if
(
!
defaultValue
){
defaultValue
=
"
none
"
;
}
if
(
!
searchString
){
searchString
=
"
none
"
;
}
if
(
isInProcess
){
showProcess
();
}
else
{
var
formCode
=
$
(
"
#formCode
"
).
val
();
var
regCode
=
$
(
"
#registryCode
"
).
val
();
if
(
!
formCode
||
!
regCode
){
UIkit
.
modal
.
alert
(
"
Необходимо ввести код формы и код реестра!
"
);
}
else
{
var
log
=
$
(
"
#login
"
).
val
();
var
pass
=
$
(
"
#password
"
).
val
();
var
action
=
$
(
'
input[name=radio1]:checked
'
).
val
();
var
defaultValue
=
$
(
'
#default-value
'
).
val
();
var
searchString
=
$
(
'
#search-value
'
).
val
();
var
shouldPasteMeaningValue
=
$
(
'
#shouldPasteMeaningValue
'
).
is
(
'
:checked
'
);
if
(
!
defaultValue
)
{
defaultValue
=
"
none
"
;
}
if
(
!
searchString
)
{
searchString
=
"
none
"
;
}
var
isActivate
=
$
(
"
#activate
"
).
is
(
'
:checked
'
);
var
file
=
$
(
"
#fileinpt
"
);
var
fd
=
new
FormData
;
fd
.
append
(
'
file
'
,
file
.
prop
(
'
files
'
)[
0
]);
$
.
ajax
({
url
:
window
.
location
.
origin
+
"
/import/api/registry/import_file?formcode=
"
+
formCode
+
"
®istrycode=
"
+
regCode
+
"
&activate=
"
+
isActivate
+
"
&action=
"
+
action
+
"
&defaultValue=
"
+
defaultValue
+
"
&searchString=
"
+
searchString
+
"
&shouldPasteMeaningValue=
"
+
shouldPasteMeaningValue
,
data
:
fd
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"
Authorization
"
,
"
Basic
"
+
btoa
(
log
+
"
:
"
+
pass
));
},
processData
:
false
,
contentType
:
false
,
type
:
'
POST
'
,
success
:
function
(
data
)
{
$
(
"
#spin
"
).
hide
();
showProcess
(
data
.
toString
());
isInProcess
=
true
;
},
error
:
function
(
error
)
{
$
(
"
#spin
"
).
hide
();
showProcess
(
"
Импорт не начался в связи с ощибкой:
"
+
error
.
responseText
);
isInProcess
=
false
;
}
});
var
isActivate
=
$
(
"
#activate
"
).
is
(
'
:checked
'
);
var
file
=
$
(
"
#fileinpt
"
);
var
fd
=
new
FormData
;
fd
.
append
(
'
file
'
,
file
.
prop
(
'
files
'
)[
0
]);
$
.
ajax
({
url
:
window
.
location
.
origin
+
"
/import/api/registry/import_file?formcode=
"
+
formCode
+
"
®istrycode=
"
+
regCode
+
"
&activate=
"
+
isActivate
+
"
&action=
"
+
action
+
"
&defaultValue=
"
+
defaultValue
+
"
&searchString=
"
+
searchString
+
"
&shouldPasteMeaningValue=
"
+
shouldPasteMeaningValue
,
data
:
fd
,
beforeSend
:
function
(
xhr
)
{
xhr
.
setRequestHeader
(
"
Authorization
"
,
"
Basic
"
+
btoa
(
log
+
"
:
"
+
pass
));
},
processData
:
false
,
contentType
:
false
,
type
:
'
POST
'
,
success
:
function
(
data
)
{
$
(
"
#spin
"
).
hide
();
alert
(
data
.
toString
());
},
error
:
function
(
error
)
{
$
(
"
#spin
"
).
hide
();
alert
(
error
.
responseText
);
}
});
}
});
});
...
...
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