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
9c4fd097
Commit
9c4fd097
authored
Jul 19, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed formula datasource issue, it will go to display the datasource in the report preview
parent
9b65181c
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
355 additions
and
35 deletions
+355
-35
vat_run.bat
atms-api/etc/generator/vat_run.bat
+1
-1
SpringContextUtil.java
.../java/pwc/taxtech/atms/common/util/SpringContextUtil.java
+2
-0
DataSource.java
...src/main/java/pwc/taxtech/atms/vat/entity/DataSource.java
+68
-0
DataSourceExample.java
...n/java/pwc/taxtech/atms/vat/entity/DataSourceExample.java
+120
-0
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+66
-8
CellConfigTranslater.java
...t/service/impl/report/functions/CellConfigTranslater.java
+1
-1
FSJZ.java
.../taxtech/atms/vat/service/impl/report/functions/FSJZ.java
+3
-2
FunctionBase.java
.../atms/vat/service/impl/report/functions/FunctionBase.java
+19
-2
GZSD.java
.../taxtech/atms/vat/service/impl/report/functions/GZSD.java
+3
-1
JXFP.java
.../taxtech/atms/vat/service/impl/report/functions/JXFP.java
+9
-3
JXFPMX.java
...axtech/atms/vat/service/impl/report/functions/JXFPMX.java
+6
-2
XXFP.java
.../taxtech/atms/vat/service/impl/report/functions/XXFP.java
+4
-2
ZC.java
...wc/taxtech/atms/vat/service/impl/report/functions/ZC.java
+3
-1
CreateProjectDB.sql
...main/resources/RuntimeDbScripts/MYSQL/CreateProjectDB.sql
+3
-1
DataSourceMapper.xml
...n/resources/pwc/taxtech/atms/vat/dao/DataSourceMapper.xml
+42
-10
RegexTest.java
atms-api/src/test/java/pwc/taxtech/atms/RegexTest.java
+5
-1
No files found.
atms-api/etc/generator/vat_run.bat
View file @
9c4fd097
rem see http://www.mybatis.org/generator/running/runningFromCmdLine.html
rem see http://www.mybatis.org/generator/running/runningFromCmdLine.html
cd /d %~dp0
cd /d %~dp0
call java -classpath .;./* org.mybatis.generator.api.ShellRunner -configfile vatGeneratorConfig.xml -overwrite -verbose -tables
period_cell_template_config
call java -classpath .;./* org.mybatis.generator.api.ShellRunner -configfile vatGeneratorConfig.xml -overwrite -verbose -tables
data_source
echo @@@@@@@@@@@ DONE @@@@@@@@@@@
echo @@@@@@@@@@@ DONE @@@@@@@@@@@
pause
pause
atms-api/src/main/java/pwc/taxtech/atms/common/util/SpringContextUtil.java
View file @
9c4fd097
...
@@ -43,6 +43,7 @@ public class SpringContextUtil implements ApplicationContextAware {
...
@@ -43,6 +43,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public
static
InputVATInvoiceMapper
inputVATInvoiceMapper
;
public
static
InputVATInvoiceMapper
inputVATInvoiceMapper
;
public
static
AssetsListMapper
assetsListMapper
;
public
static
AssetsListMapper
assetsListMapper
;
public
static
ProjectMapper
projectMapper
;
public
static
ProjectMapper
projectMapper
;
public
static
CellDataSourceMapper
cellDataSourceMapper
;
/**
/**
* 获取bean
* 获取bean
...
@@ -82,5 +83,6 @@ public class SpringContextUtil implements ApplicationContextAware {
...
@@ -82,5 +83,6 @@ public class SpringContextUtil implements ApplicationContextAware {
inputVATInvoiceMapper
=
webApplicationContext
.
getBean
(
InputVATInvoiceMapper
.
class
);
inputVATInvoiceMapper
=
webApplicationContext
.
getBean
(
InputVATInvoiceMapper
.
class
);
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
);
}
}
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/entity/DataSource.java
View file @
9c4fd097
...
@@ -147,6 +147,24 @@ public class DataSource implements Serializable {
...
@@ -147,6 +147,24 @@ public class DataSource implements Serializable {
*/
*/
private
Integer
columnIndex
;
private
Integer
columnIndex
;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column data_source.cell_template_id
*
* @mbg.generated
*/
private
Long
cellTemplateId
;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column data_source.period
*
* @mbg.generated
*/
private
Integer
period
;
/**
/**
* This field was generated by MyBatis Generator.
* This field was generated by MyBatis Generator.
* This field corresponds to the database table data_source
* This field corresponds to the database table data_source
...
@@ -515,6 +533,54 @@ public class DataSource implements Serializable {
...
@@ -515,6 +533,54 @@ public class DataSource implements Serializable {
this
.
columnIndex
=
columnIndex
;
this
.
columnIndex
=
columnIndex
;
}
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column data_source.cell_template_id
*
* @return the value of data_source.cell_template_id
*
* @mbg.generated
*/
public
Long
getCellTemplateId
()
{
return
cellTemplateId
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column data_source.cell_template_id
*
* @param cellTemplateId the value for data_source.cell_template_id
*
* @mbg.generated
*/
public
void
setCellTemplateId
(
Long
cellTemplateId
)
{
this
.
cellTemplateId
=
cellTemplateId
;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column data_source.period
*
* @return the value of data_source.period
*
* @mbg.generated
*/
public
Integer
getPeriod
()
{
return
period
;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column data_source.period
*
* @param period the value for data_source.period
*
* @mbg.generated
*/
public
void
setPeriod
(
Integer
period
)
{
this
.
period
=
period
;
}
/**
/**
* This method was generated by MyBatis Generator.
* This method was generated by MyBatis Generator.
* This method corresponds to the database table data_source
* This method corresponds to the database table data_source
...
@@ -542,6 +608,8 @@ public class DataSource implements Serializable {
...
@@ -542,6 +608,8 @@ public class DataSource implements Serializable {
sb
.
append
(
", rowIndex="
).
append
(
rowIndex
);
sb
.
append
(
", rowIndex="
).
append
(
rowIndex
);
sb
.
append
(
", remapBatchId="
).
append
(
remapBatchId
);
sb
.
append
(
", remapBatchId="
).
append
(
remapBatchId
);
sb
.
append
(
", columnIndex="
).
append
(
columnIndex
);
sb
.
append
(
", columnIndex="
).
append
(
columnIndex
);
sb
.
append
(
", cellTemplateId="
).
append
(
cellTemplateId
);
sb
.
append
(
", period="
).
append
(
period
);
sb
.
append
(
"]"
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
return
sb
.
toString
();
}
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/entity/DataSourceExample.java
View file @
9c4fd097
...
@@ -1175,6 +1175,126 @@ public class DataSourceExample {
...
@@ -1175,6 +1175,126 @@ public class DataSourceExample {
addCriterion
(
"column_index not between"
,
value1
,
value2
,
"columnIndex"
);
addCriterion
(
"column_index not between"
,
value1
,
value2
,
"columnIndex"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
andCellTemplateIdIsNull
()
{
addCriterion
(
"cell_template_id is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCellTemplateIdIsNotNull
()
{
addCriterion
(
"cell_template_id is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCellTemplateIdEqualTo
(
Long
value
)
{
addCriterion
(
"cell_template_id ="
,
value
,
"cellTemplateId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCellTemplateIdNotEqualTo
(
Long
value
)
{
addCriterion
(
"cell_template_id <>"
,
value
,
"cellTemplateId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCellTemplateIdGreaterThan
(
Long
value
)
{
addCriterion
(
"cell_template_id >"
,
value
,
"cellTemplateId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCellTemplateIdGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"cell_template_id >="
,
value
,
"cellTemplateId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCellTemplateIdLessThan
(
Long
value
)
{
addCriterion
(
"cell_template_id <"
,
value
,
"cellTemplateId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCellTemplateIdLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"cell_template_id <="
,
value
,
"cellTemplateId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCellTemplateIdIn
(
List
<
Long
>
values
)
{
addCriterion
(
"cell_template_id in"
,
values
,
"cellTemplateId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCellTemplateIdNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"cell_template_id not in"
,
values
,
"cellTemplateId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCellTemplateIdBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"cell_template_id between"
,
value1
,
value2
,
"cellTemplateId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andCellTemplateIdNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"cell_template_id not between"
,
value1
,
value2
,
"cellTemplateId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPeriodIsNull
()
{
addCriterion
(
"period is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPeriodIsNotNull
()
{
addCriterion
(
"period is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPeriodEqualTo
(
Integer
value
)
{
addCriterion
(
"period ="
,
value
,
"period"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPeriodNotEqualTo
(
Integer
value
)
{
addCriterion
(
"period <>"
,
value
,
"period"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPeriodGreaterThan
(
Integer
value
)
{
addCriterion
(
"period >"
,
value
,
"period"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPeriodGreaterThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"period >="
,
value
,
"period"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPeriodLessThan
(
Integer
value
)
{
addCriterion
(
"period <"
,
value
,
"period"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPeriodLessThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"period <="
,
value
,
"period"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPeriodIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"period in"
,
values
,
"period"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPeriodNotIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"period not in"
,
values
,
"period"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPeriodBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"period between"
,
value1
,
value2
,
"period"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPeriodNotBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"period not between"
,
value1
,
value2
,
"period"
);
return
(
Criteria
)
this
;
}
}
}
/**
/**
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
9c4fd097
...
@@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory;
...
@@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.common.POIUtil
;
import
pwc.taxtech.atms.common.POIUtil
;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.constant.enums.CellDataSourceType
;
import
pwc.taxtech.atms.constant.enums.CellDataSourceType
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dto.vatdto.CellCalcInfoDto
;
import
pwc.taxtech.atms.dto.vatdto.CellCalcInfoDto
;
...
@@ -26,6 +27,7 @@ import pwc.taxtech.atms.vat.service.impl.report.functions.*;
...
@@ -26,6 +27,7 @@ import pwc.taxtech.atms.vat.service.impl.report.functions.*;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -200,7 +202,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
...
@@ -200,7 +202,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
.
filter
(
a
->
a
.
getFormulaExpression
().
equals
(
findStr
))
.
filter
(
a
->
a
.
getFormulaExpression
().
equals
(
findStr
))
.
findFirst
();
.
findFirst
();
if
(
formulaBlock
.
isPresent
())
{
if
(
formulaBlock
.
isPresent
())
{
resultFormula
.
replace
(
findStr
,
formulaBlock
.
get
().
getData
());
resultFormula
=
resultFormula
.
replace
(
findStr
,
formulaBlock
.
get
().
getData
());
}
}
}
}
...
@@ -210,12 +212,55 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
...
@@ -210,12 +212,55 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
periodCellTemplateConfigMapper
.
updateByPrimaryKey
(
periodCellTemplateConfig
);
periodCellTemplateConfigMapper
.
updateByPrimaryKey
(
periodCellTemplateConfig
);
}
}
String
regexNormalCell
=
"[A-Z]{1,2}((?!0)[0-9]{1,3})"
;
p
=
Pattern
.
compile
(
regexNormalCell
);
m
=
p
.
matcher
(
sourceFormula
);
while
(
m
.
find
())
{
//如果找到普通单元格的公式,就去workbook里查找对应的格子取数据,然后放到DataSource,作为普通单元格数据源的数据
//找到一个格子就加一条数据
String
findStr
=
m
.
group
();
//A12,A13,A15,how to get A and 12 or A and 13
String
regexColumn
=
"[A-Z]{1,2}"
;
Pattern
pp
=
Pattern
.
compile
(
regexColumn
);
Matcher
mm
=
pp
.
matcher
(
findStr
);
while
(
mm
.
find
())
{
String
colStr
=
mm
.
group
();
int
colNum
=
FormulaHelper
.
excelColStrToNum
(
colStr
,
colStr
.
length
());
int
rowNum
=
Integer
.
parseInt
(
StringUtils
.
removeStart
(
findStr
,
colStr
));
Row
row
=
sheet
.
getRow
(
rowNum
);
if
(
row
!=
null
)
{
Cell
cell
=
row
.
getCell
(
colNum
);
if
(
cell
!=
null
)
{
//开始取值然后存放到DataSource
DataSource
dataSource
=
new
DataSource
();
dataSource
.
setId
(
distributedIDService
.
nextId
());
dataSource
.
setColumnIndex
(
colNum
);
dataSource
.
setRowIndex
(
rowNum
);
dataSource
.
setAmount
(
new
BigDecimal
(
cell
.
getNumericCellValue
()));
dataSource
.
setName
(
findStr
);
dataSource
.
setCreateTime
(
createTime
);
dataSource
.
setUpdateTime
(
createTime
);
dataSource
.
setCreateBy
(
"Admin"
);
dataSource
.
setUpdateBy
(
"Admin"
);
dataSource
.
setPeriod
(
period
);
dataSource
.
setCellTemplateId
(
periodCellTemplateConfig
.
getCellTemplateId
());
dataSourceMapper
.
insertSelective
(
dataSource
);
//这里有个问题就是DataSource的数据有了,但是celldatasource的数据没有,后面无法关联celldata和DataSource
//解决办法就是 在存DataSource的时候就先把celldata的数据加好
//然后把celldatasource的数据也加好
//然后在外面去更新celldata和celldatasource的数据
//还有就是把公式里的数据源放到内存,在所有算完之后再统一加数据源
}
}
}
}
Optional
<
PeriodCellTemplate
>
tempPeriodCellTemplate
=
periodCellTemplateList
.
stream
()
Optional
<
PeriodCellTemplate
>
tempPeriodCellTemplate
=
periodCellTemplateList
.
stream
()
.
filter
(
a
->
a
.
getCellTemplateId
().
equals
(
periodCellTemplateConfig
.
getCellTemplateId
()))
.
filter
(
a
->
a
.
getCellTemplateId
().
equals
(
periodCellTemplateConfig
.
getCellTemplateId
()))
.
findFirst
();
.
findFirst
();
if
(
tempPeriodCellTemplate
.
isPresent
())
{
if
(
tempPeriodCellTemplate
.
isPresent
())
{
CellData
cellData
=
new
CellData
();
CellData
cellData
=
new
CellData
();
cellData
.
setId
(
distributedIDService
.
nextId
());
Long
cellDataId
=
distributedIDService
.
nextId
();
cellData
.
setId
(
cellDataId
);
cellData
.
setReportId
(
reportID
);
cellData
.
setReportId
(
reportID
);
cellData
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
cellData
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
String
data
;
String
data
;
...
@@ -232,12 +277,8 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
...
@@ -232,12 +277,8 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
periodFormulaBlockExample
.
createCriteria
().
andPeriodEqualTo
(
period
)
periodFormulaBlockExample
.
createCriteria
().
andPeriodEqualTo
(
period
)
.
andCellTemplateIdEqualTo
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
.
andCellTemplateIdEqualTo
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
//todo: 这里可能一个单元格不止一个公式,需要根据公式的内容来进行替换具体的解析公式
if
(
isFind
)
{
Optional
<
PeriodFormulaBlock
>
periodFormulaBlock
=
cellData
.
setFormulaExp
(
resultFormula
);
periodFormulaBlockMapper
.
selectByExample
(
periodFormulaBlockExample
).
stream
().
findFirst
();
if
(
periodFormulaBlock
.
isPresent
())
{
cellData
.
setFormulaExp
(
periodFormulaBlock
.
get
().
getFormulaExpression
());
}
else
{
}
else
{
cellData
.
setFormulaExp
(
EMPTY
);
cellData
.
setFormulaExp
(
EMPTY
);
}
}
...
@@ -246,6 +287,23 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
...
@@ -246,6 +287,23 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
cellData
.
setUpdateBy
(
"Admin"
);
cellData
.
setUpdateBy
(
"Admin"
);
cellData
.
setUpdateTime
(
createTime
);
cellData
.
setUpdateTime
(
createTime
);
cellDataMapper
.
insertSelective
(
cellData
);
cellDataMapper
.
insertSelective
(
cellData
);
//after insert celldata, insert the celldatasource for link celldata and datasource
DataSourceExample
dataSourceExample
=
new
DataSourceExample
();
dataSourceExample
.
createCriteria
().
andPeriodEqualTo
(
period
);
dataSourceExample
.
createCriteria
().
andCellTemplateIdEqualTo
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
List
<
DataSource
>
dataSourceList
=
SpringContextUtil
.
dataSourceMapper
.
selectByExample
(
dataSourceExample
);
for
(
int
ii
=
0
;
ii
<
dataSourceList
.
size
();
ii
++)
{
DataSource
dataSource
=
dataSourceList
.
get
(
ii
);
CellDataSource
cellDataSource
=
new
CellDataSource
();
cellDataSource
.
setId
(
distributedIDService
.
nextId
());
cellDataSource
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
cellDataSource
.
setCellDataId
(
cellDataId
);
cellDataSource
.
setDataSourceId
(
dataSource
.
getId
());
cellDataSource
.
setCreateTime
(
createTime
);
cellDataSource
.
setUpdateTime
(
createTime
);
SpringContextUtil
.
cellDataSourceMapper
.
insertSelective
(
cellDataSource
);
}
}
}
}
}
}
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/CellConfigTranslater.java
View file @
9c4fd097
...
@@ -6,7 +6,7 @@ import pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfig;
...
@@ -6,7 +6,7 @@ import pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfig;
import
java.util.List
;
import
java.util.List
;
public
final
class
CellConfigTranslater
{
public
final
class
CellConfigTranslater
{
public
static
CellTemplateConfigDto
G
etPeriodConfigDto
(
String
configID
,
String
templateID
,
int
rowIndex
,
String
rowName
,
int
columnIndex
,
String
columnName
,
Integer
dataType
,
Integer
isReadOnly
,
String
description
,
List
<
PeriodCellTemplateConfig
>
configList
)
{
public
static
CellTemplateConfigDto
g
etPeriodConfigDto
(
String
configID
,
String
templateID
,
int
rowIndex
,
String
rowName
,
int
columnIndex
,
String
columnName
,
Integer
dataType
,
Integer
isReadOnly
,
String
description
,
List
<
PeriodCellTemplateConfig
>
configList
)
{
return
null
;
return
null
;
}
}
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FSJZ.java
View file @
9c4fd097
...
@@ -132,7 +132,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
...
@@ -132,7 +132,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
}
}
//todo: sava data
//todo: sava data
//save datasource
//save datasource
Long
dataSourceID
=
saveDataSource
(
ec
,
formulaDataSourceDtoList
,
FormulaDataSourceDetailType
.
BSPLFormulaDataSourceDto
,
val
);
Long
dataSourceID
=
saveDataSource
(
ec
,
formulaDataSourceDtoList
,
FormulaDataSourceDetailType
.
BSPLFormulaDataSourceDto
,
val
,
period
,
formulaContext
.
getReportTemplateGroupID
()
);
//save formulablock
//save formulablock
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
val
,
dataSourceID
);
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
val
,
dataSourceID
);
...
@@ -195,7 +195,8 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
...
@@ -195,7 +195,8 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
//todo: sava data
//todo: sava data
//save datasource
//save datasource
Long
dataSourceID
=
saveDataSource
(
ec
,
dsList
,
FormulaDataSourceDetailType
.
BSPLFormulaDataSourceDto
,
val
);
Long
dataSourceID
=
saveDataSource
(
ec
,
dsList
,
FormulaDataSourceDetailType
.
BSPLFormulaDataSourceDto
,
val
,
period
,
formulaContext
.
getReportTemplateGroupID
());
//save formulablock
//save formulablock
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
val
,
dataSourceID
);
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
val
,
dataSourceID
);
return
new
NumberEval
(
val
.
doubleValue
());
return
new
NumberEval
(
val
.
doubleValue
());
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FunctionBase.java
View file @
9c4fd097
...
@@ -11,12 +11,15 @@ import pwc.taxtech.atms.common.util.SpringContextUtil;
...
@@ -11,12 +11,15 @@ import pwc.taxtech.atms.common.util.SpringContextUtil;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType
;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType
;
import
pwc.taxtech.atms.vat.entity.DataSource
;
import
pwc.taxtech.atms.vat.entity.DataSource
;
import
pwc.taxtech.atms.vat.entity.DataSourceDetail
;
import
pwc.taxtech.atms.vat.entity.DataSourceDetail
;
import
pwc.taxtech.atms.vat.entity.PeriodCellTemplateExample
;
import
pwc.taxtech.atms.vat.entity.PeriodFormulaBlock
;
import
pwc.taxtech.atms.vat.entity.PeriodFormulaBlock
;
import
pwc.taxtech.atms.vat.service.impl.FormulaAgent
;
import
pwc.taxtech.atms.vat.service.impl.FormulaAgent
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
public
class
FunctionBase
{
public
class
FunctionBase
{
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
...
@@ -91,7 +94,20 @@ public class FunctionBase {
...
@@ -91,7 +94,20 @@ public class FunctionBase {
}
}
public
Long
saveDataSource
(
OperationEvaluationContext
ec
,
List
<
Object
>
dataSourceList
,
public
Long
saveDataSource
(
OperationEvaluationContext
ec
,
List
<
Object
>
dataSourceList
,
FormulaDataSourceDetailType
formulaDataSourceDetailType
,
BigDecimal
val
)
{
FormulaDataSourceDetailType
formulaDataSourceDetailType
,
BigDecimal
val
,
int
period
,
Long
templateGroupId
)
{
String
reportCode
=
ec
.
getWorkbook
().
getSheetName
(
ec
.
getSheetIndex
());
int
colNum
=
ec
.
getColumnIndex
();
int
rowNum
=
ec
.
getRowIndex
();
//根据这三个值还有period获取 cell_template_Id的值
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"code"
,
reportCode
);
map
.
put
(
"templateGroupID"
,
templateGroupId
);
map
.
put
(
"period"
,
period
);
map
.
put
(
"columnIndex"
,
colNum
);
map
.
put
(
"rowIndex"
,
rowNum
);
Long
periodCellTemplateId
=
SpringContextUtil
.
periodCellTemplateMapper
.
getCellTemplateIDWithMap
(
map
);
Date
creatime
=
new
Date
();
Date
creatime
=
new
Date
();
DataSource
dataSource
=
new
DataSource
();
DataSource
dataSource
=
new
DataSource
();
Long
dataSourceID
=
SpringContextUtil
.
distributedIDService
.
nextId
();
Long
dataSourceID
=
SpringContextUtil
.
distributedIDService
.
nextId
();
...
@@ -108,6 +124,8 @@ public class FunctionBase {
...
@@ -108,6 +124,8 @@ public class FunctionBase {
dataSource
.
setColumnIndex
(
ec
.
getColumnIndex
());
dataSource
.
setColumnIndex
(
ec
.
getColumnIndex
());
dataSource
.
setRowName
(
""
);
dataSource
.
setRowName
(
""
);
dataSource
.
setColumnName
(
""
);
dataSource
.
setColumnName
(
""
);
dataSource
.
setCellTemplateId
(
periodCellTemplateId
);
dataSource
.
setPeriod
(
period
);
SpringContextUtil
.
dataSourceMapper
.
insertSelective
(
dataSource
);
SpringContextUtil
.
dataSourceMapper
.
insertSelective
(
dataSource
);
for
(
Object
obj
:
dataSourceList
)
{
for
(
Object
obj
:
dataSourceList
)
{
DataSourceDetail
dataSourceDetail
=
new
DataSourceDetail
();
DataSourceDetail
dataSourceDetail
=
new
DataSourceDetail
();
...
@@ -117,7 +135,6 @@ public class FunctionBase {
...
@@ -117,7 +135,6 @@ public class FunctionBase {
dataSourceDetail
.
setItemValue
(
JSON
.
toJSONString
(
obj
));
dataSourceDetail
.
setItemValue
(
JSON
.
toJSONString
(
obj
));
SpringContextUtil
.
dataSourceDetailMapper
.
insertSelective
(
dataSourceDetail
);
SpringContextUtil
.
dataSourceDetailMapper
.
insertSelective
(
dataSourceDetail
);
}
}
return
dataSourceID
;
return
dataSourceID
;
}
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/GZSD.java
View file @
9c4fd097
...
@@ -93,7 +93,9 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
...
@@ -93,7 +93,9 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
formulaDataSourceDto
.
setAmount
(
matchedRule
.
get
().
getTaxRate
());
formulaDataSourceDto
.
setAmount
(
matchedRule
.
get
().
getTaxRate
());
formulaDataSourceDto
.
setName
(
nf
.
format
(
matchedRule
.
get
().
getTaxRate
()));
formulaDataSourceDto
.
setName
(
nf
.
format
(
matchedRule
.
get
().
getTaxRate
()));
dataSourceDtoList
.
add
(
formulaDataSourceDto
);
dataSourceDtoList
.
add
(
formulaDataSourceDto
);
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSourceDtoList
),
FormulaDataSourceDetailType
.
FormulaDataSourceDto
,
val
);
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSourceDtoList
),
FormulaDataSourceDetailType
.
FormulaDataSourceDto
,
val
,
formulaContext
.
getPeriod
(),
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
formulaContext
.
getPeriod
(),
ec
,
formulaExpression
,
val
,
dataSourceId
);
saveFormulaBlock
(
formulaContext
.
getPeriod
(),
ec
,
formulaExpression
,
val
,
dataSourceId
);
return
new
NumberEval
(
val
.
doubleValue
());
return
new
NumberEval
(
val
.
doubleValue
());
}
else
{
}
else
{
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/JXFP.java
View file @
9c4fd097
...
@@ -148,17 +148,23 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
...
@@ -148,17 +148,23 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
if
(
resultType
==
0
)
{
if
(
resultType
==
0
)
{
double
val
=
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getAmount
().
doubleValue
()).
sum
();
double
val
=
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getAmount
().
doubleValue
()).
sum
();
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
InputInvoiceDataSourceDto
,
BigDecimal
.
valueOf
(
val
));
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
InputInvoiceDataSourceDto
,
BigDecimal
.
valueOf
(
val
),
period
,
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
BigDecimal
.
valueOf
(
val
),
dataSourceId
);
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
BigDecimal
.
valueOf
(
val
),
dataSourceId
);
return
new
NumberEval
(
val
);
return
new
NumberEval
(
val
);
}
else
if
(
resultType
==
1
)
{
}
else
if
(
resultType
==
1
)
{
double
val
=
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getTaxAmount
().
doubleValue
()).
sum
();
double
val
=
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getTaxAmount
().
doubleValue
()).
sum
();
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
InputInvoiceDataSourceDto
,
BigDecimal
.
valueOf
(
val
));
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
InputInvoiceDataSourceDto
,
BigDecimal
.
valueOf
(
val
),
period
,
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
BigDecimal
.
valueOf
(
val
),
dataSourceId
);
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
BigDecimal
.
valueOf
(
val
),
dataSourceId
);
return
new
NumberEval
(
val
);
return
new
NumberEval
(
val
);
}
else
if
(
resultType
==
2
)
{
}
else
if
(
resultType
==
2
)
{
double
val
=
dataSource
.
size
();
double
val
=
dataSource
.
size
();
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
InputInvoiceDataSourceDto
,
BigDecimal
.
valueOf
(
val
));
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
InputInvoiceDataSourceDto
,
BigDecimal
.
valueOf
(
val
),
period
,
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
BigDecimal
.
valueOf
(
val
),
dataSourceId
);
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
BigDecimal
.
valueOf
(
val
),
dataSourceId
);
return
new
NumberEval
(
val
);
return
new
NumberEval
(
val
);
}
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/JXFPMX.java
View file @
9c4fd097
...
@@ -124,12 +124,16 @@ public class JXFPMX extends FunctionBase implements FreeRefFunction {
...
@@ -124,12 +124,16 @@ public class JXFPMX extends FunctionBase implements FreeRefFunction {
if
(
amountType
==
0
)
{
if
(
amountType
==
0
)
{
double
val
=
dataSouce
.
stream
().
mapToDouble
(
a
->
a
.
getAmount
().
doubleValue
()).
sum
();
double
val
=
dataSouce
.
stream
().
mapToDouble
(
a
->
a
.
getAmount
().
doubleValue
()).
sum
();
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSouce
),
FormulaDataSourceDetailType
.
InputInvoiceDetailDataSourceDto
,
new
BigDecimal
(
val
));
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSouce
),
FormulaDataSourceDetailType
.
InputInvoiceDetailDataSourceDto
,
new
BigDecimal
(
val
),
period
,
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
new
BigDecimal
(
val
),
dataSourceId
);
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
new
BigDecimal
(
val
),
dataSourceId
);
return
new
NumberEval
(
val
);
return
new
NumberEval
(
val
);
}
else
if
(
amountType
==
1
)
{
}
else
if
(
amountType
==
1
)
{
double
val
=
dataSouce
.
stream
().
mapToDouble
(
a
->
a
.
getTaxAmount
().
doubleValue
()).
sum
();
double
val
=
dataSouce
.
stream
().
mapToDouble
(
a
->
a
.
getTaxAmount
().
doubleValue
()).
sum
();
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSouce
),
FormulaDataSourceDetailType
.
InputInvoiceDetailDataSourceDto
,
new
BigDecimal
(
val
));
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSouce
),
FormulaDataSourceDetailType
.
InputInvoiceDetailDataSourceDto
,
new
BigDecimal
(
val
),
period
,
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
new
BigDecimal
(
val
),
dataSourceId
);
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
new
BigDecimal
(
val
),
dataSourceId
);
return
new
NumberEval
(
val
);
return
new
NumberEval
(
val
);
}
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/XXFP.java
View file @
9c4fd097
...
@@ -114,13 +114,15 @@ public class XXFP extends FunctionBase implements FreeRefFunction {
...
@@ -114,13 +114,15 @@ public class XXFP extends FunctionBase implements FreeRefFunction {
if
(
amountType
==
0
)
{
if
(
amountType
==
0
)
{
double
val
=
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getAmount
().
doubleValue
()).
sum
();
double
val
=
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getAmount
().
doubleValue
()).
sum
();
Long
dataSoureId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
Long
dataSoureId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
OutputInvoiceDataSourceDto
,
new
BigDecimal
(
val
));
FormulaDataSourceDetailType
.
OutputInvoiceDataSourceDto
,
new
BigDecimal
(
val
),
period
,
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
new
BigDecimal
(
val
),
dataSoureId
);
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
new
BigDecimal
(
val
),
dataSoureId
);
return
new
NumberEval
(
val
);
return
new
NumberEval
(
val
);
}
else
if
(
amountType
==
1
)
{
}
else
if
(
amountType
==
1
)
{
double
val
=
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getTaxAmount
().
doubleValue
()).
sum
();
double
val
=
dataSource
.
stream
().
mapToDouble
(
a
->
a
.
getTaxAmount
().
doubleValue
()).
sum
();
Long
dataSoureId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
Long
dataSoureId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
OutputInvoiceDataSourceDto
,
new
BigDecimal
(
val
));
FormulaDataSourceDetailType
.
OutputInvoiceDataSourceDto
,
new
BigDecimal
(
val
),
period
,
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
new
BigDecimal
(
val
),
dataSoureId
);
saveFormulaBlock
(
period
,
ec
,
formulaExpression
,
new
BigDecimal
(
val
),
dataSoureId
);
return
new
NumberEval
(
val
);
return
new
NumberEval
(
val
);
}
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/ZC.java
View file @
9c4fd097
...
@@ -126,7 +126,9 @@ public class ZC extends FunctionBase implements FreeRefFunction {
...
@@ -126,7 +126,9 @@ public class ZC extends FunctionBase implements FreeRefFunction {
default
:
default
:
break
;
break
;
}
}
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
AssetDetailDataSourceDto
,
totalData
);
Long
dataSourceId
=
saveDataSource
(
ec
,
Collections
.
singletonList
(
dataSource
),
FormulaDataSourceDetailType
.
AssetDetailDataSourceDto
,
totalData
,
formulaContext
.
getPeriod
(),
formulaContext
.
getReportTemplateGroupID
());
saveFormulaBlock
(
0
,
ec
,
formulaExpression
,
totalData
,
dataSourceId
);
saveFormulaBlock
(
0
,
ec
,
formulaExpression
,
totalData
,
dataSourceId
);
return
new
NumberEval
(
totalData
.
doubleValue
());
return
new
NumberEval
(
totalData
.
doubleValue
());
}
}
...
...
atms-api/src/main/resources/RuntimeDbScripts/MYSQL/CreateProjectDB.sql
View file @
9c4fd097
...
@@ -923,7 +923,7 @@ CREATE TABLE IF NOT EXISTS `DBKeyword_ProjectDbName`.`cell_data_source` (
...
@@ -923,7 +923,7 @@ CREATE TABLE IF NOT EXISTS `DBKeyword_ProjectDbName`.`cell_data_source` (
`data_source_id`
bigint
(
18
)
unsigned
NOT
NULL
DEFAULT
'0'
,
`data_source_id`
bigint
(
18
)
unsigned
NOT
NULL
DEFAULT
'0'
,
`operation_type`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
,
`operation_type`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
,
`create_time`
datetime
NOT
NULL
DEFAULT
'1970-01-01 08:00:00'
,
`create_time`
datetime
NOT
NULL
DEFAULT
'1970-01-01 08:00:00'
,
`update
)
_time`
datetime
NOT
NULL
DEFAULT
'1970-01-01 08:00:00'
,
`update_time`
datetime
NOT
NULL
DEFAULT
'1970-01-01 08:00:00'
,
PRIMARY
KEY
(
`id`
)
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
...
@@ -946,6 +946,8 @@ CREATE TABLE IF NOT EXISTS `DBKeyword_ProjectDbName`.`data_source` (
...
@@ -946,6 +946,8 @@ CREATE TABLE IF NOT EXISTS `DBKeyword_ProjectDbName`.`data_source` (
`row_index`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
,
`row_index`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
,
`remap_batch_id`
varchar
(
128
)
NOT
NULL
DEFAULT
''
,
`remap_batch_id`
varchar
(
128
)
NOT
NULL
DEFAULT
''
,
`column_index`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
,
`column_index`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
,
`cell_template_id`
bigint
(
18
)
unsigned
NOT
NULL
DEFAULT
'0'
,
`period`
int
(
11
)
unsigned
NOT
NULL
DEFAULT
'0'
,
PRIMARY
KEY
(
`id`
)
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
...
...
atms-api/src/main/resources/pwc/taxtech/atms/vat/dao/DataSourceMapper.xml
View file @
9c4fd097
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
<result
column=
"row_index"
jdbcType=
"INTEGER"
property=
"rowIndex"
/>
<result
column=
"row_index"
jdbcType=
"INTEGER"
property=
"rowIndex"
/>
<result
column=
"remap_batch_id"
jdbcType=
"VARCHAR"
property=
"remapBatchId"
/>
<result
column=
"remap_batch_id"
jdbcType=
"VARCHAR"
property=
"remapBatchId"
/>
<result
column=
"column_index"
jdbcType=
"INTEGER"
property=
"columnIndex"
/>
<result
column=
"column_index"
jdbcType=
"INTEGER"
property=
"columnIndex"
/>
<result
column=
"cell_template_id"
jdbcType=
"BIGINT"
property=
"cellTemplateId"
/>
<result
column=
"period"
jdbcType=
"INTEGER"
property=
"period"
/>
</resultMap>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<sql
id=
"Example_Where_Clause"
>
<!--
<!--
...
@@ -94,7 +96,8 @@
...
@@ -94,7 +96,8 @@
This element is automatically generated by MyBatis Generator, do not modify.
This element is automatically generated by MyBatis Generator, do not modify.
-->
-->
id, `type`, `name`, amount, description, key_value_data_id, create_by, create_time,
id, `type`, `name`, amount, description, key_value_data_id, create_by, create_time,
update_by, update_time, row_name, `column_name`, row_index, remap_batch_id, column_index
update_by, update_time, row_name, `column_name`, row_index, remap_batch_id, column_index,
cell_template_id, period
</sql>
</sql>
<select
id=
"selectByExample"
parameterType=
"pwc.taxtech.atms.vat.entity.DataSourceExample"
resultMap=
"BaseResultMap"
>
<select
id=
"selectByExample"
parameterType=
"pwc.taxtech.atms.vat.entity.DataSourceExample"
resultMap=
"BaseResultMap"
>
<!--
<!--
...
@@ -151,14 +154,14 @@
...
@@ -151,14 +154,14 @@
amount, description, key_value_data_id,
amount, description, key_value_data_id,
create_by, create_time, update_by,
create_by, create_time, update_by,
update_time, row_name, `column_name`,
update_time, row_name, `column_name`,
row_index, remap_batch_id, column_index
row_index, remap_batch_id, column_index
,
)
cell_template_id, period
)
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{amount,jdbcType=DECIMAL}, #{description,jdbcType=VARCHAR}, #{keyValueDataId,jdbcType=VARCHAR},
#{amount,jdbcType=DECIMAL}, #{description,jdbcType=VARCHAR}, #{keyValueDataId,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{rowName,jdbcType=VARCHAR}, #{columnName,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{rowName,jdbcType=VARCHAR}, #{columnName,jdbcType=VARCHAR},
#{rowIndex,jdbcType=INTEGER}, #{remapBatchId,jdbcType=VARCHAR}, #{columnIndex,jdbcType=INTEGER}
#{rowIndex,jdbcType=INTEGER}, #{remapBatchId,jdbcType=VARCHAR}, #{columnIndex,jdbcType=INTEGER}
,
)
#{cellTemplateId,jdbcType=BIGINT}, #{period,jdbcType=INTEGER}
)
</insert>
</insert>
<insert
id=
"insertSelective"
parameterType=
"pwc.taxtech.atms.vat.entity.DataSource"
>
<insert
id=
"insertSelective"
parameterType=
"pwc.taxtech.atms.vat.entity.DataSource"
>
<!--
<!--
...
@@ -212,6 +215,12 @@
...
@@ -212,6 +215,12 @@
<if
test=
"columnIndex != null"
>
<if
test=
"columnIndex != null"
>
column_index,
column_index,
</if>
</if>
<if
test=
"cellTemplateId != null"
>
cell_template_id,
</if>
<if
test=
"period != null"
>
period,
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
<if
test=
"id != null"
>
...
@@ -259,6 +268,12 @@
...
@@ -259,6 +268,12 @@
<if
test=
"columnIndex != null"
>
<if
test=
"columnIndex != null"
>
#{columnIndex,jdbcType=INTEGER},
#{columnIndex,jdbcType=INTEGER},
</if>
</if>
<if
test=
"cellTemplateId != null"
>
#{cellTemplateId,jdbcType=BIGINT},
</if>
<if
test=
"period != null"
>
#{period,jdbcType=INTEGER},
</if>
</trim>
</trim>
</insert>
</insert>
<select
id=
"countByExample"
parameterType=
"pwc.taxtech.atms.vat.entity.DataSourceExample"
resultType=
"java.lang.Long"
>
<select
id=
"countByExample"
parameterType=
"pwc.taxtech.atms.vat.entity.DataSourceExample"
resultType=
"java.lang.Long"
>
...
@@ -323,6 +338,12 @@
...
@@ -323,6 +338,12 @@
<if
test=
"record.columnIndex != null"
>
<if
test=
"record.columnIndex != null"
>
column_index = #{record.columnIndex,jdbcType=INTEGER},
column_index = #{record.columnIndex,jdbcType=INTEGER},
</if>
</if>
<if
test=
"record.cellTemplateId != null"
>
cell_template_id = #{record.cellTemplateId,jdbcType=BIGINT},
</if>
<if
test=
"record.period != null"
>
period = #{record.period,jdbcType=INTEGER},
</if>
</set>
</set>
<if
test=
"_parameter != null"
>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
<include
refid=
"Update_By_Example_Where_Clause"
/>
...
@@ -348,7 +369,9 @@
...
@@ -348,7 +369,9 @@
`column_name` = #{record.columnName,jdbcType=VARCHAR},
`column_name` = #{record.columnName,jdbcType=VARCHAR},
row_index = #{record.rowIndex,jdbcType=INTEGER},
row_index = #{record.rowIndex,jdbcType=INTEGER},
remap_batch_id = #{record.remapBatchId,jdbcType=VARCHAR},
remap_batch_id = #{record.remapBatchId,jdbcType=VARCHAR},
column_index = #{record.columnIndex,jdbcType=INTEGER}
column_index = #{record.columnIndex,jdbcType=INTEGER},
cell_template_id = #{record.cellTemplateId,jdbcType=BIGINT},
period = #{record.period,jdbcType=INTEGER}
<if
test=
"_parameter != null"
>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</if>
...
@@ -402,6 +425,12 @@
...
@@ -402,6 +425,12 @@
<if
test=
"columnIndex != null"
>
<if
test=
"columnIndex != null"
>
column_index = #{columnIndex,jdbcType=INTEGER},
column_index = #{columnIndex,jdbcType=INTEGER},
</if>
</if>
<if
test=
"cellTemplateId != null"
>
cell_template_id = #{cellTemplateId,jdbcType=BIGINT},
</if>
<if
test=
"period != null"
>
period = #{period,jdbcType=INTEGER},
</if>
</set>
</set>
where id = #{id,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</update>
...
@@ -424,7 +453,9 @@
...
@@ -424,7 +453,9 @@
`column_name` = #{columnName,jdbcType=VARCHAR},
`column_name` = #{columnName,jdbcType=VARCHAR},
row_index = #{rowIndex,jdbcType=INTEGER},
row_index = #{rowIndex,jdbcType=INTEGER},
remap_batch_id = #{remapBatchId,jdbcType=VARCHAR},
remap_batch_id = #{remapBatchId,jdbcType=VARCHAR},
column_index = #{columnIndex,jdbcType=INTEGER}
column_index = #{columnIndex,jdbcType=INTEGER},
cell_template_id = #{cellTemplateId,jdbcType=BIGINT},
period = #{period,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</update>
<select
id=
"selectByExampleWithRowbounds"
parameterType=
"pwc.taxtech.atms.vat.entity.DataSourceExample"
resultMap=
"BaseResultMap"
>
<select
id=
"selectByExampleWithRowbounds"
parameterType=
"pwc.taxtech.atms.vat.entity.DataSourceExample"
resultMap=
"BaseResultMap"
>
...
@@ -480,9 +511,9 @@
...
@@ -480,9 +511,9 @@
</delete>
</delete>
<delete
id=
"clearCellDataWithPeriod"
>
<delete
id=
"clearCellDataWithPeriod"
>
DELETE c FROM cell_data c join report r on c.report_id=r.id where r.period = #{period,jdbcType=INTEGER};
DELETE c FROM cell_data c join report r on c.report_id=r.id where r.period = #{period,jdbcType=INTEGER};
<!--
<if test="exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''">
-->
<!--
&lt;if test="exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''"&gt;
-->
<!--WHERE report_id not in (${exceptReportTemplateIDs});-->
<!--WHERE report_id not in (${exceptReportTemplateIDs});-->
<!--
</if>
-->
<!--
&lt;/if&gt;
-->
</delete>
</delete>
<delete
id=
"clearReportWithPeriod"
>
<delete
id=
"clearReportWithPeriod"
>
DELETE FROM report WHERE period=#{period,jdbcType=INTEGER};
DELETE FROM report WHERE period=#{period,jdbcType=INTEGER};
...
@@ -527,5 +558,5 @@
...
@@ -527,5 +558,5 @@
<!--DELETE FROM period_template WHERE period=#{period,jdbcType=INTEGER} and id not in (${exceptReportTemplateIDs});-->
<!--DELETE FROM period_template WHERE period=#{period,jdbcType=INTEGER} and id not in (${exceptReportTemplateIDs});-->
<!--DELETE FROM period_tax_payer_report_rule WHERE period=#{period,jdbcType=INTEGER};-->
<!--DELETE FROM period_tax_payer_report_rule WHERE period=#{period,jdbcType=INTEGER};-->
<!--DELETE d FROM data_source d JOIN period_formula_block f ON d.key_value_data_id = f.id WHERE f.Period = #{period,jdbcType=INTEGER};-->
<!--DELETE d FROM data_source d JOIN period_formula_block f ON d.key_value_data_id = f.id WHERE f.Period = #{period,jdbcType=INTEGER};-->
<!--&
lt;/delete&
gt;-->
<!--&
amp;amp;lt;/delete&amp;
gt;-->
</mapper>
</mapper>
\ No newline at end of file
atms-api/src/test/java/pwc/taxtech/atms/RegexTest.java
View file @
9c4fd097
...
@@ -7,9 +7,13 @@ public class RegexTest {
...
@@ -7,9 +7,13 @@ public class RegexTest {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
String
regex
=
"[A-Z]*\\([A-Za-z0-9\\\"\\,\\.\\u4e00-\\u9fa5\\%\\-]*\\)"
;
String
regex
=
"[A-Z]*\\([A-Za-z0-9\\\"\\,\\.\\u4e00-\\u9fa5\\%\\-]*\\)"
;
String
forumula
=
"ND(2) +ND(1) +A2"
;
String
forumula
=
"ND(2) +ND(1) +A2"
;
// 不以baidu开头的字符串 (?!SUM)[A-Z]+[0-9]+
String
regex3
=
"^(?!baidu).*$"
;
String
regex2
=
"[A-Z]+[0-9]+"
;
int
count
=
0
;
int
count
=
0
;
Pattern
p
=
Pattern
.
compile
(
regex
);
Pattern
p
=
Pattern
.
compile
(
regex
2
);
Matcher
m
=
p
.
matcher
(
forumula
);
Matcher
m
=
p
.
matcher
(
forumula
);
while
(
m
.
find
())
{
while
(
m
.
find
())
{
//如果有些公式无法用正则匹配,可以做特殊处理
//如果有些公式无法用正则匹配,可以做特殊处理
...
...
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