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
a7fab01f
Commit
a7fab01f
authored
Nov 09, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEV] fixed bb with manula formual value
parent
99f91997
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
18 deletions
+41
-18
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+30
-16
PeriodCellDataMapper.java
...n/java/pwc/taxtech/atms/vat/dao/PeriodCellDataMapper.java
+2
-2
PCTEntity.java
.../src/main/java/pwc/taxtech/atms/vat/entity/PCTEntity.java
+9
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
a7fab01f
...
...
@@ -326,7 +326,7 @@ public class ReportGeneratorImpl {
cellData
.
setUpdateTime
(
new
Date
());
cellData
.
setProjectId
(
projectId
);
cellData
.
setPeriod
(
period
);
periodCellDataMapper
.
insertSelective
(
cellData
);
//after insert celldata, insert the celldatasource for link celldata and datasource
PeriodDataSourceExample
dataSourceExample
=
new
PeriodDataSourceExample
();
...
...
@@ -335,6 +335,10 @@ public class ReportGeneratorImpl {
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
());
...
...
@@ -346,6 +350,8 @@ public class ReportGeneratorImpl {
cellDataSource
.
setProjectId
(
projectId
);
SpringContextUtil
.
periodCellDataSourceMapper
.
insertSelective
(
cellDataSource
);
}
periodCellDataMapper
.
insertSelective
(
cellData
);
}
}
}
...
...
@@ -644,6 +650,7 @@ public class ReportGeneratorImpl {
List
<
PCTEntity
>
manuaPctResults
=
periodCellDataMapper
.
queryManualPCTs
(
parameter
,
projectId
);
Map
<
PCTEntity
,
BigDecimal
>
pctCache
=
new
HashMap
<>();
Map
<
PCTEntity
,
PCTEntity
>
pctCachePCT
=
new
HashMap
<>();
pctResults
.
forEach
(
m
->
{
BigDecimal
data
=
null
;
try
{
...
...
@@ -653,30 +660,37 @@ public class ReportGeneratorImpl {
data
=
BigDecimal
.
ZERO
;
}
pctCache
.
put
(
m
,
data
);
pctCachePCT
.
put
(
m
,
m
);
});
manuaPctResults
.
forEach
(
m
->
{
BigDecimal
data
=
null
;
try
{
data
=
new
BigDecimal
(
m
.
getData
());
}
catch
(
NumberFormatException
e
)
{
logger
.
warn
(
"number format ecption for parameter {}"
,
m
);
data
=
BigDecimal
.
ZERO
;
}
if
(!
pctCache
.
containsKey
(
m
))
pctCache
.
put
(
m
,
data
);
else
pctCache
.
get
(
m
).
add
(
data
);
});
configMapToPCTs
.
forEach
((
k
,
v
)
->
{
v
.
forEach
(
pctStr
->
{
List
<
PCTEntity
>
entities
=
formulaMapToPCT
.
get
(
pctStr
);
List
<
PCTEntity
>
manualEntities
=
new
ArrayList
<>();
BigDecimal
result
=
new
BigDecimal
(
"0"
);
String
resultStr
=
""
;
for
(
PCTEntity
entity
:
entities
)
{
result
=
pctCache
.
containsKey
(
entity
)
?
result
.
add
(
pctCache
.
get
(
entity
))
:
result
;
if
(
manuaPctResults
.
contains
(
entity
))
{
manualEntities
.
add
(
entity
);
}
else
{
result
=
pctCache
.
containsKey
(
entity
)
?
result
.
add
(
pctCache
.
get
(
entity
))
:
result
;
}
}
resultStr
=
result
.
toString
();
if
(!
manualEntities
.
isEmpty
())
{
for
(
PCTEntity
m
:
manualEntities
)
{
if
(
pctCachePCT
.
containsKey
(
m
))
{
if
(!
StringUtils
.
isEmpty
(
pctCachePCT
.
get
(
m
).
getFormulaExp
()))
{
resultStr
+=
(
"+"
+
pctCachePCT
.
get
(
m
).
getFormulaExp
()
+
"+"
+
m
.
getData
());
}
else
{
if
(!
StringUtils
.
isEmpty
(
m
.
getData
()))
resultStr
+=
(
"+"
+
m
.
getData
());
}
}
}
}
k
.
setParsedFormula
(
k
.
getParsedFormula
().
replace
(
pctStr
,
result
.
toString
()
));
k
.
setParsedFormula
(
k
.
getParsedFormula
().
replace
(
pctStr
,
result
Str
));
});
});
...
...
atms-dao/src/main/java/pwc/taxtech/atms/vat/dao/PeriodCellDataMapper.java
View file @
a7fab01f
...
...
@@ -117,7 +117,7 @@ public interface PeriodCellDataMapper extends MyVatMapper {
@Select
(
"<script>"
+
"SELECT "
+
" R.PERIOD as period, C.CELL_TEMPLATE_ID AS cellTemplateId, DATA as data
"
+
" R.PERIOD as period, C.CELL_TEMPLATE_ID AS cellTemplateId, DATA as data
,FORMULA_EXP as formulaExp
"
+
"FROM "
+
" PERIOD_CELL_DATA C, "
+
" PERIOD_REPORT R "
+
...
...
@@ -140,7 +140,7 @@ public interface PeriodCellDataMapper extends MyVatMapper {
"FROM "
+
" PERIOD_DATA_SOURCE p "
+
"WHERE "
+
" PROJECT_ID = #{projectId} AND "
+
" PROJECT_ID = #{projectId} AND
p.TYPE = 10
"
+
" <foreach item=\"item\" index=\"index\" collection=\"list\""
+
" open=\"(\" separator=\"OR\" close=\")\">"
+
" ( p.PERIOD=#{item.period} AND p.CELL_TEMPLATE_ID=#{item.cellTemplateId} )"
+
...
...
atms-dao/src/main/java/pwc/taxtech/atms/vat/entity/PCTEntity.java
View file @
a7fab01f
...
...
@@ -4,6 +4,7 @@ public class PCTEntity {
Integer
period
;
Long
cellTemplateId
;
String
data
;
String
formulaExp
;
public
PCTEntity
()
{
}
...
...
@@ -49,4 +50,12 @@ public class PCTEntity {
public
void
setData
(
String
data
)
{
this
.
data
=
data
;
}
public
String
getFormulaExp
()
{
return
formulaExp
;
}
public
void
setFormulaExp
(
String
formulaExp
)
{
this
.
formulaExp
=
formulaExp
;
}
}
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