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
f69410c1
Commit
f69410c1
authored
Jul 31, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed report generate issue
parent
f89308cd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
130 additions
and
27 deletions
+130
-27
SpringContextUtil.java
.../java/pwc/taxtech/atms/common/util/SpringContextUtil.java
+3
-0
Constant.java
...api/src/main/java/pwc/taxtech/atms/constant/Constant.java
+9
-0
ReportController.java
...in/java/pwc/taxtech/atms/controller/ReportController.java
+4
-1
InputVATInvoiceMapper.java
.../java/pwc/taxtech/atms/vat/dao/InputVATInvoiceMapper.java
+2
-1
OutputVATInvoiceMapper.java
...java/pwc/taxtech/atms/vat/dao/OutputVATInvoiceMapper.java
+2
-1
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+11
-4
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+0
-0
FSJZ.java
.../taxtech/atms/vat/service/impl/report/functions/FSJZ.java
+2
-2
FormulaHelper.java
...atms/vat/service/impl/report/functions/FormulaHelper.java
+3
-3
FunctionBase.java
.../atms/vat/service/impl/report/functions/FunctionBase.java
+4
-6
JXFP.java
.../taxtech/atms/vat/service/impl/report/functions/JXFP.java
+3
-3
JXFPMX.java
...axtech/atms/vat/service/impl/report/functions/JXFPMX.java
+2
-2
ProjectContext.java
...tms/vat/service/impl/report/functions/ProjectContext.java
+81
-0
SGSR.java
.../taxtech/atms/vat/service/impl/report/functions/SGSR.java
+2
-2
XXFP.java
.../taxtech/atms/vat/service/impl/report/functions/XXFP.java
+2
-2
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/util/SpringContextUtil.java
View file @
f69410c1
...
...
@@ -5,6 +5,7 @@ import org.springframework.context.ApplicationContext;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.stereotype.Component
;
import
pwc.taxtech.atms.dao.FormulaAdminMapper
;
import
pwc.taxtech.atms.dao.OrganizationMapper
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dao.ProjectServiceTypeMapper
;
import
pwc.taxtech.atms.dao.dao.ProjectDao
;
...
...
@@ -44,6 +45,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public
static
AssetsListMapper
assetsListMapper
;
public
static
ProjectMapper
projectMapper
;
public
static
CellDataSourceMapper
cellDataSourceMapper
;
public
static
OrganizationMapper
organizationMapper
;
/**
* 获取bean
...
...
@@ -84,5 +86,6 @@ public class SpringContextUtil implements ApplicationContextAware {
assetsListMapper
=
webApplicationContext
.
getBean
(
AssetsListMapper
.
class
);
projectMapper
=
webApplicationContext
.
getBean
(
ProjectMapper
.
class
);
cellDataSourceMapper
=
webApplicationContext
.
getBean
(
CellDataSourceMapper
.
class
);
organizationMapper
=
webApplicationContext
.
getBean
(
OrganizationMapper
.
class
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/constant/Constant.java
View file @
f69410c1
package
pwc
.
taxtech
.
atms
.
constant
;
import
java.io.File
;
import
java.util.Locale
;
import
java.util.UUID
;
public
final
class
Constant
{
...
...
@@ -42,6 +43,7 @@ public final class Constant {
public
static
final
String
IMAGE_FORMART_
=
"png"
;
public
static
final
String
EMPTY
=
""
;
public
static
final
String
DateTimeFormate
=
"{0}年{1}月"
;
public
static
class
DataSourceName
{
public
static
final
String
KeyValueDataSource
=
"KeyValueDataSource"
;
...
...
@@ -69,4 +71,10 @@ public final class Constant {
public
static
String
ScanPass
=
"扫描认证"
;
public
static
String
NotPass
=
"未认证"
;
}
public
static
class
ReportBuildInStringFormat
{
public
static
final
String
TimeInterval
=
"税款所属时间: 自{0}年{1}月{2}日至{0}年{1}月{3}日"
;
public
static
final
String
FillForm
=
"填表日期: {0}年{1}月{2}日"
;
public
static
final
String
TaxPayer
=
"纳税人名称: {0}"
;
}
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/controller/ReportController.java
View file @
f69410c1
...
...
@@ -26,7 +26,10 @@ public class ReportController {
@RequestMapping
(
value
=
"updateConfig/{projectId}/{ifDeleteManualDataSource}/{period}"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
OperationResultDto
updateConfig
(
@PathVariable
String
projectId
,
@PathVariable
Boolean
ifDeleteManualDataSource
,
@PathVariable
Integer
period
,
@RequestParam
String
generator
)
{
return
reportService
.
updateConfig
(
projectId
,
period
,
ifDeleteManualDataSource
,
generator
);
// return reportService.updateConfig(projectId, period, ifDeleteManualDataSource, generator);
OperationResultDto
operationResultDto
=
new
OperationResultDto
();
operationResultDto
.
setResult
(
true
);
return
operationResultDto
;
}
@RequestMapping
(
value
=
"generateByTotal/{projectId}/{ifDeleteManualDataSource}/{period}"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/dao/InputVATInvoiceMapper.java
View file @
f69410c1
...
...
@@ -113,5 +113,5 @@ public interface InputVATInvoiceMapper extends MyVatMapper {
List
<
InputVATInvoice
>
getInputVATInvoiceCountByConditionWithPaging
(
@Param
(
"paras"
)
InputInvoicePreviewQueryParam
param
,
@Param
(
"limitFrom"
)
int
limitFrom
);
List
<
InputVATInvoiceResultDto
>
getInputVATInvoiceResultDto
(
String
dbName
);
List
<
InputVATInvoiceResultDto
>
getInputVATInvoiceResultDto
(
@Param
(
"dbName"
)
String
dbName
);
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/vat/dao/OutputVATInvoiceMapper.java
View file @
f69410c1
...
...
@@ -183,5 +183,5 @@ public interface OutputVATInvoiceMapper extends MyVatMapper {
" "
)
List
<
OutputVATInvoiceInfoDto
>
queryOutputDetailWithItem
(
Integer
period
);
List
<
OutputVATInvoiceDto
>
getVatInvoiceWithItems
(
String
dbName
);
List
<
OutputVATInvoiceDto
>
getVatInvoiceWithItems
(
@Param
(
"dbName"
)
String
dbName
);
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
f69410c1
...
...
@@ -86,6 +86,9 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
formulaContext
.
setReportTemplateGroupID
(
templateGroupID
);
formulaContext
.
setProjectID
(
project
.
getID
());
formulaContext
.
setYear
(
project
.
getYear
());
formulaContext
.
setIsYear
(
period
==
0
);
formulaContext
.
setIfRound
(
true
);
formulaContext
.
setOrganizationID
(
project
.
getOrganizationID
());
formulaContext
.
setIfRound
(
true
);
...
...
@@ -135,9 +138,13 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
//todo:后面单独处理kv的公式
if
(
StringUtils
.
isNotBlank
(
v
.
getFormula
())
&&
!
v
.
getFormula
().
contains
(
"@"
))
{
cell
.
setCellFormula
(
v
.
getFormula
());
logger
.
debug
(
"formula:"
+
v
.
getFormula
());
//kv 公式处理
}
else
if
(
v
.
getFormula
().
startsWith
(
"@"
))
{
cell
.
setCellFormula
(
v
.
getKeyValueParsedFormula
());
if
(
StringUtils
.
isNotBlank
(
v
.
getKeyValueParsedFormula
()))
{
cell
.
setCellFormula
(
v
.
getKeyValueParsedFormula
());
logger
.
debug
(
"formula:"
+
v
.
getKeyValueParsedFormula
());
}
}
});
}
...
...
@@ -343,7 +350,6 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
}
}
}
}
else
{
return
"GenerateReport failed"
;
}
...
...
@@ -416,9 +422,10 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
* @param workbook 工作簿
*/
private
void
addFunctionsToWorkbook
(
Workbook
workbook
,
FormulaContext
formulaContext
)
{
String
[]
functionNames
=
{
"SGSR"
,
"FSJZ"
,
"ND"
,
"BB"
,
"XXFP"
,
"GZSD"
};
String
[]
functionNames
=
{
"SGSR"
,
"FSJZ"
,
"ND"
,
"BB"
,
"XXFP"
,
"GZSD"
,
"ProjectContext"
,
"JXFPMX"
};
FreeRefFunction
[]
functionImpls
=
{
new
SGSR
(
formulaContext
),
new
FSJZ
(
formulaContext
),
new
ND
(
formulaContext
),
new
BB
(
formulaContext
),
new
XXFP
(
formulaContext
),
new
GZSD
(
formulaContext
)};
new
BB
(
formulaContext
),
new
XXFP
(
formulaContext
),
new
GZSD
(
formulaContext
),
new
ProjectContext
(
formulaContext
)
,
new
JXFPMX
(
formulaContext
)};
UDFFinder
udfs
=
new
DefaultUDFFinder
(
functionNames
,
functionImpls
);
UDFFinder
udfToolpack
=
new
AggregatingUDFFinder
(
udfs
);
workbook
.
addToolPack
(
udfToolpack
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
f69410c1
This diff is collapsed.
Click to expand it.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FSJZ.java
View file @
f69410c1
...
...
@@ -61,9 +61,9 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
year
=
formulaContext
.
getYear
();
}
int
[]
yearOffset
=
{}
;
Integer
yearOffset
=
0
;
period
=
FormulaHelper
.
getPeriod
(
period
,
yearOffset
,
formulaContext
);
year
=
year
+
yearOffset
[
0
]
;
year
=
year
+
yearOffset
;
if
(
accountType
==
0
)
{
//标准账套
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FormulaHelper.java
View file @
f69410c1
...
...
@@ -53,14 +53,14 @@ public class FormulaHelper {
return
columnStr
;
}
public
static
int
getPeriod
(
int
parameterPeriod
,
int
[]
yearOffset
,
FormulaContext
formulaFunctionContext
)
{
yearOffset
[
0
]
=
0
;
public
static
int
getPeriod
(
int
parameterPeriod
,
Integer
yearOffset
,
FormulaContext
formulaFunctionContext
)
{
yearOffset
=
0
;
if
(
parameterPeriod
==
-
99
)
{
return
parameterPeriod
;
}
else
if
(
parameterPeriod
<=
-
1
)
{
int
period
=
parameterPeriod
+
formulaFunctionContext
.
getPeriod
();
while
(
period
<=
0
)
{
yearOffset
[
0
]
--;
yearOffset
--;
period
+=
12
;
//throw new NotImplementedException();
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FunctionBase.java
View file @
f69410c1
...
...
@@ -71,17 +71,15 @@ public class FunctionBase {
}
}
public
int
getPeriod
(
int
parameterPeriod
,
int
[]
yearOffset
)
{
if
(
yearOffset
.
length
==
0
)
{
yearOffset
=
new
int
[
10
];
}
yearOffset
[
0
]
=
0
;
public
int
getPeriod
(
int
parameterPeriod
,
Integer
yearOffset
)
{
yearOffset
=
0
;
if
(
parameterPeriod
==
-
99
)
{
return
parameterPeriod
;
}
else
if
(
parameterPeriod
<=
-
1
)
{
int
period
=
parameterPeriod
+
formulaContext
.
getPeriod
();
while
(
period
<=
0
)
{
yearOffset
[
0
]
--;
yearOffset
--;
period
+=
12
;
}
return
period
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/JXFP.java
View file @
f69410c1
...
...
@@ -54,15 +54,15 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
+
authenticationType
+
","
+
resultType
+
","
+
period
+
")"
;
logger
.
debug
(
formulaExpression
);
int
[]
yearOffset
=
{}
;
Integer
yearOffset
=
0
;
certificationPeriod
=
getPeriod
(
certificationPeriod
,
yearOffset
);
if
(
yearOffset
[
0
]
<
0
)
{
if
(
yearOffset
<
0
)
{
return
NumberEval
.
ZERO
;
}
period
=
getPeriod
(
period
,
yearOffset
);
if
(
yearOffset
[
0
]
<
0
)
{
if
(
yearOffset
<
0
)
{
return
NumberEval
.
ZERO
;
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/JXFPMX.java
View file @
f69410c1
...
...
@@ -48,9 +48,9 @@ public class JXFPMX extends FunctionBase implements FreeRefFunction {
logger
.
debug
(
formulaExpression
);
int
curYear
=
formulaContext
.
getYear
();
int
[]
yearOffSet
=
{}
;
Integer
yearOffSet
=
0
;
period
=
getPeriod
(
period
,
yearOffSet
);
curYear
=
curYear
+
yearOffSet
[
0
]
;
curYear
=
curYear
+
yearOffSet
;
BigDecimal
taxRateVal
;
if
(
taxRate
.
equals
(
Constant
.
Other
))
{
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/ProjectContext.java
0 → 100644
View file @
f69410c1
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.NumberEval
;
import
org.apache.poi.ss.formula.eval.StringEval
;
import
org.apache.poi.ss.formula.eval.StringValueEval
;
import
org.apache.poi.ss.formula.eval.ValueEval
;
import
org.apache.poi.ss.formula.functions.FreeRefFunction
;
import
org.joda.time.DateTime
;
import
org.thymeleaf.expression.Dates
;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.constant.Constant
;
import
pwc.taxtech.atms.entitiy.OrganizationExample
;
import
pwc.taxtech.atms.vat.entity.Report
;
import
java.util.Calendar
;
import
java.util.Date
;
public
class
ProjectContext
extends
FunctionBase
implements
FreeRefFunction
{
public
ProjectContext
(
FormulaContext
formulaContext
)
{
super
(
formulaContext
);
}
@Override
public
ValueEval
evaluate
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
{
if
(
args
.
length
<
2
)
{
return
StringEval
.
EMPTY_INSTANCE
;
}
String
code
=
this
.
getStringParam
(
args
[
0
],
ec
);
Integer
parameterInt
=
this
.
getIntParam
(
args
[
1
],
ec
);
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar2
=
Calendar
.
getInstance
();
switch
(
code
)
{
case
"TaxPayer"
:
String
taxPayerName
=
SpringContextUtil
.
organizationMapper
.
selectByPrimaryKey
(
formulaContext
.
getOrganizationID
()).
getName
();
if
(
StringUtils
.
isNotBlank
(
taxPayerName
))
{
return
new
StringEval
(
String
.
format
(
Constant
.
ReportBuildInStringFormat
.
TaxPayer
,
taxPayerName
));
}
else
{
return
new
StringEval
(
String
.
format
(
Constant
.
ReportBuildInStringFormat
.
TaxPayer
,
" "
));
}
case
"DataTime"
:
return
new
StringEval
(
String
.
format
(
Constant
.
DateTimeFormate
,
calendar
.
get
(
Calendar
.
YEAR
),
calendar
.
get
(
Calendar
.
MONTH
)));
case
"FilterDate"
:
return
new
StringEval
(
String
.
format
(
Constant
.
DateTimeFormate
,
formulaContext
.
getYear
(),
formulaContext
.
getPeriod
()));
case
"TimeInterval"
:
Date
beginOfPeriod
=
new
Date
(
formulaContext
.
getYear
(),
formulaContext
.
getIsYear
()
?
1
:
formulaContext
.
getPeriod
(),
1
);
calendar
.
setTime
(
beginOfPeriod
);
calendar
.
add
(
Calendar
.
YEAR
,
1
);
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
calendar2
.
setTime
(
beginOfPeriod
);
calendar2
.
add
(
Calendar
.
MONTH
,
1
);
calendar2
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
Date
endOfPeriod
=
formulaContext
.
getIsYear
()
?
calendar
.
getTime
()
:
calendar2
.
getTime
();
calendar
.
setTime
(
beginOfPeriod
);
calendar2
.
setTime
(
endOfPeriod
);
return
new
StringEval
(
String
.
format
(
Constant
.
ReportBuildInStringFormat
.
TimeInterval
,
formulaContext
.
getYear
()
,
formulaContext
.
getPeriod
(),
calendar
.
get
(
Calendar
.
DAY_OF_MONTH
),
calendar2
.
get
(
Calendar
.
DAY_OF_MONTH
)));
case
"FillForm"
:
Report
report
=
SpringContextUtil
.
reportMapper
.
selectByPrimaryKey
(
formulaContext
.
getReportID
());
if
(
report
!=
null
)
{
return
new
StringEval
(
String
.
format
(
Constant
.
ReportBuildInStringFormat
.
FillForm
,
report
.
getUpdateTime
().
getYear
()
,
report
.
getUpdateTime
().
getMonth
(),
report
.
getUpdateTime
().
getDay
()));
}
else
{
return
new
StringEval
(
String
.
format
(
Constant
.
ReportBuildInStringFormat
.
FillForm
,
" "
,
" "
,
" "
));
}
case
"TaxPayerNo"
:
String
taxPayerNo
=
SpringContextUtil
.
organizationMapper
.
selectByPrimaryKey
(
formulaContext
.
getOrganizationID
()).
getTaxPayerNumber
();
if
(
StringUtils
.
isNotBlank
(
taxPayerNo
)
&&
taxPayerNo
.
length
()
-
1
>=
parameterInt
)
{
return
new
StringEval
(
String
.
valueOf
(
taxPayerNo
.
charAt
(
parameterInt
)));
}
break
;
default
:
break
;
}
return
StringEval
.
EMPTY_INSTANCE
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/SGSR.java
View file @
f69410c1
...
...
@@ -62,9 +62,9 @@ public class SGSR implements FreeRefFunction {
int
curYear
,
curPeriod
;
if
(
reportCode
.
startsWith
(
"VAT"
))
{
int
[]
yearOffSet
=
{}
;
Integer
yearOffSet
=
0
;
curPeriod
=
FormulaHelper
.
getPeriod
(
period
,
yearOffSet
,
formulaContext
);
curYear
=
FormulaHelper
.
getYear
(
year
,
formulaContext
)
+
yearOffSet
[
0
]
;
curYear
=
FormulaHelper
.
getYear
(
year
,
formulaContext
)
+
yearOffSet
;
}
else
if
(
reportCode
.
startsWith
(
"CIT."
))
{
curYear
=
FormulaHelper
.
getYear
(
year
,
formulaContext
);
curPeriod
=
0
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/XXFP.java
View file @
f69410c1
...
...
@@ -49,9 +49,9 @@ public class XXFP extends FunctionBase implements FreeRefFunction {
logger
.
debug
(
formulaExpression
);
Integer
curYear
=
formulaContext
.
getYear
();
int
[]
yearOffset
=
{}
;
Integer
yearOffset
=
0
;
period
=
getPeriod
(
period
,
yearOffset
);
curYear
=
curYear
+
yearOffset
[
0
]
;
curYear
=
curYear
+
yearOffset
;
BigDecimal
taxRateVal
=
new
BigDecimal
(
"-1"
);
if
(!
taxRate
.
endsWith
(
"%"
))
{
...
...
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