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
7a473ec4
Commit
7a473ec4
authored
Nov 01, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] do not delete maunual data
parent
6cb74496
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
9 deletions
+43
-9
ReportController.java
...in/java/pwc/taxtech/atms/controller/ReportController.java
+1
-1
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+42
-8
No files found.
atms-api/src/main/java/pwc/taxtech/atms/controller/ReportController.java
View file @
7a473ec4
...
...
@@ -31,7 +31,7 @@ public class ReportController {
@PathVariable
Boolean
ifDeleteManualDataSource
,
@PathVariable
Integer
period
,
@RequestParam
String
generator
)
{
return
reportService
.
updateConfig
(
projectId
,
period
,
ifDeleteManualDataSource
,
generator
);
return
reportService
.
updateConfig
(
projectId
,
period
,
ifDeleteManualDataSource
,
generator
,
true
);
// OperationResultDto operationResultDto = new OperationResultDto();
// operationResultDto.setResult(true);
// return operationResultDto;
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
7a473ec4
...
...
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.constant.Constant
;
import
pwc.taxtech.atms.constant.enums.*
;
import
pwc.taxtech.atms.dao.*
;
import
pwc.taxtech.atms.dpo.ReportDto
;
...
...
@@ -156,7 +157,7 @@ public class ReportServiceImpl {
return
operationResult
;
}
private
void
clearPeriodData
(
String
projectId
,
Integer
period
,
List
<
Long
>
templateIds
)
{
private
void
clearPeriodData
(
String
projectId
,
Integer
period
,
List
<
Long
>
templateIds
,
boolean
isMergeManualData
)
{
if
(
templateIds
.
isEmpty
())
templateIds
.
add
(
Long
.
MAX_VALUE
);
PeriodFormulaBlockExample
periodFormulaBlockExample
=
new
PeriodFormulaBlockExample
();
periodFormulaBlockExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andPeriodEqualTo
(
period
);
...
...
@@ -183,10 +184,33 @@ public class ReportServiceImpl {
periodTaxPayerReportRuleMapper
.
deleteByExample
(
periodTaxPayerReportRuleExample
);
PeriodDataSourceExample
periodDataSourceExample
=
new
PeriodDataSourceExample
();
periodDataSourceExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andPeriodEqualTo
(
period
);
periodDataSourceExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
)
.
andPeriodEqualTo
(
period
);
List
<
PeriodDataSource
>
periodDataSources
=
periodDataSourceMapper
.
selectByExample
(
periodDataSourceExample
);
List
<
Long
>
periodDsIds
=
Lists
.
newArrayList
(
Long
.
MAX_VALUE
);
periodDsIds
.
addAll
(
periodDataSources
.
stream
().
map
(
m
->
m
.
getId
()).
collect
(
Collectors
.
toList
()));
List
<
Long
>
periodManualDsIds
=
new
ArrayList
<>();
List
<
Long
>
periodManualCellDataIds
=
new
ArrayList
<>();
if
(
isMergeManualData
)
{
periodDataSources
.
forEach
(
m
->
{
if
(
m
.
getType
().
intValue
()
!=
FormulaDataSourceType
.
KeyInSource
.
getCode
().
intValue
())
{
periodDsIds
.
add
(
m
.
getId
());
}
else
{
periodManualDsIds
.
add
(
m
.
getId
());
}
});
PeriodCellDataSourceExample
periodCellDataSourceExample
=
new
PeriodCellDataSourceExample
();
periodCellDataSourceExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andPeriodEqualTo
(
period
)
.
andDataSourceIdIn
(
periodManualDsIds
);
List
<
PeriodCellDataSource
>
manualCellDataSource
=
periodCellDataSourceMapper
.
selectByExample
(
periodCellDataSourceExample
);
if
(!
manualCellDataSource
.
isEmpty
())
periodManualCellDataIds
.
addAll
(
manualCellDataSource
.
stream
().
map
(
PeriodCellDataSource:
:
getCellDataId
)
.
collect
(
Collectors
.
toList
()));
}
else
{
periodDsIds
.
addAll
(
periodDataSources
.
stream
().
map
(
m
->
m
.
getId
()).
collect
(
Collectors
.
toList
()));
}
PeriodDataSourceDetailExample
periodDataSourceDetailExample
=
new
PeriodDataSourceDetailExample
();
periodDataSourceDetailExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andPeriodEqualTo
(
period
)
.
andDataSourceIdIn
(
periodDsIds
);
...
...
@@ -197,7 +221,10 @@ public class ReportServiceImpl {
.
andDataSourceIdIn
(
periodDsIds
);
periodCellDataSourceMapper
.
deleteByExample
(
periodCellDataSourceExample
);
periodDataSourceMapper
.
deleteByExample
(
periodDataSourceExample
);
PeriodDataSourceExample
periodDataSourceDeleteExample
=
new
PeriodDataSourceExample
();
periodDataSourceExample
.
createCriteria
().
andIdIn
(
periodDsIds
);
periodDataSourceMapper
.
deleteByExample
(
periodDataSourceDeleteExample
);
PeriodReportExample
periodReportExample
=
new
PeriodReportExample
();
periodReportExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andPeriodEqualTo
(
period
);
...
...
@@ -206,14 +233,21 @@ public class ReportServiceImpl {
List
<
Long
>
reportIds
=
Lists
.
newArrayList
(
Long
.
MAX_VALUE
);
reportIds
.
addAll
(
reports
.
stream
().
map
(
m
->
m
.
getId
()).
collect
(
Collectors
.
toList
()));
PeriodCellDataExample
periodCellDataExample
=
new
PeriodCellDataExample
();
periodCellDataExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andPeriodEqualTo
(
period
).
andReportIdIn
(
reportIds
);
if
(!
periodManualCellDataIds
.
isEmpty
())
{
periodCellDataExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andPeriodEqualTo
(
period
).
andReportIdIn
(
reportIds
).
andIdNotIn
(
periodManualCellDataIds
);
}
else
{
periodCellDataExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andPeriodEqualTo
(
period
).
andReportIdIn
(
reportIds
);
}
periodCellDataMapper
.
deleteByExample
(
periodCellDataExample
);
periodReportMapper
.
deleteByExample
(
periodReportExample
);
}
public
OperationResultDto
updateConfig
(
String
projectId
,
Integer
period
,
Boolean
ifDeleteManualDataSource
,
String
generator
)
{
public
OperationResultDto
updateConfig
(
String
projectId
,
Integer
period
,
Boolean
ifDeleteManualDataSource
,
String
generator
,
Boolean
isMergeManualData
)
{
OperationResultDto
result
=
new
OperationResultDto
();
try
{
if
(
period
==
null
)
{
...
...
@@ -240,7 +274,7 @@ public class ReportServiceImpl {
Long
templateGroupId
=
projectMapper
.
getTemplateGroupIdByProject
(
projectId
,
EnumServiceType
.
VAT
.
getCode
());
if
(
templateGroupId
!=
null
&&
templateGroupId
!=
0
)
{
// 先进行数据清理,包括period开头的所有报表配置表 条件Period
clearPeriodData
(
projectId
,
period
,
exceptTemplateIds
);
clearPeriodData
(
projectId
,
period
,
exceptTemplateIds
,
isMergeManualData
);
// 根据templategroupid 把 template 插入到 periodTemplate
TemplateExample
example
=
new
TemplateExample
();
example
.
createCriteria
().
andTemplateGroupIdEqualTo
(
templateGroupId
);
...
...
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