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
ec6ec56c
Commit
ec6ec56c
authored
Mar 20, 2019
by
zhkwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CIT--ZC公式完善
parent
0ec02f5a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
71 deletions
+81
-71
ZC.java
...wc/taxtech/atms/vat/service/impl/report/functions/ZC.java
+81
-71
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/ZC.java
View file @
ec6ec56c
...
...
@@ -56,81 +56,91 @@ public class ZC extends FunctionBase implements FreeRefFunction {
int
curYear
=
formulaContext
.
getYear
()
+
year
;
// String dbName =
// SpringContextUtil.projectDao.getDbNameWithYearAndOrgId(formulaContext.getOrganizationId(), curYear);
List
<
CitAssetDetailResultDto
>
assetDetailResultDtos
=
SpringContextUtil
.
assetsListMapper
.
getCitAssetDetialResult
(
assetType
,
assetDetailType
);
List
<
AssetDetailDataSourceDto
>
dataSource
=
new
ArrayList
<>();
for
(
CitAssetDetailResultDto
x
:
assetDetailResultDtos
)
{
AssetDetailDataSourceDto
assetDetailDataSourceDto
=
new
AssetDetailDataSourceDto
();
assetDetailDataSourceDto
.
setResultType
(
KeyValueConfigResultType
.
Accounting
.
getCode
());
assetDetailDataSourceDto
.
setAssetNumber
(
x
.
getAssetsList
().
getAssetGroupName
());
assetDetailDataSourceDto
.
setAssetGroupName
(
x
.
getAssetDetailGroup
().
getDetailGroupName
());
assetDetailDataSourceDto
.
setAccountAcquisitionValue
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getAccountAcquisitionValue
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setAccountMonthDepreciationAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getAccountMonthDepreciationAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setAccountYearDepreciationAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getYearDepreciationAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setAccountTotalepreciationAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getAccountTotalDepreciationAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setYearEndValue
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getYearEndValue
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setTaxMonthDepreciationAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getTaxMonthDepreciationAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setTaxToCurrentYearDepreciationAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getTaxToCurrentYearDepreciationAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setTaxCurrentYearDepreciationAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getTaxCurrentYearDepreciationAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setTotalDifferenceAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getTotalDifferenceAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setYearDifferenceAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getYearDifferenceAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setDepreciationPeriod
(
x
.
getAssetsList
().
getDepreciationPeriod
());
assetDetailDataSourceDto
.
setTaxDepreciationPeriod
(
x
.
getAssetsList
().
getTaxDepreciationPeriod
());
assetDetailDataSourceDto
.
setIsRetain
(
x
.
getAssetsList
().
getIsRetain
()==
0
?
false
:
true
);
assetDetailDataSourceDto
.
setDataType
(
dataType
);
assetDetailDataSourceDto
.
setName
(
Constant
.
DataSourceName
.
AssetListDataSource
);
assetDetailDataSourceDto
.
setOperationType
(
EnumOperationType
.
Single
.
getCode
());
dataSource
.
add
(
assetDetailDataSourceDto
);
}
BigDecimal
totalData
=
new
BigDecimal
(
"0"
);
try
{
List
<
CitAssetDetailResultDto
>
assetDetailResultDtos
=
SpringContextUtil
.
assetsListMapper
.
getCitAssetDetialResult
(
assetType
,
assetDetailType
);
if
(
assetDetailResultDtos
!=
null
&&
assetDetailResultDtos
.
size
()>
0
){
System
.
out
.
println
(
assetDetailResultDtos
.
size
());
}
for
(
CitAssetDetailResultDto
x
:
assetDetailResultDtos
)
{
AssetDetailDataSourceDto
assetDetailDataSourceDto
=
new
AssetDetailDataSourceDto
();
assetDetailDataSourceDto
.
setResultType
(
KeyValueConfigResultType
.
Accounting
.
getCode
());
assetDetailDataSourceDto
.
setAssetNumber
(
x
.
getAssetsList
().
getAssetGroupName
());
assetDetailDataSourceDto
.
setAssetGroupName
(
x
.
getAssetDetailGroup
().
getDetailGroupName
());
assetDetailDataSourceDto
.
setAssetDetailGroupName
(
x
.
getAssetDetailGroup
().
getDetailGroupName
());
assetDetailDataSourceDto
.
setAccountAcquisitionValue
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getAccountAcquisitionValue
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setAccountMonthDepreciationAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getAccountMonthDepreciationAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setAccountYearDepreciationAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getYearDepreciationAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setAccountTotalepreciationAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getAccountTotalDepreciationAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setYearEndValue
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getYearEndValue
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setTaxMonthDepreciationAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getTaxMonthDepreciationAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setTaxToCurrentYearDepreciationAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getTaxToCurrentYearDepreciationAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setTaxCurrentYearDepreciationAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getTaxCurrentYearDepreciationAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setTotalDifferenceAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getTotalDifferenceAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setYearDifferenceAmount
(
FormulaHelper
.
roundValue
(
x
.
getAssetsList
().
getYearDifferenceAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
assetDetailDataSourceDto
.
setDepreciationPeriod
(
x
.
getAssetsList
().
getDepreciationPeriod
());
assetDetailDataSourceDto
.
setTaxDepreciationPeriod
(
x
.
getAssetsList
().
getTaxDepreciationPeriod
());
assetDetailDataSourceDto
.
setIsRetain
(
x
.
getAssetsList
().
getIsRetain
()==
0
?
false
:
true
);
assetDetailDataSourceDto
.
setDataType
(
dataType
);
assetDetailDataSourceDto
.
setName
(
Constant
.
DataSourceName
.
AssetListDataSource
);
assetDetailDataSourceDto
.
setOperationType
(
EnumOperationType
.
Single
.
getCode
());
dataSource
.
add
(
assetDetailDataSourceDto
);
}
dataSource
=
dataSource
.
stream
()
.
sorted
(
Comparator
.
comparing
(
AssetDetailDataSourceDto:
:
getAssetGroupName
)
.
thenComparing
(
AssetDetailDataSourceDto:
:
getAssetDetailGroupName
))
.
collect
(
Collectors
.
toList
());
dataSource
=
dataSource
.
stream
()
.
sorted
(
Comparator
.
comparing
(
AssetDetailDataSourceDto:
:
getAssetGroupName
)
.
thenComparing
(
AssetDetailDataSourceDto:
:
getAssetDetailGroupName
))
.
collect
(
Collectors
.
toList
());
BigDecimal
totalData
=
new
BigDecimal
(
"0"
);
switch
(
dataType
)
{
case
1
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getAccountAcquisitionValue
().
doubleValue
()).
sum
());
break
;
case
2
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getAccountYearDepreciationAmount
().
doubleValue
()).
sum
());
break
;
case
3
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getAccountTotalepreciationAmount
().
doubleValue
()).
sum
());
break
;
case
4
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getAccountMonthDepreciationAmount
().
doubleValue
()).
sum
());
break
;
case
5
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getYearEndValue
().
doubleValue
()).
sum
());
break
;
case
6
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getTaxMonthDepreciationAmount
().
doubleValue
()).
sum
());
break
;
case
7
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getTaxToCurrentYearDepreciationAmount
().
doubleValue
()).
sum
());
break
;
case
8
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getTaxCurrentYearDepreciationAmount
().
doubleValue
()).
sum
());
break
;
case
9
:
dataSource
=
dataSource
.
stream
().
filter
(
a
->
a
.
getIsRetain
()
!=
null
&&
a
.
getIsRetain
()).
collect
(
Collectors
.
toList
());
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getTotalDifferenceAmount
().
doubleValue
()).
sum
());
break
;
case
10
:
dataSource
=
dataSource
.
stream
().
filter
(
a
->
a
.
getIsRetain
()
!=
null
&&
a
.
getIsRetain
()).
collect
(
Collectors
.
toList
());
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getYearDifferenceAmount
().
doubleValue
()).
sum
());
break
;
default
:
break
;
switch
(
dataType
)
{
case
1
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getAccountAcquisitionValue
().
doubleValue
()).
sum
());
break
;
case
2
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getAccountYearDepreciationAmount
().
doubleValue
()).
sum
());
break
;
case
3
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getAccountTotalepreciationAmount
().
doubleValue
()).
sum
());
break
;
case
4
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getAccountMonthDepreciationAmount
().
doubleValue
()).
sum
());
break
;
case
5
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getYearEndValue
().
doubleValue
()).
sum
());
break
;
case
6
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getTaxMonthDepreciationAmount
().
doubleValue
()).
sum
());
break
;
case
7
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getTaxToCurrentYearDepreciationAmount
().
doubleValue
()).
sum
());
break
;
case
8
:
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getTaxCurrentYearDepreciationAmount
().
doubleValue
()).
sum
());
break
;
case
9
:
dataSource
=
dataSource
.
stream
().
filter
(
a
->
a
.
getIsRetain
()
!=
null
&&
a
.
getIsRetain
()).
collect
(
Collectors
.
toList
());
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getTotalDifferenceAmount
().
doubleValue
()).
sum
());
break
;
case
10
:
dataSource
=
dataSource
.
stream
().
filter
(
a
->
a
.
getIsRetain
()
!=
null
&&
a
.
getIsRetain
()).
collect
(
Collectors
.
toList
());
totalData
=
new
BigDecimal
(
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getYearDifferenceAmount
().
doubleValue
()).
sum
());
break
;
default
:
break
;
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
logger
.
error
(
"计算ZC公式报错"
);
return
new
NumberEval
(
0
);
}
finally
{
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
AssetDetailDataSourceDto
,
totalData
,
formulaContext
.
getPeriod
(),
formulaContext
.
getReportTemplateGroupId
(),
formulaContext
.
getProjectId
());
saveFormulaBlock
(
0
,
ec
,
formulaExpression
,
totalData
,
dataSourceId
,
formulaContext
.
getProjectId
());
}
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
AssetDetailDataSourceDto
,
totalData
,
formulaContext
.
getPeriod
(),
formulaContext
.
getReportTemplateGroupId
(),
formulaContext
.
getProjectId
());
saveFormulaBlock
(
0
,
ec
,
formulaExpression
,
totalData
,
dataSourceId
,
formulaContext
.
getProjectId
());
return
new
NumberEval
(
totalData
.
doubleValue
());
}
}
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