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
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
178 additions
and
71 deletions
+178
-71
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
+10
-3
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+49
-45
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;
...
@@ -5,6 +5,7 @@ import org.springframework.context.ApplicationContext;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
pwc.taxtech.atms.dao.FormulaAdminMapper
;
import
pwc.taxtech.atms.dao.FormulaAdminMapper
;
import
pwc.taxtech.atms.dao.OrganizationMapper
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dao.ProjectServiceTypeMapper
;
import
pwc.taxtech.atms.dao.ProjectServiceTypeMapper
;
import
pwc.taxtech.atms.dao.dao.ProjectDao
;
import
pwc.taxtech.atms.dao.dao.ProjectDao
;
...
@@ -44,6 +45,7 @@ public class SpringContextUtil implements ApplicationContextAware {
...
@@ -44,6 +45,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public
static
AssetsListMapper
assetsListMapper
;
public
static
AssetsListMapper
assetsListMapper
;
public
static
ProjectMapper
projectMapper
;
public
static
ProjectMapper
projectMapper
;
public
static
CellDataSourceMapper
cellDataSourceMapper
;
public
static
CellDataSourceMapper
cellDataSourceMapper
;
public
static
OrganizationMapper
organizationMapper
;
/**
/**
* 获取bean
* 获取bean
...
@@ -84,5 +86,6 @@ public class SpringContextUtil implements ApplicationContextAware {
...
@@ -84,5 +86,6 @@ public class SpringContextUtil implements ApplicationContextAware {
assetsListMapper
=
webApplicationContext
.
getBean
(
AssetsListMapper
.
class
);
assetsListMapper
=
webApplicationContext
.
getBean
(
AssetsListMapper
.
class
);
projectMapper
=
webApplicationContext
.
getBean
(
ProjectMapper
.
class
);
projectMapper
=
webApplicationContext
.
getBean
(
ProjectMapper
.
class
);
cellDataSourceMapper
=
webApplicationContext
.
getBean
(
CellDataSourceMapper
.
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
;
package
pwc
.
taxtech
.
atms
.
constant
;
import
java.io.File
;
import
java.io.File
;
import
java.util.Locale
;
import
java.util.UUID
;
import
java.util.UUID
;
public
final
class
Constant
{
public
final
class
Constant
{
...
@@ -42,6 +43,7 @@ public final class Constant {
...
@@ -42,6 +43,7 @@ public final class Constant {
public
static
final
String
IMAGE_FORMART_
=
"png"
;
public
static
final
String
IMAGE_FORMART_
=
"png"
;
public
static
final
String
EMPTY
=
""
;
public
static
final
String
EMPTY
=
""
;
public
static
final
String
DateTimeFormate
=
"{0}年{1}月"
;
public
static
class
DataSourceName
{
public
static
class
DataSourceName
{
public
static
final
String
KeyValueDataSource
=
"KeyValueDataSource"
;
public
static
final
String
KeyValueDataSource
=
"KeyValueDataSource"
;
...
@@ -69,4 +71,10 @@ public final class Constant {
...
@@ -69,4 +71,10 @@ public final class Constant {
public
static
String
ScanPass
=
"扫描认证"
;
public
static
String
ScanPass
=
"扫描认证"
;
public
static
String
NotPass
=
"未认证"
;
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 {
...
@@ -26,7 +26,10 @@ public class ReportController {
@RequestMapping
(
value
=
"updateConfig/{projectId}/{ifDeleteManualDataSource}/{period}"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@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
)
{
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
)
@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 {
...
@@ -113,5 +113,5 @@ public interface InputVATInvoiceMapper extends MyVatMapper {
List
<
InputVATInvoice
>
getInputVATInvoiceCountByConditionWithPaging
(
@Param
(
"paras"
)
InputInvoicePreviewQueryParam
param
,
@Param
(
"limitFrom"
)
int
limitFrom
);
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 {
...
@@ -183,5 +183,5 @@ public interface OutputVATInvoiceMapper extends MyVatMapper {
" "
)
" "
)
List
<
OutputVATInvoiceInfoDto
>
queryOutputDetailWithItem
(
Integer
period
);
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
...
@@ -86,6 +86,9 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
formulaContext
.
setReportTemplateGroupID
(
templateGroupID
);
formulaContext
.
setReportTemplateGroupID
(
templateGroupID
);
formulaContext
.
setProjectID
(
project
.
getID
());
formulaContext
.
setProjectID
(
project
.
getID
());
formulaContext
.
setYear
(
project
.
getYear
());
formulaContext
.
setYear
(
project
.
getYear
());
formulaContext
.
setIsYear
(
period
==
0
);
formulaContext
.
setIfRound
(
true
);
formulaContext
.
setOrganizationID
(
project
.
getOrganizationID
());
formulaContext
.
setOrganizationID
(
project
.
getOrganizationID
());
formulaContext
.
setIfRound
(
true
);
formulaContext
.
setIfRound
(
true
);
...
@@ -135,9 +138,13 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
...
@@ -135,9 +138,13 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
//todo:后面单独处理kv的公式
//todo:后面单独处理kv的公式
if
(
StringUtils
.
isNotBlank
(
v
.
getFormula
())
&&
!
v
.
getFormula
().
contains
(
"@"
))
{
if
(
StringUtils
.
isNotBlank
(
v
.
getFormula
())
&&
!
v
.
getFormula
().
contains
(
"@"
))
{
cell
.
setCellFormula
(
v
.
getFormula
());
cell
.
setCellFormula
(
v
.
getFormula
());
logger
.
debug
(
"formula:"
+
v
.
getFormula
());
//kv 公式处理
//kv 公式处理
}
else
if
(
v
.
getFormula
().
startsWith
(
"@"
))
{
}
else
if
(
v
.
getFormula
().
startsWith
(
"@"
))
{
if
(
StringUtils
.
isNotBlank
(
v
.
getKeyValueParsedFormula
()))
{
cell
.
setCellFormula
(
v
.
getKeyValueParsedFormula
());
cell
.
setCellFormula
(
v
.
getKeyValueParsedFormula
());
logger
.
debug
(
"formula:"
+
v
.
getKeyValueParsedFormula
());
}
}
}
});
});
}
}
...
@@ -343,7 +350,6 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
...
@@ -343,7 +350,6 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
}
}
}
}
}
}
}
else
{
}
else
{
return
"GenerateReport failed"
;
return
"GenerateReport failed"
;
}
}
...
@@ -416,9 +422,10 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
...
@@ -416,9 +422,10 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
* @param workbook 工作簿
* @param workbook 工作簿
*/
*/
private
void
addFunctionsToWorkbook
(
Workbook
workbook
,
FormulaContext
formulaContext
)
{
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
),
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
udfs
=
new
DefaultUDFFinder
(
functionNames
,
functionImpls
);
UDFFinder
udfToolpack
=
new
AggregatingUDFFinder
(
udfs
);
UDFFinder
udfToolpack
=
new
AggregatingUDFFinder
(
udfs
);
workbook
.
addToolPack
(
udfToolpack
);
workbook
.
addToolPack
(
udfToolpack
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
f69410c1
...
@@ -2,6 +2,7 @@ package pwc.taxtech.atms.vat.service.impl;
...
@@ -2,6 +2,7 @@ package pwc.taxtech.atms.vat.service.impl;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.common.datasource.ShardingContextHolder
;
import
pwc.taxtech.atms.common.datasource.ShardingContextHolder
;
import
pwc.taxtech.atms.constant.enums.*
;
import
pwc.taxtech.atms.constant.enums.*
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
...
@@ -131,22 +132,23 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
...
@@ -131,22 +132,23 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
List
<
PeriodTemplate
>
periodTemplateList
=
new
ArrayList
<>();
List
<
PeriodTemplate
>
periodTemplateList
=
new
ArrayList
<>();
for
(
Template
template
:
templates
)
{
for
(
Template
template
:
templates
)
{
PeriodTemplate
periodTemplate
=
new
PeriodTemplate
();
PeriodTemplate
periodTemplate
=
new
PeriodTemplate
();
CommonUtils
.
copyProperties
(
template
,
periodTemplate
);
periodTemplate
.
setId
(
distributedIDService
.
nextId
());
periodTemplate
.
setId
(
distributedIDService
.
nextId
());
periodTemplate
.
setPeriod
(
period
);
periodTemplate
.
setPeriod
(
period
);
periodTemplate
.
setName
(
template
.
getName
());
//
periodTemplate.setName(template.getName());
periodTemplate
.
setCode
(
template
.
getCode
());
//
periodTemplate.setCode(template.getCode());
periodTemplate
.
setPath
(
template
.
getPath
());
//
periodTemplate.setPath(template.getPath());
periodTemplate
.
setReportType
(
template
.
getReportType
());
//
periodTemplate.setReportType(template.getReportType());
periodTemplate
.
setTemplateGroupId
(
template
.
getTemplateGroupId
());
//
periodTemplate.setTemplateGroupId(template.getTemplateGroupId());
periodTemplate
.
setOrderIndex
(
template
.
getOrderIndex
());
//
periodTemplate.setOrderIndex(template.getOrderIndex());
periodTemplate
.
setCreateTime
(
template
.
getCreateTime
());
//
periodTemplate.setCreateTime(template.getCreateTime());
periodTemplate
.
setUpdateTime
(
template
.
getUpdateTime
());
//
periodTemplate.setUpdateTime(template.getUpdateTime());
periodTemplate
.
setIsSystemType
(
template
.
getIsSystemType
());
//
periodTemplate.setIsSystemType(template.getIsSystemType());
periodTemplate
.
setIsActiveAssociation
(
template
.
getIsActiveAssociation
());
//
periodTemplate.setIsActiveAssociation(template.getIsActiveAssociation());
periodTemplate
.
setParentId
(
template
.
getParentId
());
//
periodTemplate.setParentId(template.getParentId());
periodTemplate
.
setTemplateId
(
template
.
getId
());
periodTemplate
.
setTemplateId
(
template
.
getId
());
periodTemplate
.
setCreateBy
(
template
.
getCreateBy
());
//
periodTemplate.setCreateBy(template.getCreateBy());
periodTemplate
.
setUpdateBy
(
template
.
getUpdateBy
());
//
periodTemplate.setUpdateBy(template.getUpdateBy());
periodTemplateList
.
add
(
periodTemplate
);
periodTemplateList
.
add
(
periodTemplate
);
}
}
...
@@ -157,22 +159,23 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
...
@@ -157,22 +159,23 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
List
<
PeriodCellTemplate
>
periodCellTemplateList
=
new
ArrayList
<>();
List
<
PeriodCellTemplate
>
periodCellTemplateList
=
new
ArrayList
<>();
for
(
CellTemplate
cellTemplate
:
cellTemplateList
)
{
for
(
CellTemplate
cellTemplate
:
cellTemplateList
)
{
PeriodCellTemplate
periodCellTemplate
=
new
PeriodCellTemplate
();
PeriodCellTemplate
periodCellTemplate
=
new
PeriodCellTemplate
();
CommonUtils
.
copyProperties
(
cellTemplate
,
periodCellTemplate
);
periodCellTemplate
.
setId
(
distributedIDService
.
nextId
());
periodCellTemplate
.
setId
(
distributedIDService
.
nextId
());
periodCellTemplate
.
setPeriod
(
period
);
periodCellTemplate
.
setPeriod
(
period
);
periodCellTemplate
.
setReportTemplateId
(
cellTemplate
.
getReportTemplateId
());
//
periodCellTemplate.setReportTemplateId(cellTemplate.getReportTemplateId());
periodCellTemplate
.
setRowIndex
(
cellTemplate
.
getRowIndex
());
//
periodCellTemplate.setRowIndex(cellTemplate.getRowIndex());
periodCellTemplate
.
setRowName
(
cellTemplate
.
getRowName
());
//
periodCellTemplate.setRowName(cellTemplate.getRowName());
periodCellTemplate
.
setColumnIndex
(
cellTemplate
.
getColumnIndex
());
//
periodCellTemplate.setColumnIndex(cellTemplate.getColumnIndex());
periodCellTemplate
.
setColumnName
(
cellTemplate
.
getColumnName
());
//
periodCellTemplate.setColumnName(cellTemplate.getColumnName());
periodCellTemplate
.
setComment
(
cellTemplate
.
getComment
());
//
periodCellTemplate.setComment(cellTemplate.getComment());
periodCellTemplate
.
setCreateTime
(
cellTemplate
.
getCreateTime
());
//
periodCellTemplate.setCreateTime(cellTemplate.getCreateTime());
periodCellTemplate
.
setUpdateTime
(
cellTemplate
.
getUpdateTime
());
//
periodCellTemplate.setUpdateTime(cellTemplate.getUpdateTime());
periodCellTemplate
.
setCellTemplateId
(
cellTemplate
.
getId
());
periodCellTemplate
.
setCellTemplateId
(
cellTemplate
.
getId
());
periodCellTemplate
.
setDataType
(
cellTemplate
.
getDataType
());
//
periodCellTemplate.setDataType(cellTemplate.getDataType());
periodCellTemplate
.
setIsReadOnly
(
cellTemplate
.
getIsReadOnly
());
//
periodCellTemplate.setIsReadOnly(cellTemplate.getIsReadOnly());
periodCellTemplate
.
setCopyFromId
(
cellTemplate
.
getCopyFromId
());
//
periodCellTemplate.setCopyFromId(cellTemplate.getCopyFromId());
periodCellTemplate
.
setCreateBy
(
cellTemplate
.
getCreateBy
());
//
periodCellTemplate.setCreateBy(cellTemplate.getCreateBy());
periodCellTemplate
.
setUpdateBy
(
cellTemplate
.
getUpdateBy
());
//
periodCellTemplate.setUpdateBy(cellTemplate.getUpdateBy());
periodCellTemplateList
.
add
(
periodCellTemplate
);
periodCellTemplateList
.
add
(
periodCellTemplate
);
}
}
...
@@ -183,29 +186,30 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
...
@@ -183,29 +186,30 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
List
<
PeriodCellTemplateConfig
>
periodCellTemplateConfigList
=
new
ArrayList
<>();
List
<
PeriodCellTemplateConfig
>
periodCellTemplateConfigList
=
new
ArrayList
<>();
for
(
CellTemplateConfig
cellTemplateConfig
:
cellTemplateConfigList
)
{
for
(
CellTemplateConfig
cellTemplateConfig
:
cellTemplateConfigList
)
{
PeriodCellTemplateConfig
periodCellTemplateConfig
=
new
PeriodCellTemplateConfig
();
PeriodCellTemplateConfig
periodCellTemplateConfig
=
new
PeriodCellTemplateConfig
();
CommonUtils
.
copyProperties
(
cellTemplateConfig
,
periodCellTemplateConfig
);
periodCellTemplateConfig
.
setId
(
distributedIDService
.
nextId
());
periodCellTemplateConfig
.
setId
(
distributedIDService
.
nextId
());
periodCellTemplateConfig
.
setPeriod
(
period
);
periodCellTemplateConfig
.
setPeriod
(
period
);
periodCellTemplateConfig
.
setCellTemplateId
(
cellTemplateConfig
.
getCellTemplateId
());
//
periodCellTemplateConfig.setCellTemplateId(cellTemplateConfig.getCellTemplateId());
periodCellTemplateConfig
.
setReportTemplateId
(
cellTemplateConfig
.
getReportTemplateId
());
//
periodCellTemplateConfig.setReportTemplateId(cellTemplateConfig.getReportTemplateId());
periodCellTemplateConfig
.
setDataSourceType
(
cellTemplateConfig
.
getDataSourceType
());
//
periodCellTemplateConfig.setDataSourceType(cellTemplateConfig.getDataSourceType());
periodCellTemplateConfig
.
setFormula
(
cellTemplateConfig
.
getFormula
());
//
periodCellTemplateConfig.setFormula(cellTemplateConfig.getFormula());
periodCellTemplateConfig
.
setParsedFormula
(
StringUtils
.
EMPTY
);
periodCellTemplateConfig
.
setParsedFormula
(
StringUtils
.
EMPTY
);
periodCellTemplateConfig
.
setFormulaDescription
(
cellTemplateConfig
.
getFormulaDescription
());
//
periodCellTemplateConfig.setFormulaDescription(cellTemplateConfig.getFormulaDescription());
periodCellTemplateConfig
.
setAccountCodes
(
cellTemplateConfig
.
getAccountCodes
());
//
periodCellTemplateConfig.setAccountCodes(cellTemplateConfig.getAccountCodes());
periodCellTemplateConfig
.
setInvoiceType
(
cellTemplateConfig
.
getInvoiceType
());
//
periodCellTemplateConfig.setInvoiceType(cellTemplateConfig.getInvoiceType());
periodCellTemplateConfig
.
setTaxRate
(
cellTemplateConfig
.
getTaxRate
());
//
periodCellTemplateConfig.setTaxRate(cellTemplateConfig.getTaxRate());
periodCellTemplateConfig
.
setInvoiceAmountType
(
cellTemplateConfig
.
getInvoiceAmountType
());
//
periodCellTemplateConfig.setInvoiceAmountType(cellTemplateConfig.getInvoiceAmountType());
periodCellTemplateConfig
.
setModelIds
(
cellTemplateConfig
.
getModelIds
());
//
periodCellTemplateConfig.setModelIds(cellTemplateConfig.getModelIds());
periodCellTemplateConfig
.
setCreateBy
(
cellTemplateConfig
.
getCreateBy
());
//
periodCellTemplateConfig.setCreateBy(cellTemplateConfig.getCreateBy());
periodCellTemplateConfig
.
setCreateTime
(
cellTemplateConfig
.
getCreateTime
());
//
periodCellTemplateConfig.setCreateTime(cellTemplateConfig.getCreateTime());
periodCellTemplateConfig
.
setUpdateBy
(
cellTemplateConfig
.
getUpdateBy
());
//
periodCellTemplateConfig.setUpdateBy(cellTemplateConfig.getUpdateBy());
periodCellTemplateConfig
.
setUpdateTime
(
cellTemplateConfig
.
getUpdateTime
());
//
periodCellTemplateConfig.setUpdateTime(cellTemplateConfig.getUpdateTime());
periodCellTemplateConfig
.
setInvoiceCategory
(
cellTemplateConfig
.
getInvoiceCategory
());
//
periodCellTemplateConfig.setInvoiceCategory(cellTemplateConfig.getInvoiceCategory());
periodCellTemplateConfig
.
setFormulaDataSource
(
cellTemplateConfig
.
getFormulaDataSource
());
//
periodCellTemplateConfig.setFormulaDataSource(cellTemplateConfig.getFormulaDataSource());
periodCellTemplateConfig
.
setValidation
(
cellTemplateConfig
.
getValidation
());
//
periodCellTemplateConfig.setValidation(cellTemplateConfig.getValidation());
periodCellTemplateConfig
.
setParsedValidation
(
StringUtils
.
EMPTY
);
periodCellTemplateConfig
.
setParsedValidation
(
StringUtils
.
EMPTY
);
periodCellTemplateConfig
.
setValidationDescription
(
cellTemplateConfig
.
getValidationDescription
());
//
periodCellTemplateConfig.setValidationDescription(cellTemplateConfig.getValidationDescription());
periodCellTemplateConfig
.
setVoucherKeyword
(
cellTemplateConfig
.
getVoucherKeyword
());
//
periodCellTemplateConfig.setVoucherKeyword(cellTemplateConfig.getVoucherKeyword());
periodCellTemplateConfig
.
setCellTemplateConfigId
(
cellTemplateConfig
.
getId
());
periodCellTemplateConfig
.
setCellTemplateConfigId
(
cellTemplateConfig
.
getId
());
if
(
cellTemplateConfig
.
getFormula
().
startsWith
(
"@"
))
{
if
(
cellTemplateConfig
.
getFormula
().
startsWith
(
"@"
))
{
//todo: get the keyvalue from table add to keyvalue parsed formula
//todo: get the keyvalue from table add to keyvalue parsed formula
...
...
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 {
...
@@ -61,9 +61,9 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
year
=
formulaContext
.
getYear
();
year
=
formulaContext
.
getYear
();
}
}
int
[]
yearOffset
=
{}
;
Integer
yearOffset
=
0
;
period
=
FormulaHelper
.
getPeriod
(
period
,
yearOffset
,
formulaContext
);
period
=
FormulaHelper
.
getPeriod
(
period
,
yearOffset
,
formulaContext
);
year
=
year
+
yearOffset
[
0
]
;
year
=
year
+
yearOffset
;
if
(
accountType
==
0
)
{
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 {
...
@@ -53,14 +53,14 @@ public class FormulaHelper {
return
columnStr
;
return
columnStr
;
}
}
public
static
int
getPeriod
(
int
parameterPeriod
,
int
[]
yearOffset
,
FormulaContext
formulaFunctionContext
)
{
public
static
int
getPeriod
(
int
parameterPeriod
,
Integer
yearOffset
,
FormulaContext
formulaFunctionContext
)
{
yearOffset
[
0
]
=
0
;
yearOffset
=
0
;
if
(
parameterPeriod
==
-
99
)
{
if
(
parameterPeriod
==
-
99
)
{
return
parameterPeriod
;
return
parameterPeriod
;
}
else
if
(
parameterPeriod
<=
-
1
)
{
}
else
if
(
parameterPeriod
<=
-
1
)
{
int
period
=
parameterPeriod
+
formulaFunctionContext
.
getPeriod
();
int
period
=
parameterPeriod
+
formulaFunctionContext
.
getPeriod
();
while
(
period
<=
0
)
{
while
(
period
<=
0
)
{
yearOffset
[
0
]
--;
yearOffset
--;
period
+=
12
;
period
+=
12
;
//throw new NotImplementedException();
//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 {
...
@@ -71,17 +71,15 @@ public class FunctionBase {
}
}
}
}
public
int
getPeriod
(
int
parameterPeriod
,
int
[]
yearOffset
)
{
public
int
getPeriod
(
int
parameterPeriod
,
Integer
yearOffset
)
{
if
(
yearOffset
.
length
==
0
)
{
yearOffset
=
new
int
[
10
];
yearOffset
=
0
;
}
yearOffset
[
0
]
=
0
;
if
(
parameterPeriod
==
-
99
)
{
if
(
parameterPeriod
==
-
99
)
{
return
parameterPeriod
;
return
parameterPeriod
;
}
else
if
(
parameterPeriod
<=
-
1
)
{
}
else
if
(
parameterPeriod
<=
-
1
)
{
int
period
=
parameterPeriod
+
formulaContext
.
getPeriod
();
int
period
=
parameterPeriod
+
formulaContext
.
getPeriod
();
while
(
period
<=
0
)
{
while
(
period
<=
0
)
{
yearOffset
[
0
]
--;
yearOffset
--;
period
+=
12
;
period
+=
12
;
}
}
return
period
;
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 {
...
@@ -54,15 +54,15 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
+
authenticationType
+
","
+
resultType
+
","
+
period
+
")"
;
+
authenticationType
+
","
+
resultType
+
","
+
period
+
")"
;
logger
.
debug
(
formulaExpression
);
logger
.
debug
(
formulaExpression
);
int
[]
yearOffset
=
{}
;
Integer
yearOffset
=
0
;
certificationPeriod
=
getPeriod
(
certificationPeriod
,
yearOffset
);
certificationPeriod
=
getPeriod
(
certificationPeriod
,
yearOffset
);
if
(
yearOffset
[
0
]
<
0
)
{
if
(
yearOffset
<
0
)
{
return
NumberEval
.
ZERO
;
return
NumberEval
.
ZERO
;
}
}
period
=
getPeriod
(
period
,
yearOffset
);
period
=
getPeriod
(
period
,
yearOffset
);
if
(
yearOffset
[
0
]
<
0
)
{
if
(
yearOffset
<
0
)
{
return
NumberEval
.
ZERO
;
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 {
...
@@ -48,9 +48,9 @@ public class JXFPMX extends FunctionBase implements FreeRefFunction {
logger
.
debug
(
formulaExpression
);
logger
.
debug
(
formulaExpression
);
int
curYear
=
formulaContext
.
getYear
();
int
curYear
=
formulaContext
.
getYear
();
int
[]
yearOffSet
=
{}
;
Integer
yearOffSet
=
0
;
period
=
getPeriod
(
period
,
yearOffSet
);
period
=
getPeriod
(
period
,
yearOffSet
);
curYear
=
curYear
+
yearOffSet
[
0
]
;
curYear
=
curYear
+
yearOffSet
;
BigDecimal
taxRateVal
;
BigDecimal
taxRateVal
;
if
(
taxRate
.
equals
(
Constant
.
Other
))
{
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 {
...
@@ -62,9 +62,9 @@ public class SGSR implements FreeRefFunction {
int
curYear
,
curPeriod
;
int
curYear
,
curPeriod
;
if
(
reportCode
.
startsWith
(
"VAT"
))
{
if
(
reportCode
.
startsWith
(
"VAT"
))
{
int
[]
yearOffSet
=
{}
;
Integer
yearOffSet
=
0
;
curPeriod
=
FormulaHelper
.
getPeriod
(
period
,
yearOffSet
,
formulaContext
);
curPeriod
=
FormulaHelper
.
getPeriod
(
period
,
yearOffSet
,
formulaContext
);
curYear
=
FormulaHelper
.
getYear
(
year
,
formulaContext
)
+
yearOffSet
[
0
]
;
curYear
=
FormulaHelper
.
getYear
(
year
,
formulaContext
)
+
yearOffSet
;
}
else
if
(
reportCode
.
startsWith
(
"CIT."
))
{
}
else
if
(
reportCode
.
startsWith
(
"CIT."
))
{
curYear
=
FormulaHelper
.
getYear
(
year
,
formulaContext
);
curYear
=
FormulaHelper
.
getYear
(
year
,
formulaContext
);
curPeriod
=
0
;
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 {
...
@@ -49,9 +49,9 @@ public class XXFP extends FunctionBase implements FreeRefFunction {
logger
.
debug
(
formulaExpression
);
logger
.
debug
(
formulaExpression
);
Integer
curYear
=
formulaContext
.
getYear
();
Integer
curYear
=
formulaContext
.
getYear
();
int
[]
yearOffset
=
{}
;
Integer
yearOffset
=
0
;
period
=
getPeriod
(
period
,
yearOffset
);
period
=
getPeriod
(
period
,
yearOffset
);
curYear
=
curYear
+
yearOffset
[
0
]
;
curYear
=
curYear
+
yearOffset
;
BigDecimal
taxRateVal
=
new
BigDecimal
(
"-1"
);
BigDecimal
taxRateVal
=
new
BigDecimal
(
"-1"
);
if
(!
taxRate
.
endsWith
(
"%"
))
{
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