Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
1af4c042
Commit
1af4c042
authored
Nov 07, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEV] add async js control for gen report data
parent
d9b57f27
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
147 additions
and
21 deletions
+147
-21
vatReportService.js
...rc/main/webapp/app/common/vatservices/vatReportService.js
+9
-3
vat-caculate-data.ctrl.js
...vat/reduction/vat-caculate-data/vat-caculate-data.ctrl.js
+137
-18
vat-caculate-data.html
...pp/vat/reduction/vat-caculate-data/vat-caculate-data.html
+1
-0
No files found.
atms-web/src/main/webapp/app/common/vatservices/vatReportService.js
View file @
1af4c042
...
...
@@ -48,9 +48,15 @@
generate
:
function
(
projectId
,
templateId
,
ifDeleteManualDataSource
,
period
,
generator
)
{
return
$http
.
post
(
'/Report/generate/'
+
projectId
+
'/'
+
templateId
+
'/'
+
ifDeleteManualDataSource
+
'/'
+
period
+
'?generator='
+
generator
,
{},
apiConfig
.
createVat
({
ignoreLoadingBar
:
true
}));
},
generateAll
:
function
(
projectId
,
ifDeleteManualDataSource
,
period
,
generator
)
{
return
$http
.
post
(
'/Report/generateByTotal/'
+
projectId
+
'/'
+
ifDeleteManualDataSource
+
'/'
+
period
+
'?generator='
+
generator
,
{},
apiConfig
.
createVat
({
ignoreLoadingBar
:
true
}));
},
generateAll
:
function
(
projectId
,
isMergeManualDataSource
,
period
,
generator
)
{
return
$http
.
post
(
'/Report/generateByTotal/'
+
projectId
+
'/'
+
isMergeManualDataSource
+
'/'
+
period
+
'?generator='
+
generator
,
{},
apiConfig
.
createVat
({
ignoreLoadingBar
:
true
}));
},
getRunningJob
:
function
(
projectId
,
period
)
{
return
$http
.
get
(
'/Report/getRunningJob/'
+
projectId
+
'/'
+
period
,
apiConfig
.
createVat
());
},
getJobStatus
:
function
(
projectId
,
period
,
jobId
)
{
return
$http
.
get
(
'/Report/getJobStatus/'
+
projectId
+
'/'
+
period
+
'/'
+
jobId
,
apiConfig
.
createVat
());
},
getReportData
:
function
(
reportId
)
{
return
$http
.
get
(
'/Report/reportData/'
+
reportId
,
apiConfig
.
createVat
());
},
...
...
atms-web/src/main/webapp/app/vat/reduction/vat-caculate-data/vat-caculate-data.ctrl.js
View file @
1af4c042
vatModule
.
controller
(
'vatCaculateDataController'
,
[
'$scope'
,
'$log'
,
'$timeout'
,
'$q'
,
'$translate'
,
'loginContext'
,
vatModule
.
controller
(
'vatCaculateDataController'
,
[
'$scope'
,
'$log'
,
'$timeout'
,
'$interval'
,
'$q'
,
'$translate'
,
'loginContext'
,
'apiInterceptor'
,
'Upload'
,
'dataImportService'
,
'SweetAlert'
,
'vatReductionService'
,
'vatSessionService'
,
'uiGridConstants'
,
'enums'
,
'modelConfigurationService'
,
'vatReportService'
,
'vatCommonService'
,
'BSPLService'
,
'vatOperationLogService'
,
'vatWorkflowService'
,
function
(
$scope
,
$log
,
$timeout
,
$q
,
$translate
,
loginContext
,
apiInterceptor
,
Upload
,
dataImportService
,
SweetAlert
,
function
(
$scope
,
$log
,
$timeout
,
$
interval
,
$
q
,
$translate
,
loginContext
,
apiInterceptor
,
Upload
,
dataImportService
,
SweetAlert
,
vatReductionService
,
vatSessionService
,
uiGridConstants
,
enums
,
modelConfigurationService
,
vatReportService
,
vatCommonService
,
BSPLService
,
vatOperationLogService
,
vatWorkflowService
)
{
'use strict'
;
...
...
@@ -11,17 +11,16 @@
var
taskList
=
[];
var
fixedRef
=
[];
$scope
.
period
=
vatSessionService
.
month
;
$scope
.
isMergeManualDataSource
=
false
;
$scope
.
moduleid
=
enums
.
vatModuleEnum
.
Import_CalculateData
;
var
initTasks
=
function
()
{
var
task
=
function
(
id
,
status
,
name
)
{
var
task
=
function
(
id
,
status
,
name
,
code
)
{
this
.
id
=
id
;
this
.
name
=
_
.
isEmpty
(
name
)
?
$translate
.
instant
(
id
)
:
name
;
this
.
status
=
status
;
this
.
text
=
$translate
.
instant
(
status
);
this
.
code
=
code
;
};
task
.
prototype
.
doTask
=
function
()
{
var
_this
=
this
;
...
...
@@ -118,12 +117,12 @@
//}, function () {
// taskError(_this);
//});
vatReportService
.
updateConfig
(
vatSessionService
.
project
.
id
,
true
,
vatSessionService
.
month
,
vatSessionService
.
logUser
.
id
?
vatSessionService
.
logUser
.
id
:
""
,
$scope
.
isMergeManualDataSource
).
success
(
function
(
data
)
{
var
data
=
{
result
:
true
};
updateProgress
(
data
,
_this
);
//
//});
//
vatReportService.updateConfig(vatSessionService.project.id, true, vatSessionService.month,
//
vatSessionService.logUser.id ? vatSessionService.logUser.id : "",
//
$scope.isMergeManualDataSource ).success(function (data) {
//
var data = {result: true};
//
updateProgress(data, _this);
//vatReportService.getTemplateReferences(vatSessionService.month).then(function (refData) {
// if (refData && refData.data) {
// // 初始化resolve列表
...
...
@@ -143,10 +142,10 @@
//}).then(function () {
// updateProgress(data, _this);
//});
}).
error
(
function
()
{
taskError
(
_this
);
});
//
}).error(function () {
//
//
taskError(_this);
//
});
break
;
case
'CalculateKeyValue'
:
//$q.all().then(function () {
...
...
@@ -197,6 +196,7 @@
task
.
prototype
.
id
=
null
;
task
.
prototype
.
status
=
null
;
task
.
prototype
.
text
=
null
;
task
.
prototype
.
code
=
null
;
vatReportService
.
getTemplate
(
vatSessionService
.
project
.
id
,
constant
.
serviceType
.
VAT
,
vatSessionService
.
month
).
then
(
function
(
report
)
{
var
result
=
[];
...
...
@@ -212,7 +212,7 @@
name
:
$translate
.
instant
(
'GenerateReport'
),
isReportTask
:
true
,
items
:
_
.
map
(
report
.
data
.
data
,
function
(
x
)
{
return
new
task
(
x
.
templateId
,
'unstarted'
,
x
.
templateName
);
return
new
task
(
x
.
templateId
,
'unstarted'
,
x
.
templateName
,
x
.
templateCode
);
})
});
...
...
@@ -240,11 +240,12 @@
});
$scope
.
tasks
=
result
;
getInitTaskStatus
();
});
};
function
doStartCaculate
(
isMergeManualDataSource
)
{
$scope
.
isMergeManualDataSource
=
isMergeManualDataSource
;
$scope
.
readonly
=
true
;
$scope
.
resolveRef
.
length
=
0
;
$scope
.
resolveRef
.
push
({
...
...
@@ -276,6 +277,15 @@
// });
}
function
doStartCaculate2
(
isMergeManualDataSource
)
{
vatReportService
.
generateAll
(
vatSessionService
.
project
.
id
,
isMergeManualDataSource
,
vatSessionService
.
month
,
vatSessionService
.
logUser
.
id
?
vatSessionService
.
logUser
.
id
:
""
).
success
(
function
(
data
)
{
if
(
data
&&
data
.
result
)
{
updateTasksStatus
(
data
.
result
.
data
);
}).
error
(
function
()
{
taskError
(
_this
);
});
}
var
startCaculate
=
function
()
{
if
(
vatSessionService
.
project
.
projectStatusList
[
vatSessionService
.
month
]
>=
constant
.
ProjectStatusEnum
.
Generated
)
{
swal
({
...
...
@@ -326,6 +336,57 @@
}
};
var
startCaculate2
=
function
()
{
if
(
vatSessionService
.
project
.
projectStatusList
[
vatSessionService
.
month
]
>=
constant
.
ProjectStatusEnum
.
Generated
)
{
swal
({
title
:
"warning!"
,
text
:
$translate
.
instant
(
'IsConfirmReCalcuate'
).
formatObj
({
status
:
vatCommonService
.
getProjectStautsEnumDesc
(
vatSessionService
.
project
.
projectStatusList
[
vatSessionService
.
month
])}),
type
:
"warning"
,
showCancelButton
:
true
,
confirmButtonColor
:
"#DD6B55"
,
confirmButtonText
:
$translate
.
instant
(
'Yes'
),
cancelButtonText
:
$translate
.
instant
(
'No'
),
closeOnConfirm
:
true
,
closeOnCancel
:
true
},
function
(
isConfirm
)
{
if
(
isConfirm
)
{
vatReportService
.
hasManualDataSource
(
vatSessionService
.
project
.
id
,
vatSessionService
.
month
).
then
(
function
(
hasManual
)
{
if
(
hasManual
){
swal
({
title
:
"warning!"
,
text
:
"是否保留手工数据!"
,
type
:
"warning"
,
showCancelButton
:
true
,
confirmButtonColor
:
"#DD6B55"
,
confirmButtonText
:
$translate
.
instant
(
'Yes'
),
cancelButtonText
:
$translate
.
instant
(
'No'
),
closeOnConfirm
:
true
,
closeOnCancel
:
true
},
function
(
isConfirm
)
{
if
(
isConfirm
)
{
doStartCaculate2
(
true
);
}
else
{
doStartCaculate2
(
false
);
}
});
}
else
{
doStartCaculate2
(
false
);
}
});
}
else
{
swal
.
close
();
}
});
}
else
{
doStartCaculate2
(
false
);
}
};
var
caculateProgress
=
function
(
task
)
{
var
completedCnt
=
taskList
.
filter
(
function
(
t
)
{
...
...
@@ -464,9 +525,66 @@
logDto
.
OperationType
=
enums
.
vatLogOperationTypeEnum
.
CalculateData
;
logDto
.
UpdateState
=
status
==
null
?
''
:
status
;
vatOperationLogService
.
addOperationLog
(
logDto
);
};
var
updateTasksStatus
=
function
(
job
){
if
((
job
).
currentStep
==
'UpdateConfig'
){
$scope
.
tasks
[
0
].
items
[
0
].
status
=
'processing'
;
}
else
{
$scope
.
tasks
[
0
].
items
[
0
].
status
=
'completed'
;
var
items
=
$scope
.
tasks
[
1
].
items
;
var
currentIndex
=
0
;
items
.
forEach
(
function
(
item
,
index
){
if
((
job
).
currentStep
==
item
.
code
){
currentIndex
=
index
;
}
});
items
.
forEach
(
function
(
item
,
index
){
if
(
index
<
currentIndex
){
item
.
status
=
'completed'
;
}
else
if
(
index
==
currentIndex
){
if
((
job
).
status
==
'Error'
){
item
.
status
=
'error'
;
}
else
if
(
result
.
data
.
status
==
'End'
){
item
.
status
=
'completed'
;
if
(
$scope
.
timer
){
$interval
.
cancel
(
$scope
.
timer
);
}
}
else
if
(
result
.
data
.
status
==
'Begin'
){
item
.
status
=
'processing'
;
}
}
});
}
}
var
getInitTaskStatus
=
function
(){
vatReportService
.
getRunningJob
(
vatSessionService
.
project
.
id
,
vatSessionService
.
month
).
then
(
function
(
result
)
{
if
(
result
.
data
&&
result
.
status
==
200
){
updateTasksStatus
(
result
.
data
);
if
(
result
.
data
.
status
==
'Begin'
){
$scope
.
timer
=
$interval
(
function
(){
vatReportService
.
getJobStatus
(
vatSessionService
.
project
.
id
,
vatSessionService
.
month
,
jobId
,
id
).
then
(
function
(
result
){
if
(
result
.
data
&&
result
.
status
==
200
){
updateTasksStatus
(
result
.
data
);
}
});
},
1000
);
}
}
else
{
$log
.
debug
(
"not running job"
);
}
});
}
var
var
sendMessage
=
function
(
task
)
{
var
msgDto
=
{};
msgDto
.
projectId
=
vatSessionService
.
project
.
id
;
...
...
@@ -494,6 +612,7 @@
$scope
.
resolveRef
=
[];
initTasks
();
$scope
.
startCaculate
=
startCaculate
;
$scope
.
startCaculate2
=
startCaculate2
;
})();
}
...
...
atms-web/src/main/webapp/app/vat/reduction/vat-caculate-data/vat-caculate-data.html
View file @
1af4c042
...
...
@@ -3,6 +3,7 @@
<div
class=
"vat-caculate-data-title"
ng-if=
"tasks.length > 0"
>
<!--<span translate="vatCaculateDataDesc"></span>-->
<button
class=
"btn btn-vat-primary"
translate=
"startCaculateData"
ng-disabled=
"readonly"
ng-click=
"startCaculate()"
></button>
<button
class=
"btn btn-vat-primary"
translate=
"startCaculateData"
ng-disabled=
"readonly"
ng-click=
"startCaculate2()"
></button>
<span
ng-click=
"showOperateLogPop()"
><i
class=
"fa fa-file-excel-o"
aria-hidden=
"true"
></i>
{{'Remarks' | translate}}
</span>
</div>
...
...
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