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
4124b3b9
Commit
4124b3b9
authored
Mar 20, 2019
by
zhkwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CIT期末余额公式
parent
ec91e3be
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
36 deletions
+87
-36
RSUMIFParasBo.java
.../main/java/pwc/taxtech/atms/dto/vatdto/RSUMIFParasBo.java
+29
-7
ReportCellTableSUMIFDataSourceDto.java
...ch/atms/dto/vatdto/ReportCellTableSUMIFDataSourceDto.java
+14
-0
CitReportServiceImpl.java
...a/pwc/taxtech/atms/service/impl/CitReportServiceImpl.java
+1
-1
FormulaAgent.java
.../java/pwc/taxtech/atms/vat/service/impl/FormulaAgent.java
+6
-2
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+15
-1
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+1
-1
QMYE.java
.../taxtech/atms/vat/service/impl/report/functions/QMYE.java
+3
-9
SUM.java
...c/taxtech/atms/vat/service/impl/report/functions/SUM.java
+17
-14
cit-report-sheet.js
...ebapp/app/cit/report/cit-report-sheet/cit-report-sheet.js
+1
-1
No files found.
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/RSUMIFParasBo.java
View file @
4124b3b9
...
...
@@ -41,28 +41,47 @@ public class RSUMIFParasBo {
expressionData
.
add
(
new
PeriodCellDataTemplate
(
period
,
cellTemplateId
));
}
public
String
getExpression
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
throws
EvaluationException
{
public
String
getExpression
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
throws
EvaluationException
{
StringBuilder
expression
=
new
StringBuilder
(
""
);
begin
(
expression
);
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
if
(
i
>=
4
)
{
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
if
(
i
>=
4
)
{
concatPara
(
expression
,
resolverInteger
(
args
,
ec
,
i
));
}
else
{
}
else
{
concatPara
(
expression
,
resolverString
(
args
,
ec
,
i
));
}
if
(
i
==
args
.
length
-
1
)
{
if
(
i
==
args
.
length
-
1
)
{
continue
;
}
split
(
expression
);
}
end
(
expression
);
return
expression
.
toString
();
return
expression
.
toString
();
}
public
String
getQMYEExpression
(
Integer
subjectType
,
String
subjectCode
,
Integer
year
,
Integer
period
,
OperationEvaluationContext
ec
)
throws
EvaluationException
{
StringBuilder
expression
=
new
StringBuilder
(
""
);
beginQMYE
(
expression
);
concatPara
(
expression
,
subjectType
);
split
(
expression
);
concatPara
(
expression
,
subjectCode
);
split
(
expression
);
concatPara
(
expression
,
year
);
split
(
expression
);
concatPara
(
expression
,
period
);
end
(
expression
);
return
expression
.
toString
();
}
private
StringBuilder
begin
(
StringBuilder
expression
)
{
return
expression
.
append
(
"RSUMIF("
);
}
private
StringBuilder
beginQMYE
(
StringBuilder
expression
)
{
return
expression
.
append
(
"QMYE("
);
}
private
StringBuilder
end
(
StringBuilder
expression
)
{
return
expression
.
append
(
")"
);
}
...
...
@@ -78,7 +97,10 @@ public class RSUMIFParasBo {
private
StringBuilder
concatPara
(
StringBuilder
expression
,
Integer
para
)
{
return
expression
.
append
(
para
);
}
public
RSUMIFParasBo
(){}
public
RSUMIFParasBo
()
{
}
public
RSUMIFParasBo
(
RSUMIFParasBo
otherBo
,
int
period
,
int
curYear
)
{
this
.
reportCode
=
otherBo
.
reportCode
;
this
.
columnIndex
=
otherBo
.
getColumnIndex
();
...
...
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/ReportCellTableSUMIFDataSourceDto.java
View file @
4124b3b9
...
...
@@ -70,6 +70,20 @@ public class ReportCellTableSUMIFDataSourceDto extends DataSourceDto {
this
.
name
=
DataSourceName
.
ReportDataSource
;
}
public
void
insertQMYEData
(
OperationEvaluationContext
o
,
FormulaContext
formulaContext
)
{
this
.
tag
=
"QMYE"
;
this
.
rowIndex
=
o
.
getRowIndex
();
this
.
columnIndex
=
o
.
getColumnIndex
();
this
.
cellTemplateId
=
null
;
this
.
period
=
formulaContext
.
getPeriod
();
this
.
reportTemplateId
=
formulaContext
.
getReportTemplateGroupId
().
toString
();
this
.
year
=
formulaContext
.
getYear
();
this
.
isOnlyManualInput
=
false
;
this
.
reportName
=
formulaContext
.
getReportTemplateGroupId
().
toString
();
this
.
name
=
DataSourceName
.
ReportDataSource
;
}
public
String
getTag
()
{
return
this
.
tag
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/CitReportServiceImpl.java
View file @
4124b3b9
...
...
@@ -61,7 +61,7 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
public
class
CitReportServiceImpl
extends
BaseService
{
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CitReportServiceImpl
.
class
);
private
final
static
String
[]
functions
=
{
"SGSR"
,
"FSJZ"
,
"ND"
,
"BB"
,
"XXFP"
,
"GZSD"
,
"PC"
,
"JXFPMX"
,
"JXFP"
,
"PSUM"
,
"DFFS"
,
"JFFS"
,
"WPSR"
,
"WPNAME"
,
"WPTYPE"
,
"SUM2"
,
"RSUMIF"
,
"
SUM"
,
"
QMYE"
};
"JXFP"
,
"PSUM"
,
"DFFS"
,
"JFFS"
,
"WPSR"
,
"WPNAME"
,
"WPTYPE"
,
"SUM2"
,
"RSUMIF"
,
"QMYE"
};
@Autowired
private
OrganizationServiceTemplateGroupMapper
orgServiceTemplateGroupMapper
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/FormulaAgent.java
View file @
4124b3b9
...
...
@@ -10,6 +10,7 @@ import pwc.taxtech.atms.common.util.StringUtil;
import
pwc.taxtech.atms.constant.enums.EnumServiceType
;
import
pwc.taxtech.atms.dao.CitTbamMapper
;
import
pwc.taxtech.atms.dao.FormulaAdminMapper
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dao.ProjectServiceTypeMapper
;
import
pwc.taxtech.atms.dpo.CellTemplatePerGroupDto
;
import
pwc.taxtech.atms.dpo.GroupId
;
...
...
@@ -43,6 +44,8 @@ public class FormulaAgent {
private
PeriodDataSourceMapper
periodDataSourceMapper
;
@Autowired
private
CitTbamMapper
citTbamMapper
;
@Autowired
private
ProjectMapper
projectMapper
;
public
List
<
CellTemplatePerGroupDto
>
getCellTemplateGroupDto
(
Long
templateGroupId
,
String
projectId
,
String
code
,
Integer
rowIndex
,
Integer
columnIndex
,
Integer
period
)
{
return
adminMp
.
getCellTemplatePerGroupDto
(
templateGroupId
,
code
,
rowIndex
,
columnIndex
,
projectId
,
period
);
...
...
@@ -266,9 +269,10 @@ public class FormulaAgent {
* @param formulaContext
* @return
*/
public
BigDecimal
getQMYE
(
String
subjectType
,
String
subjectCode
,
Integer
year
,
Integer
period
,
FormulaContext
formulaContext
){
public
BigDecimal
getQMYE
(
Integer
subjectType
,
String
subjectCode
,
Integer
year
,
Integer
period
,
FormulaContext
formulaContext
){
Project
project
=
projectMapper
.
selectByPrimaryKey
(
formulaContext
.
getProjectId
());
CitTbamExample
citTbamExample
=
new
CitTbamExample
();
citTbamExample
.
createCriteria
().
andAccountCodeEqualTo
(
subjectCode
).
andPeriodEqualTo
(
year
+
CitCommonUtil
.
getPeriod
());
citTbamExample
.
createCriteria
().
andAccountCodeEqualTo
(
subjectCode
).
andPeriodEqualTo
(
year
+
project
.
getYear
());
List
<
CitTbam
>
citTbams
=
citTbamMapper
.
selectByExample
(
citTbamExample
);
if
(
citTbams
==
null
||
citTbams
.
isEmpty
()){
return
new
BigDecimal
(
0.0
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
4124b3b9
...
...
@@ -529,11 +529,25 @@ public class ReportGeneratorImpl {
* @param workbook 工作簿
*/
public
void
addFunctionsAndContext
(
Workbook
workbook
,
String
[]
functions
,
FormulaContext
formulaContext
)
{
FreeRefFunction
[]
functionImpls
=
{
new
SGSR
(
formulaContext
),
new
FSJZ
(
formulaContext
),
new
ND
(
formulaContext
),
new
BB
(
formulaContext
),
new
XXFP
(
formulaContext
),
new
GZSD
(
formulaContext
),
new
PC
(
formulaContext
)
,
new
JXFPMX
(
formulaContext
),
new
JXFP
(
formulaContext
),
new
PSUM
(
formulaContext
),
new
DFFS
(
formulaContext
),
new
JFFS
(
formulaContext
),
new
WPSR
(
formulaContext
),
new
WPNAME
(
formulaContext
),
new
WPTYPE
(
formulaContext
),
new
SUM2
(
formulaContext
),
new
RSUMIF
(
formulaContext
),
new
SUM
(
formulaContext
)};
UDFFinder
udfs
=
new
DefaultUDFFinder
(
functions
,
functionImpls
);
UDFFinder
udfToolpack
=
new
AggregatingUDFFinder
(
udfs
);
workbook
.
addToolPack
(
udfToolpack
);
}
/**
* 注册所有的自定义方法到工作簿
*
* @param workbook 工作簿
*/
public
void
addCitFunctionsAndContext
(
Workbook
workbook
,
String
[]
functions
,
FormulaContext
formulaContext
)
{
FreeRefFunction
[]
functionImpls
=
{
new
SGSR
(
formulaContext
),
new
FSJZ
(
formulaContext
),
new
ND
(
formulaContext
),
new
BB
(
formulaContext
),
new
XXFP
(
formulaContext
),
new
GZSD
(
formulaContext
),
new
PC
(
formulaContext
)
,
new
JXFPMX
(
formulaContext
),
new
JXFP
(
formulaContext
),
new
PSUM
(
formulaContext
),
new
DFFS
(
formulaContext
),
new
JFFS
(
formulaContext
),
new
WPSR
(
formulaContext
),
new
WPNAME
(
formulaContext
),
new
WPTYPE
(
formulaContext
),
new
SUM2
(
formulaContext
),
new
RSUMIF
(
formulaContext
),
new
SUM
(
formulaContext
),
new
QMYE
(
formulaContext
)};
new
SUM2
(
formulaContext
),
new
RSUMIF
(
formulaContext
),
new
QMYE
(
formulaContext
)};
UDFFinder
udfs
=
new
DefaultUDFFinder
(
functions
,
functionImpls
);
UDFFinder
udfToolpack
=
new
AggregatingUDFFinder
(
udfs
);
workbook
.
addToolPack
(
udfToolpack
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
4124b3b9
...
...
@@ -64,7 +64,7 @@ public class ReportServiceImpl extends BaseService {
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ReportServiceImpl
.
class
);
private
BlockingQueue
<
PeriodJob
>
queue
=
new
LinkedBlockingQueue
<>();
private
final
static
String
[]
functions
=
{
"SGSR"
,
"FSJZ"
,
"ND"
,
"BB"
,
"XXFP"
,
"GZSD"
,
"PC"
,
"JXFPMX"
,
"JXFP"
,
"PSUM"
,
"DFFS"
,
"JFFS"
,
"WPSR"
,
"WPNAME"
,
"WPTYPE"
,
"SUM2"
,
"RSUMIF"
,
"SUM"
,
"QMYE"
};
"JXFP"
,
"PSUM"
,
"DFFS"
,
"JFFS"
,
"WPSR"
,
"WPNAME"
,
"WPTYPE"
,
"SUM2"
,
"RSUMIF"
,
"SUM"
};
@Autowired
private
ReportGeneratorImpl
reportGenerator
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/QMYE.java
View file @
4124b3b9
...
...
@@ -37,7 +37,7 @@ public class QMYE extends FunctionBase implements FreeRefFunction {
@Override
public
ValueEval
evaluate
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
{
//科目类型
String
subjectType
=
""
;
Integer
subjectType
=
0
;
//科目代码
String
subjectCode
=
""
;
Integer
period
=
0
;
...
...
@@ -52,7 +52,7 @@ public class QMYE extends FunctionBase implements FreeRefFunction {
dataSource
.
add
(
reportCellTableSUMIFDataSourceDto
);
try
{
//科目类型,固定写为企业科目
subjectType
=
resolver
String
(
args
,
ec
,
0
);
subjectType
=
resolver
Integer
(
args
,
ec
,
0
);
//科目代码
subjectCode
=
resolverString
(
args
,
ec
,
1
);
year
=
resolverInteger
(
args
,
ec
,
2
);
//年份
...
...
@@ -63,12 +63,6 @@ public class QMYE extends FunctionBase implements FreeRefFunction {
e
.
printStackTrace
();
return
new
NumberEval
(
0.00
);
}
finally
{
boolean
boo
;
if
(
TableRule
.
map
.
get
(
tableName
).
substring
(
0
,
3
).
equals
(
"cit"
)){
boo
=
true
;
}
else
{
boo
=
false
;
}
Long
dataSourceId
=
null
;
try
{
dataSourceId
=
saveDataRSUMIFSource
(
ec
,
dataSource
,
FormulaDataSourceDetailType
.
ReportCellTableSUMIFDataSourceDto
,
...
...
@@ -80,7 +74,7 @@ public class QMYE extends FunctionBase implements FreeRefFunction {
}
try
{
saveFormulaBlock
(
formulaContext
.
getPeriod
(),
ec
,
new
RSUMIFParasBo
().
get
Expression
(
args
,
ec
),
cellValue
,
dataSourceId
,
formulaContext
.
getProjectId
());
new
RSUMIFParasBo
().
get
QMYEExpression
(
subjectType
,
subjectCode
,
year
,
period
,
ec
),
cellValue
,
dataSourceId
,
formulaContext
.
getProjectId
());
}
catch
(
EvaluationException
e
)
{
e
.
printStackTrace
();
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/SUM.java
View file @
4124b3b9
...
...
@@ -25,10 +25,26 @@ public class SUM extends FunctionBase implements FreeRefFunction {
super
(
formulaContext
);
}
@Override
public
ValueEval
evaluate
(
ValueEval
[]
valueEvals
,
OperationEvaluationContext
operationEvaluationContext
)
{
for
(
int
i
=
0
,
j
=
valueEvals
.
length
;
i
<
j
;
i
++)
{
try
{
return
new
NumberEval
(
sum
(
getData
(
parameter
(
resolverString
(
valueEvals
,
operationEvaluationContext
,
i
)))).
doubleValue
());
}
catch
(
EvaluationException
e
)
{
e
.
printStackTrace
();
return
defaultEval
;
}
}
return
defaultEval
;
}
//检查参数合法性
public
String
parameter
(
String
parameter
)
{
if
(
parameter
.
length
()
!=
2
)
if
(
parameter
.
length
()
!=
2
){
throw
Exceptions
.
parameterError
;
}
return
parameter
;
}
...
...
@@ -47,17 +63,4 @@ public class SUM extends FunctionBase implements FreeRefFunction {
return
cellValue
;
}
@Override
public
ValueEval
evaluate
(
ValueEval
[]
valueEvals
,
OperationEvaluationContext
operationEvaluationContext
)
{
for
(
int
i
=
0
,
j
=
valueEvals
.
length
;
i
<
j
;
i
++)
{
try
{
return
new
NumberEval
(
sum
(
getData
(
parameter
(
resolverString
(
valueEvals
,
operationEvaluationContext
,
i
)))).
doubleValue
());
}
catch
(
EvaluationException
e
)
{
e
.
printStackTrace
();
return
defaultEval
;
}
}
return
defaultEval
;
}
}
atms-web/src/main/webapp/app/cit/report/cit-report-sheet/cit-report-sheet.js
View file @
4124b3b9
...
...
@@ -559,7 +559,7 @@
if
(
!
_
.
isEmpty
(
parsedFormula
))
{
debugger
;
parsedFormula
=
'IFERROR('
+
parsedFormula
+
', "")'
;
//
parsedFormula = 'IFERROR(' + parsedFormula + ', "")';
sheet
.
setFormula
(
data
.
rowIndex
,
data
.
columnIndex
,
'='
+
parsedFormula
);
// sheet.setValue(data.rowIndex, data.columnIndex, data.value);
ifShowParseFloat
=
false
;
// 有公式或手工数据源,单元格设置为公式
...
...
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