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
2aae2b3e
Commit
2aae2b3e
authored
Nov 09, 2018
by
neo.wang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_oracle_neo' into 'dev_oracle'
Dev oracle neo See merge request root/atms!183
parents
8760935f
1201cc95
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
43 deletions
+87
-43
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+82
-41
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+5
-2
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
2aae2b3e
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
();
...
...
@@ -121,36 +123,6 @@ public class ReportGeneratorImpl {
.
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
();
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
()
.
map
(
PeriodCellTemplateConfig:
:
getCellTemplateId
)
...
...
@@ -160,6 +132,7 @@ public class ReportGeneratorImpl {
}
for
(
PeriodCellTemplateConfig
periodCellTemplateConfig
:
periodCellTemplateConfigs
)
{
PeriodFormulaBlockExample
periodFormulaBlockExample2
=
new
PeriodFormulaBlockExample
();
periodFormulaBlockExample2
.
createCriteria
()
.
andProjectIdEqualTo
(
projectId
)
...
...
@@ -318,14 +291,11 @@ public class ReportGeneratorImpl {
//after insert celldata, insert the celldatasource for link celldata and datasource
PeriodDataSourceExample
dataSourceExample
=
new
PeriodDataSourceExample
();
dataSourceExample
.
createCriteria
().
andPeriodEqualTo
(
period
).
andProjectIdEqualTo
(
projectId
)
.
andCellTemplateIdEqualTo
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
.
andCellTemplateIdEqualTo
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
())
.
andTypeNotEqualTo
(
10
)
;
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手工数据源
cellData
.
setData
(
dataSource
.
getAmount
()
+
""
);
}
PeriodCellDataSource
cellDataSource
=
new
PeriodCellDataSource
();
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
...
...
@@ -341,6 +311,77 @@ public class ReportGeneratorImpl {
periodCellDataMapper
.
insertSelective
(
cellData
);
}
}
if
(
isMergeMunual
)
{
List
<
PeriodCellTemplateConfig
>
keyInCellTemplateConfigs
=
resources
.
getPeriodCellTemplateConfigs
().
stream
()
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
)
&&
a
.
getDataSourceType
().
equals
(
CellDataSourceType
.
KeyIn
.
getCode
()))
.
collect
(
Collectors
.
toList
());
for
(
PeriodCellTemplateConfig
keyInCellTemplateConfig
:
keyInCellTemplateConfigs
)
{
PeriodDataSourceExample
dataSourceExample
=
new
PeriodDataSourceExample
();
dataSourceExample
.
createCriteria
().
andPeriodEqualTo
(
period
).
andProjectIdEqualTo
(
projectId
)
.
andCellTemplateIdEqualTo
(
keyInCellTemplateConfig
.
getCellTemplateId
()).
andTypeEqualTo
(
10
);
List
<
PeriodDataSource
>
dataSourceList
=
SpringContextUtil
.
periodDataSourceMapper
.
selectByExample
(
dataSourceExample
);
if
(!
dataSourceList
.
isEmpty
()
&&
dataSourceList
.
size
()
==
1
)
{
PeriodCellDataExample
cellDataExample
=
new
PeriodCellDataExample
();
cellDataExample
.
createCriteria
().
andPeriodEqualTo
(
period
).
andProjectIdEqualTo
(
projectId
)
.
andCellTemplateIdEqualTo
(
keyInCellTemplateConfig
.
getCellTemplateId
());
List
<
PeriodCellData
>
cellDataList
=
periodCellDataMapper
.
selectByExample
(
cellDataExample
);
if
(
cellDataList
.
size
()
==
1
)
{
PeriodCellData
cellData
=
cellDataList
.
get
(
0
);
PeriodDataSource
dataSource
=
dataSourceList
.
get
(
0
);
cellData
.
setData
(
dataSource
.
getAmount
()
+
""
);
if
(
StringUtils
.
isEmpty
(
cellData
.
getFormulaExp
().
trim
()))
cellData
.
setFormulaExp
(
dataSource
.
getAmount
()
+
""
);
PeriodCellDataSource
cellDataSource
=
new
PeriodCellDataSource
();
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setCellTemplateId
(
keyInCellTemplateConfig
.
getCellTemplateId
());
cellDataSource
.
setCellDataId
(
cellData
.
getId
());
cellDataSource
.
setDataSourceId
(
dataSource
.
getId
());
cellDataSource
.
setCreateTime
(
new
Date
());
cellDataSource
.
setUpdateTime
(
new
Date
());
cellDataSource
.
setPeriod
(
period
);
cellDataSource
.
setProjectId
(
projectId
);
SpringContextUtil
.
periodCellDataSourceMapper
.
insertSelective
(
cellDataSource
);
periodCellDataMapper
.
updateByPrimaryKeySelective
(
cellData
);
}
else
if
(
cellDataList
.
isEmpty
()){
PeriodCellData
cellData
=
new
PeriodCellData
();
Long
cellDataId
=
distributedIdService
.
nextId
();
cellData
.
setId
(
cellDataId
);
cellData
.
setReportId
(
reportId
);
cellData
.
setCellTemplateId
(
keyInCellTemplateConfig
.
getCellTemplateId
());
cellData
.
setCreateBy
(
"Admin"
);
cellData
.
setCreateTime
(
new
Date
());
cellData
.
setUpdateBy
(
"Admin"
);
cellData
.
setUpdateTime
(
new
Date
());
cellData
.
setProjectId
(
projectId
);
cellData
.
setPeriod
(
period
);
PeriodDataSource
dataSource
=
dataSourceList
.
get
(
0
);
cellData
.
setData
(
dataSource
.
getAmount
()
+
""
);
cellData
.
setFormulaExp
(
dataSource
.
getAmount
()
+
""
);
PeriodCellDataSource
cellDataSource
=
new
PeriodCellDataSource
();
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setCellTemplateId
(
keyInCellTemplateConfig
.
getCellTemplateId
());
cellDataSource
.
setCellDataId
(
cellData
.
getId
());
cellDataSource
.
setDataSourceId
(
dataSource
.
getId
());
cellDataSource
.
setCreateTime
(
new
Date
());
cellDataSource
.
setUpdateTime
(
new
Date
());
cellDataSource
.
setPeriod
(
period
);
cellDataSource
.
setProjectId
(
projectId
);
SpringContextUtil
.
periodCellDataSourceMapper
.
insertSelective
(
cellDataSource
);
periodCellDataMapper
.
insert
(
cellData
);
}
else
{
logger
.
warn
(
"should not be !!!"
);
}
}
}
}
}
}
catch
(
Exception
e
)
{
...
...
@@ -645,13 +686,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
().
trim
()))
{
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 @
2aae2b3e
...
...
@@ -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
);
...
...
@@ -858,6 +858,7 @@ public class ReportServiceImpl {
PeriodCellData
cellData
=
periodCellDataMapper
.
selectByPrimaryKey
(
data
.
getCellId
());
if
(
cellData
.
getData
()
!=
data
.
getAmount
().
toString
())
{
cellData
.
setData
(
data
.
getAmount
().
toString
());
if
(
StringUtils
.
isEmpty
(
cellData
.
getFormulaExp
()))
cellData
.
setFormulaExp
(
data
.
getAmount
().
toString
());
periodCellDataMapper
.
updateByPrimaryKeySelective
(
cellData
);
}
}
...
...
@@ -865,7 +866,9 @@ public class ReportServiceImpl {
List
<
DataSourceExtendDto
>
dataSourceExtendDtos
=
periodDataSourceMapper
.
getManualDataSource
(
data
.
getCellId
());
PeriodCellTemplateExample
periodCellTemplateExample
=
new
PeriodCellTemplateExample
();
periodCellTemplateExample
.
createCriteria
().
andCellTemplateIdEqualTo
(
Long
.
parseLong
(
data
.
getCellTemplateId
())).
andPeriodEqualTo
(
data
.
getPeriod
());
periodCellTemplateExample
.
createCriteria
().
andCellTemplateIdEqualTo
(
Long
.
parseLong
(
data
.
getCellTemplateId
()))
.
andPeriodEqualTo
(
data
.
getPeriod
()).
andProjectIdEqualTo
(
projectId
);
Optional
<
PeriodCellTemplate
>
periodCellTemplate
=
periodCellTemplateMapper
.
selectByExample
(
periodCellTemplateExample
).
stream
().
findFirst
();
BigDecimal
originalAmount
=
new
BigDecimal
(
"0"
);
...
...
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