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
8234757b
Commit
8234757b
authored
Sep 29, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change to periodXXX table
parent
698f9c26
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
518 additions
and
106 deletions
+518
-106
SpringContextUtil.java
.../java/pwc/taxtech/atms/common/util/SpringContextUtil.java
+10
-0
CellCommentController.java
...va/pwc/taxtech/atms/controller/CellCommentController.java
+8
-6
ReportCellDataSourceDto.java
.../pwc/taxtech/atms/dto/vatdto/ReportCellDataSourceDto.java
+2
-1
VatEnterpriseAccountDao.java
...ava/pwc/taxtech/atms/vat/dao/VatEnterpriseAccountDao.java
+6
-4
CellCommentServiceImpl.java
...taxtech/atms/vat/service/impl/CellCommentServiceImpl.java
+2
-1
FormulaAgent.java
.../java/pwc/taxtech/atms/vat/service/impl/FormulaAgent.java
+9
-9
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+10
-10
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+56
-54
VatAbstractService.java
...pwc/taxtech/atms/vat/service/impl/VatAbstractService.java
+10
-1
BB.java
...wc/taxtech/atms/vat/service/impl/report/functions/BB.java
+2
-1
FSJZ.java
.../taxtech/atms/vat/service/impl/report/functions/FSJZ.java
+3
-6
FunctionBase.java
.../atms/vat/service/impl/report/functions/FunctionBase.java
+7
-9
PeriodCellDataMapper.java
...n/java/pwc/taxtech/atms/vat/dao/PeriodCellDataMapper.java
+21
-0
PeriodDataSourceMapper.java
...java/pwc/taxtech/atms/vat/dao/PeriodDataSourceMapper.java
+33
-0
PeriodEnterpriseAccountMapper.java
...c/taxtech/atms/vat/dao/PeriodEnterpriseAccountMapper.java
+5
-0
DataSourceExtendDto.java
...in/java/pwc/taxtech/atms/vat/dpo/DataSourceExtendDto.java
+5
-4
PeriodCellDataExtendsMapper.xml
...tech/atms/vat/dao/extends/PeriodCellDataExtendsMapper.xml
+6
-0
PeriodDataSourceExtendsMapper.xml
...ch/atms/vat/dao/extends/PeriodDataSourceExtendsMapper.xml
+323
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/util/SpringContextUtil.java
View file @
8234757b
...
...
@@ -21,6 +21,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public
static
FormulaAdminMapper
formulaAdminMapper
;
public
static
ReportMapper
reportMapper
;
public
static
CellDataMapper
cellDataMapper
;
public
static
PeriodCellDataMapper
periodCellDataMapper
;
public
static
DistributedIdService
distributedIdService
;
public
static
PeriodFormulaBlockMapper
formulaBlockMapper
;
public
static
PeriodCellTemplateMapper
periodCellTemplateMapper
;
...
...
@@ -31,10 +32,13 @@ public class SpringContextUtil implements ApplicationContextAware {
public
static
ProjectDao
projectDao
;
public
static
BalanceMapper
balanceMapper
;
public
static
DataSourceMapper
dataSourceMapper
;
public
static
PeriodDataSourceMapper
periodDataSourceMapper
;
public
static
DataSourceDetailMapper
dataSourceDetailMapper
;
public
static
PeriodDataSourceDetailMapper
periodDataSourceDetailMapper
;
public
static
PeriodFormulaBlockMapper
periodFormulaBlockMapper
;
public
static
VatEnterpriseAccountDao
vatEnterpriseAccountDao
;
public
static
VatEnterpriseAccountMapper
vatEnterpriseAccountMapper
;
public
static
PeriodEnterpriseAccountMapper
periodEnterpriseAccountMapper
;
public
static
BalanceStdManualMapper
balanceStdManualMapper
;
public
static
OutputVatInvoiceMapper
outputVATInvoiceMapper
;
public
static
PeriodTaxRuleSettingMapper
periodTaxRuleSettingMapper
;
...
...
@@ -43,6 +47,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public
static
AssetsListMapper
assetsListMapper
;
public
static
ProjectMapper
projectMapper
;
public
static
CellDataSourceMapper
cellDataSourceMapper
;
public
static
PeriodCellDataSourceMapper
periodCellDataSourceMapper
;
public
static
OrganizationMapper
organizationMapper
;
/**
...
...
@@ -62,6 +67,7 @@ public class SpringContextUtil implements ApplicationContextAware {
formulaAdminMapper
=
webApplicationContext
.
getBean
(
FormulaAdminMapper
.
class
);
reportMapper
=
webApplicationContext
.
getBean
(
ReportMapper
.
class
);
cellDataMapper
=
webApplicationContext
.
getBean
(
CellDataMapper
.
class
);
periodCellDataMapper
=
webApplicationContext
.
getBean
(
PeriodCellDataMapper
.
class
);
distributedIdService
=
webApplicationContext
.
getBean
(
DistributedIdService
.
class
);
formulaBlockMapper
=
webApplicationContext
.
getBean
(
PeriodFormulaBlockMapper
.
class
);
periodCellTemplateMapper
=
webApplicationContext
.
getBean
(
PeriodCellTemplateMapper
.
class
);
...
...
@@ -72,10 +78,13 @@ public class SpringContextUtil implements ApplicationContextAware {
projectDao
=
webApplicationContext
.
getBean
(
ProjectDao
.
class
);
balanceMapper
=
webApplicationContext
.
getBean
(
BalanceMapper
.
class
);
dataSourceMapper
=
webApplicationContext
.
getBean
(
DataSourceMapper
.
class
);
periodDataSourceMapper
=
webApplicationContext
.
getBean
(
PeriodDataSourceMapper
.
class
);
dataSourceDetailMapper
=
webApplicationContext
.
getBean
(
DataSourceDetailMapper
.
class
);
periodDataSourceDetailMapper
=
webApplicationContext
.
getBean
(
PeriodDataSourceDetailMapper
.
class
);
periodFormulaBlockMapper
=
webApplicationContext
.
getBean
(
PeriodFormulaBlockMapper
.
class
);
vatEnterpriseAccountDao
=
webApplicationContext
.
getBean
(
VatEnterpriseAccountDao
.
class
);
vatEnterpriseAccountMapper
=
webApplicationContext
.
getBean
(
VatEnterpriseAccountMapper
.
class
);
periodEnterpriseAccountMapper
=
webApplicationContext
.
getBean
(
PeriodEnterpriseAccountMapper
.
class
);
balanceStdManualMapper
=
webApplicationContext
.
getBean
(
BalanceStdManualMapper
.
class
);
outputVATInvoiceMapper
=
webApplicationContext
.
getBean
(
OutputVatInvoiceMapper
.
class
);
periodTaxRuleSettingMapper
=
webApplicationContext
.
getBean
(
PeriodTaxRuleSettingMapper
.
class
);
...
...
@@ -84,6 +93,7 @@ public class SpringContextUtil implements ApplicationContextAware {
assetsListMapper
=
webApplicationContext
.
getBean
(
AssetsListMapper
.
class
);
projectMapper
=
webApplicationContext
.
getBean
(
ProjectMapper
.
class
);
cellDataSourceMapper
=
webApplicationContext
.
getBean
(
CellDataSourceMapper
.
class
);
periodCellDataSourceMapper
=
webApplicationContext
.
getBean
(
PeriodCellDataSourceMapper
.
class
);
organizationMapper
=
webApplicationContext
.
getBean
(
OrganizationMapper
.
class
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/controller/CellCommentController.java
View file @
8234757b
package
pwc
.
taxtech
.
atms
.
controller
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.vat.entity.CellComment
;
import
pwc.taxtech.atms.vat.entity.PeriodCellComment
;
...
...
@@ -21,7 +19,11 @@ public class CellCommentController {
CellCommentServiceImpl
cellCommentService
;
@RequestMapping
(
value
=
"List"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
OperationResultDto
<
List
<
PeriodCellComment
>>
getCellComments
(
@RequestParam
(
"cellDataId"
)
Optional
<
Long
>
cellDataId
)
{
return
cellCommentService
.
getCellComments
(
cellDataId
);
public
OperationResultDto
<
List
<
PeriodCellComment
>>
getCellComments
(
@RequestParam
(
"cellDataId"
)
Optional
<
Long
>
cellDataId
,
@RequestHeader
(
"from"
)
String
form
)
{
String
projectId
=
StringUtils
.
EMPTY
;
if
(
StringUtils
.
isNotBlank
(
form
)
&&
form
.
split
(
"@"
).
length
>
0
)
{
projectId
=
form
.
split
(
"@"
)[
0
];
}
return
cellCommentService
.
getCellComments
(
cellDataId
,
projectId
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/ReportCellDataSourceDto.java
View file @
8234757b
...
...
@@ -6,6 +6,7 @@ import pwc.taxtech.atms.constant.DataSourceName;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceType
;
import
pwc.taxtech.atms.dpo.CellTemplatePerGroupDto
;
import
pwc.taxtech.atms.vat.entity.CellData
;
import
pwc.taxtech.atms.vat.entity.PeriodCellData
;
import
java.math.BigDecimal
;
...
...
@@ -47,7 +48,7 @@ public class ReportCellDataSourceDto extends DataSourceDto {
}
public
void
extractFromGroup
(
BBParasBo
bbParasBo
,
CurrentPeriodBo
currentPeriodBo
,
CellData
cellData
,
CellTemplatePerGroupDto
cellTemplateData
)
{
Period
CellData
cellData
,
CellTemplatePerGroupDto
cellTemplateData
)
{
this
.
name
=
DataSourceName
.
ReportDataSource
;
this
.
year
=
currentPeriodBo
.
curYear
;
this
.
period
=
currentPeriodBo
.
curPeriod
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/dao/VatEnterpriseAccountDao.java
View file @
8234757b
...
...
@@ -3,6 +3,8 @@ package pwc.taxtech.atms.vat.dao;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.vat.dao.VatEnterpriseAccountMapper
;
import
pwc.taxtech.atms.vat.entity.PeriodEnterpriseAccount
;
import
pwc.taxtech.atms.vat.entity.PeriodEnterpriseAccountExample
;
import
pwc.taxtech.atms.vat.entity.VatEnterpriseAccount
;
import
pwc.taxtech.atms.vat.entity.VatEnterpriseAccountExample
;
...
...
@@ -11,11 +13,11 @@ import java.util.List;
@Service
public
class
VatEnterpriseAccountDao
{
@Autowired
VatEnterpriseAccountMapper
vat
EnterpriseAccountMapper
;
PeriodEnterpriseAccountMapper
period
EnterpriseAccountMapper
;
public
List
<
Vat
EnterpriseAccount
>
getListByAccountCode
(
String
accountCode
)
{
VatEnterpriseAccountExample
example
=
new
Vat
EnterpriseAccountExample
();
public
List
<
Period
EnterpriseAccount
>
getListByAccountCode
(
String
accountCode
)
{
PeriodEnterpriseAccountExample
example
=
new
Period
EnterpriseAccountExample
();
example
.
createCriteria
().
andAcctCodeEqualTo
(
accountCode
);
return
vat
EnterpriseAccountMapper
.
selectByExample
(
example
);
return
period
EnterpriseAccountMapper
.
selectByExample
(
example
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/CellCommentServiceImpl.java
View file @
8234757b
...
...
@@ -9,7 +9,7 @@ import java.util.Optional;
@Service
public
class
CellCommentServiceImpl
extends
VatAbstractService
{
public
OperationResultDto
<
List
<
PeriodCellComment
>>
getCellComments
(
Optional
<
Long
>
cellDataId
)
{
public
OperationResultDto
<
List
<
PeriodCellComment
>>
getCellComments
(
Optional
<
Long
>
cellDataId
,
String
projectId
)
{
OperationResultDto
resultDto
=
new
OperationResultDto
();
try
{
if
(!
cellDataId
.
isPresent
()
||
cellDataId
.
get
()
==
0L
)
{
...
...
@@ -20,6 +20,7 @@ public class CellCommentServiceImpl extends VatAbstractService {
PeriodCellCommentExample
example
=
new
PeriodCellCommentExample
();
example
.
createCriteria
().
andCellDataIdEqualTo
(
cellDataId
.
get
());
example
.
createCriteria
().
andProjectIdEqualTo
(
projectId
);
List
<
PeriodCellComment
>
cellComments
=
periodCellCommentMapper
.
selectByExample
(
example
);
resultDto
.
setResult
(
true
);
resultDto
.
setData
(
cellComments
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/FormulaAgent.java
View file @
8234757b
...
...
@@ -11,11 +11,9 @@ import pwc.taxtech.atms.entity.ProjectServiceType;
import
pwc.taxtech.atms.entity.ProjectServiceTypeExample
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.vat.dao.CellDataMapper
;
import
pwc.taxtech.atms.vat.dao.PeriodCellDataMapper
;
import
pwc.taxtech.atms.vat.dao.ReportMapper
;
import
pwc.taxtech.atms.vat.entity.CellData
;
import
pwc.taxtech.atms.vat.entity.CellDataExample
;
import
pwc.taxtech.atms.vat.entity.Report
;
import
pwc.taxtech.atms.vat.entity.ReportExample
;
import
pwc.taxtech.atms.vat.entity.*
;
import
java.util.List
;
...
...
@@ -29,6 +27,8 @@ public class FormulaAgent extends VatAbstractService {
public
ReportMapper
reportMapper
;
@Autowired
public
CellDataMapper
cellDataMapper
;
@Autowired
public
PeriodCellDataMapper
periodCellDataMapper
;
public
List
<
CellTemplatePerGroupDto
>
getCellTemplateGroupDto
(
Long
templateGroupId
,
String
projectId
)
{
ProjectServiceTypeExample
pst
=
new
ProjectServiceTypeExample
();
...
...
@@ -60,10 +60,10 @@ public class FormulaAgent extends VatAbstractService {
return
null
;
}
private
CellData
getCellDataListByTemplate
(
String
templateId
,
Long
reportId
)
{
CellDataExample
dataExample
=
new
CellDataExample
();
private
Period
CellData
getCellDataListByTemplate
(
String
templateId
,
Long
reportId
)
{
PeriodCellDataExample
dataExample
=
new
Period
CellDataExample
();
dataExample
.
createCriteria
().
andCellTemplateIdEqualTo
(
Long
.
valueOf
(
templateId
)).
andReportIdEqualTo
(
reportId
);
List
<
CellData
>
cellDataList
=
c
ellDataMapper
.
selectByExample
(
dataExample
);
List
<
PeriodCellData
>
cellDataList
=
periodC
ellDataMapper
.
selectByExample
(
dataExample
);
if
(
cellDataList
!=
null
&&
!
cellDataList
.
isEmpty
())
return
cellDataList
.
get
(
FIRST_OR_DEFAULT
);
return
null
;
...
...
@@ -73,11 +73,11 @@ public class FormulaAgent extends VatAbstractService {
return
adminMp
.
getPastProjectId
(
year
,
orgId
);
}
public
CellData
getCellData
(
String
templateId
,
String
cellId
,
int
periodId
)
{
public
Period
CellData
getCellData
(
String
templateId
,
String
cellId
,
int
periodId
)
{
Report
report
=
getReportByTemplate
(
templateId
,
periodId
);
MyAsserts
.
assertNotNull
(
report
,
Exceptions
.
BB_REPORT_NULL
);
CellData
cellData
=
getCellDataListByTemplate
(
cellId
,
report
.
getId
());
Period
CellData
cellData
=
getCellDataListByTemplate
(
cellId
,
report
.
getId
());
MyAsserts
.
assertNotNull
(
cellData
,
Exceptions
.
BB_CELL_DATA_NULL
);
return
cellData
;
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
8234757b
...
...
@@ -306,7 +306,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
Cell
cell
=
row
.
getCell
(
colNum
-
1
);
if
(
cell
!=
null
)
{
//开始取值然后存放到DataSource
DataSource
dataSource
=
new
DataSource
();
PeriodDataSource
dataSource
=
new
Period
DataSource
();
dataSource
.
setId
(
distributedIdService
.
nextId
());
dataSource
.
setColumnIndex
(
colNum
-
1
);
dataSource
.
setRowIndex
(
rowNum
-
1
);
...
...
@@ -329,7 +329,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
dataSource
.
setPeriod
(
period
);
dataSource
.
setCellTemplateId
(
periodCellTemplateConfig
.
getCellTemplateId
());
dataSource
.
setType
(
FormulaDataSourceType
.
Report
.
getCode
());
d
ataSourceMapper
.
insertSelective
(
dataSource
);
periodD
ataSourceMapper
.
insertSelective
(
dataSource
);
//这里有个问题就是DataSource的数据有了,但是celldatasource的数据没有,后面无法关联celldata和DataSource
//解决办法就是 在存DataSource的时候就先把celldata的数据加好
//然后把celldatasource的数据也加好
...
...
@@ -344,7 +344,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
.
filter
(
a
->
a
.
getCellTemplateId
().
equals
(
periodCellTemplateConfig
.
getCellTemplateId
()))
.
findFirst
();
if
(
tempPeriodCellTemplate
.
isPresent
())
{
CellData
cellData
=
new
CellData
();
PeriodCellData
cellData
=
new
Period
CellData
();
Long
cellDataId
=
distributedIdService
.
nextId
();
cellData
.
setId
(
cellDataId
);
cellData
.
setReportId
(
reportId
);
...
...
@@ -395,23 +395,23 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
cellData
.
setCreateTime
(
createTime
);
cellData
.
setUpdateBy
(
"Admin"
);
cellData
.
setUpdateTime
(
createTime
);
c
ellDataMapper
.
insertSelective
(
cellData
);
periodC
ellDataMapper
.
insertSelective
(
cellData
);
//after insert celldata, insert the celldatasource for link celldata and datasource
DataSourceExample
dataSourceExample
=
new
DataSourceExample
();
PeriodDataSourceExample
dataSourceExample
=
new
Period
DataSourceExample
();
dataSourceExample
.
createCriteria
().
andPeriodEqualTo
(
period
)
.
andCellTemplateIdEqualTo
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
List
<
DataSource
>
dataSourceList
=
SpringContextUtil
.
d
ataSourceMapper
.
selectByExample
(
dataSourceExample
);
List
<
PeriodDataSource
>
dataSourceList
=
SpringContextUtil
.
periodD
ataSourceMapper
.
selectByExample
(
dataSourceExample
);
for
(
int
ii
=
0
;
ii
<
dataSourceList
.
size
();
ii
++)
{
DataSource
dataSource
=
dataSourceList
.
get
(
ii
);
CellDataSource
cellDataSource
=
new
CellDataSource
();
Period
DataSource
dataSource
=
dataSourceList
.
get
(
ii
);
PeriodCellDataSource
cellDataSource
=
new
Period
CellDataSource
();
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
cellDataSource
.
setCellDataId
(
cellDataId
);
cellDataSource
.
setDataSourceId
(
dataSource
.
getId
());
cellDataSource
.
setCreateTime
(
createTime
);
cellDataSource
.
setUpdateTime
(
createTime
);
SpringContextUtil
.
c
ellDataSourceMapper
.
insertSelective
(
cellDataSource
);
SpringContextUtil
.
periodC
ellDataSourceMapper
.
insertSelective
(
cellDataSource
);
}
}
}
...
...
@@ -587,7 +587,7 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
});
if
(!
parameter
.
isEmpty
())
{
List
<
PCTEntity
>
pctResults
=
c
ellDataMapper
.
queryByPCTs
(
parameter
);
List
<
PCTEntity
>
pctResults
=
periodC
ellDataMapper
.
queryByPCTs
(
parameter
);
Map
<
PCTEntity
,
BigDecimal
>
pctCache
=
new
HashMap
<>();
pctResults
.
forEach
(
m
->
{
BigDecimal
data
=
null
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
8234757b
...
...
@@ -44,6 +44,8 @@ import java.util.regex.Matcher;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
import
static
pwc
.
taxtech
.
atms
.
common
.
util
.
SpringContextUtil
.
periodEnterpriseAccountMapper
;
@Component
public
class
ReportServiceImpl
extends
VatAbstractService
implements
ReportService
{
@Override
...
...
@@ -155,7 +157,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
// dataSourceMapper.clearDataSourceWithPeriod(period);
// dataSourceMapper.clearCellDataWithPeriod(strExceptTemplateIds, period);
// dataSourceMapper.clearReportWithPeriod(period);
d
ataSourceMapper
.
clearDataWithPeriod
(
strExceptTemplateIds
,
period
);
periodD
ataSourceMapper
.
clearDataWithPeriod
(
strExceptTemplateIds
,
period
);
// 根据templategroupid 把 template 插入到 periodTemplate
TemplateExample
example
=
new
TemplateExample
();
example
.
createCriteria
().
andTemplateGroupIdEqualTo
(
templateGroupId
);
...
...
@@ -434,10 +436,10 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
templateIds
.
add
(
report
.
getTemplateId
());
List
<
CellCalcInfoDto
>
cellCfgList
=
reportGenerator
.
getCellCalcInfo
(
templateIds
,
report
.
getPeriod
());
CellDataExample
cellDataExample
=
new
CellDataExample
();
PeriodCellDataExample
cellDataExample
=
new
Period
CellDataExample
();
cellDataExample
.
createCriteria
().
andReportIdEqualTo
(
reportId
);
List
<
CellData
>
currentCellDataList
=
c
ellDataMapper
.
selectByExample
(
cellDataExample
);
List
<
PeriodCellData
>
currentCellDataList
=
periodC
ellDataMapper
.
selectByExample
(
cellDataExample
);
PeriodFormulaBlockExample
periodFormulaBlockExample
=
new
PeriodFormulaBlockExample
();
periodFormulaBlockExample
.
createCriteria
().
andPeriodEqualTo
(
report
.
getPeriod
()).
andReportIdEqualTo
(
reportId
);
...
...
@@ -451,7 +453,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
// TODO: Check模型回填数据源是否会有多对多的情况出现,如有需distinct
//公式计算数据源 20180711 完成
List
<
DataSourceExtendDto
>
manualDataSourceList
=
d
ataSourceMapper
.
getFormulaDataSource
(
reportId
);
List
<
DataSourceExtendDto
>
manualDataSourceList
=
periodD
ataSourceMapper
.
getFormulaDataSource
(
reportId
);
//loop the datasource to add datasource detail information
for
(
DataSourceExtendDto
dseo
:
manualDataSourceList
)
{
//只处理有明细数据的DataSource
...
...
@@ -465,9 +467,9 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
}
else
if
(
dseo
.
getType
().
equals
(
FormulaDataSourceType
.
Report
.
getCode
()))
{
List
<
String
>
itemValues
=
new
ArrayList
<>();
//todo: get the datasource detail to add the items property
DataSourceDetailExample
dataSourceDetailExample
=
new
DataSourceDetailExample
();
PeriodDataSourceDetailExample
dataSourceDetailExample
=
new
Period
DataSourceDetailExample
();
dataSourceDetailExample
.
createCriteria
().
andDataSourceIdEqualTo
(
dseo
.
getId
());
List
<
DataSourceDetail
>
dataSourceDetailList
=
SpringContextUtil
.
d
ataSourceDetailMapper
.
selectByExample
(
dataSourceDetailExample
);
List
<
PeriodDataSourceDetail
>
dataSourceDetailList
=
SpringContextUtil
.
periodD
ataSourceDetailMapper
.
selectByExample
(
dataSourceDetailExample
);
dataSourceDetailList
.
forEach
(
a
->
{
if
(
StringUtils
.
isNotBlank
(
a
.
getItemValue
()))
{
itemValues
.
add
(
a
.
getItemValue
());
...
...
@@ -538,7 +540,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
cellDataDto
.
setDataType
(
a
.
getDataType
());
cellDataDto
.
setReportId
(
reportId
.
toString
());
cellDataDto
.
setIsReadOnly
(
a
.
getIsReadOnly
());
Optional
<
CellData
>
celldata
=
currentCellDataList
.
stream
()
Optional
<
Period
CellData
>
celldata
=
currentCellDataList
.
stream
()
.
filter
(
x
->
x
.
getCellTemplateId
().
toString
().
equals
(
a
.
getCellTemplateId
())).
findFirst
();
celldata
.
ifPresent
(
cellData
->
cellDataDto
.
setCellId
(
cellData
.
getId
().
toString
()));
cellDataDto
.
setFormula
(
a
.
getFormula
());
...
...
@@ -659,10 +661,10 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
public
OperationResultDto
<
List
<
VatEnterpriseAccount
>>
getStdAccountByIndustry
(
String
industryId
)
{
OperationResultDto
resultDto
=
new
OperationResultDto
();
try
{
VatEnterpriseAccountExample
example
=
new
Vat
EnterpriseAccountExample
();
PeriodEnterpriseAccountExample
example
=
new
Period
EnterpriseAccountExample
();
example
.
createCriteria
().
andIsActiveEqualTo
(
true
);
vat
EnterpriseAccountMapper
.
selectByExample
(
example
);
List
<
VatEnterpriseAccount
>
vatEnterpriseAccounts
=
vat
EnterpriseAccountMapper
.
selectByExample
(
example
);
period
EnterpriseAccountMapper
.
selectByExample
(
example
);
List
<
PeriodEnterpriseAccount
>
vatEnterpriseAccounts
=
period
EnterpriseAccountMapper
.
selectByExample
(
example
);
if
(
vatEnterpriseAccounts
==
null
)
{
resultDto
.
setResult
(
false
);
resultDto
.
setResultMsg
(
"there is no data"
);
...
...
@@ -693,11 +695,11 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
return
resultDto
;
}
VatEnterpriseAccountExample
example
=
new
Vat
EnterpriseAccountExample
();
PeriodEnterpriseAccountExample
example
=
new
Period
EnterpriseAccountExample
();
example
.
createCriteria
().
andAcctCodeIn
(
Arrays
.
asList
(
periodCellTemplateConfig
.
getAccountCodes
().
split
(
","
)));
List
<
VatEnterpriseAccount
>
vatEnterpriseAccounts
=
vat
EnterpriseAccountMapper
.
selectByExample
(
example
);
List
<
PeriodEnterpriseAccount
>
vatEnterpriseAccounts
=
period
EnterpriseAccountMapper
.
selectByExample
(
example
);
List
<
VatEnterpriseAccountResultDto
>
vatEnterpriseAccountResultDtos
=
new
ArrayList
<>();
for
(
Vat
EnterpriseAccount
vatEnterpriseAccount
:
vatEnterpriseAccounts
)
{
for
(
Period
EnterpriseAccount
vatEnterpriseAccount
:
vatEnterpriseAccounts
)
{
VatEnterpriseAccountResultDto
vatEnterpriseAccountResultDto
=
new
VatEnterpriseAccountResultDto
();
vatEnterpriseAccountResultDto
.
setPeriodCellTemplateConfigId
(
periodCellTemplateConfig
.
getCellTemplateConfigId
());
vatEnterpriseAccountResultDto
.
setAcctCode
(
vatEnterpriseAccount
.
getAcctCode
());
...
...
@@ -723,7 +725,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
try
{
if
(
data
.
getCellId
()
==
null
)
{
//todo: insert celldata for manual datasource
CellData
cellData
=
new
CellData
();
PeriodCellData
cellData
=
new
Period
CellData
();
cellData
.
setId
(
distributedIdService
.
nextId
());
cellData
.
setReportId
(
data
.
getReportId
());
cellData
.
setCellTemplateId
(
Long
.
parseLong
(
data
.
getCellTemplateId
()));
...
...
@@ -733,24 +735,24 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
cellData
.
setCreateTime
(
new
Date
());
cellData
.
setUpdateBy
(
"admin"
);
cellData
.
setUpdateTime
(
new
Date
());
c
ellDataMapper
.
insertSelective
(
cellData
);
periodC
ellDataMapper
.
insertSelective
(
cellData
);
data
.
setCellId
(
cellData
.
getId
());
}
else
{
CellData
cellData
=
c
ellDataMapper
.
selectByPrimaryKey
(
data
.
getCellId
());
PeriodCellData
cellData
=
periodC
ellDataMapper
.
selectByPrimaryKey
(
data
.
getCellId
());
if
(
cellData
.
getData
()
!=
data
.
getAmount
().
toString
())
{
cellData
.
setData
(
data
.
getAmount
().
toString
());
c
ellDataMapper
.
updateByPrimaryKeySelective
(
cellData
);
periodC
ellDataMapper
.
updateByPrimaryKeySelective
(
cellData
);
}
}
List
<
DataSourceExtendDto
>
dataSourceExtendDtos
=
d
ataSourceMapper
.
getManualDataSource
(
data
.
getCellId
());
List
<
DataSourceExtendDto
>
dataSourceExtendDtos
=
periodD
ataSourceMapper
.
getManualDataSource
(
data
.
getCellId
());
PeriodCellTemplateExample
periodCellTemplateExample
=
new
PeriodCellTemplateExample
();
periodCellTemplateExample
.
createCriteria
().
andCellTemplateIdEqualTo
(
Long
.
parseLong
(
data
.
getCellTemplateId
())).
andPeriodEqualTo
(
data
.
getPeriod
());
Optional
<
PeriodCellTemplate
>
periodCellTemplate
=
periodCellTemplateMapper
.
selectByExample
(
periodCellTemplateExample
).
stream
().
findFirst
();
BigDecimal
originalAmount
=
new
BigDecimal
(
"0"
);
DataSource
dataSourceModel
=
null
;
Period
DataSource
dataSourceModel
=
null
;
if
(
dataSourceExtendDtos
.
size
()
>
0
)
{
dataSourceModel
=
dataSourceExtendDtos
.
get
(
0
).
getDataSource
();
updateCellValueForDataSourceChange
(
dataSourceModel
,
data
.
getAmount
());
...
...
@@ -760,9 +762,9 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
dataSourceModel
.
setAmount
(
data
.
getAmount
());
dataSourceModel
.
setUpdateBy
(
"Admin"
);
dataSourceModel
.
setUpdateTime
(
new
Date
());
d
ataSourceMapper
.
updateByPrimaryKeySelective
(
dataSourceModel
);
periodD
ataSourceMapper
.
updateByPrimaryKeySelective
(
dataSourceModel
);
}
else
{
dataSourceModel
=
new
DataSource
();
dataSourceModel
=
new
Period
DataSource
();
Long
cellDataSourceId
=
distributedIdService
.
nextId
();
dataSourceModel
.
setId
(
cellDataSourceId
);
dataSourceModel
.
setType
(
FormulaDataSourceType
.
KeyInSource
.
getCode
());
...
...
@@ -780,7 +782,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
dataSourceModel
.
setUpdateBy
(
"admin"
);
dataSourceModel
.
setPeriod
(
data
.
getPeriod
());
CellDataSource
cellDataSource
=
new
CellDataSource
();
PeriodCellDataSource
cellDataSource
=
new
Period
CellDataSource
();
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setCellDataId
(
data
.
getCellId
());
cellDataSource
.
setDataSourceId
(
cellDataSourceId
);
...
...
@@ -788,9 +790,9 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
cellDataSource
.
setCreateTime
(
new
Date
());
cellDataSource
.
setUpdateTime
(
new
Date
());
updateCellValueForDataSourceChange
(
cellDataSource
.
getCellDataId
(),
new
BigDecimal
(
"0"
),
data
.
getAmount
());
d
ataSourceMapper
.
insertSelective
(
dataSourceModel
);
c
ellDataSourceMapper
.
insertSelective
(
cellDataSource
);
dataSourceExtendDtos
=
d
ataSourceMapper
.
getManualDataSource
(
data
.
getCellId
());
periodD
ataSourceMapper
.
insertSelective
(
dataSourceModel
);
periodC
ellDataSourceMapper
.
insertSelective
(
cellDataSource
);
dataSourceExtendDtos
=
periodD
ataSourceMapper
.
getManualDataSource
(
data
.
getCellId
());
}
//todo: update the reference cell's data, such as if formula is ND(1)+A2,
...
...
@@ -811,23 +813,23 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
Optional
<
Report
>
report
=
reportMapper
.
selectByExample
(
reportExample
).
stream
().
findFirst
();
if
(
report
.
isPresent
())
{
Long
reportId
=
report
.
get
().
getId
();
CellDataExample
cellDataExample
=
new
CellDataExample
();
PeriodCellDataExample
cellDataExample
=
new
Period
CellDataExample
();
cellDataExample
.
createCriteria
().
andReportIdEqualTo
(
reportId
);
List
<
CellData
>
cellDataList
=
c
ellDataMapper
.
selectByExample
(
cellDataExample
);
for
(
CellData
cellData
:
cellDataList
)
{
List
<
PeriodCellData
>
cellDataList
=
periodC
ellDataMapper
.
selectByExample
(
cellDataExample
);
for
(
Period
CellData
cellData
:
cellDataList
)
{
if
(
cellData
.
getId
()
!=
data
.
getCellId
()
&&
cellData
.
getFormulaExp
().
contains
(
cellName
))
{
CellDataSourceExample
cellDataSourceExample
=
new
CellDataSourceExample
();
PeriodCellDataSourceExample
cellDataSourceExample
=
new
Period
CellDataSourceExample
();
cellDataSourceExample
.
createCriteria
().
andCellDataIdEqualTo
(
cellData
.
getId
()).
andCellTemplateIdEqualTo
(
cellData
.
getCellTemplateId
());
List
<
CellDataSource
>
cellDataSourceList
=
c
ellDataSourceMapper
.
selectByExample
(
cellDataSourceExample
);
for
(
CellDataSource
cellDataSource
:
cellDataSourceList
)
{
List
<
PeriodCellDataSource
>
cellDataSourceList
=
periodC
ellDataSourceMapper
.
selectByExample
(
cellDataSourceExample
);
for
(
Period
CellDataSource
cellDataSource
:
cellDataSourceList
)
{
Long
dataSourceId
=
cellDataSource
.
getDataSourceId
();
DataSource
dataSource
=
d
ataSourceMapper
.
selectByPrimaryKey
(
dataSourceId
);
PeriodDataSource
dataSource
=
periodD
ataSourceMapper
.
selectByPrimaryKey
(
dataSourceId
);
if
(
dataSource
.
getDescription
().
equals
(
cellName
))
{
BigDecimal
changeValue
=
data
.
getAmount
().
subtract
(
dataSource
.
getAmount
());
dataSource
.
setAmount
(
data
.
getAmount
());
dataSource
.
setUpdateBy
(
"admin"
);
dataSource
.
setUpdateTime
(
new
Date
());
d
ataSourceMapper
.
updateByPrimaryKeySelective
(
dataSource
);
periodD
ataSourceMapper
.
updateByPrimaryKeySelective
(
dataSource
);
if
(!
cellData
.
getData
().
equals
(
"#VALUE!"
))
{
cellData
.
setData
(
new
BigDecimal
(
cellData
.
getData
()).
add
(
changeValue
).
toString
());
}
else
{
...
...
@@ -835,7 +837,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
}
//cellData.setFormulaExp(cellData.getData());
cellData
.
setUpdateTime
(
new
Date
());
c
ellDataMapper
.
updateByPrimaryKeySelective
(
cellData
);
periodC
ellDataMapper
.
updateByPrimaryKeySelective
(
cellData
);
}
}
}
...
...
@@ -857,14 +859,14 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
public
OperationResultDto
<
String
>
addDataSource
(
DataSourceDto
datasourceDto
)
{
OperationResultDto
operationResultDto
=
new
OperationResultDto
();
try
{
CellData
cellData
=
c
ellDataMapper
.
selectByPrimaryKey
(
Long
.
parseLong
(
datasourceDto
.
getCellDataId
()
!=
null
?
datasourceDto
.
getCellDataId
()
:
"0"
));
PeriodCellData
cellData
=
periodC
ellDataMapper
.
selectByPrimaryKey
(
Long
.
parseLong
(
datasourceDto
.
getCellDataId
()
!=
null
?
datasourceDto
.
getCellDataId
()
:
"0"
));
if
(
cellData
==
null
)
{
operationResultDto
.
setResult
(
false
);
operationResultDto
.
setResultMsg
(
"NoCellData"
);
return
operationResultDto
;
}
DataSource
dataSource
=
new
DataSource
();
PeriodDataSource
dataSource
=
new
Period
DataSource
();
CommonUtils
.
copyProperties
(
datasourceDto
,
dataSource
);
dataSource
.
setType
(
datasourceDto
.
getDataSourceType
());
if
(
dataSource
.
getId
()
==
null
||
dataSource
.
getId
()
==
0L
)
{
...
...
@@ -876,9 +878,9 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
dataSource
.
setCreateBy
(
datasourceDto
.
getCreator
());
}
dataSource
.
setCreateTime
(
new
Date
());
d
ataSourceMapper
.
insertSelective
(
dataSource
);
periodD
ataSourceMapper
.
insertSelective
(
dataSource
);
CellDataSource
cellDataSource
=
new
CellDataSource
();
PeriodCellDataSource
cellDataSource
=
new
Period
CellDataSource
();
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setCellDataId
(
cellData
.
getId
());
cellDataSource
.
setCellTemplateId
(
cellData
.
getCellTemplateId
());
...
...
@@ -887,7 +889,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
cellDataSource
.
setCreateTime
(
new
Date
());
cellDataSource
.
setUpdateTime
(
new
Date
());
c
ellDataSourceMapper
.
insertSelective
(
cellDataSource
);
periodC
ellDataSourceMapper
.
insertSelective
(
cellDataSource
);
operationResultDto
.
setData
(
dataSource
.
getId
().
toString
());
operationResultDto
.
setResult
(
true
);
...
...
@@ -952,19 +954,19 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
return
operationResultDto
;
}
DataSource
datasourceEntity
=
d
ataSourceMapper
.
selectByPrimaryKey
(
Long
.
parseLong
(
dataSource
.
getId
()));
PeriodDataSource
datasourceEntity
=
periodD
ataSourceMapper
.
selectByPrimaryKey
(
Long
.
parseLong
(
dataSource
.
getId
()));
if
(
datasourceEntity
==
null
)
{
operationResultDto
.
setResultMsg
(
"DatasourceInvalid"
);
operationResultDto
.
setResult
(
false
);
return
operationResultDto
;
}
updateCellValueForDataSourceChange
(
datasourceEntity
,
dataSource
.
getAmount
());
d
ataSourceMapper
.
updateByPrimaryKeySelective
(
datasourceEntity
);
periodD
ataSourceMapper
.
updateByPrimaryKeySelective
(
datasourceEntity
);
//todo:MarkProjectModelDirty(dataSource.projectId, dataSource.serviceTypeId, dataSource.Updater);
List
<
DataSourceDetail
>
dataSourceItems
=
new
ArrayList
<>();
List
<
Period
DataSourceDetail
>
dataSourceItems
=
new
ArrayList
<>();
dataSource
.
getItems
().
forEach
(
a
->
{
DataSourceDetail
dataSourceDetail
=
new
DataSourceDetail
();
PeriodDataSourceDetail
dataSourceDetail
=
new
Period
DataSourceDetail
();
dataSourceDetail
.
setId
(
distributedIdService
.
nextId
());
dataSourceDetail
.
setDataSourceId
(
Long
.
parseLong
(
dataSource
.
getId
()));
dataSourceDetail
.
setDataSourceType
(
dataSource
.
getDataSourceType
());
...
...
@@ -972,16 +974,16 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
dataSourceItems
.
add
(
dataSourceDetail
);
});
DataSourceDetailExample
example
=
new
DataSourceDetailExample
();
PeriodDataSourceDetailExample
example
=
new
Period
DataSourceDetailExample
();
example
.
createCriteria
().
andDataSourceIdEqualTo
(
Long
.
parseLong
(
dataSource
.
getId
()));
List
<
DataSourceDetail
>
dataSourceDetailList
=
d
ataSourceDetailMapper
.
selectByExample
(
example
);
List
<
PeriodDataSourceDetail
>
dataSourceDetailList
=
periodD
ataSourceDetailMapper
.
selectByExample
(
example
);
//todo: TBC tomorrow
dataSourceDetailList
.
forEach
(
a
->
{
d
ataSourceDetailMapper
.
deleteByPrimaryKey
(
a
.
getId
());
periodD
ataSourceDetailMapper
.
deleteByPrimaryKey
(
a
.
getId
());
});
dataSourceItems
.
forEach
(
a
->
{
d
ataSourceDetailMapper
.
insertSelective
(
a
);
periodD
ataSourceDetailMapper
.
insertSelective
(
a
);
});
operationResultDto
.
setResult
(
true
);
...
...
@@ -995,15 +997,15 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
@Override
public
OperationResultDto
<
String
>
getDataSourceDetailList
(
Long
datasSourceId
)
{
OperationResultDto
<
String
>
operationResultDto
=
new
OperationResultDto
<>();
DataSource
dataSource
=
d
ataSourceMapper
.
selectByPrimaryKey
(
datasSourceId
);
PeriodDataSource
dataSource
=
periodD
ataSourceMapper
.
selectByPrimaryKey
(
datasSourceId
);
String
itemStrValue
=
StringUtils
.
EMPTY
;
if
(
dataSource
.
getType
().
equals
(
FormulaDataSourceType
.
InputInvoice
.
getCode
()))
{
DataSourceDetailExample
dataSourceDetailExample
=
new
DataSourceDetailExample
();
PeriodDataSourceDetailExample
dataSourceDetailExample
=
new
Period
DataSourceDetailExample
();
dataSourceDetailExample
.
createCriteria
().
andDataSourceIdEqualTo
(
datasSourceId
).
andDataSourceTypeEqualTo
(
CellDataSourceType
.
InputInvoice
.
getCode
());
List
<
DataSourceDetail
>
dataSourceDetails
=
d
ataSourceDetailMapper
.
selectByExample
(
dataSourceDetailExample
);
List
<
PeriodDataSourceDetail
>
dataSourceDetails
=
periodD
ataSourceDetailMapper
.
selectByExample
(
dataSourceDetailExample
);
List
<
InputVATInvoiceItemExtendDto
>
inputVATInvoiceItemExtendDtos
=
new
ArrayList
<>();
for
(
DataSourceDetail
dataSourceDetail
:
dataSourceDetails
)
{
for
(
Period
DataSourceDetail
dataSourceDetail
:
dataSourceDetails
)
{
if
(
StringUtils
.
isNotBlank
(
dataSourceDetail
.
getItemValue
()))
{
InputVATInvoiceItemExtendDto
inputVATInvoiceItemExtendDto
=
inputVATInvoiceMapper
.
selectInvoiceExtendDto
(
dataSourceDetail
.
getItemValue
());
inputVATInvoiceItemExtendDtos
.
add
(
inputVATInvoiceItemExtendDto
);
...
...
@@ -1024,7 +1026,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
BigDecimal
bValue
=
originalAmount
!=
null
?
originalAmount
:
new
BigDecimal
(
"0"
);
BigDecimal
amountChange
=
aValue
.
subtract
(
bValue
);
CellData
cellData
=
c
ellDataMapper
.
selectByPrimaryKey
(
cellDataId
);
PeriodCellData
cellData
=
periodC
ellDataMapper
.
selectByPrimaryKey
(
cellDataId
);
BigDecimal
cellVal
=
new
BigDecimal
(
"0"
);
try
{
if
(
cellData
!=
null
)
{
...
...
@@ -1040,7 +1042,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
}
}
private
void
updateCellValueForDataSourceChange
(
DataSource
dataSourceEntity
,
BigDecimal
amount
)
{
private
void
updateCellValueForDataSourceChange
(
Period
DataSource
dataSourceEntity
,
BigDecimal
amount
)
{
BigDecimal
originalAmount
=
dataSourceEntity
.
getAmount
();
dataSourceEntity
.
setAmount
(
amount
);
BigDecimal
aValue
=
dataSourceEntity
.
getAmount
()
!=
null
?
dataSourceEntity
.
getAmount
()
:
new
BigDecimal
(
"0"
);
...
...
@@ -1048,7 +1050,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
BigDecimal
amountChange
=
aValue
.
subtract
(
bValue
);
DataSourceCellDataDto
dataSourceCellDataDto
=
d
ataSourceMapper
.
getManualDataSource2
(
dataSourceEntity
.
getId
());
periodD
ataSourceMapper
.
getManualDataSource2
(
dataSourceEntity
.
getId
());
BigDecimal
cellVal
=
new
BigDecimal
(
"0"
);
if
(
dataSourceCellDataDto
!=
null
&&
dataSourceCellDataDto
.
getCellData
().
getData
()
!=
null
)
{
if
(
dataSourceCellDataDto
.
getCellDataSource
().
getOperationType
().
equals
(
EnumOperationType
.
Sub
))
{
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/VatAbstractService.java
View file @
8234757b
...
...
@@ -20,6 +20,8 @@ public class VatAbstractService {
@Autowired
public
VatEnterpriseAccountMapper
vatEnterpriseAccountMapper
;
@Autowired
public
PeriodEnterpriseAccountMapper
periodEnterpriseAccountMapper
;
@Autowired
public
VatStandardAccountMapper
vatStandardAccountMapper
;
@Autowired
public
InputVatInvoiceMapper
inputVATInvoiceMapper
;
...
...
@@ -48,8 +50,12 @@ public class VatAbstractService {
@Autowired
public
DataSourceMapper
dataSourceMapper
;
@Autowired
public
PeriodDataSourceMapper
periodDataSourceMapper
;
@Autowired
public
DataSourceDetailMapper
dataSourceDetailMapper
;
@Autowired
public
PeriodDataSourceDetailMapper
periodDataSourceDetailMapper
;
@Autowired
public
TemplateGroupMapper
templateGroupMapper
;
@Autowired
public
DistributedIdService
distributedIdService
;
...
...
@@ -76,6 +82,8 @@ public class VatAbstractService {
@Autowired
public
CellDataMapper
cellDataMapper
;
@Autowired
public
PeriodCellDataMapper
periodCellDataMapper
;
@Autowired
public
ModifiedReportCellMapper
modifiedReportCellMapper
;
@Autowired
public
PeriodCellCommentMapper
periodCellCommentMapper
;
...
...
@@ -85,5 +93,6 @@ public class VatAbstractService {
public
FtpService
ftpService
;
@Autowired
public
CellDataSourceMapper
cellDataSourceMapper
;
@Autowired
public
PeriodCellDataSourceMapper
periodCellDataSourceMapper
;
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/BB.java
View file @
8234757b
...
...
@@ -18,6 +18,7 @@ import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.exception.FormulaException
;
import
pwc.taxtech.atms.vat.entity.CellData
;
import
pwc.taxtech.atms.vat.entity.PeriodCellData
;
import
java.lang.reflect.Field
;
import
java.math.BigDecimal
;
...
...
@@ -107,7 +108,7 @@ public class BB extends FunctionBase implements FreeRefFunction {
}
// bo.disCount();
CellData
cellData
=
null
;
Period
CellData
cellData
=
null
;
String
projectId
=
agent
.
getPastProjectId
(
curPeriod
.
getCurYear
(),
formulaContext
.
getOrganizationId
());
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FSJZ.java
View file @
8234757b
...
...
@@ -8,10 +8,7 @@ import pwc.taxtech.atms.common.util.SpringContextUtil;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType
;
import
pwc.taxtech.atms.constant.enums.KeyValueConfigResultType
;
import
pwc.taxtech.atms.dto.vatdto.BSPLFormulaDataSourceDto
;
import
pwc.taxtech.atms.vat.entity.Balance
;
import
pwc.taxtech.atms.vat.entity.BalanceStdManual
;
import
pwc.taxtech.atms.vat.entity.VatEnterpriseAccount
;
import
pwc.taxtech.atms.vat.entity.VatStandardAccount
;
import
pwc.taxtech.atms.vat.entity.*
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
...
...
@@ -94,7 +91,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
List
<
Object
>
formulaDataSourceDtoList
=
new
ArrayList
<>();
if
(
balanceStdManual
!=
null
)
{
List
<
VatEnterpriseAccount
>
vatEnterpriseAccountList
=
SpringContextUtil
.
vat
EnterpriseAccountMapper
.
period
EnterpriseAccountMapper
.
getListWithAccountCode
(
accountCode
);
if
(
period
==
99
)
{
val
=
new
BigDecimal
(((
balanceStdManual
.
getYearDebitNet
()
!=
null
?
balanceStdManual
.
getYearDebitNet
()
:
0
).
doubleValue
()
...
...
@@ -140,7 +137,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
return
new
NumberEval
(
val
.
doubleValue
());
}
else
{
//企业账套
List
<
Vat
EnterpriseAccount
>
vatEnterpriseAccountList
=
SpringContextUtil
List
<
Period
EnterpriseAccount
>
vatEnterpriseAccountList
=
SpringContextUtil
.
vatEnterpriseAccountDao
.
getListByAccountCode
(
accountCode
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/FunctionBase.java
View file @
8234757b
...
...
@@ -10,9 +10,7 @@ import org.slf4j.LoggerFactory;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType
;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceType
;
import
pwc.taxtech.atms.vat.entity.DataSource
;
import
pwc.taxtech.atms.vat.entity.DataSourceDetail
;
import
pwc.taxtech.atms.vat.entity.PeriodFormulaBlock
;
import
pwc.taxtech.atms.vat.entity.*
;
import
pwc.taxtech.atms.vat.service.impl.FormulaAgent
;
import
javax.tools.JavaCompiler
;
...
...
@@ -111,7 +109,7 @@ public class FunctionBase {
Long
periodCellTemplateId
=
SpringContextUtil
.
periodCellTemplateMapper
.
getCellTemplateIdWithMap
(
map
);
Date
creatime
=
new
Date
();
DataSource
dataSource
=
new
DataSource
();
PeriodDataSource
dataSource
=
new
Period
DataSource
();
Long
dataSourceId
=
SpringContextUtil
.
distributedIdService
.
nextId
();
dataSource
.
setId
(
dataSourceId
);
dataSource
.
setType
(
FormulaDataSourceType
.
Report
.
getCode
());
...
...
@@ -128,24 +126,24 @@ public class FunctionBase {
dataSource
.
setColumnName
(
""
);
dataSource
.
setCellTemplateId
(
periodCellTemplateId
);
dataSource
.
setPeriod
(
period
);
SpringContextUtil
.
d
ataSourceMapper
.
insertSelective
(
dataSource
);
SpringContextUtil
.
periodD
ataSourceMapper
.
insertSelective
(
dataSource
);
for
(
Object
obj
:
dataSourceList
)
{
if
(
obj
.
getClass
()==
java
.
util
.
ArrayList
.
class
)
{
for
(
Object
obj2
:
(
ArrayList
<
Object
>)
obj
)
{
DataSourceDetail
dataSourceDetail
=
new
DataSourceDetail
();
PeriodDataSourceDetail
dataSourceDetail
=
new
Period
DataSourceDetail
();
dataSourceDetail
.
setId
(
SpringContextUtil
.
distributedIdService
.
nextId
());
dataSourceDetail
.
setDataSourceId
(
dataSourceId
);
dataSourceDetail
.
setDataSourceType
(
formulaDataSourceDetailType
.
getCode
());
dataSourceDetail
.
setItemValue
(
JSON
.
toJSONString
(
obj2
));
SpringContextUtil
.
d
ataSourceDetailMapper
.
insertSelective
(
dataSourceDetail
);
SpringContextUtil
.
periodD
ataSourceDetailMapper
.
insertSelective
(
dataSourceDetail
);
}
}
else
{
DataSourceDetail
dataSourceDetail
=
new
DataSourceDetail
();
PeriodDataSourceDetail
dataSourceDetail
=
new
Period
DataSourceDetail
();
dataSourceDetail
.
setId
(
SpringContextUtil
.
distributedIdService
.
nextId
());
dataSourceDetail
.
setDataSourceId
(
dataSourceId
);
dataSourceDetail
.
setDataSourceType
(
formulaDataSourceDetailType
.
getCode
());
dataSourceDetail
.
setItemValue
(
JSON
.
toJSONString
(
obj
));
SpringContextUtil
.
d
ataSourceDetailMapper
.
insertSelective
(
dataSourceDetail
);
SpringContextUtil
.
periodD
ataSourceDetailMapper
.
insertSelective
(
dataSourceDetail
);
}
}
return
dataSourceId
;
...
...
atms-dao/src/main/java/pwc/taxtech/atms/vat/dao/PeriodCellDataMapper.java
View file @
8234757b
package
pwc
.
taxtech
.
atms
.
vat
.
dao
;
import
java.util.List
;
import
java.util.Set
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.ibatis.session.RowBounds
;
import
pwc.taxtech.atms.MyVatMapper
;
import
pwc.taxtech.atms.vat.entity.PCTEntity
;
import
pwc.taxtech.atms.vat.entity.PeriodCellData
;
import
pwc.taxtech.atms.vat.entity.PeriodCellDataExample
;
...
...
@@ -105,4 +109,20 @@ public interface PeriodCellDataMapper extends MyVatMapper {
* @mbg.generated
*/
int
updateByPrimaryKey
(
PeriodCellData
record
);
@Select
(
"<script>"
+
"SELECT "
+
" R.PERIOD, C.CELL_TEMPLATE_ID AS CELLTEMPLATEID, DATA "
+
"FROM "
+
" PERIOD_CELL_DATA C, "
+
" PERIOD_REPORT R "
+
"WHERE "
+
" C.REPORT_ID = R.ID AND "
+
" "
+
" <foreach item=\"item\" index=\"index\" collection=\"list\""
+
" open=\"(\" separator=\"OR\" close=\")\">"
+
" ( R.PERIOD=#{item.period} AND C.CELL_TEMPLATE_ID=#{item.cellTemplateId} )"
+
" </foreach>"
+
"</script>"
)
List
<
PCTEntity
>
queryByPCTs
(
@Param
(
"list"
)
Set
<
PCTEntity
>
parameter
);
}
\ No newline at end of file
atms-dao/src/main/java/pwc/taxtech/atms/vat/dao/PeriodDataSourceMapper.java
View file @
8234757b
...
...
@@ -5,6 +5,8 @@ import org.apache.ibatis.annotations.Mapper;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.session.RowBounds
;
import
pwc.taxtech.atms.MyVatMapper
;
import
pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto
;
import
pwc.taxtech.atms.vat.dpo.DataSourceExtendDto
;
import
pwc.taxtech.atms.vat.entity.PeriodDataSource
;
import
pwc.taxtech.atms.vat.entity.PeriodDataSourceExample
;
...
...
@@ -105,4 +107,34 @@ public interface PeriodDataSourceMapper extends MyVatMapper {
* @mbg.generated
*/
int
updateByPrimaryKey
(
PeriodDataSource
record
);
void
clearFormulaBlockWithPeriod
(
@Param
(
"period"
)
Integer
period
);
void
clearTaxRuleSettingWithPeriod
(
@Param
(
"period"
)
Integer
period
);
void
clearCellTemplateWithPeriod
(
@Param
(
"period"
)
Integer
period
,
@Param
(
"exceptReportTemplateIDs"
)
String
exceptReportTemplateIDs
);
void
clearCellTemplateConfigWithPeriod
(
@Param
(
"period"
)
Integer
period
,
@Param
(
"exceptReportTemplateIDs"
)
String
exceptReportTemplateIDs
);
void
clearTemplateWithPeriod
(
@Param
(
"period"
)
Integer
period
,
@Param
(
"exceptReportTemplateIDs"
)
String
exceptReportTemplateIDs
);
void
clearTaxPayerReportWithPeriod
(
@Param
(
"period"
)
Integer
period
);
void
clearDataSourceWithPeriod
(
@Param
(
"period"
)
Integer
period
);
void
clearDataSourceDetailWithPeriod
(
@Param
(
"period"
)
Integer
period
);
void
clearCellDataSourceDataWithPeriod
(
@Param
(
"period"
)
Integer
period
);
void
clearCellDataWithPeriod
(
@Param
(
"exceptReportTemplateIDs"
)
String
exceptReportTemplateIDs
,
@Param
(
"period"
)
Integer
period
);
void
clearReportWithPeriod
(
Integer
period
);
void
clearDataWithPeriod
(
@Param
(
"exceptReportTemplateIDs"
)
String
exceptReportTemplateIDs
,
@Param
(
"period"
)
Integer
period
);
List
<
DataSourceExtendDto
>
getFormulaDataSource
(
Long
reportID
);
List
<
DataSourceExtendDto
>
getManualDataSource
(
Long
cellDataID
);
DataSourceCellDataDto
getManualDataSource2
(
Long
dataSourceID
);
}
\ No newline at end of file
atms-dao/src/main/java/pwc/taxtech/atms/vat/dao/PeriodEnterpriseAccountMapper.java
View file @
8234757b
...
...
@@ -7,6 +7,7 @@ import org.apache.ibatis.session.RowBounds;
import
pwc.taxtech.atms.MyVatMapper
;
import
pwc.taxtech.atms.vat.entity.PeriodEnterpriseAccount
;
import
pwc.taxtech.atms.vat.entity.PeriodEnterpriseAccountExample
;
import
pwc.taxtech.atms.vat.entity.VatEnterpriseAccount
;
@Mapper
public
interface
PeriodEnterpriseAccountMapper
extends
MyVatMapper
{
...
...
@@ -105,4 +106,7 @@ public interface PeriodEnterpriseAccountMapper extends MyVatMapper {
* @mbg.generated
*/
int
updateByPrimaryKey
(
PeriodEnterpriseAccount
record
);
List
<
VatEnterpriseAccount
>
getListWithAccountCode
(
@Param
(
"accountCode"
)
String
accountCode
);
}
\ No newline at end of file
atms-dao/src/main/java/pwc/taxtech/atms/vat/dpo/DataSourceExtendDto.java
View file @
8234757b
...
...
@@ -2,6 +2,7 @@ package pwc.taxtech.atms.vat.dpo;
import
pwc.taxtech.atms.CommonUtils
;
import
pwc.taxtech.atms.vat.entity.DataSource
;
import
pwc.taxtech.atms.vat.entity.PeriodDataSource
;
import
java.util.List
;
...
...
@@ -10,12 +11,12 @@ public class DataSourceExtendDto extends DataSource {
private
Long
cellTemplateId
;
private
Long
cellDataId
;
private
List
<
String
>
items
;
private
DataSource
dataSource
;
private
Period
DataSource
dataSource
;
private
Long
reportTemplateId
;
private
Integer
dataSourceType
;
public
DataSource
getDataSource
()
{
this
.
dataSource
=
new
DataSource
();
public
Period
DataSource
getDataSource
()
{
this
.
dataSource
=
new
Period
DataSource
();
CommonUtils
.
copyProperties
(
this
,
dataSource
);
return
this
.
dataSource
;
}
...
...
@@ -52,7 +53,7 @@ public class DataSourceExtendDto extends DataSource {
this
.
items
=
items
;
}
public
void
setDataSource
(
DataSource
dataSource
)
{
public
void
setDataSource
(
Period
DataSource
dataSource
)
{
this
.
dataSource
=
dataSource
;
}
...
...
atms-dao/src/main/resources/pwc/taxtech/atms/vat/dao/extends/PeriodCellDataExtendsMapper.xml
0 → 100644
View file @
8234757b
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"pwc.taxtech.atms.vat.dao.PeriodCellTemplateMapper"
>
</mapper>
\ No newline at end of file
atms-dao/src/main/resources/pwc/taxtech/atms/vat/dao/extends/PeriodDataSourceExtendsMapper.xml
0 → 100644
View file @
8234757b
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"pwc.taxtech.atms.vat.dao.PeriodDataSourceMapper"
>
<delete
id=
"clearFormulaBlockWithPeriod"
>
DELETE FROM
PERIOD_FORMULA_BLOCK
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
</delete>
<delete
id=
"clearTaxRuleSettingWithPeriod"
>
DELETE FROM
PERIOD_TAX_RULE_SETTING
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
</delete>
<delete
id=
"clearCellTemplateWithPeriod"
>
DELETE FROM
PERIOD_CELL_TEMPLATE
WHERE
PERIOD= #{period,jdbcType=INTEGER}
<if
test=
"exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''"
>
AND REPORT_TEMPLATE_ID NOT IN (
${exceptReportTemplateIDs}
)
;
</if>
</delete>
<delete
id=
"clearCellTemplateConfigWithPeriod"
>
DELETE FROM
PERIOD_CELL_TEMPLATE_CONFIG
WHERE
PERIOD= #{period,jdbcType=INTEGER}
<if
test=
"exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''"
>
AND REPORT_TEMPLATE_ID NOT IN (
${exceptReportTemplateIDs}
)
;
</if>
</delete>
<delete
id=
"clearTemplateWithPeriod"
>
DELETE FROM
PERIOD_TEMPLATE
WHERE
PERIOD= #{period,jdbcType=INTEGER}
<if
test=
"exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''"
>
AND TEMPLATE_ID NOT IN (
${exceptReportTemplateIDs}
)
;
</if>
</delete>
<delete
id=
"clearTaxPayerReportWithPeriod"
>
DELETE FROM
PERIOD_TAX_PAYER_REPORT_RULE
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
</delete>
<delete
id=
"clearDataSourceWithPeriod"
>
DELETE
D FROM
DATA_SOURCE D
WHERE
D.PERIOD = #{period,jdbcType=INTEGER} ;
</delete>
<delete
id=
"clearDataSourceDetailWithPeriod"
>
DELETE
D FROM
DATA_SOURCE_DETAIL D
JOIN
DATA_SOURCE F
ON
D.DATA_SOURCE_ID = F.ID
WHERE
F.PERIOD = #{period,jdbcType=INTEGER} ;
</delete>
<delete
id=
"clearCellDataSourceDataWithPeriod"
>
DELETE
D FROM
CELL_DATA_SOURCE D
JOIN
DATA_SOURCE F
ON
D.DATA_SOURCE_ID = F.ID
WHERE
F.PERIOD = #{period,jdbcType=INTEGER} ;
</delete>
<delete
id=
"clearCellDataWithPeriod"
>
DELETE
C FROM
CELL_DATA C
JOIN
REPORT R
ON
C.REPORT_ID=R.ID
WHERE
R.PERIOD = #{period,jdbcType=INTEGER} ;
<!--&lt;if test="exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''"&gt;-->
<!--WHERE report_id not in (${exceptReportTemplateIDs});-->
<!--&lt;/if&gt;-->
</delete>
<delete
id=
"clearReportWithPeriod"
>
DELETE FROM
REPORT
WHERE
period= #{period,jdbcType=INTEGER} ;
</delete>
<delete
id=
"clearDataWithPeriod"
>
DELETE FROM
PERIOD_FORMULA_BLOCK
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
DELETE FROM
PERIOD_TAX_RULE_SETTING
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
DELETE FROM
PERIOD_CELL_TEMPLATE
WHERE
PERIOD= #{period,jdbcType=INTEGER}
AND REPORT_TEMPLATE_ID NOT IN (
${exceptReportTemplateIDs}
)
;
DELETE FROM
PERIOD_CELL_TEMPLATE_CONFIG
WHERE
PERIOD= #{period,jdbcType=INTEGER}
AND REPORT_TEMPLATE_ID NOT IN (
${exceptReportTemplateIDs}
)
;
DELETE FROM
PERIOD_TEMPLATE
WHERE
PERIOD= #{period,jdbcType=INTEGER}
AND TEMPLATE_ID NOT IN (
${exceptReportTemplateIDs}
)
;
DELETE FROM
PERIOD_TAX_PAYER_REPORT_RULE
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
DELETE
D FROM
DATA_SOURCE_DETAIL D
JOIN
DATA_SOURCE F
ON
D.DATA_SOURCE_ID = F.ID
WHERE
F.PERIOD = #{period,jdbcType=INTEGER} ;
DELETE
D FROM
CELL_DATA_SOURCE D
JOIN
DATA_SOURCE F
ON
D.DATA_SOURCE_ID = F.ID
WHERE
F.PERIOD = #{period,jdbcType=INTEGER} ;
DELETE
D FROM
DATA_SOURCE D
WHERE
D.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} ;
DELETE FROM
REPORT
WHERE
PERIOD= #{period,jdbcType=INTEGER} ;
</delete>
<resultMap
id=
"DataSourceExtendDtoMap"
type=
"pwc.taxtech.atms.vat.dpo.DataSourceExtendDto"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"TYPE"
jdbcType=
"INTEGER"
property=
"type"
/>
<result
column=
"NAME"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"AMOUNT"
jdbcType=
"DECIMAL"
property=
"amount"
/>
<result
column=
"DESCRIPTION"
jdbcType=
"VARCHAR"
property=
"description"
/>
<result
column=
"KEY_VALUE_DATA_ID"
jdbcType=
"VARCHAR"
property=
"keyValueDataId"
/>
<result
column=
"CREATE_BY"
jdbcType=
"VARCHAR"
property=
"createBy"
/>
<result
column=
"CREATE_TIME"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"UPDATE_BY"
jdbcType=
"VARCHAR"
property=
"updateBy"
/>
<result
column=
"UPDATE_TIME"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"ROW_NAME"
jdbcType=
"VARCHAR"
property=
"rowName"
/>
<result
column=
"COLUMN_NAME"
jdbcType=
"VARCHAR"
property=
"columnName"
/>
<result
column=
"ROW_INDEX"
jdbcType=
"INTEGER"
property=
"rowIndex"
/>
<result
column=
"REMAP_BATCH_ID"
jdbcType=
"VARCHAR"
property=
"remapBatchId"
/>
<result
column=
"COLUMN_INDEX"
jdbcType=
"INTEGER"
property=
"columnIndex"
/>
<result
column=
"OPERATION_TYPE"
jdbcType=
"INTEGER"
property=
"operationType"
/>
<result
column=
"CELL_TEMPLATE_ID"
jdbcType=
"BIGINT"
property=
"cellTemplateId"
/>
<result
column=
"CELL_DATA_ID"
jdbcType=
"BIGINT"
property=
"cellDataId"
/>
<result
column=
"REPORT_TEMPLATE_ID"
jdbcType=
"BIGINT"
property=
"reportTemplateId"
/>
</resultMap>
<select
id=
"getFormulaDataSource"
parameterType=
"java.lang.Long"
resultMap=
"DataSourceExtendDtoMap"
>
SELECT
DS.*,
CDS.OPERATION_TYPE AS OPERATION_TYPE,
CD.CELL_TEMPLATE_ID AS CELL_TEMPLATE_ID,
CD.ID AS CELL_DATA_ID,
RPT.TEMPLATE_ID AS REPORT_TEMPLATE_ID
FROM
DATA_SOURCE DS
JOIN
CELL_DATA_SOURCE CDS
ON
DS.ID = CDS.DATA_SOURCE_ID
JOIN
CELL_DATA CD
ON
CDS.CELL_DATA_ID = CD.ID
JOIN
REPORT RPT
ON
CD.REPORT_ID= RPT.ID
WHERE
CD.REPORT_ID = #{reportID,jdbcType=BIGINT}
<!--AND <![CDATA[ ds.type <> 1]]>-->
</select>
<select
id=
"getManualDataSource"
parameterType=
"java.lang.Long"
resultMap=
"DataSourceExtendDtoMap"
>
SELECT
CDS.CELL_DATA_ID,
DS.ID,
DS.T_Y_P_E,
DS.NAME,
DS.AMOUNT,
DS.DESCRIPTION,
DS.KEY_VALUE_DATA_ID,
DS.CREATE_BY,
DS.CREATE_TIME,
DS.UPDATE_BY,
DS.UPDATE_TIME,
DS.ROW_NAME,
DS.COLUMN_NAME,
DS.ROW_INDEX,
DS.REMAP_BATCH_ID,
DS.COLUMN_INDEX,
DS.CELL_TEMPLATE_ID,
DS.PERIOD
FROM
CELL_DATA_SOURCE CDS
JOIN
DATA_SOURCE DS
ON
CDS.DATA_SOURCE_ID = DS.ID
WHERE
DS.TYPE = 10
AND CDS.CELL_DATA_ID = #{cellDataID,jdbcType=BIGINT}
</select>
<resultMap
id=
"dataSourceCellDataDto"
type=
"pwc.taxtech.atms.dto.vatdto.DataSourceCellDataDto"
>
<id
column=
"ID"
jdbcType=
"BIGINT"
property=
"id"
/>
<association
property=
"cellData"
javaType=
"pwc.taxtech.atms.vat.entity.CellData"
>
<id
column=
"CELL_DATA_ID"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"CELL_DATA_DATA"
property=
"data"
javaType=
"java.lang.String"
jdbcType=
"VARCHAR"
/>
<result
column=
"CELL_DATA_TEMPLATE_ID"
property=
"cellTemplateId"
javaType=
"java.lang.Long"
jdbcType=
"BIGINT"
/>
<result
column=
"CELL_DATA_REPORT_ID"
property=
"reportId"
javaType=
"java.lang.Long"
jdbcType=
"BIGINT"
/>
</association>
<association
property=
"cellDataSource"
javaType=
"pwc.taxtech.atms.vat.entity.CellDataSource"
>
<id
column=
"CELL_DATA_SOURCE_ID"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"CELL_DATA_SOURCE_OPERATION_TYPE"
property=
"operationType"
javaType=
"java.lang.Integer"
jdbcType=
"INTEGER"
/>
</association>
</resultMap>
<select
id=
"getManualDataSource2"
parameterType=
"java.lang.Long"
resultMap=
"dataSourceCellDataDto"
>
SELECT
CELL_DATA_SOURCE.ID AS ID,
CELLDATA.ID AS CELL_DATA_ID,
CELLDATA.DATA AS CELL_DATA_DATA,
CELLDATA.CELL_TEMPLATE_ID AS CELL_DATA_TEMPLATE_ID,
CELLDATA.REPORT_ID AS CELL_DATA_REPORT_ID,
CELLDATASOURCE.ID AS CELL_DATA_SOURCE_ID,
CELLDATASOURCE.OPERATION_TYPE AS CELL_DATA_SOURCE_OPERATION_TYPE
FROM
CELL_DATA CELLDATA
JOIN
CELL_DATA_SOURCE CELLDATASOURCE
ON
CELLDATA.ID = CELLDATASOURCE.CELL_DATA_ID
WHERE
CELLDATASOURCE.DATA_SOURCE_ID = #{dataSourceID,jdbcType=BIGINT} LIMIT 1
</select>
<!--DELETE FROM period_tax_rule_setting WHERE period=#{period,jdbcType=INTEGER};-->
<!--DELETE FROM period_cell_template WHERE period=#{period,jdbcType=INTEGER} and report_template_id not in (${exceptReportTemplateIDs});-->
<!--DELETE FROM period_cell_template_config WHERE period=#{period,jdbcType=INTEGER} and report_template_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 d FROM data_source d JOIN period_formula_block f ON d.key_value_data_id = f.id WHERE f.Period = #{period,jdbcType=INTEGER};-->
<!--&amp;lt;/delete&amp;gt;-->
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment