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
85dc97ea
Commit
85dc97ea
authored
Nov 09, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] fixed re gen datasource
parent
f6a33be1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
40 deletions
+14
-40
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+13
-39
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+1
-1
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
85dc97ea
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
;
import
com.google.common.collect.Lists
;
import
jdk.nashorn.internal.runtime.options.Option
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.openxml4j.exceptions.InvalidFormatException
;
import
org.apache.poi.ss.formula.functions.FreeRefFunction
;
...
...
@@ -86,7 +87,8 @@ public class ReportGeneratorImpl {
}
@Transactional
public
void
updateWorkbookCaclsValueToDb
(
String
projectId
,
Integer
period
,
Workbook
workbook
,
PeriodResources
resources
,
PeriodJob
job
)
{
public
void
updateWorkbookCaclsValueToDb
(
String
projectId
,
Integer
period
,
Workbook
workbook
,
PeriodResources
resources
,
Boolean
isMergeMunual
,
PeriodJob
job
)
{
for
(
int
i
=
0
;
i
<
workbook
.
getNumberOfSheets
();
i
++)
{
Sheet
sheet
=
workbook
.
getSheetAt
(
i
);
String
code
=
sheet
.
getSheetName
();
...
...
@@ -118,38 +120,8 @@ public class ReportGeneratorImpl {
reportMapper
.
insertSelective
(
report
);
List
<
PeriodCellTemplateConfig
>
periodCellTemplateConfigs
=
resources
.
getPeriodCellTemplateConfigs
().
stream
()
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
)
&&
a
.
getDataSourceType
().
equals
(
CellDataSourceType
.
Formula
.
getCode
()))
.
collect
(
Collectors
.
toList
());
List
<
PeriodCellTemplateConfig
>
keyInCellTemplateConfigs
=
resources
.
getPeriodCellTemplateConfigs
().
stream
()
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
)
&&
a
.
getDataSourceType
().
equals
(
CellDataSourceType
.
KeyIn
.
getCode
()))
.
collect
(
Collectors
.
toList
());
//todo: add manual datasource here,in order to disaplay the manual datasource we need add it first at here.
for
(
PeriodCellTemplateConfig
keyInCellTemplateConfig
:
keyInCellTemplateConfigs
)
{
PeriodCellTemplateExample
periodCellTemplateExample1
=
new
PeriodCellTemplateExample
();
periodCellTemplateExample1
.
createCriteria
().
andCellTemplateIdEqualTo
(
keyInCellTemplateConfig
.
getCellTemplateId
());
Optional
<
PeriodCellTemplate
>
periodCellTemplate
=
periodCellTemplateMapper
.
selectByExample
(
periodCellTemplateExample1
).
stream
().
findFirst
();
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
)).
collect
(
Collectors
.
toList
());
PeriodDataSource
dataSource
=
new
PeriodDataSource
();
dataSource
.
setId
(
distributedIdService
.
nextId
());
if
(
periodCellTemplate
.
isPresent
())
{
dataSource
.
setColumnIndex
(
periodCellTemplate
.
get
().
getColumnIndex
());
dataSource
.
setRowIndex
(
periodCellTemplate
.
get
().
getRowIndex
());
}
dataSource
.
setAmount
(
new
BigDecimal
(
"0"
));
dataSource
.
setName
(
"ManualDataSource"
);
dataSource
.
setDescription
(
"ManualDataSource"
);
dataSource
.
setCreateTime
(
new
Date
());
dataSource
.
setUpdateTime
(
new
Date
());
dataSource
.
setCreateBy
(
"Admin"
);
dataSource
.
setUpdateBy
(
"Admin"
);
dataSource
.
setPeriod
(
period
);
dataSource
.
setCellTemplateId
(
keyInCellTemplateConfig
.
getCellTemplateId
());
dataSource
.
setType
(
FormulaDataSourceType
.
KeyInSource
.
getCode
());
periodDataSourceMapper
.
insertSelective
(
dataSource
);
}
//update formulablock table reportid field
List
<
Long
>
cellTemplateConfigIds
=
periodCellTemplateConfigs
.
stream
()
...
...
@@ -160,6 +132,7 @@ public class ReportGeneratorImpl {
}
for
(
PeriodCellTemplateConfig
periodCellTemplateConfig
:
periodCellTemplateConfigs
)
{
PeriodFormulaBlockExample
periodFormulaBlockExample2
=
new
PeriodFormulaBlockExample
();
periodFormulaBlockExample2
.
createCriteria
()
.
andProjectIdEqualTo
(
projectId
)
...
...
@@ -320,12 +293,13 @@ public class ReportGeneratorImpl {
dataSourceExample
.
createCriteria
().
andPeriodEqualTo
(
period
).
andProjectIdEqualTo
(
projectId
)
.
andCellTemplateIdEqualTo
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
List
<
PeriodDataSource
>
dataSourceList
=
SpringContextUtil
.
periodDataSourceMapper
.
selectByExample
(
dataSourceExample
);
for
(
int
ii
=
0
;
ii
<
dataSourceList
.
size
();
ii
++)
{
PeriodDataSource
dataSource
=
dataSourceList
.
get
(
ii
);
if
(
dataSource
.
getType
().
intValue
()
==
10
)
{
//s手工数据源
if
(
isMergeMunual
&&
dataSource
.
getType
().
intValue
()
==
10
)
{
cellData
.
setData
(
dataSource
.
getAmount
()
+
""
);
if
(
dataSourceList
.
size
()
==
1
)
cellData
.
setFormulaExp
(
dataSource
.
getAmount
()
+
""
);
}
PeriodCellDataSource
cellDataSource
=
new
PeriodCellDataSource
();
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
...
...
@@ -645,13 +619,13 @@ public class ReportGeneratorImpl {
List
<
PCTEntity
>
entities
=
formulaMapToPCT
.
get
(
pctStr
);
StringBuilder
result
=
new
StringBuilder
(
"0"
);
for
(
PCTEntity
entity
:
entities
)
{
if
(
pctCache
.
containsKey
(
entity
))
{
PCTEntity
pct
=
pctCache
.
get
(
entity
);
if
(
pct
.
getDsCount
()==
1
&&
pct
.
getAmount
()!=
null
)
{
if
(
pctCache
.
containsKey
(
entity
))
{
PCTEntity
pct
=
pctCache
.
get
(
entity
);
if
(
pct
.
getDsCount
()
==
1
&&
pct
.
getAmount
()
!=
null
)
{
result
.
append
(
"+"
).
append
(
pct
.
getAmount
());
}
else
if
(
pct
.
getDsCount
()>
1
&&
pct
.
getAmount
()!=
null
&&!
StringUtils
.
isEmpty
(
pct
.
getFormulaExp
()))
{
}
else
if
(
pct
.
getDsCount
()
>
1
&&
pct
.
getAmount
()
!=
null
&&
!
StringUtils
.
isEmpty
(
pct
.
getFormulaExp
()))
{
result
.
append
(
"+"
).
append
(
pct
.
getFormulaExp
()).
append
(
"+"
).
append
(
pct
.
getAmount
());
}
else
if
(
pct
.
getAmount
()==
null
&&!
StringUtils
.
isNotEmpty
(
pct
.
getData
()))
{
}
else
if
(
pct
.
getAmount
()
==
null
&&
!
StringUtils
.
isNotEmpty
(
pct
.
getData
()))
{
result
.
append
(
pct
.
getData
());
}
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
85dc97ea
...
...
@@ -485,7 +485,7 @@ public class ReportServiceImpl {
FormulaEvaluator
evaluator
=
workbook
.
getCreationHelper
().
createFormulaEvaluator
();
evaluator
.
evaluateAll
();
reportGenerator
.
updateWorkbookCaclsValueToDb
(
projectId
,
periodParam
,
workbook
,
resources
,
genJob
);
reportGenerator
.
updateWorkbookCaclsValueToDb
(
projectId
,
periodParam
,
workbook
,
resources
,
isMergeManualData
,
genJob
);
genJob
.
setStatus
(
WrapPeriodJobDto
.
STATUS_END
);
periodJobMapper
.
updateByPrimaryKey
(
genJob
);
...
...
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