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
eb762354
Commit
eb762354
authored
Nov 13, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEV] set stauts for all task
parent
d10f97aa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
9 deletions
+60
-9
WrapPeriodJobDto.java
...in/java/pwc/taxtech/atms/dto/vatdto/WrapPeriodJobDto.java
+52
-2
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+4
-2
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+4
-5
No files found.
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/WrapPeriodJobDto.java
View file @
eb762354
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
org.apache.commons.lang3.StringUtils
;
import
pwc.taxtech.atms.common.util.MyAsserts
;
import
pwc.taxtech.atms.entity.Project
;
import
pwc.taxtech.atms.entity.Template
;
...
...
@@ -27,9 +31,8 @@ public class WrapPeriodJobDto {
job
.
setProjectId
(
projectId
);
job
.
setPeriod
(
period
);
job
.
setId
(
UUID
.
randomUUID
().
toString
());
job
.
setStatus
(
STATUS_BEGIN
);
job
.
setCurrentStep
(
STEP_UPDATE_CONFIG
);
setStatus
(
job
,
STEP_UPDATE_CONFIG
,
STATUS_BEGIN
);
StringBuilder
builder
=
new
StringBuilder
(
STEP_UPDATE_CONFIG
);
templates
.
forEach
(
m
->
{
builder
.
append
(
","
).
append
(
m
.
getCode
());
...
...
@@ -38,4 +41,51 @@ public class WrapPeriodJobDto {
job
.
setStepsCode
(
builder
.
toString
());
return
job
;
}
public
static
class
Task
{
String
code
;
String
status
;
}
public
static
List
<
Task
>
fromJson
(
String
taskJson
)
{
return
JSONObject
.
parseArray
(
taskJson
,
Task
.
class
);
}
public
static
String
toJson
(
List
<
Task
>
tasks
)
{
return
JSON
.
toJSONString
(
tasks
);
}
public
static
void
setStatus
(
PeriodJob
periodJob
,
String
code
,
String
status
)
{
List
<
Task
>
list
;
if
(
StringUtils
.
isBlank
(
periodJob
.
getStatus
()))
{
list
=
new
ArrayList
<>();
}
else
{
list
=
fromJson
(
periodJob
.
getStatus
());
}
Task
t
=
new
Task
();
t
.
code
=
code
;
t
.
status
=
status
;
boolean
contains
=
false
;
for
(
Task
m
:
list
)
{
if
(
m
.
code
.
equals
(
t
.
code
))
{
m
.
status
=
status
;
contains
=
true
;
break
;
}
}
if
(!
contains
)
list
.
add
(
t
);
periodJob
.
setStatus
(
toJson
(
list
));
}
public
static
void
setStatus
(
PeriodJob
periodJob
,
String
status
)
{
List
<
Task
>
list
;
if
(
StringUtils
.
isBlank
(
periodJob
.
getStatus
()))
{
list
=
new
ArrayList
<>();
}
else
{
list
=
fromJson
(
periodJob
.
getStatus
());
}
list
.
get
(
list
.
size
()-
1
).
status
=
status
;
periodJob
.
setStatus
(
toJson
(
list
));
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
eb762354
...
...
@@ -44,6 +44,7 @@ import java.util.stream.Collectors;
import
static
pwc
.
taxtech
.
atms
.
common
.
util
.
SpringContextUtil
.
reportMapper
;
import
static
pwc
.
taxtech
.
atms
.
constant
.
Constant
.
EMPTY
;
import
static
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
WrapPeriodJobDto
.*;
@Component
public
class
ReportGeneratorImpl
{
...
...
@@ -93,7 +94,7 @@ public class ReportGeneratorImpl {
Sheet
sheet
=
workbook
.
getSheetAt
(
i
);
String
code
=
sheet
.
getSheetName
();
logger
.
info
(
"-------------------------------------Begin Job [{}]------------------------------------------------------"
,
code
);
job
.
setCurrentStep
(
code
);
setStatus
(
job
,
code
,
STATUS_BEGIN
);
periodJobMapper
.
updateByPrimaryKey
(
job
);
Optional
<
PeriodTemplate
>
periodTemplate
=
resources
.
getPeriodTemplates
().
stream
()
...
...
@@ -385,7 +386,8 @@ public class ReportGeneratorImpl {
}
}
}
setStatus
(
job
,
code
,
STATUS_END
);
periodJobMapper
.
updateByPrimaryKey
(
job
);
logger
.
info
(
"-------------------------------------End Job [{}]------------------------------------------------------"
,
code
);
}
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
eb762354
...
...
@@ -42,6 +42,8 @@ import java.util.regex.Matcher;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
import
static
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
WrapPeriodJobDto
.*;
@Component
public
class
ReportServiceImpl
{
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ReportServiceImpl
.
class
);
...
...
@@ -476,6 +478,7 @@ public class ReportServiceImpl {
try
{
updateConfig
(
projectId
,
periodParam
,
isMergeManualData
,
templates
,
genJob
);
setStatus
(
genJob
,
STEP_UPDATE_CONFIG
,
STATUS_END
);
PeriodResources
resources
=
reportGenerator
.
getPeriodResources
(
projectId
,
periodParam
,
templates
.
stream
().
map
(
Template:
:
getId
).
collect
(
Collectors
.
toList
()));
...
...
@@ -489,12 +492,8 @@ public class ReportServiceImpl {
evaluator
.
evaluateAll
();
reportGenerator
.
updateWorkbookCaclsValueToDb
(
projectId
,
periodParam
,
workbook
,
resources
,
isMergeManualData
,
genJob
);
genJob
.
setStatus
(
WrapPeriodJobDto
.
STATUS_END
);
periodJobMapper
.
updateByPrimaryKey
(
genJob
);
}
catch
(
Exception
e
)
{
genJob
.
setStatus
(
WrapPeriodJobDto
.
STATUS_ERROR
);
setStatus
(
genJob
,
STATUS_ERROR
);
genJob
.
setErrorMsg
(
"Sever error "
+
e
.
getMessage
());
periodJobMapper
.
updateByPrimaryKey
(
genJob
);
e
.
printStackTrace
();
...
...
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