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
aae9f6a9
Commit
aae9f6a9
authored
Nov 06, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Optimial] fixed gen data to async
parent
178b5b36
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
425 additions
and
316 deletions
+425
-316
ReportController.java
...in/java/pwc/taxtech/atms/controller/ReportController.java
+3
-14
PeriodResources.java
...ain/java/pwc/taxtech/atms/dto/vatdto/PeriodResources.java
+50
-0
WrapPeriodJobDto.java
...in/java/pwc/taxtech/atms/dto/vatdto/WrapPeriodJobDto.java
+41
-0
ConflictException.java
...in/java/pwc/taxtech/atms/exception/ConflictException.java
+30
-0
Exceptions.java
.../src/main/java/pwc/taxtech/atms/exception/Exceptions.java
+6
-1
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+225
-228
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+70
-73
No files found.
atms-api/src/main/java/pwc/taxtech/atms/controller/ReportController.java
View file @
aae9f6a9
...
@@ -32,22 +32,11 @@ public class ReportController {
...
@@ -32,22 +32,11 @@ public class ReportController {
return
reportService
.
getReportTemplate
(
projectId
,
EnumServiceType
.
getEnumByCode
(
serviceType
),
period
);
return
reportService
.
getReportTemplate
(
projectId
,
EnumServiceType
.
getEnumByCode
(
serviceType
),
period
);
}
}
@RequestMapping
(
value
=
"updateConfig/{projectId}/{ifDeleteManualDataSource}/{period}"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
OperationResultDto
updateConfig
(
@PathVariable
String
projectId
,
@PathVariable
Boolean
ifDeleteManualDataSource
,
@PathVariable
Integer
period
,
@RequestParam
String
generator
,
@RequestParam
Boolean
mergeManual
)
{
return
reportService
.
updateConfig
(
projectId
,
period
,
ifDeleteManualDataSource
,
generator
,
mergeManual
);
// OperationResultDto operationResultDto = new OperationResultDto();
// operationResultDto.setResult(true);
// return operationResultDto;
}
@RequestMapping
(
value
=
"generateByTotal/{projectId}/{ifDeleteManualDataSource}/{period}"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"generateByTotal/{projectId}/{ifDeleteManualDataSource}/{period}"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
OperationResultDto
generateAllData
(
@PathVariable
String
projectId
,
@PathVariable
Boolean
ifDeleteManualDataSource
,
public
OperationResultDto
generateAllData
(
@PathVariable
String
projectId
,
@PathVariable
Boolean
ifDeleteManualDataSource
,
@PathVariable
Integer
period
,
@RequestParam
Optional
<
String
>
generator
)
{
@PathVariable
Integer
period
,
@RequestParam
Optional
<
String
>
generator
,
return
reportService
.
generateData
(
projectId
,
EnumServiceType
.
VAT
,
ifDeleteManualDataSource
,
period
,
null
,
generator
);
@RequestParam
Boolean
mergeManual
)
{
return
reportService
.
generateData
(
projectId
,
EnumServiceType
.
VAT
,
mergeManual
,
period
,
null
,
generator
);
}
}
@RequestMapping
(
value
=
"templateReferences/{period}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"templateReferences/{period}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
...
...
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/PeriodResources.java
0 → 100644
View file @
aae9f6a9
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
lombok.Getter
;
import
pwc.taxtech.atms.common.util.MyAsserts
;
import
pwc.taxtech.atms.entity.Project
;
import
pwc.taxtech.atms.entity.TemplateGroup
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.service.impl.Message
;
import
pwc.taxtech.atms.vat.entity.PeriodCellTemplate
;
import
pwc.taxtech.atms.vat.entity.PeriodCellTemplateConfig
;
import
pwc.taxtech.atms.vat.entity.PeriodTemplate
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Getter
public
class
PeriodResources
{
Project
project
;
List
<
PeriodTemplate
>
periodTemplates
=
new
ArrayList
<>();
List
<
PeriodCellTemplate
>
periodCellTemplates
=
new
ArrayList
<>();
List
<
PeriodCellTemplateConfig
>
periodCellTemplateConfigs
=
new
ArrayList
<>();
public
void
setProject
(
Project
project
)
{
this
.
project
=
project
;
}
public
void
putAllTemplate
(
List
<
PeriodTemplate
>
periodTemplates
)
{
periodTemplates
.
addAll
(
periodTemplates
);
}
public
List
<
Long
>
getTemolateIds
()
{
MyAsserts
.
assertNotEmpty
(
periodTemplates
,
Exceptions
.
NOT_FOUND_TEMPLATE_EXCEPTION
);
return
periodTemplates
.
stream
()
.
map
(
PeriodTemplate:
:
getTemplateId
)
.
collect
(
Collectors
.
toList
());
}
public
void
putAllCellTemplate
(
List
<
PeriodCellTemplate
>
periodCellTemplates
)
{
periodCellTemplates
.
addAll
(
periodCellTemplates
);
}
public
void
putAllCellTemplateConfig
(
List
<
PeriodCellTemplateConfig
>
periodCellTemplateConfigs
)
{
periodCellTemplateConfigs
.
addAll
(
periodCellTemplateConfigs
);
}
public
Long
getTemplateGroupId
(){
return
periodTemplates
.
get
(
0
).
getTemplateGroupId
();
}
}
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/WrapPeriodJobDto.java
0 → 100644
View file @
aae9f6a9
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
pwc.taxtech.atms.common.util.MyAsserts
;
import
pwc.taxtech.atms.entity.Project
;
import
pwc.taxtech.atms.entity.Template
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.vat.entity.PeriodJob
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.UUID
;
public
class
WrapPeriodJobDto
{
public
static
final
String
STATUS_BEGIN
=
"Begin"
;
public
static
final
String
STATUS_CANCEL
=
"Cancel"
;
public
static
final
String
STATUS_ERROR
=
"Error"
;
public
static
final
String
STATUS_END
=
"End"
;
public
static
final
String
STEP_UPDATE_CONFIG
=
"UpdateConfig"
;
public
static
PeriodJob
createReportGenJob
(
String
projectId
,
Integer
period
,
List
<
Template
>
templates
)
{
MyAsserts
.
assertNotEmpty
(
templates
,
Exceptions
.
NOT_FOUND_TEMPLATE_EXCEPTION
);
PeriodJob
job
=
new
PeriodJob
();
job
.
setCreateTime
(
new
Date
());
job
.
setName
(
"Gen All Report"
);
job
.
setProjectId
(
projectId
);
job
.
setPeriod
(
period
);
job
.
setId
(
UUID
.
randomUUID
().
toString
());
job
.
setStatus
(
STATUS_BEGIN
);
job
.
setCurrentStep
(
STEP_UPDATE_CONFIG
);
StringBuilder
builder
=
new
StringBuilder
(
STEP_UPDATE_CONFIG
);
templates
.
forEach
(
m
->
{
builder
.
append
(
","
).
append
(
m
.
getCode
());
});
job
.
setStepsCode
(
builder
.
toString
());
return
job
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/exception/ConflictException.java
0 → 100644
View file @
aae9f6a9
package
pwc
.
taxtech
.
atms
.
exception
;
import
org.springframework.http.ResponseEntity
;
import
javax.net.ssl.SSLEngineResult
;
import
static
org
.
springframework
.
http
.
HttpStatus
.
CONFLICT
;
public
class
ConflictException
extends
ApiException
{
public
ConflictException
()
{
super
();
}
public
ConflictException
(
String
message
)
{
super
(
message
);
}
public
ConflictException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
ConflictException
(
Throwable
cause
)
{
super
(
cause
);
}
@Override
public
<
Object
>
ResponseEntity
handle
()
{
return
ResponseEntity
.
status
(
CONFLICT
).
build
();
}
}
atms-api/src/main/java/pwc/taxtech/atms/exception/Exceptions.java
View file @
aae9f6a9
...
@@ -10,6 +10,11 @@ public class Exceptions {
...
@@ -10,6 +10,11 @@ public class Exceptions {
public
static
final
ApiException
EMPTY_PROJECT_PARAM
=
new
BadParameterException
(
"project is empty"
);
public
static
final
ApiException
EMPTY_PROJECT_PARAM
=
new
BadParameterException
(
"project is empty"
);
public
static
final
ApiException
EMPTY_PRIODDATE_PARAM
=
new
BadParameterException
(
"period data is empty"
);
public
static
final
ApiException
EMPTY_PRIODDATE_PARAM
=
new
BadParameterException
(
"period data is empty"
);
public
static
final
ApiException
NOT_FOUND_REPORT_EXCEPTION
=
new
NotFoundException
(
"not found report"
);
public
static
final
ApiException
NOT_FOUND_REPORT_EXCEPTION
=
new
NotFoundException
(
"not found report"
);
public
static
final
ApiException
NOT_FOUND_TEMPLATE_EXCEPTION
=
new
NotFoundException
(
"not found template"
);
public
static
final
ApiException
REPORT_HAS_COMMIT_EXCEPTION
=
new
AlreadyExistsException
(
"report approval has commit"
);
public
static
final
ApiException
REPORT_HAS_COMMIT_EXCEPTION
=
new
AlreadyExistsException
(
"report approval has commit"
);
public
static
final
ApiException
SERVER_ERROR_EXCEPTION
=
new
ServerErrorException
(
"server error exception"
);
public
static
final
ApiException
SERVER_ERROR_EXCEPTION
=
new
ServerErrorException
(
"server error exception"
);
public
static
final
ApiException
TASK_HAS_BEGINNING
=
new
ConflictException
(
"task has beginning .."
);
public
static
final
ApiException
PROJECT_EMPTY_EXCEPTION
=
new
BadParameterException
(
"projectId is empty"
);
public
static
final
ApiException
PROJECT_PROJECT_EXCEPTION
=
new
NotFoundException
(
"not found project"
);
public
static
final
ApiException
NOT_FOUND_TEMPLATE_GROUP_EXCEPTION
=
new
NotFoundException
(
"not found template group"
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
aae9f6a9
...
@@ -20,7 +20,9 @@ import pwc.taxtech.atms.constant.enums.CellDataSourceType;
...
@@ -20,7 +20,9 @@ import pwc.taxtech.atms.constant.enums.CellDataSourceType;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceType
;
import
pwc.taxtech.atms.constant.enums.FormulaDataSourceType
;
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
;
import
pwc.taxtech.atms.entity.Project
;
import
pwc.taxtech.atms.dto.vatdto.PeriodResources
;
import
pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.service.impl.DistributedIdService
;
import
pwc.taxtech.atms.service.impl.DistributedIdService
;
import
pwc.taxtech.atms.service.impl.HttpFileService
;
import
pwc.taxtech.atms.service.impl.HttpFileService
;
import
pwc.taxtech.atms.vat.dao.*
;
import
pwc.taxtech.atms.vat.dao.*
;
...
@@ -63,78 +65,63 @@ public class ReportGeneratorImpl {
...
@@ -63,78 +65,63 @@ public class ReportGeneratorImpl {
private
PeriodTemplateMapper
periodTemplateMapper
;
private
PeriodTemplateMapper
periodTemplateMapper
;
@Autowired
@Autowired
private
DistributedIdService
distributedIdService
;
private
DistributedIdService
distributedIdService
;
@Autowired
private
PeriodJobMapper
periodJobMapper
;
public
String
generateData
(
String
projectId
,
List
<
Long
>
templateIds
,
Boolean
ifDeleteManualDataSource
,
List
<
String
>
exceptCellTemplates
,
Integer
periodParam
,
Optional
<
String
>
generator
)
{
int
period
=
periodParam
!=
null
?
periodParam
:
0
;
Project
project
=
projectMapper
.
selectByPrimaryKey
(
projectId
);
if
(
templateIds
.
isEmpty
())
templateIds
.
add
(
Long
.
MAX_VALUE
);
List
<
PeriodTemplate
>
periodTemplateList
=
queryPeriodTemplates
(
projectId
,
period
,
templateIds
);
List
<
Long
>
periodTemplateIdList
=
periodTemplateList
.
stream
()
.
map
(
PeriodTemplate:
:
getTemplateId
)
.
collect
(
Collectors
.
toList
());
Long
templateGroupId
=
periodTemplateList
.
size
()
>
0
?
periodTemplateList
.
get
(
0
).
getTemplateGroupId
()
:
0
;
List
<
PeriodCellTemplate
>
periodCellTemplateList
=
queryPeriodCellTemplates
(
projectId
,
period
,
periodTemplateIdList
);
List
<
PeriodCellTemplateConfig
>
periodCellTemplateConfigList
=
queryPeriodCellTemplateConfigs
(
projectId
,
period
,
periodTemplateIdList
);
Optional
<
Workbook
>
workbook
=
createWorkBookWithExcelFileList
(
periodTemplateList
);
if
(
workbook
.
isPresent
())
{
Workbook
newWorkbook
=
workbook
.
get
();
FormulaContext
formulaContext
=
FormulaContext
.
extractContextFromProject
(
project
).
fixedFormula
(
period
,
templateGroupId
,
formulaAgent
);
addFunctionsToWorkbook
(
newWorkbook
,
formulaContext
);
setConfigAndDataToWorkBook
(
newWorkbook
,
periodTemplateList
,
periodCellTemplateList
,
periodCellTemplateConfigList
);
FormulaEvaluator
evaluator
=
newWorkbook
.
getCreationHelper
().
createFormulaEvaluator
();
public
FormulaContext
initContext
(
PeriodResources
resources
,
Integer
period
)
{
evaluator
.
evaluateAll
();
return
FormulaContext
.
extractContextFromProject
(
resources
.
getProject
()).
fixedFormula
(
period
,
resources
.
getTemplateGroupId
(),
formulaAgent
);
}
List
<
PeriodReport
>
reports
=
createReportsByTemplates
(
workbook
.
get
(),
periodTemplateList
,
projectId
,
period
);
public
PeriodResources
getPeriodResources
(
String
projectId
,
Integer
period
,
List
<
Long
>
templateIds
)
{
updateWorkbookCaclsValueToDb
(
projectId
,
period
,
workbook
.
get
(),
reports
,
periodTemplateList
,
periodCellTemplateList
,
periodCellTemplateConfigList
);
PeriodResources
periodResources
=
new
PeriodResources
();
return
"generate report successful"
;
periodResources
.
putAllTemplate
(
queryPeriodTemplates
(
projectId
,
period
,
templateIds
));
}
else
{
periodResources
.
putAllCellTemplate
(
queryPeriodCellTemplates
(
projectId
,
period
,
periodResources
.
getTemolateIds
()));
return
"GenerateReport failed"
;
periodResources
.
putAllCellTemplateConfig
(
queryPeriodCellTemplateConfigs
(
projectId
,
period
,
periodResources
.
getTemolateIds
()));
}
periodResources
.
setProject
(
projectMapper
.
selectByPrimaryKey
(
projectId
));
return
periodResources
;
}
}
private
void
updateWorkbookCaclsValueToDb
(
String
projectId
,
Integer
period
,
Workbook
workbook
,
List
<
PeriodReport
>
periodReports
,
public
void
updateWorkbookCaclsValueToDb
(
String
projectId
,
Integer
period
,
Workbook
workbook
,
PeriodResources
resources
,
PeriodJob
job
)
{
List
<
PeriodTemplate
>
periodTemplateList
,
List
<
PeriodCellTemplate
>
periodCellTemplateList
,
List
<
PeriodCellTemplateConfig
>
periodCellTemplateConfigList
){
for
(
int
i
=
0
;
i
<
workbook
.
getNumberOfSheets
();
i
++)
{
for
(
int
i
=
0
;
i
<
workbook
.
getNumberOfSheets
();
i
++)
{
Sheet
sheet
=
workbook
.
getSheetAt
(
i
);
Sheet
sheet
=
workbook
.
getSheetAt
(
i
);
String
code
=
sheet
.
getSheetName
();
String
code
=
sheet
.
getSheetName
();
Optional
<
PeriodTemplate
>
periodTemplate
=
periodTemplateList
.
stream
()
Optional
<
PeriodTemplate
>
periodTemplate
=
resources
.
getPeriodTemplates
()
.
stream
()
.
filter
(
a
->
a
.
getCode
().
equals
(
code
))
.
filter
(
a
->
a
.
getCode
().
equals
(
code
))
.
findFirst
();
.
findFirst
();
Long
templateId
;
try
{
if
(
periodTemplate
.
isPresent
())
{
templateId
=
periodTemplate
.
get
().
getTemplateId
();
}
else
{
templateId
=
0L
;
}
Optional
<
PeriodReport
>
periodReport
=
periodReports
.
stream
()
.
filter
(
a
->
a
.
getTemplateId
().
equals
(
templateId
))
.
findFirst
();
Long
reportId
;
if
(
periodReport
.
isPresent
())
{
reportId
=
periodReport
.
get
().
getId
();
}
else
{
reportId
=
0L
;
}
if
(
templateId
>
0
)
{
Long
templateId
;
List
<
PeriodCellTemplateConfig
>
periodCellTemplateConfigs
=
periodCellTemplateConfigList
.
stream
()
if
(
periodTemplate
.
isPresent
())
{
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
)
&&
a
.
getDataSourceType
().
equals
(
CellDataSourceType
.
Formula
.
getCode
()))
templateId
=
periodTemplate
.
get
().
getTemplateId
();
.
collect
(
Collectors
.
toList
());
}
else
{
templateId
=
0L
;
List
<
PeriodCellTemplateConfig
>
keyInCellTemplateConfigs
=
periodCellTemplateConfigList
.
stream
()
}
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
)
&&
a
.
getDataSourceType
().
equals
(
CellDataSourceType
.
KeyIn
.
getCode
()))
.
collect
(
Collectors
.
toList
());
//todo: add manual datasource here,in order to disaplay the manual datasource we need add it first at here.
if
(
templateId
>
0
)
{
PeriodReport
report
=
new
PeriodReport
();
Long
reportId
=
distributedIdService
.
nextId
();
report
.
setId
(
reportId
);
report
.
setTemplateId
(
templateId
);
report
.
setPeriod
(
period
);
report
.
setProjectId
(
projectId
);
report
.
setCreateBy
(
"Admin"
);
report
.
setCreateTime
(
new
Date
());
report
.
setUpdateBy
(
"Admin"
);
report
.
setUpdateTime
(
new
Date
());
report
.
setProjectId
(
projectId
);
reportMapper
.
insertSelective
(
report
);
List
<
PeriodCellTemplateConfig
>
periodCellTemplateConfigs
=
resources
.
getPeriodCellTemplateConfigs
().
stream
()
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
)
&&
a
.
getDataSourceType
().
equals
(
CellDataSourceType
.
Formula
.
getCode
()))
.
collect
(
Collectors
.
toList
());
List
<
PeriodCellTemplateConfig
>
keyInCellTemplateConfigs
=
resources
.
getPeriodCellTemplateConfigs
().
stream
()
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
)
&&
a
.
getDataSourceType
().
equals
(
CellDataSourceType
.
KeyIn
.
getCode
()))
.
collect
(
Collectors
.
toList
());
//todo: add manual datasource here,in order to disaplay the manual datasource we need add it first at here.
// for (PeriodCellTemplateConfig keyInCellTemplateConfig : keyInCellTemplateConfigs) {
// for (PeriodCellTemplateConfig keyInCellTemplateConfig : keyInCellTemplateConfigs) {
// PeriodCellTemplateExample periodCellTemplateExample1 = new PeriodCellTemplateExample();
// PeriodCellTemplateExample periodCellTemplateExample1 = new PeriodCellTemplateExample();
// periodCellTemplateExample1.createCriteria().andCellTemplateIdEqualTo(keyInCellTemplateConfig.getCellTemplateId());
// periodCellTemplateExample1.createCriteria().andCellTemplateIdEqualTo(keyInCellTemplateConfig.getCellTemplateId());
...
@@ -160,190 +147,200 @@ public class ReportGeneratorImpl {
...
@@ -160,190 +147,200 @@ public class ReportGeneratorImpl {
// dataSourceMapper.insertSelective(dataSource);
// dataSourceMapper.insertSelective(dataSource);
// }
// }
//update formulablock table reportid field
//update formulablock table reportid field
List
<
Long
>
cellTemplateConfigIds
=
periodCellTemplateConfigs
.
stream
()
List
<
Long
>
cellTemplateConfigIds
=
periodCellTemplateConfigs
.
stream
()
.
map
(
PeriodCellTemplateConfig:
:
getCellTemplateId
)
.
map
(
PeriodCellTemplateConfig:
:
getCellTemplateId
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
if
(
cellTemplateConfigIds
.
size
()
>
0
)
{
if
(
cellTemplateConfigIds
.
size
()
>
0
)
{
periodFormulaBlockMapper
.
updateReportId
(
reportId
,
cellTemplateConfigIds
,
period
,
projectId
);
periodFormulaBlockMapper
.
updateReportId
(
reportId
,
cellTemplateConfigIds
,
period
,
projectId
);
}
}
for
(
PeriodCellTemplateConfig
periodCellTemplateConfig
:
periodCellTemplateConfigs
)
{
for
(
PeriodCellTemplateConfig
periodCellTemplateConfig
:
periodCellTemplateConfigs
)
{
PeriodFormulaBlockExample
periodFormulaBlockExample2
=
new
PeriodFormulaBlockExample
();
PeriodFormulaBlockExample
periodFormulaBlockExample2
=
new
PeriodFormulaBlockExample
();
periodFormulaBlockExample2
.
createCriteria
()
periodFormulaBlockExample2
.
createCriteria
()
.
andProjectIdEqualTo
(
projectId
)
.
andProjectIdEqualTo
(
projectId
)
.
andCellTemplateIdEqualTo
(
periodCellTemplateConfig
.
getCellTemplateId
())
.
andCellTemplateIdEqualTo
(
periodCellTemplateConfig
.
getCellTemplateId
())
.
andReportIdEqualTo
(
reportId
)
.
andReportIdEqualTo
(
reportId
)
.
andPeriodEqualTo
(
period
);
.
andPeriodEqualTo
(
period
);
List
<
PeriodFormulaBlock
>
periodFormulaBlocks
=
periodFormulaBlockMapper
.
selectByExample
(
periodFormulaBlockExample2
);
List
<
PeriodFormulaBlock
>
periodFormulaBlocks
=
periodFormulaBlockMapper
.
selectByExample
(
periodFormulaBlockExample2
);
//TODO:如果formula 为 ND(100) +ND(22) ,需要使用正则表达式拆分出自定义公式,然后根据自定义公式取formulablock 的数据进行替换
//TODO:如果formula 为 ND(100) +ND(22) ,需要使用正则表达式拆分出自定义公式,然后根据自定义公式取formulablock 的数据进行替换
String
regex
=
"[A-Z]*\\([\\-A-Za-z0-9\\\"\\,\\.\\u4e00-\\u9fa5\\%]*\\)"
;
String
regex
=
"[A-Z]*\\([\\-A-Za-z0-9\\\"\\,\\.\\u4e00-\\u9fa5\\%]*\\)"
;
Pattern
p
=
Pattern
.
compile
(
regex
);
Pattern
p
=
Pattern
.
compile
(
regex
);
String
sourceFormula
=
StringUtils
.
isNotBlank
(
periodCellTemplateConfig
.
getKeyValueParsedFormula
())
?
String
sourceFormula
=
StringUtils
.
isNotBlank
(
periodCellTemplateConfig
.
getKeyValueParsedFormula
())
?
periodCellTemplateConfig
.
getKeyValueParsedFormula
()
:
periodCellTemplateConfig
.
getKeyValueParsedFormula
()
:
periodCellTemplateConfig
.
getFormula
();
periodCellTemplateConfig
.
getFormula
();
String
resultFormula
=
StringUtils
.
isNotBlank
(
periodCellTemplateConfig
.
getKeyValueParsedFormula
())
?
String
resultFormula
=
StringUtils
.
isNotBlank
(
periodCellTemplateConfig
.
getKeyValueParsedFormula
())
?
periodCellTemplateConfig
.
getKeyValueParsedFormula
()
:
periodCellTemplateConfig
.
getKeyValueParsedFormula
()
:
periodCellTemplateConfig
.
getFormula
();
periodCellTemplateConfig
.
getFormula
();
Matcher
m
=
p
.
matcher
(
sourceFormula
);
Matcher
m
=
p
.
matcher
(
sourceFormula
);
Boolean
isFind
=
false
;
Boolean
isFind
=
false
;
while
(
m
.
find
())
{
while
(
m
.
find
())
{
isFind
=
true
;
isFind
=
true
;
//如果有些公式无法用正则匹配,可以做特殊处理
//如果有些公式无法用正则匹配,可以做特殊处理
String
findStr
=
m
.
group
();
String
findStr
=
m
.
group
();
Optional
<
PeriodFormulaBlock
>
formulaBlock
=
periodFormulaBlocks
.
stream
()
Optional
<
PeriodFormulaBlock
>
formulaBlock
=
periodFormulaBlocks
.
stream
()
.
filter
(
a
->
a
.
getFormulaExpression
().
equals
(
findStr
))
.
filter
(
a
->
a
.
getFormulaExpression
().
equals
(
findStr
))
.
findFirst
();
.
findFirst
();
if
(
formulaBlock
.
isPresent
())
{
if
(
formulaBlock
.
isPresent
())
{
resultFormula
=
resultFormula
.
replace
(
findStr
,
formulaBlock
.
get
().
getData
());
resultFormula
=
resultFormula
.
replace
(
findStr
,
formulaBlock
.
get
().
getData
());
}
}
}
}
//如果有正则匹配就进行更新公式解析
//如果有正则匹配就进行更新公式解析
if
(
isFind
)
{
if
(
isFind
)
{
periodCellTemplateConfig
.
setParsedFormula
(
StringUtils
.
isNotBlank
(
resultFormula
)
?
resultFormula
:
null
);
periodCellTemplateConfig
.
setParsedFormula
(
StringUtils
.
isNotBlank
(
resultFormula
)
?
resultFormula
:
null
);
if
(
periodCellTemplateConfig
.
getFormula
()
!=
null
&&
!
periodCellTemplateConfig
.
getFormula
().
contains
(
"BB("
))
if
(
periodCellTemplateConfig
.
getFormula
()
!=
null
&&
!
periodCellTemplateConfig
.
getFormula
().
contains
(
"BB("
))
periodCellTemplateConfig
.
setFormula
(
StringUtils
.
isNotBlank
(
periodCellTemplateConfig
.
getFormula
())
?
resultFormula
:
null
);
periodCellTemplateConfig
.
setFormula
(
StringUtils
.
isNotBlank
(
periodCellTemplateConfig
.
getFormula
())
?
resultFormula
:
null
);
periodCellTemplateConfigMapper
.
updateByPrimaryKeySelective
(
periodCellTemplateConfig
);
periodCellTemplateConfigMapper
.
updateByPrimaryKeySelective
(
periodCellTemplateConfig
);
}
}
String
regexNormalCell
=
"[A-Z]{1,2}((?!0)[0-9]{1,3})"
;
String
regexNormalCell
=
"[A-Z]{1,2}((?!0)[0-9]{1,3})"
;
p
=
Pattern
.
compile
(
regexNormalCell
);
p
=
Pattern
.
compile
(
regexNormalCell
);
m
=
p
.
matcher
(
sourceFormula
);
m
=
p
.
matcher
(
sourceFormula
);
while
(
m
.
find
())
{
while
(
m
.
find
())
{
//如果找到普通单元格的公式,就去workbook里查找对应的格子取数据,然后放到DataSource,作为普通单元格数据源的数据
//如果找到普通单元格的公式,就去workbook里查找对应的格子取数据,然后放到DataSource,作为普通单元格数据源的数据
//找到一个格子就加一条数据
//找到一个格子就加一条数据
String
findStr
=
m
.
group
();
//A12,A13,A15,how to get A and 12 or A and 13
String
findStr
=
m
.
group
();
//A12,A13,A15,how to get A and 12 or A and 13
String
regexColumn
=
"[A-Z]{1,2}"
;
String
regexColumn
=
"[A-Z]{1,2}"
;
Pattern
pp
=
Pattern
.
compile
(
regexColumn
);
Pattern
pp
=
Pattern
.
compile
(
regexColumn
);
Matcher
mm
=
pp
.
matcher
(
findStr
);
Matcher
mm
=
pp
.
matcher
(
findStr
);
while
(
mm
.
find
())
{
while
(
mm
.
find
())
{
String
colStr
=
mm
.
group
();
String
colStr
=
mm
.
group
();
int
colNum
=
FormulaHelper
.
excelColStrToNum
(
colStr
,
colStr
.
length
());
int
colNum
=
FormulaHelper
.
excelColStrToNum
(
colStr
,
colStr
.
length
());
int
rowNum
=
Integer
.
parseInt
(
StringUtils
.
removeStart
(
findStr
,
colStr
));
int
rowNum
=
Integer
.
parseInt
(
StringUtils
.
removeStart
(
findStr
,
colStr
));
Row
row
=
sheet
.
getRow
(
rowNum
-
1
);
Row
row
=
sheet
.
getRow
(
rowNum
-
1
);
if
(
row
!=
null
)
{
if
(
row
!=
null
)
{
Cell
cell
=
row
.
getCell
(
colNum
-
1
);
Cell
cell
=
row
.
getCell
(
colNum
-
1
);
if
(
cell
!=
null
)
{
if
(
cell
!=
null
)
{
//开始取值然后存放到DataSource
//开始取值然后存放到DataSource
PeriodDataSource
dataSource
=
new
PeriodDataSource
();
PeriodDataSource
dataSource
=
new
PeriodDataSource
();
dataSource
.
setId
(
distributedIdService
.
nextId
());
dataSource
.
setId
(
distributedIdService
.
nextId
());
dataSource
.
setColumnIndex
(
colNum
-
1
);
dataSource
.
setColumnIndex
(
colNum
-
1
);
dataSource
.
setRowIndex
(
rowNum
-
1
);
dataSource
.
setRowIndex
(
rowNum
-
1
);
if
(((
XSSFCell
)
cell
).
getRawValue
()
!=
"#VALUE!"
)
{
if
(((
XSSFCell
)
cell
).
getRawValue
()
!=
"#VALUE!"
)
{
dataSource
.
setAmount
(
new
BigDecimal
(
dataSource
.
setAmount
(
new
BigDecimal
(
((
XSSFCell
)
cell
).
getRawValue
()
!=
null
?
((
XSSFCell
)
cell
).
getRawValue
()
!=
null
?
((
XSSFCell
)
cell
).
getRawValue
()
((
XSSFCell
)
cell
).
getRawValue
()
:
(
StringUtils
.
isNotBlank
(
cell
.
getStringCellValue
()))
?
:
(
StringUtils
.
isNotBlank
(
cell
.
getStringCellValue
()))
?
cell
.
getStringCellValue
()
cell
.
getStringCellValue
()
:
Double
.
toString
(
cell
.
getNumericCellValue
())));
:
Double
.
toString
(
cell
.
getNumericCellValue
())));
}
else
{
}
else
{
dataSource
.
setAmount
(
new
BigDecimal
(
"0.0"
));
dataSource
.
setAmount
(
new
BigDecimal
(
"0.0"
));
}
dataSource
.
setName
(
"ReportDataSource"
);
dataSource
.
setDescription
(
findStr
);
dataSource
.
setCreateTime
(
new
Date
());
dataSource
.
setUpdateTime
(
new
Date
());
dataSource
.
setCreateBy
(
"Admin"
);
dataSource
.
setUpdateBy
(
"Admin"
);
dataSource
.
setPeriod
(
period
);
dataSource
.
setCellTemplateId
(
periodCellTemplateConfig
.
getCellTemplateId
());
dataSource
.
setType
(
FormulaDataSourceType
.
Report
.
getCode
());
dataSource
.
setProjectId
(
projectId
);
periodDataSourceMapper
.
insertSelective
(
dataSource
);
//这里有个问题就是DataSource的数据有了,但是celldatasource的数据没有,后面无法关联celldata和DataSource
//解决办法就是 在存DataSource的时候就先把celldata的数据加好
//然后把celldatasource的数据也加好
//然后在外面去更新celldata和celldatasource的数据
//还有就是把公式里的数据源放到内存,在所有算完之后再统一加数据源
}
}
dataSource
.
setName
(
"ReportDataSource"
);
dataSource
.
setDescription
(
findStr
);
dataSource
.
setCreateTime
(
new
Date
());
dataSource
.
setUpdateTime
(
new
Date
());
dataSource
.
setCreateBy
(
"Admin"
);
dataSource
.
setUpdateBy
(
"Admin"
);
dataSource
.
setPeriod
(
period
);
dataSource
.
setCellTemplateId
(
periodCellTemplateConfig
.
getCellTemplateId
());
dataSource
.
setType
(
FormulaDataSourceType
.
Report
.
getCode
());
dataSource
.
setProjectId
(
projectId
);
periodDataSourceMapper
.
insertSelective
(
dataSource
);
//这里有个问题就是DataSource的数据有了,但是celldatasource的数据没有,后面无法关联celldata和DataSource
//解决办法就是 在存DataSource的时候就先把celldata的数据加好
//然后把celldatasource的数据也加好
//然后在外面去更新celldata和celldatasource的数据
//还有就是把公式里的数据源放到内存,在所有算完之后再统一加数据源
}
}
}
}
}
}
}
Optional
<
PeriodCellTemplate
>
tempPeriodCellTemplate
=
periodCellTemplateList
.
stream
()
Optional
<
PeriodCellTemplate
>
tempPeriodCellTemplate
=
resources
.
getPeriodCellTemplates
()
.
stream
()
.
filter
(
a
->
a
.
getCellTemplateId
().
equals
(
periodCellTemplateConfig
.
getCellTemplateId
()))
.
filter
(
a
->
a
.
getCellTemplateId
().
equals
(
periodCellTemplateConfig
.
getCellTemplateId
()))
.
findFirst
();
.
findFirst
();
if
(
tempPeriodCellTemplate
.
isPresent
())
{
if
(
tempPeriodCellTemplate
.
isPresent
())
{
PeriodCellData
cellData
=
new
PeriodCellData
();
PeriodCellData
cellData
=
new
PeriodCellData
();
Long
cellDataId
=
distributedIdService
.
nextId
();
Long
cellDataId
=
distributedIdService
.
nextId
();
cellData
.
setId
(
cellDataId
);
cellData
.
setId
(
cellDataId
);
cellData
.
setReportId
(
reportId
);
cellData
.
setReportId
(
reportId
);
cellData
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
cellData
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
String
data
;
String
data
;
if
(
sheet
.
getRow
(
tempPeriodCellTemplate
.
get
().
getRowIndex
())
!=
null
if
(
sheet
.
getRow
(
tempPeriodCellTemplate
.
get
().
getRowIndex
())
!=
null
&&
sheet
.
getRow
(
tempPeriodCellTemplate
.
get
().
getRowIndex
())
&&
sheet
.
getRow
(
tempPeriodCellTemplate
.
get
().
getRowIndex
())
.
getCell
(
tempPeriodCellTemplate
.
get
().
getColumnIndex
())
!=
null
)
{
.
getCell
(
tempPeriodCellTemplate
.
get
().
getColumnIndex
())
!=
null
)
{
Cell
cell
=
sheet
.
getRow
(
tempPeriodCellTemplate
.
get
().
getRowIndex
())
Cell
cell
=
sheet
.
getRow
(
tempPeriodCellTemplate
.
get
().
getRowIndex
())
.
getCell
(
tempPeriodCellTemplate
.
get
().
getColumnIndex
());
.
getCell
(
tempPeriodCellTemplate
.
get
().
getColumnIndex
());
data
=
((
XSSFCell
)
cell
).
getRawValue
();
data
=
((
XSSFCell
)
cell
).
getRawValue
();
if
(
data
!=
null
&&
data
.
equals
(
"#VALUE!"
))
{
if
(
data
!=
null
&&
data
.
equals
(
"#VALUE!"
))
{
data
=
"0.0"
;
data
=
"0.0"
;
}
}
//evaluator.evaluate(cell);
//evaluator.evaluate(cell);
// if (cell.getCellTypeEnum().equals(CellType.NUMERIC)||cell.getCellTypeEnum().equals(CellType.FORMULA)) {
// if (cell.getCellTypeEnum().equals(CellType.NUMERIC)||cell.getCellTypeEnum().equals(CellType.FORMULA)) {
// data = Double.toString(cell.getNumericCellValue());
// data = Double.toString(cell.getNumericCellValue());
// } else {
// } else {
// data = cell.getStringCellValue();
// data = cell.getStringCellValue();
// }
// }
}
else
{
}
else
{
data
=
EMPTY
;
data
=
EMPTY
;
}
}
if
(
StringUtils
.
isNotBlank
(
data
))
{
if
(
StringUtils
.
isNotBlank
(
data
))
{
Pattern
pattern
=
Pattern
.
compile
(
"[0-9.]*"
);
Pattern
pattern
=
Pattern
.
compile
(
"[0-9.]*"
);
Matcher
isNum
=
pattern
.
matcher
(
data
);
Matcher
isNum
=
pattern
.
matcher
(
data
);
if
(
isNum
.
matches
())
{
if
(
isNum
.
matches
())
{
cellData
.
setData
(
new
BigDecimal
(
data
).
toString
());
cellData
.
setData
(
new
BigDecimal
(
data
).
toString
());
}
else
{
cellData
.
setData
(
data
);
}
}
else
{
}
else
{
cellData
.
setData
(
data
);
cellData
.
setData
(
data
);
}
}
}
else
{
cellData
.
setData
(
data
);
}
//cellData.setData(new BigDecimal(data).toString());
//cellData.setData(new BigDecimal(data).toString());
// PeriodFormulaBlockExample periodFormulaBlockExample = new PeriodFormulaBlockExample();
// PeriodFormulaBlockExample periodFormulaBlockExample = new PeriodFormulaBlockExample();
// periodFormulaBlockExample.createCriteria().andPeriodEqualTo(period)
// periodFormulaBlockExample.createCriteria().andPeriodEqualTo(period)
// .andCellTemplateIdEqualTo(tempPeriodCellTemplate.get().getCellTemplateId());
// .andCellTemplateIdEqualTo(tempPeriodCellTemplate.get().getCellTemplateId());
if
(
StringUtils
.
isBlank
(
resultFormula
))
{
if
(
StringUtils
.
isBlank
(
resultFormula
))
{
resultFormula
=
null
;
resultFormula
=
null
;
}
}
// if (isFind) {
// if (isFind) {
cellData
.
setFormulaExp
(
resultFormula
);
cellData
.
setFormulaExp
(
resultFormula
);
// } else {
// } else {
// cellData.setFormulaExp(EMPTY);
// cellData.setFormulaExp(EMPTY);
// }
// }
cellData
.
setCreateBy
(
"Admin"
);
cellData
.
setCreateBy
(
"Admin"
);
cellData
.
setCreateTime
(
new
Date
());
cellData
.
setCreateTime
(
new
Date
());
cellData
.
setUpdateBy
(
"Admin"
);
cellData
.
setUpdateBy
(
"Admin"
);
cellData
.
setUpdateTime
(
new
Date
());
cellData
.
setUpdateTime
(
new
Date
());
cellData
.
setProjectId
(
projectId
);
cellData
.
setProjectId
(
projectId
);
cellData
.
setPeriod
(
period
);
cellData
.
setPeriod
(
period
);
periodCellDataMapper
.
insertSelective
(
cellData
);
periodCellDataMapper
.
insertSelective
(
cellData
);
//after insert celldata, insert the celldatasource for link celldata and datasource
//after insert celldata, insert the celldatasource for link celldata and datasource
PeriodDataSourceExample
dataSourceExample
=
new
PeriodDataSourceExample
();
PeriodDataSourceExample
dataSourceExample
=
new
PeriodDataSourceExample
();
dataSourceExample
.
createCriteria
().
andPeriodEqualTo
(
period
)
dataSourceExample
.
createCriteria
().
andPeriodEqualTo
(
period
)
.
andCellTemplateIdEqualTo
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
.
andCellTemplateIdEqualTo
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
List
<
PeriodDataSource
>
dataSourceList
=
SpringContextUtil
.
periodDataSourceMapper
.
selectByExample
(
dataSourceExample
);
List
<
PeriodDataSource
>
dataSourceList
=
SpringContextUtil
.
periodDataSourceMapper
.
selectByExample
(
dataSourceExample
);
for
(
int
ii
=
0
;
ii
<
dataSourceList
.
size
();
ii
++)
{
for
(
int
ii
=
0
;
ii
<
dataSourceList
.
size
();
ii
++)
{
PeriodDataSource
dataSource
=
dataSourceList
.
get
(
ii
);
PeriodDataSource
dataSource
=
dataSourceList
.
get
(
ii
);
PeriodCellDataSource
cellDataSource
=
new
PeriodCellDataSource
();
PeriodCellDataSource
cellDataSource
=
new
PeriodCellDataSource
();
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
cellDataSource
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
cellDataSource
.
setCellDataId
(
cellDataId
);
cellDataSource
.
setCellDataId
(
cellDataId
);
cellDataSource
.
setDataSourceId
(
dataSource
.
getId
());
cellDataSource
.
setDataSourceId
(
dataSource
.
getId
());
cellDataSource
.
setCreateTime
(
new
Date
());
cellDataSource
.
setCreateTime
(
new
Date
());
cellDataSource
.
setUpdateTime
(
new
Date
());
cellDataSource
.
setUpdateTime
(
new
Date
());
cellDataSource
.
setPeriod
(
period
);
cellDataSource
.
setPeriod
(
period
);
cellDataSource
.
setProjectId
(
projectId
);
cellDataSource
.
setProjectId
(
projectId
);
SpringContextUtil
.
periodCellDataSourceMapper
.
insertSelective
(
cellDataSource
);
SpringContextUtil
.
periodCellDataSourceMapper
.
insertSelective
(
cellDataSource
);
}
}
}
}
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
job
.
setStatus
(
WrapPeriodJobDto
.
STATUS_ERROR
);
job
.
setErrorMsg
(
"cacals report for code "
+
code
+
" failed"
);
}
finally
{
job
.
setCurrentStep
(
code
);
periodJobMapper
.
updateByPrimaryKey
(
job
);
}
}
}
}
}
}
...
@@ -383,14 +380,12 @@ public class ReportGeneratorImpl {
...
@@ -383,14 +380,12 @@ public class ReportGeneratorImpl {
return
reports
;
return
reports
;
}
}
private
void
setConfigAndDataToWorkBook
(
Workbook
workbook
,
List
<
PeriodTemplate
>
periodTemplates
,
public
void
setConfigAndDataToWorkBook
(
Workbook
workbook
,
PeriodResources
resources
)
{
List
<
PeriodCellTemplate
>
periodCellTemplates
,
List
<
PeriodCellTemplateConfig
>
periodCellTemplateConfigs
)
{
for
(
int
i
=
0
;
i
<
workbook
.
getNumberOfSheets
();
i
++)
{
for
(
int
i
=
0
;
i
<
workbook
.
getNumberOfSheets
();
i
++)
{
Sheet
sheet
=
workbook
.
getSheetAt
(
i
);
Sheet
sheet
=
workbook
.
getSheetAt
(
i
);
String
code
=
sheet
.
getSheetName
();
String
code
=
sheet
.
getSheetName
();
Optional
<
PeriodTemplate
>
periodTemplate
=
periodTemplates
.
stream
()
Optional
<
PeriodTemplate
>
periodTemplate
=
resources
.
getPeriodTemplates
()
.
stream
()
.
filter
(
a
->
a
.
getCode
().
equals
(
code
))
.
filter
(
a
->
a
.
getCode
().
equals
(
code
))
.
findFirst
();
.
findFirst
();
Long
templateId
;
Long
templateId
;
...
@@ -403,11 +398,11 @@ public class ReportGeneratorImpl {
...
@@ -403,11 +398,11 @@ public class ReportGeneratorImpl {
if
(
templateId
>
0
)
{
if
(
templateId
>
0
)
{
//get cell template and cell template config with templateId
//get cell template and cell template config with templateId
Map
<
PeriodCellTemplate
,
PeriodCellTemplateConfig
>
cellTemplatePeriodCellTemplateConfigMap
=
new
HashMap
<>();
Map
<
PeriodCellTemplate
,
PeriodCellTemplateConfig
>
cellTemplatePeriodCellTemplateConfigMap
=
new
HashMap
<>();
List
<
PeriodCellTemplate
>
tempPeriodCellTemplateList
=
periodCellTemplates
.
stream
()
List
<
PeriodCellTemplate
>
tempPeriodCellTemplateList
=
resources
.
getPeriodCellTemplates
()
.
stream
()
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
))
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
tempPeriodCellTemplateList
.
forEach
(
a
->
{
tempPeriodCellTemplateList
.
forEach
(
a
->
{
Optional
<
PeriodCellTemplateConfig
>
tempCellTemplateConfig
=
periodCellTemplateConfigs
.
stream
()
Optional
<
PeriodCellTemplateConfig
>
tempCellTemplateConfig
=
resources
.
getPeriodCellTemplateConfigs
()
.
stream
()
.
filter
(
item
->
item
.
getCellTemplateId
().
equals
(
a
.
getCellTemplateId
())
.
filter
(
item
->
item
.
getCellTemplateId
().
equals
(
a
.
getCellTemplateId
())
&&
item
.
getDataSourceType
().
equals
(
CellDataSourceType
.
Formula
.
getCode
()))
&&
item
.
getDataSourceType
().
equals
(
CellDataSourceType
.
Formula
.
getCode
()))
.
findFirst
();
.
findFirst
();
...
@@ -480,7 +475,7 @@ public class ReportGeneratorImpl {
...
@@ -480,7 +475,7 @@ public class ReportGeneratorImpl {
* @param templates 模板code和模板路径 键值对
* @param templates 模板code和模板路径 键值对
* @return 工作簿workbook
* @return 工作簿workbook
*/
*/
p
rivate
Optional
<
Workbook
>
createWorkBookWithExcelFileList
(
List
<
PeriodTemplate
>
templates
)
{
p
ublic
Workbook
createWorkBookByPeriodTemplate
(
List
<
PeriodTemplate
>
templates
,
PeriodJob
periodJob
)
{
Workbook
workbook
=
new
XSSFWorkbook
();
Workbook
workbook
=
new
XSSFWorkbook
();
try
{
try
{
String
filePath
=
this
.
getClass
().
getResource
(
""
).
toURI
().
getPath
();
String
filePath
=
this
.
getClass
().
getResource
(
""
).
toURI
().
getPath
();
...
@@ -516,11 +511,14 @@ public class ReportGeneratorImpl {
...
@@ -516,11 +511,14 @@ public class ReportGeneratorImpl {
}
}
POIUtil
.
cloneSheet
(
tWorkbook
.
getSheetAt
(
0
),
workbook
.
createSheet
(
a
.
getCode
()));
POIUtil
.
cloneSheet
(
tWorkbook
.
getSheetAt
(
0
),
workbook
.
createSheet
(
a
.
getCode
()));
});
});
return
Optional
.
of
(
workbook
)
;
return
workbook
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"createWorkBookWithExcelFileList error."
,
e
);
logger
.
error
(
"createWorkBookByPeriodTemplate error."
,
e
);
periodJob
.
setStatus
(
WrapPeriodJobDto
.
STATUS_ERROR
);
periodJob
.
setErrorMsg
(
"error for gen excel , redo it later!!1"
);
periodJobMapper
.
updateByPrimaryKey
(
periodJob
);
throw
Exceptions
.
SERVER_ERROR_EXCEPTION
;
}
}
return
Optional
.
empty
();
}
}
/**
/**
...
@@ -528,12 +526,11 @@ public class ReportGeneratorImpl {
...
@@ -528,12 +526,11 @@ public class ReportGeneratorImpl {
*
*
* @param workbook 工作簿
* @param workbook 工作簿
*/
*/
private
void
addFunctionsToWorkbook
(
Workbook
workbook
,
FormulaContext
formulaContext
)
{
public
void
addFunctionsAndContext
(
Workbook
workbook
,
String
[]
functions
,
FormulaContext
formulaContext
)
{
String
[]
functionNames
=
{
"SGSR"
,
"FSJZ"
,
"ND"
,
"BB"
,
"XXFP"
,
"GZSD"
,
"ProjectContext"
,
"JXFPMX"
,
"JXFP"
};
FreeRefFunction
[]
functionImpls
=
{
new
SGSR
(
formulaContext
),
new
FSJZ
(
formulaContext
),
new
ND
(
formulaContext
),
FreeRefFunction
[]
functionImpls
=
{
new
SGSR
(
formulaContext
),
new
FSJZ
(
formulaContext
),
new
ND
(
formulaContext
),
new
BB
(
formulaContext
),
new
XXFP
(
formulaContext
),
new
GZSD
(
formulaContext
),
new
ProjectContext
(
formulaContext
)
new
BB
(
formulaContext
),
new
XXFP
(
formulaContext
),
new
GZSD
(
formulaContext
),
new
ProjectContext
(
formulaContext
)
,
new
JXFPMX
(
formulaContext
),
new
JXFP
(
formulaContext
)};
,
new
JXFPMX
(
formulaContext
),
new
JXFP
(
formulaContext
)};
UDFFinder
udfs
=
new
DefaultUDFFinder
(
function
Name
s
,
functionImpls
);
UDFFinder
udfs
=
new
DefaultUDFFinder
(
functions
,
functionImpls
);
UDFFinder
udfToolpack
=
new
AggregatingUDFFinder
(
udfs
);
UDFFinder
udfToolpack
=
new
AggregatingUDFFinder
(
udfs
);
workbook
.
addToolPack
(
udfToolpack
);
workbook
.
addToolPack
(
udfToolpack
);
}
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
aae9f6a9
...
@@ -2,8 +2,9 @@ package pwc.taxtech.atms.vat.service.impl;
...
@@ -2,8 +2,9 @@ package pwc.taxtech.atms.vat.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.grapecity.documents.excel.Workbook
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.FormulaEvaluator
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.reflections.util.Utils
;
import
org.reflections.util.Utils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -12,15 +13,14 @@ import org.springframework.stereotype.Component;
...
@@ -12,15 +13,14 @@ import org.springframework.stereotype.Component;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.common.util.MyAsserts
;
import
pwc.taxtech.atms.common.util.MyAsserts
;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.constant.Constant
;
import
pwc.taxtech.atms.constant.enums.*
;
import
pwc.taxtech.atms.constant.enums.*
;
import
pwc.taxtech.atms.dao.*
;
import
pwc.taxtech.atms.dao.*
;
import
pwc.taxtech.atms.dpo.ReportDto
;
import
pwc.taxtech.atms.dpo.ReportDto
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.vatdto.*
;
import
pwc.taxtech.atms.dto.vatdto.*
;
import
pwc.taxtech.atms.entity.*
;
import
pwc.taxtech.atms.entity.*
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.exception.NotFoundException
;
import
pwc.taxtech.atms.exception.NotFoundException
;
import
pwc.taxtech.atms.exception.NotSupportedException
;
import
pwc.taxtech.atms.service.impl.CellConfigTranslater
;
import
pwc.taxtech.atms.service.impl.CellConfigTranslater
;
import
pwc.taxtech.atms.service.impl.DistributedIdService
;
import
pwc.taxtech.atms.service.impl.DistributedIdService
;
import
pwc.taxtech.atms.vat.dao.*
;
import
pwc.taxtech.atms.vat.dao.*
;
...
@@ -28,14 +28,14 @@ import pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto;
...
@@ -28,14 +28,14 @@ import pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto;
import
pwc.taxtech.atms.vat.dpo.DataSourceExtendDto
;
import
pwc.taxtech.atms.vat.dpo.DataSourceExtendDto
;
import
pwc.taxtech.atms.vat.dpo.InputVATInvoiceItemExtendDto
;
import
pwc.taxtech.atms.vat.dpo.InputVATInvoiceItemExtendDto
;
import
pwc.taxtech.atms.vat.entity.*
;
import
pwc.taxtech.atms.vat.entity.*
;
import
pwc.taxtech.atms.vat.service.impl.report.functions.FormulaContext
;
import
pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper
;
import
pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -43,6 +43,8 @@ import java.util.stream.Collectors;
...
@@ -43,6 +43,8 @@ import java.util.stream.Collectors;
@Component
@Component
public
class
ReportServiceImpl
{
public
class
ReportServiceImpl
{
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ReportServiceImpl
.
class
);
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ReportServiceImpl
.
class
);
private
BlockingQueue
<
PeriodJob
>
queue
=
new
LinkedBlockingQueue
<>();
private
final
static
String
[]
functions
=
{
"SGSR"
,
"FSJZ"
,
"ND"
,
"BB"
,
"XXFP"
,
"GZSD"
,
"ProjectContext"
,
"JXFPMX"
,
"JXFP"
};
@Autowired
@Autowired
private
ReportGeneratorImpl
reportGenerator
;
private
ReportGeneratorImpl
reportGenerator
;
...
@@ -96,6 +98,8 @@ public class ReportServiceImpl {
...
@@ -96,6 +98,8 @@ public class ReportServiceImpl {
private
ProjectMapper
projectMapper
;
private
ProjectMapper
projectMapper
;
@Autowired
@Autowired
private
DistributedIdService
distributedIdService
;
private
DistributedIdService
distributedIdService
;
@Autowired
private
PeriodJobMapper
periodJobMapper
;
public
OperationResultDto
<
List
<
ReportDto
>>
getReportTemplate
(
String
projectId
,
EnumServiceType
serviceType
,
Integer
periodParam
)
{
public
OperationResultDto
<
List
<
ReportDto
>>
getReportTemplate
(
String
projectId
,
EnumServiceType
serviceType
,
Integer
periodParam
)
{
int
period
=
periodParam
!=
null
?
periodParam
:
0
;
int
period
=
periodParam
!=
null
?
periodParam
:
0
;
...
@@ -255,39 +259,33 @@ public class ReportServiceImpl {
...
@@ -255,39 +259,33 @@ public class ReportServiceImpl {
}
}
public
OperationResultDto
updateConfig
(
String
projectId
,
Integer
period
,
Boolean
ifDeleteManualDataSource
,
private
void
updateConfig
(
String
projectId
,
Integer
period
,
Boolean
isMergeManualData
,
List
<
Template
>
templates
,
PeriodJob
job
)
{
String
generator
,
Boolean
isMergeManualData
)
{
OperationResultDto
result
=
new
OperationResultDto
();
try
{
try
{
if
(
period
==
null
)
{
result
.
setResultMsg
(
"peirod is null"
);
return
result
;
}
Project
project
=
projectMapper
.
selectByPrimaryKey
(
projectId
);
if
(
project
==
null
)
{
result
.
setResultMsg
(
"NoProject"
);
return
result
;
}
List
<
Long
>
exceptTemplateIds
=
templateMapper
.
getIdsForExceptTemplate
();
List
<
Long
>
exceptTemplateIds
=
templateMapper
.
getIdsForExceptTemplate
();
Long
templateGroupId
=
projectMapper
.
getTemplateGroupIdByProject
(
projectId
,
EnumServiceType
.
VAT
.
getCode
());
clearPeriodData
(
projectId
,
period
,
exceptTemplateIds
,
isMergeManualData
);
if
(
templateGroupId
!=
null
&&
templateGroupId
!=
0
)
{
// 先进行数据清理,包括period开头的所有报表配置表 条件Period
copyTemplateAndConfigFromAdmin
(
projectId
,
templates
,
period
);
clearPeriodData
(
projectId
,
period
,
exceptTemplateIds
,
isMergeManualData
);
copyTemplateAndConfigFromAdmin
(
projectId
,
templateGroupId
,
period
);
}
else
{
result
.
setResult
(
true
);
result
.
setResultMsg
(
"there is no templateGroup"
);
return
result
;
}
result
.
setResult
(
true
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
result
.
setResult
(
false
);
job
.
setStatus
(
WrapPeriodJobDto
.
STATUS_ERROR
);
job
.
setErrorMsg
(
"error update config with projectId "
+
projectId
+
" period"
+
period
);
periodJobMapper
.
updateByPrimaryKey
(
job
);
logger
.
error
(
ex
.
getMessage
(),
ex
);
logger
.
error
(
ex
.
getMessage
(),
ex
);
}
}
return
result
;
}
private
List
<
Template
>
getTemplatesByProjectId
(
String
projectId
)
{
MyAsserts
.
assertEmpty
(
projectId
,
Exceptions
.
PROJECT_PROJECT_EXCEPTION
);
Project
project
=
projectMapper
.
selectByPrimaryKey
(
projectId
);
MyAsserts
.
assertNotNull
(
project
,
Exceptions
.
NOT_FOUND_REPORT_EXCEPTION
);
Long
templateGroupId
=
projectMapper
.
getTemplateGroupIdByProject
(
projectId
,
EnumServiceType
.
VAT
.
getCode
());
MyAsserts
.
assertNotNull
(
templateGroupId
,
Exceptions
.
NOT_FOUND_TEMPLATE_GROUP_EXCEPTION
);
List
<
Template
>
templates
=
queryTemplateByGroup
(
templateGroupId
);
MyAsserts
.
assertNotEmpty
(
templates
,
Exceptions
.
NOT_FOUND_TEMPLATE_EXCEPTION
);
templates
.
sort
(
Comparator
.
comparing
(
Template:
:
getOrderIndex
));
return
templates
;
}
}
private
void
copyPeriodConfigFromCellTemplateConfig
(
String
projectId
,
Long
templateId
,
Integer
period
)
{
private
void
copyPeriodConfigFromCellTemplateConfig
(
String
projectId
,
Long
templateId
,
Integer
period
)
{
...
@@ -421,11 +419,13 @@ public class ReportServiceImpl {
...
@@ -421,11 +419,13 @@ public class ReportServiceImpl {
periodCellTemplateMapper
.
batchInsert
(
periodCellTemplateList
);
periodCellTemplateMapper
.
batchInsert
(
periodCellTemplateList
);
}
}
private
void
copyTemplateAndConfigFromAdmin
(
String
projectId
,
Long
templateGroupId
,
Integer
perio
d
)
{
private
List
<
Template
>
queryTemplateByGroup
(
Long
templateGroupI
d
)
{
TemplateExample
example
=
new
TemplateExample
();
TemplateExample
example
=
new
TemplateExample
();
example
.
createCriteria
().
andTemplateGroupIdEqualTo
(
templateGroupId
).
andIsActiveAssociationEqualTo
(
true
);
example
.
createCriteria
().
andTemplateGroupIdEqualTo
(
templateGroupId
).
andIsActiveAssociationEqualTo
(
true
);
List
<
Template
>
templates
=
templateMapper
.
selectByExample
(
example
);
return
templateMapper
.
selectByExample
(
example
);
}
private
void
copyTemplateAndConfigFromAdmin
(
String
projectId
,
List
<
Template
>
templates
,
Integer
period
)
{
List
<
PeriodTemplate
>
periodTemplateList
=
new
ArrayList
<>();
List
<
PeriodTemplate
>
periodTemplateList
=
new
ArrayList
<>();
for
(
Template
template
:
templates
)
{
for
(
Template
template
:
templates
)
{
Long
startTime
=
System
.
currentTimeMillis
();
Long
startTime
=
System
.
currentTimeMillis
();
...
@@ -458,7 +458,8 @@ public class ReportServiceImpl {
...
@@ -458,7 +458,8 @@ public class ReportServiceImpl {
periodTemplateMapper
.
batchInsert
(
periodTemplateList
);
periodTemplateMapper
.
batchInsert
(
periodTemplateList
);
}
}
public
OperationResultDto
generateData
(
String
projectId
,
EnumServiceType
serviceType
,
Boolean
ifDeleteManualDataSource
,
public
OperationResultDto
generateData
(
String
projectId
,
EnumServiceType
serviceType
,
Boolean
isMergeManualData
,
Integer
periodParam
,
Integer
reportType
,
Optional
<
String
>
generator
)
{
Integer
periodParam
,
Integer
reportType
,
Optional
<
String
>
generator
)
{
OperationResultDto
operationResultDto
=
new
OperationResultDto
();
OperationResultDto
operationResultDto
=
new
OperationResultDto
();
try
{
try
{
...
@@ -468,13 +469,38 @@ public class ReportServiceImpl {
...
@@ -468,13 +469,38 @@ public class ReportServiceImpl {
}
}
MyAsserts
.
assertEq
(
serviceType
,
EnumServiceType
.
VAT
,
new
NotFoundException
());
MyAsserts
.
assertEq
(
serviceType
,
EnumServiceType
.
VAT
,
new
NotFoundException
());
List
<
Long
>
templateIds
=
queryTemplates
(
projectId
,
periodParam
,
reportType
,
serviceType
.
getCode
().
toString
());
PeriodJobExample
example
=
new
PeriodJobExample
();
example
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andPeriodEqualTo
(
periodParam
)
.
andStatusEqualTo
(
WrapPeriodJobDto
.
STATUS_BEGIN
);
MyAsserts
.
assertEmpty
(
periodJobMapper
.
selectByExample
(
example
),
Exceptions
.
TASK_HAS_BEGINNING
);
String
rslt
=
reportGenerator
.
generateData
(
projectId
,
templateIds
,
ifDeleteManualDataSource
,
null
,
periodParam
,
generator
);
if
(
StringUtils
.
isBlank
(
rslt
))
{
List
<
Template
>
templates
=
getTemplatesByProjectId
(
projectId
);
operationResultDto
.
setResultMsg
(
"ReportGenerateFailed!"
);
return
operationResultDto
;
PeriodJob
genJob
=
WrapPeriodJobDto
.
createReportGenJob
(
projectId
,
periodParam
,
templates
);
}
periodJobMapper
.
insert
(
genJob
);
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
updateConfig
(
projectId
,
periodParam
,
isMergeManualData
,
templates
,
genJob
);
PeriodResources
resources
=
reportGenerator
.
getPeriodResources
(
projectId
,
periodParam
,
templates
.
stream
().
map
(
Template:
:
getId
).
collect
(
Collectors
.
toList
()));
Workbook
workbook
=
reportGenerator
.
createWorkBookByPeriodTemplate
(
resources
.
getPeriodTemplates
(),
genJob
);
reportGenerator
.
addFunctionsAndContext
(
workbook
,
functions
,
reportGenerator
.
initContext
(
resources
,
periodParam
));
reportGenerator
.
setConfigAndDataToWorkBook
(
workbook
,
resources
);
FormulaEvaluator
evaluator
=
workbook
.
getCreationHelper
().
createFormulaEvaluator
();
evaluator
.
evaluateAll
();
reportGenerator
.
updateWorkbookCaclsValueToDb
(
projectId
,
periodParam
,
workbook
,
resources
,
genJob
);
genJob
.
setStatus
(
WrapPeriodJobDto
.
STATUS_END
);
periodJobMapper
.
updateByPrimaryKey
(
genJob
);
}
}).
start
();
operationResultDto
.
setData
(
genJob
.
getId
());
operationResultDto
.
setResult
(
true
);
operationResultDto
.
setResult
(
true
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
operationResultDto
.
setResult
(
false
);
operationResultDto
.
setResult
(
false
);
...
@@ -483,35 +509,6 @@ public class ReportServiceImpl {
...
@@ -483,35 +509,6 @@ public class ReportServiceImpl {
return
operationResultDto
;
return
operationResultDto
;
}
}
private
List
<
Long
>
queryTemplates
(
String
projectId
,
Integer
period
,
Integer
reportType
,
String
serviceTypeStr
)
{
ProjectServiceTypeExample
projectServiceTypeExample
=
new
ProjectServiceTypeExample
();
projectServiceTypeExample
.
createCriteria
().
andServiceTypeIdEqualTo
(
serviceTypeStr
).
andProjectIdEqualTo
(
projectId
);
Optional
<
Long
>
templateGroupId
=
projectServiceTypeMapper
.
selectByExample
(
projectServiceTypeExample
).
stream
()
.
map
(
ProjectServiceType:
:
getTemplateGroupId
).
findFirst
();
MyAsserts
.
assertNotNull
(
templateGroupId
,
new
NotFoundException
(
"not found group"
));
List
<
Long
>
templateIds
;
if
(
reportType
!=
null
)
{
PeriodTemplateExample
periodTemplateExample
=
new
PeriodTemplateExample
();
periodTemplateExample
.
createCriteria
()
.
andTemplateGroupIdEqualTo
(
templateGroupId
.
get
())
.
andProjectIdEqualTo
(
projectId
)
.
andPeriodEqualTo
(
period
)
.
andIsActiveAssociationEqualTo
(
true
)
.
andReportTypeEqualTo
(
reportType
);
templateIds
=
periodTemplateMapper
.
selectByExample
(
periodTemplateExample
).
stream
().
map
(
PeriodTemplate:
:
getId
).
collect
(
Collectors
.
toList
());
}
else
{
PeriodTemplateExample
periodTemplateExample
=
new
PeriodTemplateExample
();
periodTemplateExample
.
createCriteria
().
andTemplateGroupIdEqualTo
(
templateGroupId
.
get
())
.
andProjectIdEqualTo
(
projectId
)
.
andPeriodEqualTo
(
period
).
andIsActiveAssociationEqualTo
(
true
);
templateIds
=
periodTemplateMapper
.
selectByExample
(
periodTemplateExample
).
stream
().
map
(
PeriodTemplate:
:
getId
).
collect
(
Collectors
.
toList
());
}
return
templateIds
;
}
public
List
<
CellTemplateReferenceDto
>
getTemplateReferences
(
int
period
)
{
public
List
<
CellTemplateReferenceDto
>
getTemplateReferences
(
int
period
)
{
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
...
@@ -1221,7 +1218,7 @@ public class ReportServiceImpl {
...
@@ -1221,7 +1218,7 @@ public class ReportServiceImpl {
public
String
export
(
String
reportData
,
String
serverPath
)
{
public
String
export
(
String
reportData
,
String
serverPath
)
{
String
filePath
=
String
.
format
(
"GeneratedReports\tt_{0}.xlsx"
,
UUID
.
randomUUID
().
toString
());
String
filePath
=
String
.
format
(
"GeneratedReports\tt_{0}.xlsx"
,
UUID
.
randomUUID
().
toString
());
String
fullFilePath
=
combine
(
serverPath
,
filePath
);
String
fullFilePath
=
combine
(
serverPath
,
filePath
);
Workbook
workbook
=
new
Workbook
();
com
.
grapecity
.
documents
.
excel
.
Workbook
workbook
=
new
com
.
grapecity
.
documents
.
excel
.
Workbook
();
workbook
.
fromJson
(
reportData
);
workbook
.
fromJson
(
reportData
);
workbook
.
save
(
fullFilePath
);
workbook
.
save
(
fullFilePath
);
return
filePath
;
return
filePath
;
...
...
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