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
017a3bf0
Commit
017a3bf0
authored
Apr 02, 2019
by
chase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
61b410ff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
21 deletions
+54
-21
SpringContextUtil.java
.../java/pwc/taxtech/atms/common/util/SpringContextUtil.java
+2
-0
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+12
-5
KPSR.java
.../taxtech/atms/vat/service/impl/report/functions/KPSR.java
+40
-16
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/util/SpringContextUtil.java
View file @
017a3bf0
...
@@ -59,6 +59,7 @@ public class SpringContextUtil implements ApplicationContextAware {
...
@@ -59,6 +59,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public
static
AdjustmentTableMapper
adjustmentTableMapper
;
public
static
AdjustmentTableMapper
adjustmentTableMapper
;
public
static
TrialBalanceFinalMapper
trialBalanceFinalMapper
;
public
static
TrialBalanceFinalMapper
trialBalanceFinalMapper
;
public
static
ProfitLossStatementMapper
profitLossStatementMapper
;
public
static
ProfitLossStatementMapper
profitLossStatementMapper
;
public
static
RevenueConfigMapper
revenueConfigMapper
;
public
static
RevenueTypeMappingMapper
revenueTypeMappingMapper
;
public
static
RevenueTypeMappingMapper
revenueTypeMappingMapper
;
public
static
InvoiceRecordMapper
invoiceRecordMapper
;
public
static
InvoiceRecordMapper
invoiceRecordMapper
;
public
static
CertifiedInvoicesListMapper
certifiedInvoicesListMapper
;
public
static
CertifiedInvoicesListMapper
certifiedInvoicesListMapper
;
...
@@ -148,6 +149,7 @@ public class SpringContextUtil implements ApplicationContextAware {
...
@@ -148,6 +149,7 @@ public class SpringContextUtil implements ApplicationContextAware {
invoiceRecordMapper
=
webApplicationContext
.
getBean
(
InvoiceRecordMapper
.
class
);
invoiceRecordMapper
=
webApplicationContext
.
getBean
(
InvoiceRecordMapper
.
class
);
certifiedInvoicesListMapper
=
webApplicationContext
.
getBean
(
CertifiedInvoicesListMapper
.
class
);
certifiedInvoicesListMapper
=
webApplicationContext
.
getBean
(
CertifiedInvoicesListMapper
.
class
);
trialBalanceMappingMapper
=
webApplicationContext
.
getBean
(
TrialBalanceMappingMapper
.
class
);
trialBalanceMappingMapper
=
webApplicationContext
.
getBean
(
TrialBalanceMappingMapper
.
class
);
revenueConfigMapper
=
webApplicationContext
.
getBean
(
RevenueConfigMapper
.
class
);
/* map.put("balance_sheet", balanceMapper);
/* map.put("balance_sheet", balanceMapper);
map.put("profit_loss_statement",profitLossStatementMapper);
map.put("profit_loss_statement",profitLossStatementMapper);
map.put("cash_flow", cashFlowMapper);
map.put("cash_flow", cashFlowMapper);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
017a3bf0
...
@@ -342,6 +342,17 @@ public class ReportServiceImpl extends BaseService {
...
@@ -342,6 +342,17 @@ public class ReportServiceImpl extends BaseService {
andStartDateLessThanOrEqualTo
(
queryDate
).
andEndDateGreaterThanOrEqualTo
(
queryDate
).
andStartDateLessThanOrEqualTo
(
queryDate
).
andEndDateGreaterThanOrEqualTo
(
queryDate
).
andStatusEqualTo
(
0
);
andStatusEqualTo
(
0
);
List
<
RevenueTypeMapping
>
mappingList
=
revenueTypeMappingMapper
.
selectByExample
(
mappingExample
);
List
<
RevenueTypeMapping
>
mappingList
=
revenueTypeMappingMapper
.
selectByExample
(
mappingExample
);
//先清除数据
InvoiceRecord
delRecord
=
new
InvoiceRecord
();
delRecord
.
setRevenueCofId
(
null
);
if
(!
isMergeManualData
){
delRecord
.
setModifyRevenueCofId
(
null
);
}
InvoiceRecordExample
delExample
=
new
InvoiceRecordExample
();
delExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
)
.
andProjectIdEqualTo
(
projectId
).
andPeriodEqualTo
(
Integer
.
valueOf
(
queryDate
.
replace
(
"-"
,
""
)));
invoiceRecordMapper
.
deleteByExample
(
delExample
);
Map
<
String
,
Long
>
map
=
new
HashMap
<>();
Map
<
String
,
Long
>
map
=
new
HashMap
<>();
for
(
RevenueTypeMapping
mapping
:
mappingList
)
{
for
(
RevenueTypeMapping
mapping
:
mappingList
)
{
if
(!
map
.
containsKey
(
mapping
.
getContent
()))
{
if
(!
map
.
containsKey
(
mapping
.
getContent
()))
{
...
@@ -356,10 +367,6 @@ public class ReportServiceImpl extends BaseService {
...
@@ -356,10 +367,6 @@ public class ReportServiceImpl extends BaseService {
}
}
if
(
map
.
containsKey
(
mapping
.
getContent
()))
{
if
(
map
.
containsKey
(
mapping
.
getContent
()))
{
InvoiceRecord
destRecord
=
new
InvoiceRecord
();
InvoiceRecord
destRecord
=
new
InvoiceRecord
();
//是否保存手工数据源
if
(!
isMergeManualData
){
destRecord
.
setModifyRevenueCofId
(
null
);
}
destRecord
.
setRevenueCofId
(
map
.
get
(
mapping
.
getContent
()));
destRecord
.
setRevenueCofId
(
map
.
get
(
mapping
.
getContent
()));
InvoiceRecordExample
recordExample
=
new
InvoiceRecordExample
();
InvoiceRecordExample
recordExample
=
new
InvoiceRecordExample
();
recordExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
)
recordExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
)
...
@@ -2331,7 +2338,7 @@ public class ReportServiceImpl extends BaseService {
...
@@ -2331,7 +2338,7 @@ public class ReportServiceImpl extends BaseService {
}
}
@
Autowired
@
Resource
private
EbitSpreadDataMapper
ebitSpreadDataMapper
;
private
EbitSpreadDataMapper
ebitSpreadDataMapper
;
public
OperationResultDto
spreadToDb
(
RequestParameterDto
.
EbitParam
ebitParam
)
{
public
OperationResultDto
spreadToDb
(
RequestParameterDto
.
EbitParam
ebitParam
)
{
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/KPSR.java
View file @
017a3bf0
...
@@ -12,19 +12,17 @@ import pwc.taxtech.atms.constant.enums.EnumOperationType;
...
@@ -12,19 +12,17 @@ import pwc.taxtech.atms.constant.enums.EnumOperationType;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType
;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType
;
import
pwc.taxtech.atms.constant.enums.KeyValueConfigResultType
;
import
pwc.taxtech.atms.constant.enums.KeyValueConfigResultType
;
import
pwc.taxtech.atms.dto.vatdto.OutputInvoiceDataSourceDto
;
import
pwc.taxtech.atms.dto.vatdto.OutputInvoiceDataSourceDto
;
import
pwc.taxtech.atms.vat.entity.InvoiceRecord
;
import
pwc.taxtech.atms.vat.entity.*
;
import
pwc.taxtech.atms.vat.entity.InvoiceRecordExample
;
import
pwc.taxtech.atms.vat.entity.RevenueTypeMapping
;
import
pwc.taxtech.atms.vat.entity.RevenueTypeMappingExample
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
*
根据收入类型配置查询开票收入开票金额总计
* 根据收入类型配置查询开票收入开票金额总计
*/
*/
public
class
KPSR
extends
FunctionBase
implements
FreeRefFunction
{
public
class
KPSR
extends
FunctionBase
implements
FreeRefFunction
{
public
KPSR
(
FormulaContext
formulaContext
)
{
public
KPSR
(
FormulaContext
formulaContext
)
{
...
@@ -40,10 +38,10 @@ public class KPSR extends FunctionBase implements FreeRefFunction {
...
@@ -40,10 +38,10 @@ public class KPSR extends FunctionBase implements FreeRefFunction {
String
revenueTypeName
=
getStringParam
(
args
[
0
],
ec
);
//收入类型名称
String
revenueTypeName
=
getStringParam
(
args
[
0
],
ec
);
//收入类型名称
Integer
billType
=
getIntParam
(
args
[
1
],
ec
);
//发票类型
Integer
billType
=
getIntParam
(
args
[
1
],
ec
);
//发票类型
Integer
amountType
=
getIntParam
(
args
[
2
],
ec
);
//金额类型
Integer
amountType
=
getIntParam
(
args
[
2
],
ec
);
//金额类型
String
formulaExpression
=
"KPSR(\""
+
revenueTypeName
+
"\","
+
billType
+
","
+
amountType
+
")"
;
String
formulaExpression
=
"KPSR(\""
+
revenueTypeName
+
"\","
+
billType
+
","
+
amountType
+
")"
;
logger
.
debug
(
formulaExpression
);
logger
.
debug
(
formulaExpression
);
List
<
OutputInvoiceDataSourceDto
>
dataSource
=
new
ArrayList
<>();
List
<
OutputInvoiceDataSourceDto
>
dataSource
=
new
ArrayList
<>();
double
result
=
assembleData
(
revenueTypeName
,
dataSource
,
billType
,
amountType
,
ec
);
double
result
=
assembleData
(
revenueTypeName
,
dataSource
,
billType
,
amountType
,
ec
);
Long
dataSoureId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
OutputInvoiceDataSourceDto
,
new
BigDecimal
(
result
),
formulaContext
.
getPeriod
(),
Long
dataSoureId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
OutputInvoiceDataSourceDto
,
new
BigDecimal
(
result
),
formulaContext
.
getPeriod
(),
formulaContext
.
getReportTemplateGroupId
(),
formulaContext
.
getProjectId
());
formulaContext
.
getReportTemplateGroupId
(),
formulaContext
.
getProjectId
());
saveFormulaBlock
(
formulaContext
.
getPeriod
(),
ec
,
formulaExpression
,
new
BigDecimal
(
result
),
dataSoureId
,
formulaContext
.
getProjectId
());
saveFormulaBlock
(
formulaContext
.
getPeriod
(),
ec
,
formulaExpression
,
new
BigDecimal
(
result
),
dataSoureId
,
formulaContext
.
getProjectId
());
...
@@ -51,9 +49,9 @@ public class KPSR extends FunctionBase implements FreeRefFunction {
...
@@ -51,9 +49,9 @@ public class KPSR extends FunctionBase implements FreeRefFunction {
}
}
private
double
assembleData
(
String
revenueTypeName
,
List
<
OutputInvoiceDataSourceDto
>
contain
,
Integer
billType
,
Integer
amountType
,
OperationEvaluationContext
ec
)
{
private
double
assembleData
(
String
revenueTypeName
,
List
<
OutputInvoiceDataSourceDto
>
contain
,
Integer
billType
,
Integer
amountType
,
OperationEvaluationContext
ec
)
{
String
queryDate
=
formulaContext
.
getYear
()
+(
formulaContext
.
getPeriod
()<
10
?(
"0"
+
formulaContext
.
getPeriod
()):(
formulaContext
.
getPeriod
()+
""
));
String
queryDate
=
formulaContext
.
getYear
()
+
(
formulaContext
.
getPeriod
()
<
10
?
(
"0"
+
formulaContext
.
getPeriod
())
:
(
formulaContext
.
getPeriod
()
+
""
));
RevenueTypeMappingExample
typeMappingExample
=
new
RevenueTypeMappingExample
();
RevenueTypeMappingExample
typeMappingExample
=
new
RevenueTypeMappingExample
();
typeMappingExample
.
createCriteria
().
andOrgIdEqualTo
(
formulaContext
.
getOrganizationId
())
typeMappingExample
.
createCriteria
().
andOrgIdEqualTo
(
formulaContext
.
getOrganizationId
())
.
andRevenueTypeNameEqualTo
(
revenueTypeName
).
andStartDateLessThanOrEqualTo
(
queryDate
)
.
andRevenueTypeNameEqualTo
(
revenueTypeName
).
andStartDateLessThanOrEqualTo
(
queryDate
)
...
@@ -62,17 +60,43 @@ public class KPSR extends FunctionBase implements FreeRefFunction {
...
@@ -62,17 +60,43 @@ public class KPSR extends FunctionBase implements FreeRefFunction {
if
(
CollectionUtils
.
isEmpty
(
typeMappingList
))
{
if
(
CollectionUtils
.
isEmpty
(
typeMappingList
))
{
return
0.0
;
return
0.0
;
}
}
List
<
String
>
contens
=
typeMappingList
.
stream
()
List
<
String
>
revenueTypes
=
typeMappingList
.
stream
()
.
map
(
o
->
o
.
getContent
()).
collect
(
Collectors
.
toList
());
.
map
(
o
->
o
.
getRevenueTypeName
()).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
contens
))
{
RevenueConfigExample
configExample
=
new
RevenueConfigExample
();
configExample
.
createCriteria
().
andOrgIdEqualTo
(
formulaContext
.
getOrganizationId
()).
andStartDateLessThanOrEqualTo
(
queryDate
)
.
andEndDateGreaterThanOrEqualTo
(
queryDate
).
andNameIn
(
revenueTypes
);
List
<
RevenueConfig
>
configDatas
=
SpringContextUtil
.
revenueConfigMapper
.
selectByExample
(
configExample
);
if
(
CollectionUtils
.
isEmpty
(
configDatas
))
{
return
0.0
;
return
0.0
;
}
}
List
<
Long
>
revenueTypeIds
=
configDatas
.
stream
()
.
map
(
o
->
o
.
getId
()).
collect
(
Collectors
.
toList
());
List
<
InvoiceRecord
>
billDetails
=
new
ArrayList
<>();
InvoiceRecordExample
invoiceRecordExample
=
new
InvoiceRecordExample
();
InvoiceRecordExample
invoiceRecordExample
=
new
InvoiceRecordExample
();
InvoiceRecordExample
.
Criteria
c
=
invoiceRecordExample
.
createCriteria
().
andBillingContentIn
(
contens
)
invoiceRecordExample
.
createCriteria
().
andRevenueCofIdIn
(
revenueTypeIds
)
.
andProjectIdEqualTo
(
formulaContext
.
getProjectId
())
.
andPeriodEqualTo
(
Integer
.
valueOf
(
queryDate
))
.
andInvoiceTypeEqualTo
(
InvoiceRecordEnum
.
InvoiceType
.
MAPPING
.
get
(
billType
));
List
<
InvoiceRecord
>
billDetails1
=
SpringContextUtil
.
invoiceRecordMapper
.
selectByExample
(
invoiceRecordExample
);
if
(
CollectionUtils
.
isNotEmpty
(
billDetails1
)){
Iterator
<
InvoiceRecord
>
iterator
=
billDetails1
.
iterator
();
while
(
iterator
.
hasNext
()){
if
(
iterator
.
next
().
getModifyRevenueCofId
()!=
null
){
iterator
.
remove
();
}
}
billDetails
.
addAll
(
billDetails1
);
}
invoiceRecordExample
=
new
InvoiceRecordExample
();
invoiceRecordExample
.
createCriteria
().
andModifyRevenueCofIdIn
(
revenueTypeIds
)
.
andProjectIdEqualTo
(
formulaContext
.
getProjectId
())
.
andProjectIdEqualTo
(
formulaContext
.
getProjectId
())
.
andPeriodEqualTo
(
Integer
.
valueOf
(
queryDate
))
.
andPeriodEqualTo
(
Integer
.
valueOf
(
queryDate
))
.
andInvoiceTypeEqualTo
(
InvoiceRecordEnum
.
InvoiceType
.
MAPPING
.
get
(
billType
));
.
andInvoiceTypeEqualTo
(
InvoiceRecordEnum
.
InvoiceType
.
MAPPING
.
get
(
billType
));
List
<
InvoiceRecord
>
billDetails
=
SpringContextUtil
.
invoiceRecordMapper
.
selectByExample
(
invoiceRecordExample
);
List
<
InvoiceRecord
>
billDetails2
=
SpringContextUtil
.
invoiceRecordMapper
.
selectByExample
(
invoiceRecordExample
);
if
(
CollectionUtils
.
isNotEmpty
(
billDetails2
)){
billDetails
.
addAll
(
billDetails2
);
}
for
(
InvoiceRecord
invoiceRecord
:
billDetails
)
{
for
(
InvoiceRecord
invoiceRecord
:
billDetails
)
{
OutputInvoiceDataSourceDto
outputInvoiceDataSourceDto
=
new
OutputInvoiceDataSourceDto
();
OutputInvoiceDataSourceDto
outputInvoiceDataSourceDto
=
new
OutputInvoiceDataSourceDto
();
outputInvoiceDataSourceDto
.
setAmount
(
FormulaHelper
.
roundValue
(
invoiceRecord
.
getInvoiceAmount
(),
outputInvoiceDataSourceDto
.
setAmount
(
FormulaHelper
.
roundValue
(
invoiceRecord
.
getInvoiceAmount
(),
...
@@ -91,9 +115,9 @@ public class KPSR extends FunctionBase implements FreeRefFunction {
...
@@ -91,9 +115,9 @@ public class KPSR extends FunctionBase implements FreeRefFunction {
outputInvoiceDataSourceDto
.
setOperationType
(
EnumOperationType
.
Single
.
getCode
());
outputInvoiceDataSourceDto
.
setOperationType
(
EnumOperationType
.
Single
.
getCode
());
contain
.
add
(
outputInvoiceDataSourceDto
);
contain
.
add
(
outputInvoiceDataSourceDto
);
}
}
if
(
InvoiceRecordEnum
.
AmountType
.
INVOICE_AMOUNT
.
getCode
().
equals
(
amountType
))
{
if
(
InvoiceRecordEnum
.
AmountType
.
INVOICE_AMOUNT
.
getCode
().
equals
(
amountType
))
{
return
billDetails
.
stream
().
mapToDouble
(
a
->
a
.
getInvoiceAmount
().
doubleValue
()).
sum
();
return
billDetails
.
stream
().
mapToDouble
(
a
->
a
.
getInvoiceAmount
().
doubleValue
()).
sum
();
}
else
if
(
InvoiceRecordEnum
.
AmountType
.
TAX_AMOUNT
.
getCode
().
equals
(
amountType
))
{
}
else
if
(
InvoiceRecordEnum
.
AmountType
.
TAX_AMOUNT
.
getCode
().
equals
(
amountType
))
{
return
billDetails
.
stream
().
mapToDouble
(
a
->
a
.
getTaxAmount
().
doubleValue
()).
sum
();
return
billDetails
.
stream
().
mapToDouble
(
a
->
a
.
getTaxAmount
().
doubleValue
()).
sum
();
}
}
return
0
;
return
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