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
201ba46b
Commit
201ba46b
authored
Apr 03, 2019
by
chase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
c3095df3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
22 deletions
+31
-22
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+31
-22
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
201ba46b
...
...
@@ -305,7 +305,7 @@ public class ReportServiceImpl extends BaseService {
private
void
updateConfig
(
String
projectId
,
Integer
period
,
Boolean
isMergeManualData
,
List
<
Template
>
templates
,
PeriodJob
job
)
{
List
<
Long
>
exceptTemplateIds
=
templateMapper
.
getIdsForExceptTemplate
();
//根据收入类型映射生成开票记录关联数据
assembleInvoiceRecord
(
projectId
,
period
,
isMergeManualData
);
assembleInvoiceRecord
(
projectId
,
period
,
isMergeManualData
);
//生成trial_balance_final数据
assembleTrialBalanceFinal
(
projectId
,
period
);
clearPeriodData
(
projectId
,
period
,
exceptTemplateIds
,
isMergeManualData
);
...
...
@@ -333,7 +333,7 @@ public class ReportServiceImpl extends BaseService {
trialBalanceFinalMapper
.
generateFinalData
(
projectId
,
Integer
.
valueOf
(
queryPeriod
),
lastProject
==
null
?
"0"
:
lastProject
.
getId
(),
Integer
.
valueOf
(
lastPeriod
));
}
public
void
assembleInvoiceRecord
(
String
projectId
,
Integer
period
,
Boolean
isMergeManualData
)
{
public
void
assembleInvoiceRecord
(
String
projectId
,
Integer
period
,
Boolean
isMergeManualData
)
{
Project
project
=
projectMapper
.
selectByPrimaryKey
(
projectId
);
MyAsserts
.
assertNotNull
(
project
,
Exceptions
.
NOT_FOUND_REPORT_EXCEPTION
);
String
queryDate
=
project
.
getYear
()
+
"-"
+
(
period
<
10
?
(
"0"
+
period
)
:
(
period
+
""
));
...
...
@@ -345,10 +345,10 @@ public class ReportServiceImpl extends BaseService {
InvoiceRecordExample
delExample
=
new
InvoiceRecordExample
();
delExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andPeriodEqualTo
(
Integer
.
valueOf
(
queryDate
.
replace
(
"-"
,
""
)));
if
(
isMergeManualData
)
{
invoiceRecordMapper
.
clearRevenueCof
(
true
,
false
,
delExample
);
}
else
{
invoiceRecordMapper
.
clearRevenueCof
(
true
,
true
,
delExample
);
if
(
isMergeManualData
)
{
invoiceRecordMapper
.
clearRevenueCof
(
true
,
false
,
delExample
);
}
else
{
invoiceRecordMapper
.
clearRevenueCof
(
true
,
true
,
delExample
);
}
Map
<
String
,
Long
>
map
=
new
HashMap
<>();
...
...
@@ -470,12 +470,14 @@ public class ReportServiceImpl extends BaseService {
for
(
int
r
=
sheet
.
getFirstRowNum
();
r
<=
sheet
.
getLastRowNum
();
r
++)
{
Row
row
=
sheet
.
getRow
(
r
);
for
(
int
c
=
row
.
getFirstCellNum
();
c
<=
row
.
getLastCellNum
();
c
++)
{
Cell
cell
=
row
.
getCell
(
c
);
if
(
cell
==
null
)
{
continue
;
//todo cell == null 如何处理
}
if
(
r
<=
addRowIndex
+
1
)
{
if
(
r
==
addRowIndex
+
1
&&
c
>
TaxesCalculateReportEnum
.
Column
.
Column_14
.
getIndex
()){
assembleOriginalTemplateData
(
template
,
projectId
,
period
,
r
,
c
,
addRowIndex
,
cellTemplateList
,
cellTemplateConfigList
);
}
else
{
String
cellId
=
projectId
+
template
.
getId
()
+
period
+
r
+
c
;
if
((
r
-
1
)
>=
0
&&
(
r
-
1
)
<
configIds
.
size
())
{
cellId
+=
configIds
.
get
(
configIds
.
size
()
-
r
);
...
...
@@ -537,7 +539,26 @@ public class ReportServiceImpl extends BaseService {
if
(
r
>
0
&&
r
<=
addRowIndex
&&
hasHandDatas
.
contains
(
c
))
{
addManualConfig
(
cellTemplate
,
cell
,
now
,
cellTemplateConfigList
);
}
}
}
else
{
assembleOriginalTemplateData
(
template
,
projectId
,
period
,
r
,
c
,
addRowIndex
,
cellTemplateList
,
cellTemplateConfigList
);
}
}
}
List
<
List
<
PeriodCellTemplate
>>
tmpList
=
CommonUtils
.
subListWithLen
(
cellTemplateList
,
CommonUtils
.
BATCH_NUM
);
// tmpList.forEach(list -> cellTemplateMapper.batchInsert2(list));
tmpList
.
forEach
(
list
->
periodCellTemplateMapper
.
batchInsert
(
list
));
//todo 批量插入优化
List
<
List
<
PeriodCellTemplateConfig
>>
tmpConfigList
=
CommonUtils
.
subListWithLen
(
cellTemplateConfigList
,
CommonUtils
.
BATCH_NUM
);
tmpConfigList
.
forEach
(
list
->
periodCellTemplateConfigMapper
.
batchInsert
(
list
));
}
catch
(
Exception
e
)
{
logger
.
error
(
"importTemplateExcelFile error."
,
e
);
throw
new
ServiceException
(
ErrorMessage
.
SystemError
);
}
}
public
void
assembleOriginalTemplateData
(
Template
template
,
String
projectId
,
Integer
period
,
Integer
r
,
Integer
c
,
Integer
addRowIndex
,
List
<
PeriodCellTemplate
>
cellTemplateList
,
List
<
PeriodCellTemplateConfig
>
cellTemplateConfigList
)
{
//查询原来行cell是否有CellTemplate
CellTemplateExample
cellTemplateExample
=
new
CellTemplateExample
();
cellTemplateExample
.
createCriteria
().
andReportTemplateIdEqualTo
(
template
.
getId
()).
andRowIndexEqualTo
(
r
-
addRowIndex
).
andColumnIndexEqualTo
(
c
);
...
...
@@ -605,18 +626,6 @@ public class ReportServiceImpl extends BaseService {
}
}
}
}
}
List
<
List
<
PeriodCellTemplate
>>
tmpList
=
CommonUtils
.
subListWithLen
(
cellTemplateList
,
CommonUtils
.
BATCH_NUM
);
// tmpList.forEach(list -> cellTemplateMapper.batchInsert2(list));
tmpList
.
forEach
(
list
->
periodCellTemplateMapper
.
batchInsert
(
list
));
//todo 批量插入优化
List
<
List
<
PeriodCellTemplateConfig
>>
tmpConfigList
=
CommonUtils
.
subListWithLen
(
cellTemplateConfigList
,
CommonUtils
.
BATCH_NUM
);
tmpConfigList
.
forEach
(
list
->
periodCellTemplateConfigMapper
.
batchInsert
(
list
));
}
catch
(
Exception
e
)
{
logger
.
error
(
"importTemplateExcelFile error."
,
e
);
throw
new
ServiceException
(
ErrorMessage
.
SystemError
);
}
}
private
void
addManualConfig
(
PeriodCellTemplate
cellTemplate
,
Cell
cell
,
Date
now
,
List
<
PeriodCellTemplateConfig
>
list
)
{
PeriodCellTemplateConfig
configManual
=
new
PeriodCellTemplateConfig
();
...
...
@@ -987,7 +996,7 @@ public class ReportServiceImpl extends BaseService {
Workbook
workbook
=
reportGenerator
.
createWorkBookByPeriodTemplate
(
resources
.
getPeriodTemplates
(),
genJob
);
reportGenerator
.
addFunctionsAndContext
(
workbook
,
functions
,
reportGenerator
.
initContext
(
resources
,
periodParam
),
false
);
reportGenerator
.
addFunctionsAndContext
(
workbook
,
functions
,
reportGenerator
.
initContext
(
resources
,
periodParam
),
false
);
reportGenerator
.
setConfigAndDataToWorkBook
(
workbook
,
resources
);
FormulaEvaluator
evaluator
=
workbook
.
getCreationHelper
().
createFormulaEvaluator
();
...
...
@@ -1029,7 +1038,7 @@ public class ReportServiceImpl extends BaseService {
periodCellTemplateConfigDtos
.
forEach
(
a
->
{
workbook4Validate
.
getSheetAt
(
a
.
getSheetNumber
()
-
1
).
getRow
(
a
.
getRowNumber
()).
getCell
(
a
.
getColNumber
()).
setCellFormula
(
a
.
getParsedValidation
());
});
reportGenerator
.
addFunctionsAndContext
(
workbook4Validate
,
functions
,
reportGenerator
.
initContext
(
resources
,
periodParam
),
true
);
reportGenerator
.
addFunctionsAndContext
(
workbook4Validate
,
functions
,
reportGenerator
.
initContext
(
resources
,
periodParam
),
true
);
FormulaEvaluator
validateEvaluator
=
workbook4Validate
.
getCreationHelper
().
createFormulaEvaluator
();
validateEvaluator
.
evaluateAll
();
//todo: 4.then save the validation result to cellData table
...
...
@@ -2423,7 +2432,7 @@ public class ReportServiceImpl extends BaseService {
}
dataList
.
add
(
orgTypeList
);
}
if
(
dataList
.
size
()
==
0
)
{
if
(
dataList
.
size
()
==
0
)
{
throw
new
Exception
(
"没有可导出的数据"
);
}
if
(
template
.
getIsSystemType
())
{
...
...
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