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
6f213aef
Commit
6f213aef
authored
Mar 15, 2019
by
kevin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#
parent
948117e7
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
815 additions
and
199 deletions
+815
-199
DataSourceName.java
...c/main/java/pwc/taxtech/atms/constant/DataSourceName.java
+1
-0
FormulaDataSourceDetailType.java
...tech/atms/constant/enums/FormulaDataSourceDetailType.java
+4
-2
FormulaDataSourceType.java
...wc/taxtech/atms/constant/enums/FormulaDataSourceType.java
+10
-1
CellCommentController.java
...va/pwc/taxtech/atms/controller/CellCommentController.java
+18
-0
CamelPagingDto.java
.../main/java/pwc/taxtech/atms/dto/input/CamelPagingDto.java
+1
-0
DataSourceDto.java
.../main/java/pwc/taxtech/atms/dto/vatdto/DataSourceDto.java
+9
-0
RSUMIFParasBo.java
.../main/java/pwc/taxtech/atms/dto/vatdto/RSUMIFParasBo.java
+144
-0
ReportCellTableSUMIFDataSourceDto.java
...ch/atms/dto/vatdto/ReportCellTableSUMIFDataSourceDto.java
+254
-0
CitReportServiceImpl.java
...a/pwc/taxtech/atms/service/impl/CitReportServiceImpl.java
+1
-1
FormulaAgent.java
.../java/pwc/taxtech/atms/vat/service/impl/FormulaAgent.java
+16
-6
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+2
-9
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+1
-0
FunctionBase.java
.../atms/vat/service/impl/report/functions/FunctionBase.java
+13
-2
RSUMIF.java
...axtech/atms/vat/service/impl/report/functions/RSUMIF.java
+76
-77
TABLESUMIF.java
...ch/atms/vat/service/impl/report/functions/TABLESUMIF.java
+0
-65
_RSUMIF.java
...xtech/atms/vat/service/impl/report/functions/_RSUMIF.java
+123
-0
CitTbamMapper.java
...dao/src/main/java/pwc/taxtech/atms/dao/CitTbamMapper.java
+4
-0
CitTbamDto.java
atms-dao/src/main/java/pwc/taxtech/atms/dpo/CitTbamDto.java
+13
-0
PeriodDataSource.java
...in/java/pwc/taxtech/atms/vat/entity/PeriodDataSource.java
+32
-25
CitTbamExtendsMapper.xml
...ces/pwc/taxtech/atms/dao/extends/CitTbamExtendsMapper.xml
+7
-0
PeriodDataSourceMapper.xml
...urces/pwc/taxtech/atms/vat/dao/PeriodDataSourceMapper.xml
+7
-0
PeriodDataSourceExtendsMapper.xml
...ch/atms/vat/dao/extends/PeriodDataSourceExtendsMapper.xml
+2
-0
tax-report-cell-detail-modal.ctrl.js
...rt-cell-detail-modal/tax-report-cell-detail-modal.ctrl.js
+63
-0
tax-report-cell-detail-modal.html
...eport-cell-detail-modal/tax-report-cell-detail-modal.html
+5
-6
vat-report-view.ctrl.js
...p/common/controls/vat-report-view/vat-report-view.ctrl.js
+0
-1
enums.js
atms-web/src/main/webapp/app/common/utils/enums.js
+5
-4
cellComment.svc.js
...src/main/webapp/app/common/webservices/cellComment.svc.js
+4
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/constant/DataSourceName.java
View file @
6f213aef
...
...
@@ -13,4 +13,5 @@ public class DataSourceName {
public
static
final
String
SAPDataSource
=
"SAPDataSource"
;
public
static
final
String
LandSellDataSource
=
"LandSellDataSource"
;
public
static
final
String
UnbilledDataSource
=
"UnbilledDataSource"
;
public
static
final
String
TableSumIfDataSource
=
"TableSumIfDataSource"
;
}
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/FormulaDataSourceDetailType.java
View file @
6f213aef
package
pwc
.
taxtech
.
atms
.
constant
.
enums
;
import
pwc.taxtech.atms.dto.vatdto.ReportCellTableSUMIFDataSourceDto
;
public
enum
FormulaDataSourceDetailType
{
BSPLFormulaDataSourceDto
(
1
,
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
BSPLFormulaDataSourceDto
.
class
),
...
...
@@ -8,9 +10,9 @@ public enum FormulaDataSourceDetailType {
InputInvoiceDetailDataSourceDto
(
4
,
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
InputInvoiceDetailDataSourceDto
.
class
),
OutputInvoiceDataSourceDto
(
5
,
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
OutputInvoiceDataSourceDto
.
class
),
AssetDetailDataSourceDto
(
5
,
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
AssetDetailDataSourceDto
.
class
),
ReportCellDataSourceDto
(
6
,
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
ReportCellDataSourceDto
.
class
);
ReportCellDataSourceDto
(
6
,
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
ReportCellDataSourceDto
.
class
),
ReportCellTableSUMIFDataSourceDto
(
7
,
ReportCellTableSUMIFDataSourceDto
.
class
);
private
Integer
code
;
private
Class
clas
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/FormulaDataSourceType.java
View file @
6f213aef
...
...
@@ -41,6 +41,7 @@ public enum FormulaDataSourceType {
/// </summary>
SapDaily
(
7
),
/// <summary>
/// 土地出让金数据源
/// </summary>
...
...
@@ -58,9 +59,12 @@ public enum FormulaDataSourceType {
ModelSource
(
13
),
WPSRSource
(
33
),
TrialBalance
(
20
),
AssetListSource
(
21
)
;
AssetListSource
(
21
)
,
// FSESource(14),
RSUMIF
(
22
),
CIT_TBAM
(
50
);
//针对试算平衡表
private
Integer
code
;
...
...
@@ -100,8 +104,13 @@ public enum FormulaDataSourceType {
return
FormulaDataSourceType
.
TrialBalance
;
case
21
:
return
FormulaDataSourceType
.
AssetListSource
;
case
22
:
return
FormulaDataSourceType
.
RSUMIF
;
case
33
:
return
FormulaDataSourceType
.
WPSRSource
;
case
50
:
return
FormulaDataSourceType
.
CIT_TBAM
;
default
:
return
FormulaDataSourceType
.
Other
;
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/controller/CellCommentController.java
View file @
6f213aef
...
...
@@ -3,13 +3,17 @@ package pwc.taxtech.atms.controller;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.web.bind.annotation.*
;
import
pwc.taxtech.atms.dao.CitTbamMapper
;
import
pwc.taxtech.atms.dpo.CitTbamDto
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.vat.entity.CellComment
;
import
pwc.taxtech.atms.vat.entity.PeriodCellComment
;
import
pwc.taxtech.atms.vat.service.impl.CellCommentServiceImpl
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
@RestController
...
...
@@ -26,4 +30,18 @@ public class CellCommentController {
}
return
cellCommentService
.
getCellComments
(
cellDataId
,
projectId
);
}
@Autowired
private
CitTbamMapper
citTbamMapper
;
@Autowired
private
JdbcTemplate
jdbcTemplate
;
//通过sql获取展示表格展示数据
@RequestMapping
(
value
=
"getCellInformation"
)
public
OperationResultDto
getCellInformation
(
String
sql
){
OperationResultDto
operationResultDto
=
new
OperationResultDto
();
operationResultDto
.
setResultMsg
(
"success"
);
operationResultDto
.
setData
(
citTbamMapper
.
selectBySql
(
sql
));
return
operationResultDto
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/dto/input/CamelPagingDto.java
View file @
6f213aef
...
...
@@ -5,6 +5,7 @@ public class CamelPagingDto {
private
Integer
pageIndex
;
private
Integer
pageSize
;
public
Integer
getTotalCount
()
{
return
totalCount
;
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/DataSourceDto.java
View file @
6f213aef
...
...
@@ -27,6 +27,7 @@ public class DataSourceDto {
// 1: +, 2: -, 3: *, 4: /
Integer
operationType
;
String
rel_sql
;
// 1: Number, 2: Percentage, 3: Boolean, 4: String
Integer
resultType
;
...
...
@@ -56,6 +57,14 @@ public class DataSourceDto {
@JsonProperty
(
"reportTemplateID"
)
String
reportTemplateId
;
public
String
getRel_sql
()
{
return
rel_sql
;
}
public
void
setRel_sql
(
String
rel_sql
)
{
this
.
rel_sql
=
rel_sql
;
}
public
String
getId
()
{
return
this
.
id
;
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/RSUMIFParasBo.java
0 → 100644
View file @
6f213aef
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
org.apache.poi.ss.formula.OperationEvaluationContext
;
import
org.apache.poi.ss.formula.eval.EvaluationException
;
import
org.apache.poi.ss.formula.eval.ValueEval
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
pwc
.
taxtech
.
atms
.
common
.
util
.
FormulaUtil
.
resolverString
;
import
static
pwc
.
taxtech
.
atms
.
exception
.
Exceptions
.
BAD_BBVO_PARAMS
;
public
class
RSUMIFParasBo
{
private
String
reportCode
;
private
Integer
columnIndex
;
private
Integer
rowIndex
;
private
Integer
period
;
private
Integer
year
;
private
String
formulaExpression
;
private
List
<
PeriodCellDataTemplate
>
expressionData
=
new
ArrayList
<>();
public
static
class
PeriodCellDataTemplate
{
Integer
period
;
Long
cellTemplateId
;
@Override
public
String
toString
()
{
return
period
+
":"
+
cellTemplateId
;
}
public
PeriodCellDataTemplate
(
Integer
period
,
Long
cellTemplateId
)
{
this
.
period
=
period
;
this
.
cellTemplateId
=
cellTemplateId
;
}
}
public
void
putPeriodCellTempate
(
Integer
period
,
Long
cellTemplateId
)
{
if
(
period
<
1
||
period
>
12
||
cellTemplateId
<
0
)
throw
BAD_BBVO_PARAMS
;
expressionData
.
add
(
new
PeriodCellDataTemplate
(
period
,
cellTemplateId
));
}
public
String
getExpression
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
throws
EvaluationException
{
StringBuilder
expression
=
new
StringBuilder
(
""
);
String
_para
=
""
;
begin
(
expression
);
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++){
_para
=
resolverString
(
args
,
ec
,
i
);
concatPara
(
expression
,
_para
);
split
(
expression
);
}
end
(
expression
);
return
expression
.
toString
();
}
private
StringBuilder
begin
(
StringBuilder
expression
)
{
return
expression
.
append
(
"RSUMIF("
);
}
private
StringBuilder
end
(
StringBuilder
expression
)
{
return
expression
.
append
(
")"
);
}
private
StringBuilder
split
(
StringBuilder
expression
)
{
return
expression
.
append
(
","
);
}
private
StringBuilder
concatPara
(
StringBuilder
expression
,
String
para
)
{
return
expression
.
append
(
"\""
).
append
(
para
).
append
(
"\""
);
}
private
StringBuilder
concatPara
(
StringBuilder
expression
,
Integer
para
)
{
return
expression
.
append
(
para
);
}
public
RSUMIFParasBo
(){}
public
RSUMIFParasBo
(
RSUMIFParasBo
otherBo
,
int
period
,
int
curYear
)
{
this
.
reportCode
=
otherBo
.
reportCode
;
this
.
columnIndex
=
otherBo
.
getColumnIndex
();
this
.
rowIndex
=
otherBo
.
rowIndex
;
this
.
period
=
period
;
this
.
year
=
curYear
;
this
.
formulaExpression
=
otherBo
.
formulaExpression
;
}
public
String
expression
()
{
return
formulaExpression
;
}
public
String
getReportCode
()
{
return
this
.
reportCode
;
}
public
void
setReportCode
(
String
reportCode
)
{
this
.
reportCode
=
reportCode
;
}
public
Integer
getColumnIndex
()
{
return
this
.
columnIndex
;
}
public
void
setColumnIndex
(
Integer
columnIndex
)
{
this
.
columnIndex
=
columnIndex
;
}
public
Integer
getRowIndex
()
{
return
this
.
rowIndex
;
}
public
void
setRowIndex
(
Integer
rowIndex
)
{
this
.
rowIndex
=
rowIndex
;
}
public
Integer
getPeriod
()
{
return
this
.
period
;
}
public
void
setPeriod
(
Integer
period
)
{
this
.
period
=
period
;
}
public
Integer
getYear
()
{
return
this
.
year
;
}
public
void
setYear
(
Integer
year
)
{
this
.
year
=
year
;
}
public
String
getFormulaExpression
()
{
return
this
.
formulaExpression
;
}
public
void
setFormulaExpression
(
String
formulaExpression
)
{
this
.
formulaExpression
=
formulaExpression
;
}
public
List
<
PeriodCellDataTemplate
>
getExpressionData
()
{
return
this
.
expressionData
;
}
public
void
setExpressionData
(
List
<
PeriodCellDataTemplate
>
expressionData
)
{
this
.
expressionData
=
expressionData
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/ReportCellTableSUMIFDataSourceDto.java
0 → 100644
View file @
6f213aef
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
org.apache.poi.ss.formula.OperationEvaluationContext
;
import
pwc.taxtech.atms.constant.DataSourceName
;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceType
;
import
pwc.taxtech.atms.dpo.CellTemplatePerGroupDto
;
import
pwc.taxtech.atms.vat.entity.PeriodCellData
;
import
pwc.taxtech.atms.vat.service.impl.report.functions.FormulaContext
;
import
java.math.BigDecimal
;
public
class
ReportCellTableSUMIFDataSourceDto
extends
DataSourceDto
{
private
String
tag
=
"RSUMIF"
;
private
String
name
;
private
Integer
year
;
private
Integer
period
;
private
Integer
columnIndex
;
private
String
columnName
;
private
Integer
rowIndex
;
private
String
rowName
;
private
String
reportTemplateId
;
private
String
reportName
;
private
String
cellDataId
;
private
String
cellTemplateId
;
private
Boolean
isOnlyManualInput
;
private
Integer
type
;
private
Integer
resultType
;
private
BigDecimal
amount
;
private
String
tableName
;
private
String
filter
;
private
String
filterValue
;
public
String
getTableName
()
{
return
tableName
;
}
public
void
setTableName
(
String
tableName
)
{
this
.
tableName
=
tableName
;
}
public
String
getFilter
()
{
return
filter
;
}
public
void
setFilter
(
String
filter
)
{
this
.
filter
=
filter
;
}
public
String
getFilterValue
()
{
return
filterValue
;
}
public
void
setFilterValue
(
String
filterValue
)
{
this
.
filterValue
=
filterValue
;
}
public
ReportCellTableSUMIFDataSourceDto
()
{
this
.
type
=
FormulaDataSourceType
.
Report
.
getCode
();
}
public
void
insertData
(
OperationEvaluationContext
o
,
FormulaContext
formulaContext
)
{
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
;
}
public
void
setTag
(
String
tag
)
{
this
.
tag
=
tag
;
}
@Override
public
String
getName
()
{
return
this
.
name
;
}
@Override
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
@Override
public
Integer
getYear
()
{
return
this
.
year
;
}
@Override
public
void
setYear
(
Integer
year
)
{
this
.
year
=
year
;
}
@Override
public
Integer
getPeriod
()
{
return
this
.
period
;
}
@Override
public
void
setPeriod
(
Integer
period
)
{
this
.
period
=
period
;
}
@Override
public
Integer
getColumnIndex
()
{
return
this
.
columnIndex
;
}
@Override
public
void
setColumnIndex
(
Integer
columnIndex
)
{
this
.
columnIndex
=
columnIndex
;
}
@Override
public
String
getColumnName
()
{
return
this
.
columnName
;
}
@Override
public
void
setColumnName
(
String
columnName
)
{
this
.
columnName
=
columnName
;
}
@Override
public
Integer
getRowIndex
()
{
return
this
.
rowIndex
;
}
@Override
public
void
setRowIndex
(
Integer
rowIndex
)
{
this
.
rowIndex
=
rowIndex
;
}
@Override
public
String
getRowName
()
{
return
this
.
rowName
;
}
@Override
public
void
setRowName
(
String
rowName
)
{
this
.
rowName
=
rowName
;
}
@Override
public
String
getReportTemplateId
()
{
return
this
.
reportTemplateId
;
}
@Override
public
void
setReportTemplateId
(
String
reportTemplateId
)
{
this
.
reportTemplateId
=
reportTemplateId
;
}
public
String
getReportName
()
{
return
this
.
reportName
;
}
public
void
setReportName
(
String
reportName
)
{
this
.
reportName
=
reportName
;
}
@Override
public
String
getCellDataId
()
{
return
this
.
cellDataId
;
}
@Override
public
void
setCellDataId
(
String
cellDataId
)
{
this
.
cellDataId
=
cellDataId
;
}
@Override
public
String
getCellTemplateId
()
{
return
this
.
cellTemplateId
;
}
@Override
public
void
setCellTemplateId
(
String
cellTemplateId
)
{
this
.
cellTemplateId
=
cellTemplateId
;
}
public
Boolean
getIsOnlyManualInput
()
{
return
this
.
isOnlyManualInput
;
}
public
void
setIsOnlyManualInput
(
Boolean
onlyManualInput
)
{
this
.
isOnlyManualInput
=
onlyManualInput
;
}
@Override
public
Integer
getType
()
{
return
this
.
type
;
}
@Override
public
void
setType
(
Integer
type
)
{
this
.
type
=
type
;
}
@Override
public
Integer
getResultType
()
{
return
this
.
resultType
;
}
@Override
public
void
setResultType
(
Integer
resultType
)
{
this
.
resultType
=
resultType
;
}
@Override
public
BigDecimal
getAmount
()
{
return
this
.
amount
;
}
@Override
public
void
setAmount
(
BigDecimal
amount
)
{
this
.
amount
=
amount
;
}
@Override
public
String
toString
()
{
return
"ReportCellTableSUMIFDataSourceDto{"
+
"tag='"
+
tag
+
'\''
+
", name='"
+
name
+
'\''
+
", year="
+
year
+
", period="
+
period
+
", columnIndex="
+
columnIndex
+
", columnName='"
+
columnName
+
'\''
+
", rowIndex="
+
rowIndex
+
", rowName='"
+
rowName
+
'\''
+
", reportTemplateId='"
+
reportTemplateId
+
'\''
+
", reportName='"
+
reportName
+
'\''
+
", cellDataId='"
+
cellDataId
+
'\''
+
", cellTemplateId='"
+
cellTemplateId
+
'\''
+
", isOnlyManualInput="
+
isOnlyManualInput
+
", type="
+
type
+
", resultType="
+
resultType
+
", amount="
+
amount
+
", tableName='"
+
tableName
+
'\''
+
", filter='"
+
filter
+
'\''
+
", filterValue='"
+
filterValue
+
'\''
+
'}'
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/CitReportServiceImpl.java
View file @
6f213aef
...
...
@@ -57,7 +57,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"
,
"TABLE
SUMIF"
,
"SUM"
};
"JXFP"
,
"PSUM"
,
"DFFS"
,
"JFFS"
,
"WPSR"
,
"WPNAME"
,
"WPTYPE"
,
"SUM2"
,
"R
SUMIF"
,
"SUM"
};
@Autowired
private
OrganizationServiceTemplateGroupMapper
orgServiceTemplateGroupMapper
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/FormulaAgent.java
View file @
6f213aef
...
...
@@ -145,6 +145,7 @@ public class FormulaAgent {
}
public
static
String
buildSql
(
String
tableName
,
String
getField
,
String
filter
,
String
filterValue
,
Integer
period
,
String
year
,
FormulaContext
formulaContext
)
{
/*
...
...
@@ -159,13 +160,13 @@ public class FormulaAgent {
if
(
tableName
.
substring
(
0
,
3
).
equals
(
"cit"
))
{
try
{
return
_buildSql
(
getField
,
tableName
,
filter
,
filterValue
,
period
,
formulaContext
,
year
,
true
);
return
_buildSql
(
getField
,
tableName
,
filter
,
filterValue
,
period
,
formulaContext
,
year
,
true
,
false
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
try
{
return
_buildSql
(
getField
,
tableName
,
filter
,
filterValue
,
period
,
formulaContext
,
year
,
false
);
return
_buildSql
(
getField
,
tableName
,
filter
,
filterValue
,
period
,
formulaContext
,
year
,
false
,
false
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -173,8 +174,15 @@ public class FormulaAgent {
}
public
static
String
_buildSql
(
String
getField
,
String
tableName
,
String
filter
,
String
filterValue
,
Integer
period
,
FormulaContext
formulaContext
,
String
year
,
boolean
bool
)
throws
Exception
{
String
sql
=
"select sum("
+
getField
+
") as "
+
getField
+
" from "
+
tableName
+
" where 1=1 and "
+
filter
+
filterValue
;
public
static
String
_buildSql
(
String
getField
,
String
tableName
,
String
filter
,
String
filterValue
,
Integer
period
,
FormulaContext
formulaContext
,
String
year
,
boolean
bool
,
boolean
getSql
)
throws
Exception
{
String
sql
=
""
;
if
(
getSql
){
sql
=
"select * from "
+
tableName
+
" where 1=1 and "
+
filter
+
filterValue
;
return
sql
;
}
else
{
sql
=
"select sum("
+
getField
+
") as "
+
getField
+
" from "
+
tableName
+
" where 1=1 and "
+
filter
+
filterValue
;
}
String
_p
=
insertZero
(
formulaContext
.
getPeriod
()
-
Math
.
abs
(
period
));
String
_period
=
insertZero
(
formulaContext
.
getPeriod
());
String
per
=
insertZero
((
formulaContext
.
getPeriod
()
-
1
));
...
...
@@ -210,15 +218,17 @@ public class FormulaAgent {
@Autowired
JdbcTemplate
jdbcTemplate
;
/*
public static void main(String[] args) {
FormulaAgent formulaAgent = new FormulaAgent();
FormulaContext formulaContext = new FormulaContext();
formulaContext.setPeriod(3);
formulaAgent.getTableDataByName("CIT_TBAM", "ending_balance", "attribute", "= '销售费用-财产损耗、盘亏及毁损损失'", 0, "2018", formulaContext);
}
}
*/
public
BigDecimal
getTableDataByName
(
String
tableName
,
String
getField
,
String
filter
,
String
filterValue
,
Integer
period
,
String
year
,
FormulaContext
formulaContext
)
{
Map
<
String
,
Object
>
stringObjectMap
=
jdbcTemplate
.
queryForMap
(
buildSql
(
TableRule
.
map
.
get
(
tableName
),
getField
,
filter
,
filterValue
,
period
,
year
,
formulaContext
));
/* for (int i = 0, j = stringObjectMap.size(); i < j; i++) {
if (i == 1) {
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
6f213aef
...
...
@@ -95,7 +95,6 @@ public class ReportGeneratorImpl {
Optional
<
PeriodTemplate
>
periodTemplate
=
resources
.
getPeriodTemplates
().
stream
()
.
filter
(
a
->
a
.
getCode
().
equals
(
code
))
.
findFirst
();
Long
templateId
;
if
(
periodTemplate
.
isPresent
())
{
templateId
=
periodTemplate
.
get
().
getTemplateId
();
...
...
@@ -209,8 +208,6 @@ public class ReportGeneratorImpl {
}
else
{
cellData
.
setData
(
data
);
}
if
(
StringUtils
.
isBlank
(
resultFormula
))
{
resultFormula
=
" "
;
}
...
...
@@ -240,19 +237,17 @@ public class ReportGeneratorImpl {
cellDataSource
.
setUpdateTime
(
new
Date
());
cellDataSource
.
setPeriod
(
period
);
cellDataSource
.
setProjectId
(
projectId
);
SpringContextUtil
.
periodCellDataSourceMapper
.
insertSelective
(
cellDataSource
);
}
periodCellDataMapper
.
insertSelective
(
cellData
);
}
}
if
(
isMergeMunual
)
{
List
<
PeriodCellTemplateConfig
>
keyInCellTemplateConfigs
=
resources
.
getPeriodCellTemplateConfigs
().
stream
()
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
)
&&
a
.
getDataSourceType
().
equals
(
CellDataSourceType
.
KeyIn
.
getCode
()))
.
collect
(
Collectors
.
toList
());
for
(
PeriodCellTemplateConfig
keyInCellTemplateConfig
:
keyInCellTemplateConfigs
)
{
PeriodDataSourceExample
dataSourceExample
=
new
PeriodDataSourceExample
();
dataSourceExample
.
createCriteria
().
andPeriodEqualTo
(
period
).
andProjectIdEqualTo
(
projectId
)
...
...
@@ -313,7 +308,6 @@ public class ReportGeneratorImpl {
}
else
{
logger
.
warn
(
"should not be !!!"
);
}
}
}
...
...
@@ -512,8 +506,7 @@ public class ReportGeneratorImpl {
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
TABLESUMIF
(
formulaContext
),
new
SUM
(
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
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
6f213aef
...
...
@@ -763,6 +763,7 @@ public class ReportServiceImpl extends BaseService {
dataSourceDto
.
setColumnIndex
(
a
.
getColumnIndex
());
dataSourceDto
.
setColumnName
(
a
.
getColumnName
());
dataSourceDto
.
setReportTemplateId
(
a
.
getReportTemplateId
().
toString
());
dataSourceDto
.
setRel_sql
(
a
.
getRelSql
());
if
(
a
.
getType
().
equals
(
FormulaDataSourceType
.
Report
.
getCode
()))
{
if
(
a
.
getItems
().
size
()
==
0
)
{
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FunctionBase.java
View file @
6f213aef
...
...
@@ -99,12 +99,20 @@ public class FunctionBase {
int
period
,
Long
templateGroupId
,
Integer
colNumP
,
Integer
rowNumP
,
String
projectId
)
{
return
saveDataSource
(
ec
,
dataSourceList
,
FormulaDataSourceType
.
Report
,
formulaDataSourceDetailType
,
val
,
period
,
templateGroupId
,
colNumP
,
rowNumP
,
projectId
);
templateGroupId
,
colNumP
,
rowNumP
,
projectId
,
null
);
}
public
Long
saveDataRSUMIFSource
(
OperationEvaluationContext
ec
,
List
<
Object
>
dataSourceList
,
FormulaDataSourceDetailType
formulaDataSourceDetailType
,
BigDecimal
val
,
int
period
,
Long
templateGroupId
,
Integer
colNumP
,
Integer
rowNumP
,
String
projectId
,
FormulaDataSourceType
type
,
String
sql
)
{
return
saveDataSource
(
ec
,
dataSourceList
,
type
,
formulaDataSourceDetailType
,
val
,
period
,
templateGroupId
,
colNumP
,
rowNumP
,
projectId
,
sql
);
}
public
Long
saveDataSource
(
OperationEvaluationContext
ec
,
List
<
Object
>
dataSourceList
,
FormulaDataSourceType
dataSourceType
,
FormulaDataSourceDetailType
formulaDataSourceDetailType
,
BigDecimal
val
,
int
period
,
Long
templateGroupId
,
Integer
colNumP
,
Integer
rowNumP
,
String
projectId
)
{
int
period
,
Long
templateGroupId
,
Integer
colNumP
,
Integer
rowNumP
,
String
projectId
,
String
sql
)
{
String
reportCode
=
ec
.
getWorkbook
().
getSheetName
(
ec
.
getSheetIndex
());
int
colNum
=
ec
.
getColumnIndex
();
int
rowNum
=
ec
.
getRowIndex
();
...
...
@@ -137,6 +145,9 @@ public class FunctionBase {
dataSource
.
setCellTemplateId
(
periodCellTemplateId
);
dataSource
.
setPeriod
(
period
);
dataSource
.
setProjectId
(
projectId
);
if
(
sql
!=
null
){
dataSource
.
setRelSql
(
sql
);
}
SpringContextUtil
.
periodDataSourceMapper
.
insertSelective
(
dataSource
);
if
(
CollectionUtils
.
isNotEmpty
(
dataSourceList
))
{
for
(
Object
obj
:
dataSourceList
)
{
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/RSUMIF.java
View file @
6f213aef
...
...
@@ -3,15 +3,17 @@ 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.NumberEval
;
import
org.apache.poi.ss.formula.eval.StringEval
;
import
org.apache.poi.ss.formula.eval.ValueEval
;
import
org.apache.poi.ss.formula.functions.FreeRefFunction
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
pwc.taxtech.atms.dpo.CellTemplatePerGroupDto
;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType
;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceType
;
import
pwc.taxtech.atms.dto.TableRule
;
import
pwc.taxtech.atms.dto.vatdto.RSUMIFParasBo
;
import
pwc.taxtech.atms.dto.vatdto.ReportCellTableSUMIFDataSourceDto
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.
exception.FormulaException
;
import
pwc.taxtech.atms.
vat.service.impl.FormulaAgent
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -22,102 +24,99 @@ import static pwc.taxtech.atms.common.util.FormulaUtil.resolverString;
/**
* @ClassName RSUMIF
* Description TODO
公式还需要校验
* Description TODO
* @Author pwc kevin
* @Date 3/
8/2019 5:21
PM
* @Date 3/
11/2019 2:52
PM
* Version 1.0
**/
public
class
RSUMIF
extends
FunctionBase
implements
FreeRefFunction
{
final
static
ValueEval
defaultEval
=
new
StringEval
(
"0"
);
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
RSUMIF
.
class
);
String
tableName
;
String
getField
;
//取值列字段
Map
<
String
,
String
>
fileterMap
=
new
HashMap
<
String
,
String
>();
String
year
;
int
period
;
String
selectPeriod
=
""
;
String
selectFilter
=
""
;
Long
result
;
int
argsLength
;
int
selectCount
;
private
String
tableName
;
Map
<
String
,
String
>
_map
=
TableRule
.
map
;
public
RSUMIF
(
FormulaContext
formulaContext
)
{
super
(
formulaContext
);
}
@Override
public
ValueEval
evaluate
(
ValueEval
[]
valueEvals
,
OperationEvaluationContext
operationEvaluationContext
)
{
//进行参数验证
public
void
parameterCheck
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
{
argsLength
=
args
.
length
;
if
(
argsLength
!=
6
)
//参数小于6当做异常处理, 最后俩参数可以取默认值
throw
Exceptions
.
parameterError
;
try
{
return
wrapExceptionEval
(
valueEvals
,
operationEvaluationContext
);
}
catch
(
Exception
e
)
{
if
(
e
instanceof
FormulaException
)
LOGGER
.
warn
(
"Formula Exception || {}"
,
e
.
getMessage
());
e
.
printStackTrace
();
return
defaultEval
;
}
}
tableName
=
resolverString
(
args
,
ec
,
0
);
public
ValueEval
wrapExceptionEval
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
throws
Exception
{
List
<
Object
>
ds
=
new
ArrayList
<>();
parameterCheck
(
args
);
setWhere
(
args
,
ec
);
List
<
CellTemplatePerGroupDto
>
tableData
=
null
;
try
{
tableData
=
agent
.
getTableData
(
tableName
,
getField
,
selectFilter
,
year
,
selectPeriod
);
}
catch
(
Exception
e
)
{
if
(!
_map
.
containsKey
(
tableName
))
throw
Exceptions
.
parameterError
;
}
catch
(
EvaluationException
e
)
{
e
.
printStackTrace
();
throw
new
Exception
(
"公式参数配置错误"
);
}
for
(
CellTemplatePerGroupDto
cellTemplatePerGroupDto
:
tableData
)
{
result
=
result
+
Long
.
parseLong
(
cellTemplatePerGroupDto
.
getData
());
}
return
new
NumberEval
(
result
);
}
//进行参数验证
public
void
parameterCheck
(
ValueEval
[]
args
)
{
argsLength
=
args
.
length
;
if
(
argsLength
<
4
)
{
//参数小于3当做异常处理, 最后俩参数可以取默认值
throw
Exceptions
.
parameterError
;
}
}
private
void
setWhere
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
{
Integer
argsLength
;
String
getField
;
Integer
period
;
String
year
;
@Override
public
ValueEval
evaluate
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
{
parameterCheck
(
args
,
ec
);
BigDecimal
cellValue
=
BigDecimal
.
ZERO
;
List
<
Object
>
dataSource
=
new
ArrayList
<>();
Map
map
=
new
HashMap
<
String
,
String
>();
ReportCellTableSUMIFDataSourceDto
reportCellTableSUMIFDataSourceDto
=
new
ReportCellTableSUMIFDataSourceDto
();
reportCellTableSUMIFDataSourceDto
.
insertData
(
ec
,
formulaContext
);
String
filter
=
null
;
String
filterValue
=
null
;
dataSource
.
add
(
reportCellTableSUMIFDataSourceDto
);
try
{
selectCount
=
(
argsLength
-
4
)
/
2
;
tableName
=
resolverString
(
args
,
ec
,
0
);
getField
=
resolverString
(
args
,
ec
,
1
);
period
=
resolverInteger
(
args
,
ec
,
argsLength
-
1
);
//会计期间
year
=
resolverString
(
args
,
ec
,
argsLength
-
2
);
//会计年度
if
(
selectCount
%
2
!=
0
)
throw
Exceptions
.
parameterError
;
for
(
int
i
=
3
;
i
<
selectCount
*
2
+
3
;
i
++)
{
if
(
i
%
2
!=
0
)
{
fileterMap
.
put
(
resolverString
(
args
,
ec
,
i
),
resolverString
(
args
,
ec
,
i
+
1
));
}
filter
=
resolverString
(
args
,
ec
,
2
);
filterValue
=
resolverString
(
args
,
ec
,
3
);
period
=
resolverInteger
(
args
,
ec
,
4
);
//会计期间
year
=
resolverString
(
args
,
ec
,
5
);
//会计年度
cellValue
=
agent
.
getTableDataByName
(
tableName
,
getField
,
filter
,
filterValue
,
period
,
year
,
formulaContext
);
return
new
NumberEval
(
cellValue
.
doubleValue
());
}
catch
(
EvaluationException
e
)
{
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
;
}
if
(
period
==
0
)
{
selectPeriod
=
"t.period = "
+
formulaContext
.
getPeriod
();
}
else
if
(
period
==
-
99
)
{
selectPeriod
=
"t.period between '0' and "
+
(
formulaContext
.
getPeriod
()
-
1
);
}
else
if
(
period
==
99
)
{
selectPeriod
=
"t.period between '0' and "
+
(
formulaContext
.
getPeriod
()
-
1
);
}
else
{
selectPeriod
=
"t.period between "
+
(
formulaContext
.
getPeriod
()
-
period
)
+
" and "
+
(
formulaContext
.
getPeriod
()
-
1
);
Long
dataSourceId
=
null
;
try
{
dataSourceId
=
saveDataRSUMIFSource
(
ec
,
dataSource
,
FormulaDataSourceDetailType
.
ReportCellTableSUMIFDataSourceDto
,
cellValue
,
formulaContext
.
getPeriod
(),
formulaContext
.
getReportTemplateGroupId
(),
ec
.
getColumnIndex
(),
ec
.
getRowIndex
(),
formulaContext
.
getProjectId
(),
selectShow
(
tableName
),
FormulaAgent
.
_buildSql
(
getField
,
tableName
,
filter
,
filterValue
,
period
,
formulaContext
,
year
,
boo
,
true
)
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
}
for
(
Map
.
Entry
<
String
,
String
>
entry
:
fileterMap
.
entrySet
())
{
if
(
selectFilter
.
equals
(
""
))
{
selectFilter
=
"t."
+
entry
.
getKey
()
+
entry
.
getValue
();
}
else
{
selectFilter
=
selectFilter
+
" and "
+
"t."
+
entry
.
getKey
()
+
entry
.
getValue
();
}
try
{
saveFormulaBlock
(
formulaContext
.
getPeriod
(),
ec
,
new
RSUMIFParasBo
().
getExpression
(
args
,
ec
),
cellValue
,
dataSourceId
,
formulaContext
.
getProjectId
());
}
catch
(
EvaluationException
e
)
{
e
.
printStackTrace
();
}
}
catch
(
EvaluationException
e
)
{
e
.
printStackTrace
();
}
}
//解决不同表结构关联不同的展示方式
public
FormulaDataSourceType
selectShow
(
String
tableName
)
{
if
(
"CIT_TBAM"
.
equals
(
tableName
))
{
return
FormulaDataSourceType
.
CIT_TBAM
;
}
return
null
;
}
public
static
String
getSql
(){
return
""
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/TABLESUMIF.java
deleted
100644 → 0
View file @
948117e7
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.NumberEval
;
import
org.apache.poi.ss.formula.eval.ValueEval
;
import
org.apache.poi.ss.formula.functions.FreeRefFunction
;
import
pwc.taxtech.atms.dto.TableRule
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
java.util.Map
;
import
static
pwc
.
taxtech
.
atms
.
common
.
util
.
FormulaUtil
.
resolverInteger
;
import
static
pwc
.
taxtech
.
atms
.
common
.
util
.
FormulaUtil
.
resolverString
;
/**
* @ClassName TABLESUMIF
* Description TODO
* @Author pwc kevin
* @Date 3/11/2019 2:52 PM
* Version 1.0
**/
public
class
TABLESUMIF
extends
FunctionBase
implements
FreeRefFunction
{
private
String
tableName
;
public
TABLESUMIF
(
FormulaContext
formulaContext
)
{
super
(
formulaContext
);
}
//进行参数验证
public
void
parameterCheck
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
{
argsLength
=
args
.
length
;
if
(
argsLength
!=
6
)
//参数小于6当做异常处理, 最后俩参数可以取默认值
throw
Exceptions
.
parameterError
;
try
{
tableName
=
resolverString
(
args
,
ec
,
0
);
Map
<
String
,
String
>
map
=
TableRule
.
map
;
if
(!
map
.
containsKey
(
tableName
))
throw
Exceptions
.
parameterError
;
}
catch
(
EvaluationException
e
)
{
e
.
printStackTrace
();
}
}
Integer
argsLength
;
String
getField
;
Integer
period
;
String
year
;
@Override
public
ValueEval
evaluate
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
{
parameterCheck
(
args
,
ec
);
try
{
tableName
=
resolverString
(
args
,
ec
,
0
);
getField
=
resolverString
(
args
,
ec
,
1
);
String
filter
=
resolverString
(
args
,
ec
,
2
);
String
filterValue
=
resolverString
(
args
,
ec
,
3
);
period
=
resolverInteger
(
args
,
ec
,
4
);
//会计期间
year
=
resolverString
(
args
,
ec
,
5
);
//会计年度
return
new
NumberEval
(
agent
.
getTableDataByName
(
tableName
,
getField
,
filter
,
filterValue
,
period
,
year
,
formulaContext
).
doubleValue
());
}
catch
(
EvaluationException
e
)
{
e
.
printStackTrace
();
return
new
NumberEval
(
0.00
);
}
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/_RSUMIF.java
0 → 100644
View file @
6f213aef
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.NumberEval
;
import
org.apache.poi.ss.formula.eval.StringEval
;
import
org.apache.poi.ss.formula.eval.ValueEval
;
import
org.apache.poi.ss.formula.functions.FreeRefFunction
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
pwc.taxtech.atms.dpo.CellTemplatePerGroupDto
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.exception.FormulaException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
pwc
.
taxtech
.
atms
.
common
.
util
.
FormulaUtil
.
resolverInteger
;
import
static
pwc
.
taxtech
.
atms
.
common
.
util
.
FormulaUtil
.
resolverString
;
/**
* @ClassName _RSUMIF
* Description TODO 公式还需要校验
* @Author pwc kevin
* @Date 3/8/2019 5:21 PM
* Version 1.0
**/
public
class
_RSUMIF
extends
FunctionBase
implements
FreeRefFunction
{
final
static
ValueEval
defaultEval
=
new
StringEval
(
"0"
);
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
_RSUMIF
.
class
);
String
tableName
;
String
getField
;
//取值列字段
Map
<
String
,
String
>
fileterMap
=
new
HashMap
<
String
,
String
>();
String
year
;
int
period
;
String
selectPeriod
=
""
;
String
selectFilter
=
""
;
Long
result
;
int
argsLength
;
int
selectCount
;
public
_RSUMIF
(
FormulaContext
formulaContext
)
{
super
(
formulaContext
);
}
@Override
public
ValueEval
evaluate
(
ValueEval
[]
valueEvals
,
OperationEvaluationContext
operationEvaluationContext
)
{
try
{
return
wrapExceptionEval
(
valueEvals
,
operationEvaluationContext
);
}
catch
(
Exception
e
)
{
if
(
e
instanceof
FormulaException
)
LOGGER
.
warn
(
"Formula Exception || {}"
,
e
.
getMessage
());
e
.
printStackTrace
();
return
defaultEval
;
}
}
public
ValueEval
wrapExceptionEval
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
throws
Exception
{
List
<
Object
>
ds
=
new
ArrayList
<>();
parameterCheck
(
args
);
setWhere
(
args
,
ec
);
List
<
CellTemplatePerGroupDto
>
tableData
=
null
;
try
{
tableData
=
agent
.
getTableData
(
tableName
,
getField
,
selectFilter
,
year
,
selectPeriod
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
Exception
(
"公式参数配置错误"
);
}
for
(
CellTemplatePerGroupDto
cellTemplatePerGroupDto
:
tableData
)
{
result
=
result
+
Long
.
parseLong
(
cellTemplatePerGroupDto
.
getData
());
}
return
new
NumberEval
(
result
);
}
//进行参数验证
public
void
parameterCheck
(
ValueEval
[]
args
)
{
argsLength
=
args
.
length
;
if
(
argsLength
<
4
)
{
//参数小于3当做异常处理, 最后俩参数可以取默认值
throw
Exceptions
.
parameterError
;
}
}
private
void
setWhere
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
{
try
{
selectCount
=
(
argsLength
-
4
)
/
2
;
tableName
=
resolverString
(
args
,
ec
,
0
);
getField
=
resolverString
(
args
,
ec
,
1
);
period
=
resolverInteger
(
args
,
ec
,
argsLength
-
1
);
//会计期间
year
=
resolverString
(
args
,
ec
,
argsLength
-
2
);
//会计年度
if
(
selectCount
%
2
!=
0
)
throw
Exceptions
.
parameterError
;
for
(
int
i
=
3
;
i
<
selectCount
*
2
+
3
;
i
++)
{
if
(
i
%
2
!=
0
)
{
fileterMap
.
put
(
resolverString
(
args
,
ec
,
i
),
resolverString
(
args
,
ec
,
i
+
1
));
}
}
if
(
period
==
0
)
{
selectPeriod
=
"t.period = "
+
formulaContext
.
getPeriod
();
}
else
if
(
period
==
-
99
)
{
selectPeriod
=
"t.period between '0' and "
+
(
formulaContext
.
getPeriod
()
-
1
);
}
else
if
(
period
==
99
)
{
selectPeriod
=
"t.period between '0' and "
+
(
formulaContext
.
getPeriod
()
-
1
);
}
else
{
selectPeriod
=
"t.period between "
+
(
formulaContext
.
getPeriod
()
-
period
)
+
" and "
+
(
formulaContext
.
getPeriod
()
-
1
);
}
for
(
Map
.
Entry
<
String
,
String
>
entry
:
fileterMap
.
entrySet
())
{
if
(
selectFilter
.
equals
(
""
))
{
selectFilter
=
"t."
+
entry
.
getKey
()
+
entry
.
getValue
();
}
else
{
selectFilter
=
selectFilter
+
" and "
+
"t."
+
entry
.
getKey
()
+
entry
.
getValue
();
}
}
}
catch
(
EvaluationException
e
)
{
e
.
printStackTrace
();
}
}
}
atms-dao/src/main/java/pwc/taxtech/atms/dao/CitTbamMapper.java
View file @
6f213aef
...
...
@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.session.RowBounds
;
import
pwc.taxtech.atms.MyMapper
;
import
pwc.taxtech.atms.dpo.CitTbamDto
;
import
pwc.taxtech.atms.entity.CitTbam
;
import
pwc.taxtech.atms.entity.CitTbamExample
;
...
...
@@ -113,4 +114,6 @@ public interface CitTbamMapper extends MyMapper {
* @return
*/
int
insertBatch
(
List
<
CitTbam
>
citTbamList
);
List
<
CitTbamDto
>
selectBySql
(
@Param
(
"sql"
)
String
sql
);
}
\ No newline at end of file
atms-dao/src/main/java/pwc/taxtech/atms/dpo/CitTbamDto.java
0 → 100644
View file @
6f213aef
package
pwc
.
taxtech
.
atms
.
dpo
;
import
pwc.taxtech.atms.entity.CitTbam
;
/**
* @ClassName CitTbamDto
* Description TODO
* @Author pwc kevin
* @Date 3/15/2019 3:46 PM
* Version 1.0
**/
public
class
CitTbamDto
extends
CitTbam
{
}
atms-dao/src/main/java/pwc/taxtech/atms/vat/entity/PeriodDataSource.java
View file @
6f213aef
...
...
@@ -20,6 +20,15 @@ public class PeriodDataSource implements Serializable {
* @mbg.generated
*/
private
Long
id
;
private
String
relSql
;
public
String
getRelSql
()
{
return
relSql
;
}
public
void
setRelSql
(
String
relSql
)
{
this
.
relSql
=
relSql
;
}
/**
*
...
...
@@ -655,30 +664,27 @@ public class PeriodDataSource implements Serializable {
*/
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
getClass
().
getSimpleName
());
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", type="
).
append
(
type
);
sb
.
append
(
", name="
).
append
(
name
);
sb
.
append
(
", amount="
).
append
(
amount
);
sb
.
append
(
", description="
).
append
(
description
);
sb
.
append
(
", keyValueDataId="
).
append
(
keyValueDataId
);
sb
.
append
(
", createBy="
).
append
(
createBy
);
sb
.
append
(
", createTime="
).
append
(
createTime
);
sb
.
append
(
", updateBy="
).
append
(
updateBy
);
sb
.
append
(
", updateTime="
).
append
(
updateTime
);
sb
.
append
(
", rowName="
).
append
(
rowName
);
sb
.
append
(
", columnName="
).
append
(
columnName
);
sb
.
append
(
", rowIndex="
).
append
(
rowIndex
);
sb
.
append
(
", remapBatchId="
).
append
(
remapBatchId
);
sb
.
append
(
", columnIndex="
).
append
(
columnIndex
);
sb
.
append
(
", cellTemplateId="
).
append
(
cellTemplateId
);
sb
.
append
(
", period="
).
append
(
period
);
sb
.
append
(
", projectId="
).
append
(
projectId
);
sb
.
append
(
", keyinData="
).
append
(
keyinData
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
return
"PeriodDataSource{"
+
"id="
+
id
+
", relSql='"
+
relSql
+
'\''
+
", type="
+
type
+
", name='"
+
name
+
'\''
+
", amount="
+
amount
+
", description='"
+
description
+
'\''
+
", keyValueDataId='"
+
keyValueDataId
+
'\''
+
", createBy='"
+
createBy
+
'\''
+
", createTime="
+
createTime
+
", updateBy='"
+
updateBy
+
'\''
+
", updateTime="
+
updateTime
+
", rowName='"
+
rowName
+
'\''
+
", columnName='"
+
columnName
+
'\''
+
", rowIndex="
+
rowIndex
+
", remapBatchId='"
+
remapBatchId
+
'\''
+
", columnIndex="
+
columnIndex
+
", cellTemplateId="
+
cellTemplateId
+
", period="
+
period
+
", projectId='"
+
projectId
+
'\''
+
", keyinData='"
+
keyinData
+
'\''
+
'}'
;
}
}
\ No newline at end of file
atms-dao/src/main/resources/pwc/taxtech/atms/dao/extends/CitTbamExtendsMapper.xml
View file @
6f213aef
...
...
@@ -81,4 +81,10 @@
SELECT 1 FROM DUAL;
</insert>
<select
id =
"selectBySql"
parameterType=
"java.lang.String"
resultType=
"pwc.taxtech.atms.dpo.CitTbamDto"
>
<if
test =
"sql != null and sql != '' "
>
${sql}
</if>
</select>
</mapper>
\ No newline at end of file
atms-dao/src/main/resources/pwc/taxtech/atms/vat/dao/PeriodDataSourceMapper.xml
View file @
6f213aef
...
...
@@ -231,7 +231,11 @@
<if
test=
"keyinData != null"
>
keyin_data,
</if>
<if
test=
"relSql != null"
>
rel_sql
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
...
...
@@ -290,6 +294,9 @@
<if
test=
"keyinData != null"
>
#{keyinData,jdbcType=VARCHAR},
</if>
<if
test=
"relSql != null"
>
#{relSql,jdbcType=VARCHAR}
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"pwc.taxtech.atms.vat.entity.PeriodDataSourceExample"
resultType=
"java.lang.Long"
>
...
...
atms-dao/src/main/resources/pwc/taxtech/atms/vat/dao/extends/PeriodDataSourceExtendsMapper.xml
View file @
6f213aef
...
...
@@ -245,6 +245,7 @@
<result
column=
"CELL_TEMPLATE_ID"
jdbcType=
"BIGINT"
property=
"cellTemplateId"
/>
<result
column=
"CELL_DATA_ID"
jdbcType=
"BIGINT"
property=
"cellDataId"
/>
<result
column=
"REPORT_TEMPLATE_ID"
jdbcType=
"BIGINT"
property=
"reportTemplateId"
/>
<result
column=
"REL_SQL"
jdbcType=
"VARCHAR"
property=
"relSql"
/>
</resultMap>
<select
id=
"getFormulaDataSource"
parameterType=
"java.lang.Long"
resultMap=
"DataSourceExtendDtoMap"
>
...
...
@@ -268,6 +269,7 @@
DS.period as PERIOD,
DS.project_id as PROJECT_ID,
DS.keyin_data as KEYIN_DATA,
DS.rel_sql as REL_SQL,
CDS.operation_type AS OPERATION_TYPE,
CD.cell_template_id AS CELL_TEMPLATE_ID,
CD.id AS CELL_DATA_ID,
...
...
atms-web/src/main/webapp/app/common/controls/tax-report-cell-detail-modal/tax-report-cell-detail-modal.ctrl.js
View file @
6f213aef
...
...
@@ -1495,6 +1495,53 @@
{
dataField
:
'money'
,
caption
:
'Amount'
,
alignment
:
'center'
,
width
:
'100%'
},
];
break
;
case
enums
.
formulaDataSourceType
.
CIT_TBAM
:
dataGridColumns
=
[
{
dataField
:
'accountCode'
,
caption
:
$translate
.
instant
(
'AccountCode'
),
alignment
:
'center'
,
},
{
dataField
:
'accountDescription'
,
caption
:
$translate
.
instant
(
'AccountName'
),
alignment
:
'left'
,
},
{
dataField
:
'customerCode'
,
caption
:
$translate
.
instant
(
'CustomerCode'
),
alignment
:
'left'
},
{
dataField
:
'beginningBalance'
,
caption
:
$translate
.
instant
(
'BegBal'
),
alignment
:
'left'
},
{
dataField
:
'debitAmount'
,
caption
:
$translate
.
instant
(
'DebitBal'
),
alignment
:
'left'
}
,
{
dataField
:
'creditAmount'
,
caption
:
$translate
.
instant
(
'CreditAmount'
),
alignment
:
'left'
}
,
{
dataField
:
'endingBalance'
,
caption
:
$translate
.
instant
(
'EndingBalance'
),
alignment
:
'left'
}
,
{
dataField
:
'Attribute'
,
caption
:
$translate
.
instant
(
'Attribute'
),
alignment
:
'left'
}
];
break
;
}
return
dataGridColumns
;
};
...
...
@@ -2161,6 +2208,11 @@
break
;
case
enums
.
formulaDataSourceType
.
InputInvoice
:
$scope
.
detail
.
dataGridSourceBind
=
[
$scope
.
detail
.
dataGridSource
[
0
]];
break
;
case
enums
.
formulaDataSourceType
.
InputInvoice
:
$scope
.
detail
.
dataGridSourceBind
=
[
$scope
.
detail
.
dataGridSource
[
0
]];
break
;
case
enums
.
formulaDataSourceType
.
CIT_TBAM
:
$scope
.
detail
.
dataGridSourceBind
=
getBlowGridData
(
$scope
.
detail
.
dataGridSource
[
0
]);
break
;
default
:
$scope
.
detail
.
dataGridSourceBind
=
$scope
.
detail
.
dataGridSource
;
...
...
@@ -2181,6 +2233,17 @@
},
500
);
});
var
getBlowGridData
=
function
(
data
){
cellCommentService
.
getCellInformation
(
data
).
success
(
function
(
res
)
{
if
(
res
.
resultMsg
){
return
res
.
data
;
}
}).
error
(
function
(
error
)
{
});
}
//当数据源数量变化是,重新排序数据源
$scope
.
$watch
(
'detail.items.length'
,
function
(
newVal
,
oldValue
)
{
...
...
atms-web/src/main/webapp/app/common/controls/tax-report-cell-detail-modal/tax-report-cell-detail-modal.html
View file @
6f213aef
...
...
@@ -21,13 +21,11 @@
<!--<i ng-show="detail.hasModelError" class="fa fa-exclamation-circle red-color"></i>-->
<!--{{'ModelAnalysisResults' | translate}}</span>-->
<span
ng-show=
"detail.validationErrorList && detail.validationErrorList.length > 0"
ng-model=
"tabType"
uib-btn-radio=
"3"
>
<i
class=
"fa fa-exclamation-circle red-color"
></i>
{{'ReportCheckResult' | translate}}
</span>
uib-btn-radio=
"3"
><i
class=
"fa fa-exclamation-circle red-color"
></i>
{{'ReportCheckResult' | translate}}
</span>
<span
ng-model=
"tabType"
uib-btn-radio=
"4"
>
{{'cellComment'|translate}}
</span>
<span
ng-model=
"tabType"
uib-btn-radio=
"5"
ng-click =
"loadAttach()"
>
{{'RelatedAttach'|translate}}
</span>
</div>
<div
class=
"content-info"
ng-show=
"tabType === 1"
>
<div
class=
"cell-info-sammary"
>
<!-- <div class="tab tab-selected cell-info-title">{{'CellInfo' | translate}}</div> -->
...
...
@@ -44,11 +42,11 @@
<label
class=
"cell-info-subject-label"
>
{{'ColumnName' | translate}}:
</label>
{{detail.cellInfo.column}}
</div>
<
!--<
div class="cell-info-subject">
<div
class=
"cell-info-subject"
>
<label
class=
"cell-info-subject-label"
>
{{'Formula' | translate}}
</label>
<formula-translator
formula-list=
"formulaList"
key-value-list=
"keyValueList"
include-optional=
"false"
account-data-source=
"accountDataSource"
formula-exp=
"detail.config.formula"
></formula-translator>
</div>
-->
</div>
<div
class=
"cell-info-subject"
>
<label
class=
"cell-info-subject-label"
>
{{'SourceOrFormula' | translate}}:
</label>
{{detail.cellInfo.description}}
...
...
@@ -121,6 +119,7 @@
<i
class=
"material-icons add-icon"
>
add_circle
</i><a
translate=
"AddDataSource"
></a>
</div>
</div>
<div
class=
"data-source-detail-container"
>
<!--数据源-->
<div
class=
"income-data-source"
ng-if=
"selectedDataSourceTabIndex === 1 && detail.cellType != 0"
>
...
...
atms-web/src/main/webapp/app/common/controls/vat-report-view/vat-report-view.ctrl.js
View file @
6f213aef
...
...
@@ -1023,7 +1023,6 @@
var
html
=
$compile
(
report
)(
$scope
);
$
(
'.export-container'
).
append
(
html
);
}
timeOutExportSpread
(
exportReportData
);
});
return
;
...
...
atms-web/src/main/webapp/app/common/utils/enums.js
View file @
6f213aef
...
...
@@ -439,8 +439,8 @@ commonModule.factory('enums', ['$translate', function ($translate) {
// 条件判断数据源
Judgment
:
6
,
//
// Sap日报
数据源
//
SapDaily: 7,
//
RUSUM公式
数据源
SapDaily
:
7
,
//// 土地出让金数据源
//LandSell: 8,
...
...
@@ -464,8 +464,9 @@ commonModule.factory('enums', ['$translate', function ($translate) {
// 用于存放特殊逻辑中获取的数据源数值与备注等信息,如未开票视同销售等
Special
:
19
,
BSPL
:
20
,
WPSR
:
33
RSUMIF
:
22
,
WPSR
:
33
,
CIT_TBAM
:
50
//试算平衡表
},
...
...
atms-web/src/main/webapp/app/common/webservices/cellComment.svc.js
View file @
6f213aef
...
...
@@ -11,5 +11,8 @@ webservices.factory('cellCommentService', ['$http', 'apiConfig', function ($http
deleteCellComment
:
function
(
commentId
)
{
return
$http
.
post
(
'/CellComment/Delete/'
+
commentId
,
{},
apiConfig
.
createVat
());
},
getCellInformation
:
function
(
data
){
return
$http
.
get
(
'/CellComment/getCellInformation?sql='
+
data
.
relSql
,
apiConfig
.
vat
());
}
};
}]);
\ 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