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
b0658e9d
Commit
b0658e9d
authored
Mar 13, 2019
by
kevin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#
parent
072dc907
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
18 deletions
+19
-18
TableRule.java
atms-api/src/main/java/pwc/taxtech/atms/dto/TableRule.java
+2
-0
FormulaAgent.java
.../java/pwc/taxtech/atms/vat/service/impl/FormulaAgent.java
+16
-16
TABLESUMIF.java
...ch/atms/vat/service/impl/report/functions/TABLESUMIF.java
+1
-2
No files found.
atms-api/src/main/java/pwc/taxtech/atms/dto/TableRule.java
View file @
b0658e9d
...
...
@@ -26,5 +26,7 @@ public class TableRule {
map
.
put
(
"ZXXJLLB"
,
"cash_flow_final"
);
map
.
put
(
"CITZCFZB"
,
"cit_balance_sheet_prc_adjust"
);
map
.
put
(
"CITLRB"
,
"cit_profit_prc_adjust"
);
map
.
put
(
"CIT_TBAM"
,
"cit_tbam"
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/FormulaAgent.java
View file @
b0658e9d
...
...
@@ -146,18 +146,18 @@ public class FormulaAgent {
public
static
String
buildSql
(
String
tableName
,
String
getField
,
String
filter
,
String
filterValue
,
Integer
period
,
String
year
,
FormulaContext
formulaContext
)
{
String
sql
=
""
;
String
[]
split
=
filterValue
.
split
(
" "
);
String
para3
=
null
;
/*
if (split[0].indexOf(">=") != -1) {
filterValue
=
"
> "
+
split
[
1
]
+
"and"
+
filter
+
" =
"
+
split
[
1
];
filterValue = "
> " + split[1] + " or " + filter + " =
" + split[1];
} else if (split[0].indexOf("<=") != -1) {
filterValue
=
"
< "
+
split
[
1
]
+
"and"
+
filter
+
" =
"
+
split
[
1
];
filterValue = "
< " + split[1] + " or " + filter + " =
" + split[1];
} else {
filterValue
=
split
[
0
]
+
"
'"
+
split
[
1
]
+
"'
"
;
filterValue = split[0] + "
= " + split[1] + "
";
}
if
(
"cit_balance_sheet_prc_adjust"
.
equals
(
tableName
)
||
(
"cit_profit_prc_adjust"
.
equals
(
tableName
)))
{
*/
if
(
tableName
.
substring
(
0
,
3
).
equals
(
"cit"
))
{
try
{
return
_buildSql
(
getField
,
tableName
,
filter
,
filterValue
,
period
,
formulaContext
,
year
,
true
);
}
catch
(
Exception
e
)
{
...
...
@@ -180,16 +180,16 @@ public class FormulaAgent {
String
per
=
insertZero
((
formulaContext
.
getPeriod
()
-
1
));
if
(!
bool
)
{
if
(
period
==
0
)
{
sql
+=
" and tms_period = "
+
year
+
_period
;
sql
+=
" and tms_period = "
+
Integer
.
parseInt
(
year
+
_period
)
;
}
else
if
(
period
==
-
99
)
{
sql
+=
" and tms_period between "
+
year
+
"01 and "
+
year
+
per
;
sql
+=
" and tms_period between "
+
Integer
.
parseInt
(
year
+
"01"
)
+
" and "
+
Integer
.
parseInt
(
year
+
per
)
;
}
else
if
(
period
==
99
)
{
sql
+=
" and tms_period between "
+
year
+
"01 and "
+
year
+
_period
;
sql
+=
" and tms_period between "
+
Integer
.
parseInt
(
year
+
"01"
)
+
" and "
+
Integer
.
parseInt
(
year
+
_period
)
;
}
else
{
if
(
period
>
0
)
throw
new
Exception
(
"参数不正确"
);
sql
+=
" and tms_period between "
+
year
+
_p
+
" and "
+
year
+
per
;
sql
+=
" and tms_period between "
+
Integer
.
parseInt
(
year
+
_p
)+
" and "
+
Integer
.
parseInt
(
year
+
per
)
;
}
}
if
(
bool
)
...
...
@@ -211,16 +211,16 @@ public class FormulaAgent {
@Autowired
JdbcTemplate
jdbcTemplate
;
/*
public static void main(String[] args) {
public
static
void
main
(
String
[]
args
)
{
FormulaAgent
formulaAgent
=
new
FormulaAgent
();
FormulaContext
formulaContext
=
new
FormulaContext
();
formulaContext
.
setPeriod
(
3
);
formulaAgent.getTableDataByName("CIT
LRB", "end_bal", "item_name", "= 小帅哥", -3
, "2018", formulaContext);
}
*/
formulaAgent
.
getTableDataByName
(
"CIT
_TBAM"
,
"ending_balance"
,
"attribute"
,
"= '销售费用-财产损耗、盘亏及毁损损失'"
,
0
,
"2018"
,
formulaContext
);
}
public
Long
getTableDataByName
(
String
tableName
,
String
getField
,
String
filter
,
String
filterValue
,
Integer
period
,
String
year
,
FormulaContext
formulaContext
)
{
public
double
getTableDataByName
(
String
tableName
,
String
getField
,
String
filter
,
String
filterValue
,
Integer
period
,
String
year
,
FormulaContext
formulaContext
)
{
List
<
Map
<
String
,
Object
>>
stringObjectMap
=
jdbcTemplate
.
queryForList
(
buildSql
(
TableRule
.
map
.
get
(
tableName
),
getField
,
filter
,
filterValue
,
period
,
year
,
formulaContext
));
Long
rev
=
0L
;
double
rev
=
0.00
;
for
(
int
i
=
0
,
j
=
stringObjectMap
.
size
();
i
<
j
;
i
++)
{
if
(
i
==
1
)
{
rev
=
Long
.
parseLong
(
String
.
valueOf
(
stringObjectMap
.
get
(
i
).
get
(
StringUtil
.
underline2Camel
(
getField
))));
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/TABLESUMIF.java
View file @
b0658e9d
...
...
@@ -28,7 +28,7 @@ public class TABLESUMIF extends FunctionBase implements FreeRefFunction {
//进行参数验证
public
void
parameterCheck
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
{
argsLength
=
args
.
length
;
if
(
argsLength
!=
6
)
//参数小于当做异常处理, 最后俩参数可以取默认值
if
(
argsLength
!=
6
)
//参数小于
6
当做异常处理, 最后俩参数可以取默认值
throw
Exceptions
.
parameterError
;
try
{
tableName
=
resolverString
(
args
,
ec
,
0
);
...
...
@@ -42,7 +42,6 @@ public class TABLESUMIF extends FunctionBase implements FreeRefFunction {
}
Integer
argsLength
;
String
getField
;
Integer
period
;
String
year
;
...
...
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