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
4e073be0
Commit
4e073be0
authored
Nov 09, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEV] fixed mualt bb with manula value
parent
649519d1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
105 deletions
+76
-105
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+12
-51
PeriodCellDataMapper.java
...n/java/pwc/taxtech/atms/vat/dao/PeriodCellDataMapper.java
+37
-54
PCTEntity.java
.../src/main/java/pwc/taxtech/atms/vat/entity/PCTEntity.java
+27
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
4e073be0
...
...
@@ -85,19 +85,6 @@ public class ReportGeneratorImpl {
return
periodResources
;
}
@Transactional
public
void
updateManaCellDataWithNewReport
(
String
projectId
,
Integer
period
)
{
List
<
MergerManaualCellData
>
result
=
periodCellDataMapper
.
selectManualToBeMerged
(
projectId
,
period
);
if
(!
result
.
isEmpty
())
{
result
.
forEach
(
m
->
{
PeriodCellData
pcd
=
new
PeriodCellData
();
pcd
.
setId
(
m
.
getId
());
pcd
.
setReportId
(
m
.
getNewReportId
());
periodCellDataMapper
.
updateByPrimaryKeySelective
(
pcd
);
});
}
}
@Transactional
public
void
updateWorkbookCaclsValueToDb
(
String
projectId
,
Integer
period
,
Workbook
workbook
,
PeriodResources
resources
,
PeriodJob
job
)
{
for
(
int
i
=
0
;
i
<
workbook
.
getNumberOfSheets
();
i
++)
{
...
...
@@ -647,55 +634,29 @@ public class ReportGeneratorImpl {
if
(!
parameter
.
isEmpty
())
{
List
<
PCTEntity
>
pctResults
=
periodCellDataMapper
.
queryByPCTs
(
parameter
,
projectId
);
List
<
PCTEntity
>
manuaPctResults
=
periodCellDataMapper
.
queryManualPCTs
(
parameter
,
projectId
);
Map
<
PCTEntity
,
BigDecimal
>
pctCache
=
new
HashMap
<>();
Map
<
PCTEntity
,
PCTEntity
>
pctCachePCT
=
new
HashMap
<>();
Map
<
PCTEntity
,
PCTEntity
>
pctCache
=
new
HashMap
<>();
pctResults
.
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
;
}
pctCache
.
put
(
m
,
data
);
pctCachePCT
.
put
(
m
,
m
);
pctCache
.
put
(
m
,
m
);
});
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
=
""
;
StringBuilder
result
=
new
StringBuilder
(
"0"
);
for
(
PCTEntity
entity
:
entities
)
{
if
(
manuaPctResults
!=
null
&&
!
manuaPctResults
.
isEmpty
()
&&
manuaPctResults
.
contains
(
entity
))
{
for
(
PCTEntity
manual
:
manuaPctResults
)
{
if
(
manual
.
equals
(
entity
))
{
manualEntities
.
add
(
manual
);
}
}
}
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
());
}
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
())){
result
.
append
(
"+"
).
append
(
pct
.
getFormulaExp
()).
append
(
"+"
).
append
(
pct
.
getAmount
());
}
else
if
(
pct
.
getAmount
()==
null
&&!
StringUtils
.
isNotEmpty
(
pct
.
getData
())){
result
.
append
(
pct
.
getData
());
}
}
}
k
.
setParsedFormula
(
k
.
getParsedFormula
().
replace
(
pctStr
,
result
Str
));
k
.
setParsedFormula
(
k
.
getParsedFormula
().
replace
(
pctStr
,
result
.
toString
()
));
});
});
...
...
atms-dao/src/main/java/pwc/taxtech/atms/vat/dao/PeriodCellDataMapper.java
View file @
4e073be0
...
...
@@ -115,66 +115,48 @@ public interface PeriodCellDataMapper extends MyVatMapper {
int
batchInsert
(
List
<
PeriodCellData
>
list
);
@Select
(
"<script>"
+
"SELECT "
+
" 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 "
+
"WHERE "
+
" C.REPORT_ID = R.ID"
+
" AND C.PROJECT_ID = #{projectId} AND "
+
" "
+
" <foreach item=\"item\" index=\"index\" collection=\"list\""
+
" open=\"(\" separator=\"OR\" close=\")\">"
+
" ( R.PERIOD=#{item.period} AND C.CELL_TEMPLATE_ID=#{item.cellTemplateId} )"
+
" </foreach>"
+
"</script>"
)
List
<
PCTEntity
>
queryByPCTs
(
@Param
(
"list"
)
Set
<
PCTEntity
>
parameter
,
@Param
(
"projectId"
)
String
projectId
);
@Select
(
"<script>"
+
"SELECT "
+
" p.PERIOD AS period, "
+
" p.CELL_TEMPLATE_ID AS cellTemplateId, "
+
" p.AMOUNT AS data "
+
" count( pcds.DATA_SOURCE_ID ) AS dsCount, "
+
" pcd.ID as cellId, "
+
" pcd.DATA as data, "
+
" pcd.FORMULA_EXP as formulaExp, "
+
" pcd.CELL_TEMPLATE_ID as cellTemplateId, "
+
" pcd.PERIOD as period, "
+
" temp.AMOUNT as amount "
+
"FROM "
+
" PERIOD_DATA_SOURCE p "
+
" PERIOD_CELL_DATA pcd "
+
" JOIN PERIOD_CELL_DATA_SOURCE pcds ON pcd.ID = pcds.CELL_DATA_ID "
+
" LEFT JOIN ( "
+
" SELECT "
+
" pcd.ID, "
+
" pds.TYPE, "
+
" pds.AMOUNT, "
+
" pds.PERIOD, "
+
" pds.PROJECT_ID "
+
" FROM "
+
" PERIOD_CELL_DATA pcd "
+
" JOIN PERIOD_CELL_DATA_SOURCE pcds ON pcd.ID = pcds.CELL_DATA_ID "
+
" JOIN PERIOD_DATA_SOURCE pds ON pcds.DATA_SOURCE_ID = pds.ID "
+
" WHERE "
+
" pcd.PROJECT_ID = #{projectId} "
+
" AND pds.TYPE = 10 "
+
" ) temp ON pcd.ID = temp.ID AND pcd.PROJECT_ID = temp.PROJECT_ID and pcd.PERIOD = temp.period "
+
"WHERE "
+
" PROJECT_ID = #{projectId} AND p.TYPE = 10 AND "
+
" pcd.PERIOD = 10 "
+
" AND pcd.PROJECT_ID = #{projectId} "
+
" AND p.TYPE = 10 AND "
+
" <foreach item=\"item\" index=\"index\" collection=\"list\""
+
" open=\"(\" separator=\"OR\" close=\")\">"
+
" ( p
.PERIOD=#{item.period} AND p
.CELL_TEMPLATE_ID=#{item.cellTemplateId} )"
+
" ( p
cd.PERIOD=#{item.period} AND pcd
.CELL_TEMPLATE_ID=#{item.cellTemplateId} )"
+
" </foreach>"
+
"GROUP BY "
+
" pcd.ID, "
+
" pcd.DATA, "
+
" pcd.FORMULA_EXP, "
+
" pcd.CELL_TEMPLATE_ID, "
+
" pcd.PERIOD, "
+
" temp.AMOUNT;"
+
"</script>"
)
List
<
PCTEntity
>
queryManualPCTs
(
@Param
(
"list"
)
Set
<
PCTEntity
>
parameter
,
@Param
(
"projectId"
)
String
projectId
);
@Select
(
""
+
"SELECT "
+
" d.ID AS id, "
+
" d.REPORT_ID AS reportId, "
+
" d.CELL_TEMPLATE_ID AS cellTemplateId, "
+
" p.REPORT_TEMPLATE_ID AS templateId, "
+
" t.ID AS newReportId "
+
"FROM "
+
" PERIOD_CELL_DATA d "
+
" JOIN PERIOD_CELL_TEMPLATE p ON d.CELL_TEMPLATE_ID = p.CELL_TEMPLATE_ID "
+
" LEFT JOIN PERIOD_REPORT t ON p.REPORT_TEMPLATE_ID = t.TEMPLATE_ID "
+
"WHERE "
+
" d.PROJECT_ID = #{projectId} "
+
" AND p.PROJECT_ID = #{projectId} "
+
" AND t.PROJECT_ID = #{projectId} "
+
" AND d.PERIOD = #{period} "
+
" AND p.PERIOD = #{period} "
+
" AND t.PERIOD = #{period} "
+
" AND d.REPORT_ID NOT IN ( "
+
" SELECT "
+
" ID "
+
" FROM "
+
" PERIOD_REPORT "
+
" WHERE "
+
" PROJECT_ID = #{projectId} "
+
" AND PERIOD = #{period} "
+
" )"
+
""
)
List
<
MergerManaualCellData
>
selectManualToBeMerged
(
@Param
(
"projectId"
)
String
projectId
,
@Param
(
"period"
)
Integer
period
);
List
<
PCTEntity
>
queryByPCTs
(
@Param
(
"list"
)
Set
<
PCTEntity
>
parameter
,
@Param
(
"projectId"
)
String
projectId
);
}
\ No newline at end of file
atms-dao/src/main/java/pwc/taxtech/atms/vat/entity/PCTEntity.java
View file @
4e073be0
...
...
@@ -5,6 +5,9 @@ public class PCTEntity {
Long
cellTemplateId
;
String
data
;
String
formulaExp
;
Long
cellId
;
String
amount
;
Integer
dsCount
;
public
PCTEntity
()
{
}
...
...
@@ -58,4 +61,28 @@ public class PCTEntity {
public
void
setFormulaExp
(
String
formulaExp
)
{
this
.
formulaExp
=
formulaExp
;
}
public
Long
getCellId
()
{
return
cellId
;
}
public
void
setCellId
(
Long
cellId
)
{
this
.
cellId
=
cellId
;
}
public
String
getAmount
()
{
return
amount
;
}
public
void
setAmount
(
String
amount
)
{
this
.
amount
=
amount
;
}
public
Integer
getDsCount
()
{
return
dsCount
;
}
public
void
setDsCount
(
Integer
dsCount
)
{
this
.
dsCount
=
dsCount
;
}
}
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