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
eb5daca4
Commit
eb5daca4
authored
Jul 16, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function JXFP code, need debug later
parent
246ab479
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
250 additions
and
4 deletions
+250
-4
SpringContextUtil.java
.../java/pwc/taxtech/atms/common/util/SpringContextUtil.java
+3
-0
Constant.java
...api/src/main/java/pwc/taxtech/atms/constant/Constant.java
+7
-0
FormulaDataSourceDetailType.java
...tech/atms/constant/enums/FormulaDataSourceDetailType.java
+3
-2
InputInvoiceDataSourceDto.java
...wc/taxtech/atms/dto/vatdto/InputInvoiceDataSourceDto.java
+26
-0
InputVatInvoiceDao.java
...java/pwc/taxtech/atms/vat/dao/dao/InputVatInvoiceDao.java
+44
-0
GZSD.java
.../taxtech/atms/vat/service/impl/report/functions/GZSD.java
+0
-2
JXFP.java
.../taxtech/atms/vat/service/impl/report/functions/JXFP.java
+167
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/util/SpringContextUtil.java
View file @
eb5daca4
...
@@ -9,6 +9,7 @@ import pwc.taxtech.atms.dao.ProjectServiceTypeMapper;
...
@@ -9,6 +9,7 @@ import pwc.taxtech.atms.dao.ProjectServiceTypeMapper;
import
pwc.taxtech.atms.dao.dao.ProjectDao
;
import
pwc.taxtech.atms.dao.dao.ProjectDao
;
import
pwc.taxtech.atms.service.impl.DistributedIDService
;
import
pwc.taxtech.atms.service.impl.DistributedIDService
;
import
pwc.taxtech.atms.vat.dao.*
;
import
pwc.taxtech.atms.vat.dao.*
;
import
pwc.taxtech.atms.vat.dao.dao.InputVatInvoiceDao
;
import
pwc.taxtech.atms.vat.dao.dao.VatEnterpriseAccountDao
;
import
pwc.taxtech.atms.vat.dao.dao.VatEnterpriseAccountDao
;
//用来获取spring托管的bean
//用来获取spring托管的bean
...
@@ -37,6 +38,7 @@ public class SpringContextUtil implements ApplicationContextAware {
...
@@ -37,6 +38,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public
static
BalanceStdManualMapper
balanceStdManualMapper
;
public
static
BalanceStdManualMapper
balanceStdManualMapper
;
public
static
OutputVATInvoiceMapper
outputVATInvoiceMapper
;
public
static
OutputVATInvoiceMapper
outputVATInvoiceMapper
;
public
static
PeriodTaxRuleSettingMapper
periodTaxRuleSettingMapper
;
public
static
PeriodTaxRuleSettingMapper
periodTaxRuleSettingMapper
;
public
static
InputVatInvoiceDao
inputVatInvoiceDao
;
/**
/**
...
@@ -73,5 +75,6 @@ public class SpringContextUtil implements ApplicationContextAware {
...
@@ -73,5 +75,6 @@ public class SpringContextUtil implements ApplicationContextAware {
balanceStdManualMapper
=
webApplicationContext
.
getBean
(
BalanceStdManualMapper
.
class
);
balanceStdManualMapper
=
webApplicationContext
.
getBean
(
BalanceStdManualMapper
.
class
);
outputVATInvoiceMapper
=
webApplicationContext
.
getBean
(
OutputVATInvoiceMapper
.
class
);
outputVATInvoiceMapper
=
webApplicationContext
.
getBean
(
OutputVATInvoiceMapper
.
class
);
periodTaxRuleSettingMapper
=
webApplicationContext
.
getBean
(
PeriodTaxRuleSettingMapper
.
class
);
periodTaxRuleSettingMapper
=
webApplicationContext
.
getBean
(
PeriodTaxRuleSettingMapper
.
class
);
inputVatInvoiceDao
=
webApplicationContext
.
getBean
(
InputVatInvoiceDao
.
class
);
}
}
}
}
atms-api/src/main/java/pwc/taxtech/atms/constant/Constant.java
View file @
eb5daca4
...
@@ -63,4 +63,10 @@ public final class Constant {
...
@@ -63,4 +63,10 @@ public final class Constant {
public
static
final
short
Yes
=
1
;
public
static
final
short
Yes
=
1
;
public
static
final
short
No
=
0
;
public
static
final
short
No
=
0
;
}
}
public
static
class
InputInvoiceCertificationResult
{
public
static
String
CheckPass
=
"勾选认证"
;
public
static
String
ScanPass
=
"扫描认证"
;
public
static
String
NotPass
=
"未认证"
;
}
}
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/FormulaDataSourceDetailType.java
View file @
eb5daca4
...
@@ -3,8 +3,9 @@ package pwc.taxtech.atms.constant.enums;
...
@@ -3,8 +3,9 @@ package pwc.taxtech.atms.constant.enums;
public
enum
FormulaDataSourceDetailType
{
public
enum
FormulaDataSourceDetailType
{
BSPLFormulaDataSourceDto
(
1
,
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
BSPLFormulaDataSourceDto
.
class
),
BSPLFormulaDataSourceDto
(
1
,
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
BSPLFormulaDataSourceDto
.
class
),
FormulaDataSourceDto
(
1
,
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
FormulaDataSourceDto
.
class
),
FormulaDataSourceDto
(
2
,
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
FormulaDataSourceDto
.
class
),
OutputInvoiceDataSourceDto
(
1
,
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
OutputInvoiceDataSourceDto
.
class
);
InputInvoiceDataSourceDto
(
3
,
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
FormulaDataSourceDto
.
class
),
OutputInvoiceDataSourceDto
(
4
,
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
OutputInvoiceDataSourceDto
.
class
);
private
Integer
code
;
private
Integer
code
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/InputInvoiceDataSourceDto.java
0 → 100644
View file @
eb5daca4
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
lombok.Getter
;
import
lombok.Setter
;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceType
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Setter
@Getter
public
class
InputInvoiceDataSourceDto
extends
FormulaDataSourceDto
{
public
InputInvoiceDataSourceDto
()
{
super
();
this
.
setType
(
FormulaDataSourceType
.
InputInvoice
.
getCode
());
}
public
int
Period
;
public
Date
certificationDate
;
public
String
sellerTaxNumber
;
public
String
invoiceCode
;
public
String
invoiceNumber
;
public
BigDecimal
taxAmount
;
public
int
invoiceType
;
}
atms-api/src/main/java/pwc/taxtech/atms/vat/dao/dao/InputVatInvoiceDao.java
0 → 100644
View file @
eb5daca4
package
pwc
.
taxtech
.
atms
.
vat
.
dao
.
dao
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.vat.dao.InputVATInvoiceMapper
;
import
pwc.taxtech.atms.vat.entity.InputVATInvoice
;
import
pwc.taxtech.atms.vat.entity.InputVATInvoiceExample
;
import
java.util.List
;
@Service
public
class
InputVatInvoiceDao
{
@Autowired
InputVATInvoiceMapper
inputVATInvoiceMapper
;
public
List
<
InputVATInvoice
>
getInputVATInvoice
(
Integer
period
,
Integer
invoiceType
,
String
checkPass
,
String
scanPass
,
String
notPass
)
{
InputVATInvoiceExample
example
=
new
InputVATInvoiceExample
();
InputVATInvoiceExample
.
Criteria
criteria
=
example
.
createCriteria
();
InputVATInvoiceExample
.
Criteria
criteria1
=
example
.
createCriteria
();
if
(
period
!=
null
)
{
criteria
.
andPeriodIDEqualTo
(
period
);
criteria1
.
andPeriodIDEqualTo
(
period
);
}
if
(
invoiceType
!=
null
)
{
criteria
.
andInvoiceTypeEqualTo
(
invoiceType
);
criteria1
.
andInvoiceTypeEqualTo
(
invoiceType
);
}
if
(
StringUtils
.
isNotBlank
(
notPass
)){
criteria
.
andCertificationResultEqualTo
(
notPass
);
criteria1
.
andCertificationResultEqualTo
(
notPass
);
}
else
if
(
StringUtils
.
isNotBlank
(
checkPass
)&&
StringUtils
.
isNotBlank
(
scanPass
)){
criteria
.
andCertificationResultEqualTo
(
checkPass
);
criteria
.
andCertificationResultEqualTo
(
scanPass
);
example
.
or
(
criteria1
);
}
return
inputVATInvoiceMapper
.
selectByExample
(
example
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/GZSD.java
View file @
eb5daca4
...
@@ -101,8 +101,6 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
...
@@ -101,8 +101,6 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
//return new NumberEval(matchedRule.get().getTaxBase());
//return new NumberEval(matchedRule.get().getTaxBase());
}
}
return
null
;
return
null
;
}
}
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/JXFP.java
0 → 100644
View file @
eb5daca4
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
.
report
.
functions
;
import
org.apache.poi.ss.formula.OperationEvaluationContext
;
import
org.apache.poi.ss.formula.eval.NumberEval
;
import
org.apache.poi.ss.formula.eval.ValueEval
;
import
org.apache.poi.ss.formula.functions.FreeRefFunction
;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.constant.Constant
;
import
pwc.taxtech.atms.constant.enums.EnumOperationType
;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType
;
import
pwc.taxtech.atms.constant.enums.KeyValueConfigResultType
;
import
pwc.taxtech.atms.dto.vatdto.InputInvoiceDataSourceDto
;
import
pwc.taxtech.atms.vat.entity.InputVATInvoice
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/// <summary>
/// 名称:本期/前期认证相符且本期申报抵扣
/// 功能:从导入进项发票明细清单取数
/// 备注:取值表格:进项明细清单
/// 条件字段:
/// 认证期间:"0"当期,"-99"前期(当月之前所有月份,不含当月),"99"所有认证期间
/// 发票类型:“1”增值税专票,“2”货运发票,“3”机动车发票,“4”农产品发票,“5”其他发票(包括空值);
/// 认证结果(认证通过,认证未通过,未认证)
/// 取值字段:金额,税额,份数
/// 在导入进项发票时会去检查是否有重复导入发票现象,不允许重复导入,从而杜绝重复抵扣。
/// </summary>
/// <param name="certificationPeriod">认证期间:“0”当期(当月),“-99”前期(当月之前所有月份,不含当月),"99"所有认证期间</param>
/// <param name="invoiceType">“1”增值税专票,“2”货运发票,“3”机动车发票,“4”农产品发票,“5”其他发票(包括空值)</param>
/// <param name="authenticationType">认证结果:“1”认证通过;“0”认证未通过;“2”未认证</param>
/// <param name="resultType">计算取值:“0”金额;“1”税额;“2”份数;</param>
/// <param name="period">会计期间——“0”当期,1-12为自然月</param>
/// <returns></returns>
public
class
JXFP
extends
FunctionBase
implements
FreeRefFunction
{
public
JXFP
(
FormulaContext
formulaContext
)
{
super
(
formulaContext
);
}
@Override
public
ValueEval
evaluate
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
{
if
(
args
.
length
<
5
)
{
return
null
;
}
int
certificationPeriod
=
getIntParam
(
args
[
0
],
ec
);
int
invoiceType
=
getIntParam
(
args
[
1
],
ec
);
int
authenticationType
=
getIntParam
(
args
[
2
],
ec
);
int
resultType
=
getIntParam
(
args
[
3
],
ec
);
int
period
=
getIntParam
(
args
[
3
],
ec
);
String
formulaExpression
=
"JXFP("
+
certificationPeriod
+
","
+
invoiceType
+
","
+
authenticationType
+
","
+
resultType
+
","
+
period
+
")"
;
logger
.
debug
(
formulaExpression
);
int
[]
yearOffset
=
{};
certificationPeriod
=
getPeriod
(
certificationPeriod
,
yearOffset
);
if
(
yearOffset
[
0
]
<
0
)
{
return
null
;
}
period
=
getPeriod
(
period
,
yearOffset
);
if
(
yearOffset
[
0
]
<
0
)
{
return
null
;
}
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
set
(
formulaContext
.
getYear
(),
1
,
1
);
Date
startDate
=
calendar
.
getTime
();
calendar
.
add
(
Calendar
.
YEAR
,
1
);
Date
endDate
=
calendar
.
getTime
();
List
<
InputVATInvoice
>
inputVATInvoices
;
if
(
authenticationType
==
1
&&
formulaContext
.
getIsYear
())
{
inputVATInvoices
=
SpringContextUtil
.
inputVatInvoiceDao
.
getInputVATInvoice
(
null
,
invoiceType
,
Constant
.
InputInvoiceCertificationResult
.
CheckPass
,
Constant
.
InputInvoiceCertificationResult
.
ScanPass
,
null
);
}
else
if
(
authenticationType
==
1
)
{
inputVATInvoices
=
SpringContextUtil
.
inputVatInvoiceDao
.
getInputVATInvoice
(
period
,
invoiceType
,
Constant
.
InputInvoiceCertificationResult
.
CheckPass
,
Constant
.
InputInvoiceCertificationResult
.
ScanPass
,
null
);
}
// 认证未通过与未认证暂认为是同一个意思
else
if
((
authenticationType
==
1
||
authenticationType
==
2
)
&&
formulaContext
.
getIsYear
())
{
inputVATInvoices
=
SpringContextUtil
.
inputVatInvoiceDao
.
getInputVATInvoice
(
null
,
invoiceType
,
null
,
null
,
Constant
.
InputInvoiceCertificationResult
.
NotPass
);
}
// 认证未通过与未认证暂认为是同一个意思
else
if
(
authenticationType
==
0
||
authenticationType
==
2
)
{
inputVATInvoices
=
SpringContextUtil
.
inputVatInvoiceDao
.
getInputVATInvoice
(
period
,
invoiceType
,
null
,
null
,
Constant
.
InputInvoiceCertificationResult
.
NotPass
);
}
else
{
return
null
;
}
if
(
certificationPeriod
!=
-
99
&&
certificationPeriod
!=
99
&&
(
certificationPeriod
<
1
||
certificationPeriod
>
12
))
{
return
null
;
}
else
if
(!
formulaContext
.
getIsYear
())
{
if
(
certificationPeriod
==
-
99
)
{
calendar
.
set
(
formulaContext
.
getYear
(),
formulaContext
.
getPeriod
(),
1
);
endDate
=
calendar
.
getTime
();
Date
finalEndDate
=
endDate
;
inputVATInvoices
=
inputVATInvoices
.
stream
()
.
filter
(
a
->
a
.
getCertificationDate
().
before
(
finalEndDate
))
.
collect
(
Collectors
.
toList
());
}
else
if
(
certificationPeriod
!=
99
)
{
calendar
.
set
(
formulaContext
.
getYear
(),
certificationPeriod
,
1
);
startDate
=
calendar
.
getTime
();
calendar
.
set
(
formulaContext
.
getYear
(),
certificationPeriod
,
1
);
calendar
.
add
(
Calendar
.
MONTH
,
1
);
endDate
=
calendar
.
getTime
();
Date
finalEndDate1
=
endDate
;
Date
finalStartDate
=
startDate
;
inputVATInvoices
=
inputVATInvoices
.
stream
()
.
filter
(
a
->
a
.
getCertificationDate
().
after
(
finalStartDate
)
&&
a
.
getCertificationDate
().
before
(
finalEndDate1
))
.
collect
(
Collectors
.
toList
());
}
}
List
<
InputInvoiceDataSourceDto
>
dataSource
=
new
ArrayList
();
for
(
InputVATInvoice
x
:
inputVATInvoices
)
{
InputInvoiceDataSourceDto
inputInvoiceDataSourceDto
=
new
InputInvoiceDataSourceDto
();
inputInvoiceDataSourceDto
.
setAmount
(
FormulaHelper
.
roundValue
(
x
.
getAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
inputInvoiceDataSourceDto
.
setResultType
(
KeyValueConfigResultType
.
Accounting
.
getCode
());
inputInvoiceDataSourceDto
.
setTaxAmount
(
FormulaHelper
.
roundValue
(
x
.
getTaxAmount
(),
KeyValueConfigResultType
.
Accounting
,
null
,
formulaContext
));
inputInvoiceDataSourceDto
.
setCertificationDate
(
x
.
getCertificationDate
());
inputInvoiceDataSourceDto
.
setInvoiceCode
(
x
.
getInvoiceCode
());
inputInvoiceDataSourceDto
.
setInvoiceNumber
(
x
.
getInvoiceNumber
());
inputInvoiceDataSourceDto
.
setInvoiceType
(
x
.
getInvoiceType
());
inputInvoiceDataSourceDto
.
setPeriod
(
x
.
getPeriodID
());
inputInvoiceDataSourceDto
.
setSellerTaxNumber
(
x
.
getSellerTaxNumber
());
inputInvoiceDataSourceDto
.
setName
(
Constant
.
DataSourceName
.
InputDetailInvoiceDataSource
);
inputInvoiceDataSourceDto
.
setOperationType
(
EnumOperationType
.
Single
.
getCode
());
dataSource
.
add
(
inputInvoiceDataSourceDto
);
}
dataSource
=
dataSource
.
stream
()
.
sorted
(
Comparator
.
comparing
(
InputInvoiceDataSourceDto:
:
getCertificationDate
)
.
thenComparing
(
InputInvoiceDataSourceDto:
:
getInvoiceCode
)
.
thenComparing
(
InputInvoiceDataSourceDto:
:
getInvoiceNumber
))
.
collect
(
Collectors
.
toList
());
if
(
resultType
==
0
)
{
double
val
=
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getAmount
().
doubleValue
()).
sum
();
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
InputInvoiceDataSourceDto
,
BigDecimal
.
valueOf
(
val
));
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
BigDecimal
.
valueOf
(
val
),
dataSourceId
);
return
new
NumberEval
(
val
);
}
else
if
(
resultType
==
1
)
{
double
val
=
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getTaxAmount
().
doubleValue
()).
sum
();
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
InputInvoiceDataSourceDto
,
BigDecimal
.
valueOf
(
val
));
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
BigDecimal
.
valueOf
(
val
),
dataSourceId
);
return
new
NumberEval
(
val
);
}
else
if
(
resultType
==
2
)
{
double
val
=
dataSource
.
size
();
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
InputInvoiceDataSourceDto
,
BigDecimal
.
valueOf
(
val
));
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
BigDecimal
.
valueOf
(
val
),
dataSourceId
);
return
new
NumberEval
(
val
);
}
return
null
;
}
}
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