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
23a0a809
Commit
23a0a809
authored
Jul 04, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function FSJZ(Not finished yet)
parent
788e071a
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
506 additions
and
15 deletions
+506
-15
FormulaDataSourceType.java
...wc/taxtech/atms/constant/enums/FormulaDataSourceType.java
+80
-0
BSPLFormulaDataSourceDto.java
...pwc/taxtech/atms/dto/vatdto/BSPLFormulaDataSourceDto.java
+30
-0
DataSourceDto.java
.../main/java/pwc/taxtech/atms/dto/vatdto/DataSourceDto.java
+1
-1
BalanceMapper.java
...src/main/java/pwc/taxtech/atms/vat/dao/BalanceMapper.java
+5
-0
BalanceStdManualMapper.java
...java/pwc/taxtech/atms/vat/dao/BalanceStdManualMapper.java
+6
-0
VatEnterpriseAccountMapper.java
.../pwc/taxtech/atms/vat/dao/VatEnterpriseAccountMapper.java
+3
-0
VatStandardAccountMapper.java
...va/pwc/taxtech/atms/vat/dao/VatStandardAccountMapper.java
+3
-0
VatAbstractService.java
...pwc/taxtech/atms/vat/service/impl/VatAbstractService.java
+4
-0
FSJZ.java
.../taxtech/atms/vat/service/impl/report/functions/FSJZ.java
+123
-0
FormulaContext.java
...tms/vat/service/impl/report/functions/FormulaContext.java
+161
-7
FunctionBase.java
.../atms/vat/service/impl/report/functions/FunctionBase.java
+32
-0
SGSR.java
.../taxtech/atms/vat/service/impl/report/functions/SGSR.java
+29
-7
BalanceMapper.xml
...main/resources/pwc/taxtech/atms/vat/dao/BalanceMapper.xml
+5
-0
BalanceStdManualMapper.xml
...urces/pwc/taxtech/atms/vat/dao/BalanceStdManualMapper.xml
+15
-0
VatEnterpriseAccountMapper.xml
...s/pwc/taxtech/atms/vat/dao/VatEnterpriseAccountMapper.xml
+4
-0
VatStandardAccountMapper.xml
...ces/pwc/taxtech/atms/vat/dao/VatStandardAccountMapper.xml
+5
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/FormulaDataSourceType.java
0 → 100644
View file @
23a0a809
package
pwc
.
taxtech
.
atms
.
constant
.
enums
;
public
enum
FormulaDataSourceType
{
/// <summary>
/// 其他数据源,如公式中的税率、数字部分
/// </summary>
Other
(
0
),
/// <summary>
/// 进项数据源
/// </summary>
InputInvoice
(
1
),
/// <summary>
/// 进项明细数据源
/// </summary>
InputInvoiceDetail
(
2
),
/// <summary>
/// 销项数据源
/// </summary>
OutputInvoice
(
3
),
/// <summary>
/// 凭证数据源
/// </summary>
Voucher
(
4
),
/// <summary>
/// 报表数据源
/// </summary>
Report
(
5
),
/// <summary>
/// 条件判断数据源
/// </summary>
Judgment
(
6
),
/// <summary>
/// Sap日报数据源
/// </summary>
SapDaily
(
7
),
/// <summary>
/// 土地出让金数据源
/// </summary>
LandSell
(
8
),
/// <summary>
/// 未开票数据源
/// </summary>
Unbilled
(
9
),
KeyInSource
(
10
),
//由于开会讨论,期末余额,期初余额等都是试算平衡数据源, code 11,12,14 所以删除他们统一改成试算平衡表
//试算平衡数据源
TrialBalanceSource
(
11
),
//QMYESource(12),
ModelSource
(
13
),
// FSESource(14),
RuleSource
(
15
),
//凭证筛选
VoucherFilter
(
16
),
//发票筛选
InvoiceFilter
(
17
),
//模型数据源
ModelDatasource
(
18
),
// 用于存放特殊逻辑中获取的数据源数值与备注等信息,如未开票视同销售等
Special
(
19
),
TrialBalance
(
20
);
private
Integer
code
;
FormulaDataSourceType
(
Integer
code
)
{
this
.
code
=
code
;
}
public
Integer
getCode
()
{
return
code
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/BSPLFormulaDataSourceDto.java
0 → 100644
View file @
23a0a809
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceType
;
public
class
BSPLFormulaDataSourceDto
extends
FormulaDataSourceDto
{
public
BSPLFormulaDataSourceDto
(){
super
();
this
.
setType
(
FormulaDataSourceType
.
TrialBalance
.
getCode
());
}
private
String
accountCode
;
private
String
accountName
;
public
String
getAccountCode
()
{
return
accountCode
;
}
public
void
setAccountCode
(
String
accountCode
)
{
this
.
accountCode
=
accountCode
;
}
public
String
getAccountName
()
{
return
accountName
;
}
public
void
setAccountName
(
String
accountName
)
{
this
.
accountName
=
accountName
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/DataSourceDto.java
View file @
23a0a809
...
@@ -9,7 +9,7 @@ public class DataSourceDto {
...
@@ -9,7 +9,7 @@ public class DataSourceDto {
private
static
String
_DataSourceSuffix
=
"]"
;
private
static
String
_DataSourceSuffix
=
"]"
;
public
DataSourceDto
()
{
public
DataSourceDto
()
{
this
.
internalCode
=
_DataSourcePrefix
+
new
Object
().
hashCode
()
+
_DataSourceSuffix
;
this
.
internalCode
=
_DataSourcePrefix
+
hashCode
()
+
_DataSourceSuffix
;
}
}
private
String
id
;
private
String
id
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/dao/BalanceMapper.java
View file @
23a0a809
package
pwc
.
taxtech
.
atms
.
vat
.
dao
;
package
pwc
.
taxtech
.
atms
.
vat
.
dao
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.session.RowBounds
;
import
org.apache.ibatis.session.RowBounds
;
import
org.springframework.security.access.method.P
;
import
pwc.taxtech.atms.MyVatMapper
;
import
pwc.taxtech.atms.MyVatMapper
;
import
pwc.taxtech.atms.vat.entity.Balance
;
import
pwc.taxtech.atms.vat.entity.Balance
;
import
pwc.taxtech.atms.vat.entity.BalanceExample
;
import
pwc.taxtech.atms.vat.entity.BalanceExample
;
...
@@ -105,4 +107,6 @@ public interface BalanceMapper extends MyVatMapper {
...
@@ -105,4 +107,6 @@ public interface BalanceMapper extends MyVatMapper {
* @mbg.generated
* @mbg.generated
*/
*/
int
updateByPrimaryKey
(
Balance
record
);
int
updateByPrimaryKey
(
Balance
record
);
BigDecimal
getSumOfBalance
(
@Param
(
"acctCode"
)
String
acctCode
,
@Param
(
"direction"
)
int
direction
);
}
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/vat/dao/BalanceStdManualMapper.java
View file @
23a0a809
...
@@ -105,4 +105,9 @@ public interface BalanceStdManualMapper extends MyVatMapper {
...
@@ -105,4 +105,9 @@ public interface BalanceStdManualMapper extends MyVatMapper {
* @mbg.generated
* @mbg.generated
*/
*/
int
updateByPrimaryKey
(
BalanceStdManual
record
);
int
updateByPrimaryKey
(
BalanceStdManual
record
);
BalanceStdManual
selectOneWithAccountCodeAndDBName
(
@Param
(
"accountCode"
)
String
accountCode
,
@Param
(
"dbName"
)
String
dbName
,
@Param
(
"period"
)
int
period
);
BalanceStdManual
selectOneWithAccountCode
(
@Param
(
"accountCode"
)
String
accountCode
,
@Param
(
"period"
)
int
period
);
}
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/vat/dao/VatEnterpriseAccountMapper.java
View file @
23a0a809
...
@@ -105,4 +105,6 @@ public interface VatEnterpriseAccountMapper extends MyVatMapper {
...
@@ -105,4 +105,6 @@ public interface VatEnterpriseAccountMapper extends MyVatMapper {
* @mbg.generated
* @mbg.generated
*/
*/
int
updateByPrimaryKey
(
VatEnterpriseAccount
record
);
int
updateByPrimaryKey
(
VatEnterpriseAccount
record
);
List
<
VatEnterpriseAccount
>
getListWithAccountCode
(
@Param
(
"accountCode"
)
String
accountCode
);
}
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/vat/dao/VatStandardAccountMapper.java
View file @
23a0a809
...
@@ -110,4 +110,6 @@ public interface VatStandardAccountMapper extends MyVatMapper {
...
@@ -110,4 +110,6 @@ public interface VatStandardAccountMapper extends MyVatMapper {
int
updateByPrimaryKey
(
VatStandardAccount
record
);
int
updateByPrimaryKey
(
VatStandardAccount
record
);
List
<
TrialBalanceDto
>
selectProjectStandardAccountLeftJoinBalanceStdManual
(
@Param
(
"fromMonth"
)
String
fromMonth
,
@Param
(
"toMonth"
)
String
toMonth
);
List
<
TrialBalanceDto
>
selectProjectStandardAccountLeftJoinBalanceStdManual
(
@Param
(
"fromMonth"
)
String
fromMonth
,
@Param
(
"toMonth"
)
String
toMonth
);
VatStandardAccount
selectOneByAccountCode
(
@Param
(
"accountCode"
)
String
accountCode
);
}
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/VatAbstractService.java
View file @
23a0a809
...
@@ -55,5 +55,9 @@ public class VatAbstractService {
...
@@ -55,5 +55,9 @@ public class VatAbstractService {
public
EnterpriseAccountMapper
enterpriseAccountMapper
;
public
EnterpriseAccountMapper
enterpriseAccountMapper
;
@Autowired
@Autowired
public
ReportGenerator
reportGenerator
;
public
ReportGenerator
reportGenerator
;
@Autowired
public
BalanceStdManualMapper
balanceStdManualMapper
;
@Autowired
public
BalanceMapper
balanceMapper
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FSJZ.java
0 → 100644
View file @
23a0a809
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
.
report
.
functions
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.formula.OperationEvaluationContext
;
import
org.apache.poi.ss.formula.eval.ValueEval
;
import
org.apache.poi.ss.formula.functions.FreeRefFunction
;
import
pwc.taxtech.atms.dto.vatdto.BSPLFormulaDataSourceDto
;
import
pwc.taxtech.atms.dto.vatdto.FormulaDataSourceDto
;
import
pwc.taxtech.atms.entitiy.Project
;
import
pwc.taxtech.atms.entitiy.ProjectExample
;
import
pwc.taxtech.atms.vat.entity.BalanceStdManual
;
import
pwc.taxtech.atms.vat.entity.VatEnterpriseAccount
;
import
pwc.taxtech.atms.vat.entity.VatStandardAccount
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
/// <summary>
/// 名称:发生净值
/// 功能:计算指定科目发生额(根据科目自带方向而定)
/// 备注:科目在贷方 则用贷方发生额-借方发生额
/// 科目在借方 则用借方发生额-贷方发生额
/// 本公式取VAT试算平衡表 总账(经过科目重分类和审计调整之后的)中累计发生额相关数据。
/// web admin中需要新增科目(科目代码待确定),6001.04 税率为17%, 6001.05税率为13%,6001.06税率为11%,6001.07税率为6%
/// </summary>
/// <param name="accountType">科目类型——两种取值结果“0”标准科目,“1”企业科目;</param>
/// <param name="accountCode">科目代码;</param>
/// <param name="year">会计年份——“0”为当前年份,其他年份则为具体年份;</param>
/// <param name="period">会计期间——“0”为当前月份,1-12为自然月;"99"当年累计</param>
/// <param name="keyParam">摘要(未实现)</param>
public
class
FSJZ
extends
FunctionBase
implements
FreeRefFunction
{
private
FormulaContext
formulaContext
;
public
FSJZ
(
FormulaContext
formulaContext
)
{
this
.
formulaContext
=
formulaContext
;
}
@Override
public
ValueEval
evaluate
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
{
int
accountType
,
year
,
period
;
String
accountCode
,
keyParam
;
if
(
args
.
length
<
5
)
{
return
null
;
}
accountType
=
this
.
getIntParam
(
args
[
0
],
ec
);
accountCode
=
this
.
getStringParam
(
args
[
1
],
ec
);
year
=
this
.
getIntParam
(
args
[
2
],
ec
);
period
=
this
.
getIntParam
(
args
[
3
],
ec
);
keyParam
=
this
.
getStringParam
(
args
[
4
],
ec
);
if
(
year
==
0
)
{
year
=
formulaContext
.
getYear
();
}
int
[]
yearOffset
=
{};
period
=
FormulaHelper
.
getPeriod
(
period
,
yearOffset
,
formulaContext
);
year
=
year
+
yearOffset
[
0
];
if
(
accountType
==
0
)
{
VatStandardAccount
vatStandardAccount
=
formulaContext
.
getFormulaAgent
().
vatStandardAccountMapper
.
selectOneByAccountCode
(
accountCode
);
if
(
vatStandardAccount
==
null
)
{
return
null
;
}
BalanceStdManual
balanceStdManual
=
null
;
if
(
year
!=
formulaContext
.
getYear
())
{
ProjectExample
example
=
new
ProjectExample
();
example
.
createCriteria
().
andOrganizationIDEqualTo
(
formulaContext
.
getOrganizationID
()).
andYearEqualTo
(
year
);
Project
project
=
formulaContext
.
getFormulaAgent
().
projectMapper
.
selectByExample
(
example
).
get
(
0
);
String
dbName
=
StringUtils
.
EMPTY
;
if
(
project
==
null
)
{
return
null
;
}
else
{
dbName
=
project
.
getDbName
();
}
if
(
period
==
99
)
{
balanceStdManual
=
formulaContext
.
getFormulaAgent
().
balanceStdManualMapper
.
selectOneWithAccountCodeAndDBName
(
accountCode
,
dbName
,
12
);
}
else
{
balanceStdManual
=
formulaContext
.
getFormulaAgent
().
balanceStdManualMapper
.
selectOneWithAccountCodeAndDBName
(
accountCode
,
dbName
,
period
);
}
}
else
{
if
(
period
==
99
)
{
balanceStdManual
=
formulaContext
.
getFormulaAgent
().
balanceStdManualMapper
.
selectOneWithAccountCode
(
accountCode
,
12
);
}
else
{
balanceStdManual
=
formulaContext
.
getFormulaAgent
().
balanceStdManualMapper
.
selectOneWithAccountCode
(
accountCode
,
period
);
}
}
BigDecimal
val
=
new
BigDecimal
(
0
);
List
<
FormulaDataSourceDto
>
formulaDataSourceDtoList
=
new
ArrayList
<>();
if
(
balanceStdManual
!=
null
)
{
if
(
period
==
99
)
{
val
=
new
BigDecimal
(((
balanceStdManual
.
getYearDebitNet
()
!=
null
?
balanceStdManual
.
getYearDebitNet
()
:
0
).
doubleValue
()
-
(
balanceStdManual
.
getYearCreditNet
()
!=
null
?
balanceStdManual
.
getYearCreditNet
()
:
0
).
doubleValue
())
*
vatStandardAccount
.
getDirection
());
List
<
VatEnterpriseAccount
>
vatEnterpriseAccountList
=
formulaContext
.
getFormulaAgent
().
vatEnterpriseAccountMapper
.
getListWithAccountCode
(
accountCode
);
for
(
VatEnterpriseAccount
vatEnterpriseAccount:
vatEnterpriseAccountList
){
BigDecimal
amount
=
formulaContext
.
getFormulaAgent
().
balanceMapper
.
getSumOfBalance
(
vatEnterpriseAccount
.
getAcctCode
(),
vatStandardAccount
.
getDirection
());
BSPLFormulaDataSourceDto
bsplFormulaDataSourceDto
=
new
BSPLFormulaDataSourceDto
();
bsplFormulaDataSourceDto
.
setAccountCode
(
vatEnterpriseAccount
.
getAcctCode
());
bsplFormulaDataSourceDto
.
setAccountName
(
vatEnterpriseAccount
.
getName
());
bsplFormulaDataSourceDto
.
setName
(
"TrialBalanceDataSource"
);
bsplFormulaDataSourceDto
.
setAmount
(
amount
);
formulaDataSourceDtoList
.
add
(
bsplFormulaDataSourceDto
);
}
}
else
{
}
}
}
else
{
}
return
null
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FormulaContext.java
View file @
23a0a809
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
.
report
.
functions
;
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
.
report
.
functions
;
import
lombok.Getter
;
import
pwc.taxtech.atms.utils.FormulaResult
;
import
lombok.Setter
;
import
pwc.taxtech.atms.vat.dao.PeriodTemplateMapper
;
import
java.util.Map
;
@Setter
@Getter
public
class
FormulaContext
{
public
class
FormulaContext
{
private
String
projectID
;
private
String
projectID
;
private
String
reportTemplateGroupID
;
private
String
reportTemplateGroupID
;
...
@@ -21,7 +21,7 @@ public class FormulaContext {
...
@@ -21,7 +21,7 @@ public class FormulaContext {
private
Boolean
isDetailed
;
private
Boolean
isDetailed
;
private
Boolean
isIndexAnalysis
;
private
Boolean
isIndexAnalysis
;
private
Boolean
cacheHasIndexCode
;
private
Boolean
cacheHasIndexCode
;
private
FormulaAgent
formulaAgent
;
// <summary>
// <summary>
// 如果BB公式在cache中取上期失败,是否去上期取
// 如果BB公式在cache中取上期失败,是否去上期取
...
@@ -31,7 +31,161 @@ public class FormulaContext {
...
@@ -31,7 +31,161 @@ public class FormulaContext {
// 如果为99,则实时计算;如果为-1,则不用于判断是否实时计算;其他情况会在对应时机计算并保存
// 如果为99,则实时计算;如果为-1,则不用于判断是否实时计算;其他情况会在对应时机计算并保存
// </summary>
// </summary>
private
Integer
calculateStatus
;
private
Integer
calculateStatus
;
// private Map<String, FormulaResult> replaceSpecialCellFormulaDic;
private
Map
<
String
,
FormulaResult
>
replaceSpecialCellFormulaDic
;
private
FormulaAgent
formulaAgent
;
public
String
getProjectID
()
{
return
projectID
;
}
public
void
setProjectID
(
String
projectID
)
{
this
.
projectID
=
projectID
;
}
public
String
getReportTemplateGroupID
()
{
return
reportTemplateGroupID
;
}
public
void
setReportTemplateGroupID
(
String
reportTemplateGroupID
)
{
this
.
reportTemplateGroupID
=
reportTemplateGroupID
;
}
public
String
getReportID
()
{
return
reportID
;
}
public
void
setReportID
(
String
reportID
)
{
this
.
reportID
=
reportID
;
}
public
String
getOrganizationID
()
{
return
organizationID
;
}
public
void
setOrganizationID
(
String
organizationID
)
{
this
.
organizationID
=
organizationID
;
}
public
Integer
getPeriod
()
{
return
period
;
}
public
void
setPeriod
(
Integer
period
)
{
this
.
period
=
period
;
}
public
Integer
getYear
()
{
return
year
;
}
public
void
setYear
(
Boolean
year
)
{
isYear
=
year
;
}
public
String
getIndexResultId
()
{
return
indexResultId
;
}
public
void
setIndexResultId
(
String
indexResultId
)
{
this
.
indexResultId
=
indexResultId
;
}
public
Integer
getYearBeginPeriod
()
{
return
yearBeginPeriod
;
}
public
void
setYearBeginPeriod
(
Integer
yearBeginPeriod
)
{
this
.
yearBeginPeriod
=
yearBeginPeriod
;
}
public
Integer
getYearEndPeriod
()
{
return
yearEndPeriod
;
}
public
void
setYearEndPeriod
(
Integer
yearEndPeriod
)
{
this
.
yearEndPeriod
=
yearEndPeriod
;
}
public
Boolean
getIfRound
()
{
return
ifRound
;
}
public
void
setIfRound
(
Boolean
ifRound
)
{
this
.
ifRound
=
ifRound
;
}
public
Boolean
getValidation
()
{
return
isValidation
;
}
public
void
setValidation
(
Boolean
validation
)
{
isValidation
=
validation
;
}
public
Boolean
getDetailed
()
{
return
isDetailed
;
}
public
void
setDetailed
(
Boolean
detailed
)
{
isDetailed
=
detailed
;
}
public
Boolean
getIndexAnalysis
()
{
return
isIndexAnalysis
;
}
public
void
setIndexAnalysis
(
Boolean
indexAnalysis
)
{
isIndexAnalysis
=
indexAnalysis
;
}
public
Boolean
getCacheHasIndexCode
()
{
return
cacheHasIndexCode
;
}
public
void
setCacheHasIndexCode
(
Boolean
cacheHasIndexCode
)
{
this
.
cacheHasIndexCode
=
cacheHasIndexCode
;
}
public
Boolean
getIfCalcStackValue
()
{
return
ifCalcStackValue
;
}
public
void
setIfCalcStackValue
(
Boolean
ifCalcStackValue
)
{
this
.
ifCalcStackValue
=
ifCalcStackValue
;
}
public
Integer
getCalculateStatus
()
{
return
calculateStatus
;
}
public
void
setCalculateStatus
(
Integer
calculateStatus
)
{
this
.
calculateStatus
=
calculateStatus
;
}
public
Map
<
String
,
FormulaResult
>
getReplaceSpecialCellFormulaDic
()
{
return
replaceSpecialCellFormulaDic
;
}
public
void
setReplaceSpecialCellFormulaDic
(
Map
<
String
,
FormulaResult
>
replaceSpecialCellFormulaDic
)
{
this
.
replaceSpecialCellFormulaDic
=
replaceSpecialCellFormulaDic
;
}
public
void
setYear
(
Integer
year
)
{
this
.
year
=
year
;
}
public
Boolean
getIsYear
()
{
return
isYear
;
}
public
void
setIsYear
(
Boolean
isYear
)
{
isYear
=
isYear
;
}
public
FormulaAgent
getFormulaAgent
()
{
return
formulaAgent
;
}
public
void
setFormulaAgent
(
FormulaAgent
formulaAgent
)
{
this
.
formulaAgent
=
formulaAgent
;
}
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FunctionBase.java
0 → 100644
View file @
23a0a809
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
.
report
.
functions
;
import
org.apache.poi.ss.formula.OperationEvaluationContext
;
import
org.apache.poi.ss.formula.eval.EvaluationException
;
import
org.apache.poi.ss.formula.eval.OperandResolver
;
import
org.apache.poi.ss.formula.eval.ValueEval
;
public
class
FunctionBase
{
public
String
getStringParam
(
ValueEval
valueEval
,
OperationEvaluationContext
ec
)
{
try
{
ValueEval
v1
=
OperandResolver
.
getSingleValue
(
valueEval
,
ec
.
getRowIndex
(),
ec
.
getColumnIndex
());
return
OperandResolver
.
coerceValueToString
(
v1
);
}
catch
(
EvaluationException
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
public
Integer
getIntParam
(
ValueEval
valueEval
,
OperationEvaluationContext
ec
)
{
try
{
ValueEval
v1
=
OperandResolver
.
getSingleValue
(
valueEval
,
ec
.
getRowIndex
(),
ec
.
getColumnIndex
());
return
OperandResolver
.
coerceValueToInt
(
v1
);
}
catch
(
EvaluationException
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/SGSR.java
View file @
23a0a809
...
@@ -5,15 +5,16 @@ import org.apache.poi.ss.formula.eval.EvaluationException;
...
@@ -5,15 +5,16 @@ import org.apache.poi.ss.formula.eval.EvaluationException;
import
org.apache.poi.ss.formula.eval.OperandResolver
;
import
org.apache.poi.ss.formula.eval.OperandResolver
;
import
org.apache.poi.ss.formula.eval.ValueEval
;
import
org.apache.poi.ss.formula.eval.ValueEval
;
import
org.apache.poi.ss.formula.functions.FreeRefFunction
;
import
org.apache.poi.ss.formula.functions.FreeRefFunction
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
pwc.taxtech.atms.dto.vatdto.CellTemplatePerGroupDto
;
import
pwc.taxtech.atms.vat.dao.PeriodTemplateMapper
;
import
java.util.List
;
import
java.util.Optional
;
public
class
SGSR
implements
FreeRefFunction
{
public
class
SGSR
implements
FreeRefFunction
{
private
FormulaContext
formulaContext
;
private
FormulaContext
formulaContext
;
@Autowired
PeriodTemplateMapper
periodTemplateMapper
;
public
SGSR
(
FormulaContext
formulaContext
)
{
public
SGSR
(
FormulaContext
formulaContext
)
{
this
.
formulaContext
=
formulaContext
;
this
.
formulaContext
=
formulaContext
;
}
}
...
@@ -28,8 +29,10 @@ public class SGSR implements FreeRefFunction {
...
@@ -28,8 +29,10 @@ public class SGSR implements FreeRefFunction {
operationEvaluationContext
.
getRowIndex
(),
operationEvaluationContext
.
getRowIndex
(),
operationEvaluationContext
.
getColumnIndex
());
operationEvaluationContext
.
getColumnIndex
());
year
=
OperandResolver
.
coerceValueToInt
(
v5
);
year
=
OperandResolver
.
coerceValueToInt
(
v5
);
}
else
{
}
else
if
(
valueEvals
.
length
==
4
)
{
year
=
0
;
year
=
0
;
}
else
{
return
null
;
}
}
ValueEval
v1
=
OperandResolver
.
getSingleValue
(
valueEvals
[
0
],
ValueEval
v1
=
OperandResolver
.
getSingleValue
(
valueEvals
[
0
],
...
@@ -63,8 +66,27 @@ public class SGSR implements FreeRefFunction {
...
@@ -63,8 +66,27 @@ public class SGSR implements FreeRefFunction {
curYear
=
FormulaHelper
.
getYear
(
year
,
formulaContext
);
curYear
=
FormulaHelper
.
getYear
(
year
,
formulaContext
);
curPeriod
=
0
;
curPeriod
=
0
;
}
else
{
}
else
{
return
null
;
}
}
formulaContext
.
getFormulaAgent
().
periodTemplateMapper
.
getCellTemplatePerGroup
(
formulaContext
.
getPeriod
(),
formulaContext
.
getReportTemplateGroupID
());
List
<
CellTemplatePerGroupDto
>
cellTemplatePerGroupDtoList
=
formulaContext
.
getFormulaAgent
().
periodTemplateMapper
.
getCellTemplatePerGroup
(
formulaContext
.
getPeriod
(),
formulaContext
.
getReportTemplateGroupID
());
int
r
=
rowIndex
;
int
c
=
colIndex
;
Optional
<
CellTemplatePerGroupDto
>
cellTemplatePerGroupDto
=
cellTemplatePerGroupDtoList
.
stream
()
.
filter
(
a
->
a
.
getRowIndex
()
==
r
&&
a
.
getColumnIndex
()
==
c
&&
a
.
getReportCode
().
equals
(
reportCode
))
.
findFirst
();
if
(
cellTemplatePerGroupDto
==
null
)
{
return
null
;
}
//配置的行号列号都比 DB 中+1
rowIndex
--;
colIndex
--;
}
catch
(
EvaluationException
e
)
{
}
catch
(
EvaluationException
e
)
{
...
...
atms-api/src/main/resources/pwc/taxtech/atms/vat/dao/BalanceMapper.xml
View file @
23a0a809
...
@@ -666,4 +666,8 @@
...
@@ -666,4 +666,8 @@
order by ${orderByClause}
order by ${orderByClause}
</if>
</if>
</select>
</select>
<select
id=
"getSumOfBalance"
resultType=
"java.math.BigDecimal"
>
SELECT IFNULL(SUM((IFNULL(a.DebitNet,0)-IFNULL(a.CreditNet,0))*#{direction,,jdbcType=INTEGER}),0) FROM Balance a WHERE a.AcctCode=#{acctCode,jdbcType=VARCHAR}
</select>
</mapper>
</mapper>
\ No newline at end of file
atms-api/src/main/resources/pwc/taxtech/atms/vat/dao/BalanceStdManualMapper.xml
View file @
23a0a809
...
@@ -556,4 +556,18 @@
...
@@ -556,4 +556,18 @@
order by ${orderByClause}
order by ${orderByClause}
</if>
</if>
</select>
</select>
<select
id=
"selectOneWithAccountCodeAndDBName"
resultMap=
"BaseResultMap"
>
SELECT * FROM ${dbName}.BalanceStdManual a
WHERE
a.AcctCode=#{accountCode,jdbcType=VARCHAR} AND a.PeriodID=#{period,jdbcType=INTEGER}
LIMIT 1
</select>
<select
id=
"selectOneWithAccountCode"
resultMap=
"BaseResultMap"
>
SELECT * FROM BalanceStdManual a
WHERE
a.AcctCode=#{accountCode,jdbcType=VARCHAR} AND a.PeriodID=#{period,jdbcType=INTEGER}
LIMIT 1
</select>
</mapper>
</mapper>
\ No newline at end of file
atms-api/src/main/resources/pwc/taxtech/atms/vat/dao/VatEnterpriseAccountMapper.xml
View file @
23a0a809
...
@@ -523,4 +523,7 @@
...
@@ -523,4 +523,7 @@
order by ${orderByClause}
order by ${orderByClause}
</if>
</if>
</select>
</select>
<select
id=
"getListWithAccountCode"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
SELECT * FROM EnterpriseAccount WHERE StdCode IS NOT NULL AND StdCode LIKE '${accountCode}%' AND IsLeaf=1
</select>
</mapper>
</mapper>
\ No newline at end of file
atms-api/src/main/resources/pwc/taxtech/atms/vat/dao/VatStandardAccountMapper.xml
View file @
23a0a809
...
@@ -493,4 +493,8 @@
...
@@ -493,4 +493,8 @@
ORDER BY
ORDER BY
b.PeriodID
b.PeriodID
</select>
</select>
<select
id=
"selectOneByAccountCode"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
SELECT * FROM StandardAccount a WHERE a.Code=#{accountCode,jdbcType=VARCHAR} LIMIT 1
</select>
</mapper>
</mapper>
\ No newline at end of file
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