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
abb89b56
Commit
abb89b56
authored
Nov 06, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[optimize] fixed gen all report data
parent
8541823a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
35 deletions
+61
-35
MyAsserts.java
...src/main/java/pwc/taxtech/atms/common/util/MyAsserts.java
+8
-0
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+0
-0
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+34
-35
FormulaContext.java
...tms/vat/service/impl/report/functions/FormulaContext.java
+19
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/util/MyAsserts.java
View file @
abb89b56
...
...
@@ -41,4 +41,12 @@ public class MyAsserts {
public
static
void
assertEmpty
(
Collection
obj
,
ApiException
exception
)
{
if
(
obj
!=
null
&&
!
obj
.
isEmpty
())
throw
exception
;
}
public
static
<
T
,
S
>
void
assertEq
(
T
t
,
S
s
,
ApiException
exception
){
if
(
s
!=
t
)
throw
exception
;
}
public
static
<
T
,
S
>
void
assertNotEq
(
T
t
,
S
s
,
ApiException
exception
){
if
(
s
==
t
)
throw
exception
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
abb89b56
This diff is collapsed.
Click to expand it.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
abb89b56
...
...
@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.common.util.MyAsserts
;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.constant.Constant
;
import
pwc.taxtech.atms.constant.enums.*
;
...
...
@@ -18,6 +19,7 @@ import pwc.taxtech.atms.dpo.ReportDto;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.vatdto.*
;
import
pwc.taxtech.atms.entity.*
;
import
pwc.taxtech.atms.exception.NotFoundException
;
import
pwc.taxtech.atms.exception.NotSupportedException
;
import
pwc.taxtech.atms.service.impl.CellConfigTranslater
;
import
pwc.taxtech.atms.service.impl.DistributedIdService
;
...
...
@@ -292,7 +294,7 @@ public class ReportServiceImpl {
CellTemplateConfigExample
cellTemplateConfigExample
=
new
CellTemplateConfigExample
();
cellTemplateConfigExample
.
createCriteria
().
andReportTemplateIdEqualTo
(
templateId
);
List
<
CellTemplateConfig
>
cellTemplateConfigList
=
cellTemplateConfigMapper
.
selectByExample
(
cellTemplateConfigExample
);
if
(
cellTemplateConfigList
.
isEmpty
())
return
;
if
(
cellTemplateConfigList
.
isEmpty
())
return
;
List
<
PeriodCellTemplateConfig
>
periodCellTemplateConfigList
=
new
ArrayList
<>();
...
...
@@ -465,40 +467,8 @@ public class ReportServiceImpl {
return
operationResultDto
;
}
if
(
serviceType
!=
EnumServiceType
.
VAT
)
{
// 暂不支持非CIT/VAT service批量后端生成报表
throw
new
NotSupportedException
();
}
int
period
=
periodParam
;
String
serviceTypeStr
=
serviceType
.
getCode
().
toString
();
ProjectServiceTypeExample
projectServiceTypeExample
=
new
ProjectServiceTypeExample
();
projectServiceTypeExample
.
createCriteria
().
andServiceTypeIdEqualTo
(
serviceTypeStr
).
andProjectIdEqualTo
(
projectId
);
Optional
<
Long
>
templateGroupId
=
projectServiceTypeMapper
.
selectByExample
(
projectServiceTypeExample
).
stream
()
.
map
(
ProjectServiceType:
:
getTemplateGroupId
).
findFirst
();
if
(
templateGroupId
==
null
)
{
operationResultDto
.
setResultMsg
(
"TemplateGroupNotExist"
);
return
operationResultDto
;
}
List
<
Long
>
templateIds
;
if
(
reportType
!=
null
)
{
PeriodTemplateExample
periodTemplateExample
=
new
PeriodTemplateExample
();
periodTemplateExample
.
createCriteria
()
.
andTemplateGroupIdEqualTo
(
templateGroupId
.
get
())
.
andProjectIdEqualTo
(
projectId
)
.
andPeriodEqualTo
(
period
)
.
andIsActiveAssociationEqualTo
(
true
)
.
andReportTypeEqualTo
(
reportType
);
templateIds
=
periodTemplateMapper
.
selectByExample
(
periodTemplateExample
).
stream
().
map
(
PeriodTemplate:
:
getId
).
collect
(
Collectors
.
toList
());
}
else
{
PeriodTemplateExample
periodTemplateExample
=
new
PeriodTemplateExample
();
periodTemplateExample
.
createCriteria
().
andTemplateGroupIdEqualTo
(
templateGroupId
.
get
())
.
andProjectIdEqualTo
(
projectId
)
.
andPeriodEqualTo
(
period
).
andIsActiveAssociationEqualTo
(
true
);
templateIds
=
periodTemplateMapper
.
selectByExample
(
periodTemplateExample
).
stream
().
map
(
PeriodTemplate:
:
getId
).
collect
(
Collectors
.
toList
());
}
MyAsserts
.
assertEq
(
serviceType
,
EnumServiceType
.
VAT
,
new
NotFoundException
());
List
<
Long
>
templateIds
=
queryTemplates
(
projectId
,
periodParam
,
reportType
,
serviceType
.
getCode
().
toString
());
String
rslt
=
reportGenerator
.
generateData
(
projectId
,
templateIds
,
ifDeleteManualDataSource
,
null
,
periodParam
,
generator
);
if
(
StringUtils
.
isBlank
(
rslt
))
{
...
...
@@ -513,6 +483,35 @@ public class ReportServiceImpl {
return
operationResultDto
;
}
private
List
<
Long
>
queryTemplates
(
String
projectId
,
Integer
period
,
Integer
reportType
,
String
serviceTypeStr
)
{
ProjectServiceTypeExample
projectServiceTypeExample
=
new
ProjectServiceTypeExample
();
projectServiceTypeExample
.
createCriteria
().
andServiceTypeIdEqualTo
(
serviceTypeStr
).
andProjectIdEqualTo
(
projectId
);
Optional
<
Long
>
templateGroupId
=
projectServiceTypeMapper
.
selectByExample
(
projectServiceTypeExample
).
stream
()
.
map
(
ProjectServiceType:
:
getTemplateGroupId
).
findFirst
();
MyAsserts
.
assertNotNull
(
templateGroupId
,
new
NotFoundException
(
"not found group"
));
List
<
Long
>
templateIds
;
if
(
reportType
!=
null
)
{
PeriodTemplateExample
periodTemplateExample
=
new
PeriodTemplateExample
();
periodTemplateExample
.
createCriteria
()
.
andTemplateGroupIdEqualTo
(
templateGroupId
.
get
())
.
andProjectIdEqualTo
(
projectId
)
.
andPeriodEqualTo
(
period
)
.
andIsActiveAssociationEqualTo
(
true
)
.
andReportTypeEqualTo
(
reportType
);
templateIds
=
periodTemplateMapper
.
selectByExample
(
periodTemplateExample
).
stream
().
map
(
PeriodTemplate:
:
getId
).
collect
(
Collectors
.
toList
());
}
else
{
PeriodTemplateExample
periodTemplateExample
=
new
PeriodTemplateExample
();
periodTemplateExample
.
createCriteria
().
andTemplateGroupIdEqualTo
(
templateGroupId
.
get
())
.
andProjectIdEqualTo
(
projectId
)
.
andPeriodEqualTo
(
period
).
andIsActiveAssociationEqualTo
(
true
);
templateIds
=
periodTemplateMapper
.
selectByExample
(
periodTemplateExample
).
stream
().
map
(
PeriodTemplate:
:
getId
).
collect
(
Collectors
.
toList
());
}
return
templateIds
;
}
public
List
<
CellTemplateReferenceDto
>
getTemplateReferences
(
int
period
)
{
return
new
ArrayList
<>();
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FormulaContext.java
View file @
abb89b56
...
...
@@ -2,6 +2,7 @@ package pwc.taxtech.atms.vat.service.impl.report.functions;
import
lombok.Getter
;
import
lombok.Setter
;
import
pwc.taxtech.atms.entity.Project
;
import
pwc.taxtech.atms.vat.service.impl.FormulaAgent
;
@Setter
...
...
@@ -36,4 +37,22 @@ public class FormulaContext {
private
FormulaAgent
formulaAgent
;
//private Map<String, FormulaResult> replaceSpecialCellFormulaDic;
public
static
FormulaContext
extractContextFromProject
(
Project
project
){
FormulaContext
formulaContext
=
new
FormulaContext
();
formulaContext
.
setProjectId
(
project
.
getId
());
formulaContext
.
setYear
(
project
.
getYear
());
formulaContext
.
setIfRound
(
true
);
formulaContext
.
setOrganizationId
(
project
.
getOrganizationId
());
formulaContext
.
setIfRound
(
true
);
return
formulaContext
;
}
public
FormulaContext
fixedFormula
(
Integer
period
,
Long
reportTemplateGroupId
,
FormulaAgent
agent
){
this
.
period
=
period
;
this
.
formulaAgent
=
agent
;
this
.
reportTemplateGroupId
=
reportTemplateGroupId
;
this
.
isYear
=(
period
==
0
);
return
this
;
}
}
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