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
5b3df9e0
Commit
5b3df9e0
authored
Nov 14, 2018
by
eddie.woo
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
c4501047
fd4a320a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
344 additions
and
297 deletions
+344
-297
WrapPeriodJobDto.java
...in/java/pwc/taxtech/atms/dto/vatdto/WrapPeriodJobDto.java
+57
-2
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+261
-264
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+19
-28
conf_profile_dev.properties
atms-api/src/main/resources/conf/conf_profile_dev.properties
+3
-3
vat-report-view.ctrl.js
...p/common/controls/vat-report-view/vat-report-view.ctrl.js
+2
-0
vat-caculate-data.ctrl.js
...vat/reduction/vat-caculate-data/vat-caculate-data.ctrl.js
+2
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/WrapPeriodJobDto.java
View file @
5b3df9e0
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.ibatis.annotations.Select
;
import
pwc.taxtech.atms.common.util.MyAsserts
;
import
pwc.taxtech.atms.entity.Project
;
import
pwc.taxtech.atms.entity.Template
;
...
...
@@ -27,9 +34,8 @@ public class WrapPeriodJobDto {
job
.
setProjectId
(
projectId
);
job
.
setPeriod
(
period
);
job
.
setId
(
UUID
.
randomUUID
().
toString
());
job
.
setStatus
(
STATUS_BEGIN
);
job
.
setCurrentStep
(
STEP_UPDATE_CONFIG
);
setStatus
(
job
,
STEP_UPDATE_CONFIG
,
STATUS_BEGIN
);
StringBuilder
builder
=
new
StringBuilder
(
STEP_UPDATE_CONFIG
);
templates
.
forEach
(
m
->
{
builder
.
append
(
","
).
append
(
m
.
getCode
());
...
...
@@ -38,4 +44,53 @@ public class WrapPeriodJobDto {
job
.
setStepsCode
(
builder
.
toString
());
return
job
;
}
@Getter
@Setter
public
static
class
Task
{
String
code
;
String
status
;
}
public
static
List
<
Task
>
fromJson
(
String
taskJson
)
{
return
JSON
.
parseObject
(
taskJson
,
new
TypeReference
<
List
<
Task
>>()
{});
}
public
static
String
toJson
(
List
<
Task
>
tasks
)
{
return
JSON
.
toJSONString
(
tasks
);
}
public
static
void
setStatus
(
PeriodJob
periodJob
,
String
code
,
String
status
)
{
List
<
Task
>
list
;
if
(
StringUtils
.
isBlank
(
periodJob
.
getStatus
()))
{
list
=
new
ArrayList
<>();
}
else
{
list
=
fromJson
(
periodJob
.
getStatus
());
}
Task
t
=
new
Task
();
t
.
code
=
code
;
t
.
status
=
status
;
boolean
contains
=
false
;
for
(
Task
m
:
list
)
{
if
(
m
.
code
.
equals
(
t
.
code
))
{
m
.
status
=
status
;
contains
=
true
;
break
;
}
}
if
(!
contains
)
list
.
add
(
t
);
periodJob
.
setStatus
(
toJson
(
list
));
}
public
static
void
setStatus
(
PeriodJob
periodJob
,
String
status
)
{
List
<
Task
>
list
;
if
(
StringUtils
.
isBlank
(
periodJob
.
getStatus
()))
{
list
=
new
ArrayList
<>();
}
else
{
list
=
fromJson
(
periodJob
.
getStatus
());
}
list
.
get
(
list
.
size
()-
1
).
status
=
status
;
periodJob
.
setStatus
(
toJson
(
list
));
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
5b3df9e0
...
...
@@ -44,6 +44,7 @@ import java.util.stream.Collectors;
import
static
pwc
.
taxtech
.
atms
.
common
.
util
.
SpringContextUtil
.
reportMapper
;
import
static
pwc
.
taxtech
.
atms
.
constant
.
Constant
.
EMPTY
;
import
static
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
WrapPeriodJobDto
.*;
@Component
public
class
ReportGeneratorImpl
{
...
...
@@ -86,320 +87,312 @@ public class ReportGeneratorImpl {
return
periodResources
;
}
@Transactional
public
void
updateWorkbookCaclsValueToDb
(
String
projectId
,
Integer
period
,
Workbook
workbook
,
PeriodResources
resources
,
Boolean
isMergeMunual
,
PeriodJob
job
)
{
for
(
int
i
=
0
;
i
<
workbook
.
getNumberOfSheets
();
i
++)
{
Sheet
sheet
=
workbook
.
getSheetAt
(
i
);
String
code
=
sheet
.
getSheetName
();
logger
.
info
(
"-------------------------------------Begin Job [{}]------------------------------------------------------"
,
code
);
job
.
setCurrentStep
(
code
);
logger
.
info
(
"-------------------------------------Begin Job [{}]------------------------------------------------------"
,
code
);
setStatus
(
job
,
code
,
STATUS_BEGIN
);
periodJobMapper
.
updateByPrimaryKey
(
job
);
try
{
Optional
<
PeriodTemplate
>
periodTemplate
=
resources
.
getPeriodTemplates
().
stream
()
.
filter
(
a
->
a
.
getCode
().
equals
(
code
))
.
findFirst
();
Optional
<
PeriodTemplate
>
periodTemplate
=
resources
.
getPeriodTemplates
().
stream
()
.
filter
(
a
->
a
.
getCode
().
equals
(
code
))
.
findFirst
();
Long
templateId
;
if
(
periodTemplate
.
isPresent
())
{
templateId
=
periodTemplate
.
get
().
getTemplateId
();
}
else
{
templateId
=
0L
;
}
Long
templateId
;
if
(
periodTemplate
.
isPresent
())
{
templateId
=
periodTemplate
.
get
().
getTemplateId
();
}
else
{
templateId
=
0L
;
}
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
());
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
);
//update formulablock table reportid field
List
<
Long
>
cellTemplateConfigIds
=
periodCellTemplateConfigs
.
stream
()
.
map
(
PeriodCellTemplateConfig:
:
getCellTemplateId
)
.
collect
(
Collectors
.
toList
());
if
(
cellTemplateConfigIds
.
size
()
>
0
)
{
periodFormulaBlockMapper
.
updateReportId
(
reportId
,
cellTemplateConfigIds
,
period
,
projectId
);
}
List
<
PeriodCellTemplateConfig
>
periodCellTemplateConfigs
=
resources
.
getPeriodCellTemplateConfigs
().
stream
()
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
)
&&
a
.
getDataSourceType
().
equals
(
CellDataSourceType
.
Formula
.
getCode
()))
.
collect
(
Collectors
.
toList
());
for
(
PeriodCellTemplateConfig
periodCellTemplateConfig
:
periodCellTemplateConfigs
)
{
PeriodFormulaBlockExample
periodFormulaBlockExample2
=
new
PeriodFormulaBlockExample
();
periodFormulaBlockExample2
.
createCriteria
()
.
andProjectIdEqualTo
(
projectId
)
.
andCellTemplateIdEqualTo
(
periodCellTemplateConfig
.
getCellTemplateId
())
.
andReportIdEqualTo
(
reportId
)
.
andPeriodEqualTo
(
period
);
List
<
PeriodFormulaBlock
>
periodFormulaBlocks
=
periodFormulaBlockMapper
.
selectByExample
(
periodFormulaBlockExample2
);
//TODO:如果formula 为 ND(100) +ND(22) ,需要使用正则表达式拆分出自定义公式,然后根据自定义公式取formulablock 的数据进行替换
String
regex
=
"[A-Z]*\\([\\-A-Za-z0-9\\\"\\,\\.\\u4e00-\\u9fa5\\%]*\\)"
;
Pattern
p
=
Pattern
.
compile
(
regex
);
String
sourceFormula
=
StringUtils
.
isNotBlank
(
periodCellTemplateConfig
.
getKeyValueParsedFormula
())
?
periodCellTemplateConfig
.
getKeyValueParsedFormula
()
:
periodCellTemplateConfig
.
getFormula
();
String
resultFormula
=
StringUtils
.
isNotBlank
(
periodCellTemplateConfig
.
getKeyValueParsedFormula
())
?
periodCellTemplateConfig
.
getKeyValueParsedFormula
()
:
periodCellTemplateConfig
.
getFormula
();
Matcher
m
=
p
.
matcher
(
sourceFormula
);
Boolean
isFind
=
false
;
while
(
m
.
find
())
{
isFind
=
true
;
//如果有些公式无法用正则匹配,可以做特殊处理
String
findStr
=
m
.
group
();
Optional
<
PeriodFormulaBlock
>
formulaBlock
=
periodFormulaBlocks
.
stream
()
.
filter
(
a
->
a
.
getFormulaExpression
().
equals
(
findStr
))
.
findFirst
();
if
(
formulaBlock
.
isPresent
())
{
resultFormula
=
resultFormula
.
replace
(
findStr
,
formulaBlock
.
get
().
getData
());
}
}
//update formulablock table reportid field
List
<
Long
>
cellTemplateConfigIds
=
periodCellTemplateConfigs
.
stream
()
.
map
(
PeriodCellTemplateConfig:
:
getCellTemplateId
)
.
collect
(
Collectors
.
toList
());
if
(
cellTemplateConfigIds
.
size
()
>
0
)
{
periodFormulaBlockMapper
.
updateReportId
(
reportId
,
cellTemplateConfigIds
,
period
,
projectId
);
}
//如果有正则匹配就进行更新公式解析
if
(
isFind
)
{
periodCellTemplateConfig
.
setParsedFormula
(
StringUtils
.
isNotBlank
(
resultFormula
)
?
resultFormula
:
null
);
if
(
periodCellTemplateConfig
.
getFormula
()
!=
null
&&
!
periodCellTemplateConfig
.
getFormula
().
contains
(
"BB("
))
periodCellTemplateConfig
.
setFormula
(
StringUtils
.
isNotBlank
(
periodCellTemplateConfig
.
getFormula
())
?
resultFormula
:
null
);
periodCellTemplateConfigMapper
.
updateByPrimaryKeySelective
(
periodCellTemplateConfig
);
for
(
PeriodCellTemplateConfig
periodCellTemplateConfig
:
periodCellTemplateConfigs
)
{
PeriodFormulaBlockExample
periodFormulaBlockExample2
=
new
PeriodFormulaBlockExample
();
periodFormulaBlockExample2
.
createCriteria
()
.
andProjectIdEqualTo
(
projectId
)
.
andCellTemplateIdEqualTo
(
periodCellTemplateConfig
.
getCellTemplateId
())
.
andReportIdEqualTo
(
reportId
)
.
andPeriodEqualTo
(
period
);
List
<
PeriodFormulaBlock
>
periodFormulaBlocks
=
periodFormulaBlockMapper
.
selectByExample
(
periodFormulaBlockExample2
);
//TODO:如果formula 为 ND(100) +ND(22) ,需要使用正则表达式拆分出自定义公式,然后根据自定义公式取formulablock 的数据进行替换
String
regex
=
"[A-Z]*\\([\\-A-Za-z0-9\\\"\\,\\.\\u4e00-\\u9fa5\\%]*\\)"
;
Pattern
p
=
Pattern
.
compile
(
regex
);
String
sourceFormula
=
StringUtils
.
isNotBlank
(
periodCellTemplateConfig
.
getKeyValueParsedFormula
())
?
periodCellTemplateConfig
.
getKeyValueParsedFormula
()
:
periodCellTemplateConfig
.
getFormula
();
String
resultFormula
=
StringUtils
.
isNotBlank
(
periodCellTemplateConfig
.
getKeyValueParsedFormula
())
?
periodCellTemplateConfig
.
getKeyValueParsedFormula
()
:
periodCellTemplateConfig
.
getFormula
();
Matcher
m
=
p
.
matcher
(
sourceFormula
);
Boolean
isFind
=
false
;
while
(
m
.
find
())
{
isFind
=
true
;
//如果有些公式无法用正则匹配,可以做特殊处理
String
findStr
=
m
.
group
();
Optional
<
PeriodFormulaBlock
>
formulaBlock
=
periodFormulaBlocks
.
stream
()
.
filter
(
a
->
a
.
getFormulaExpression
().
equals
(
findStr
))
.
findFirst
();
if
(
formulaBlock
.
isPresent
())
{
resultFormula
=
resultFormula
.
replace
(
findStr
,
formulaBlock
.
get
().
getData
());
}
}
String
regexNormalCell
=
"[A-Z]{1,2}((?!0)[0-9]{1,3})"
;
p
=
Pattern
.
compile
(
regexNormalCell
);
m
=
p
.
matcher
(
sourceFormula
);
while
(
m
.
find
())
{
//如果找到普通单元格的公式,就去workbook里查找对应的格子取数据,然后放到DataSource,作为普通单元格数据源的数据
//找到一个格子就加一条数据
String
findStr
=
m
.
group
();
//A12,A13,A15,how to get A and 12 or A and 13
String
regexColumn
=
"[A-Z]{1,2}"
;
Pattern
pp
=
Pattern
.
compile
(
regexColumn
);
Matcher
mm
=
pp
.
matcher
(
findStr
);
while
(
mm
.
find
())
{
String
colStr
=
mm
.
group
();
int
colNum
=
FormulaHelper
.
excelColStrToNum
(
colStr
,
colStr
.
length
());
int
rowNum
=
Integer
.
parseInt
(
StringUtils
.
removeStart
(
findStr
,
colStr
));
Row
row
=
sheet
.
getRow
(
rowNum
-
1
);
if
(
row
!=
null
)
{
Cell
cell
=
row
.
getCell
(
colNum
-
1
);
if
(
cell
!=
null
)
{
//开始取值然后存放到DataSource
PeriodDataSource
dataSource
=
new
PeriodDataSource
();
dataSource
.
setId
(
distributedIdService
.
nextId
());
dataSource
.
setColumnIndex
(
colNum
-
1
);
dataSource
.
setRowIndex
(
rowNum
-
1
);
if
(((
XSSFCell
)
cell
).
getRawValue
()
!=
"#VALUE!"
)
{
dataSource
.
setAmount
(
new
BigDecimal
(
((
XSSFCell
)
cell
).
getRawValue
()
!=
null
?
((
XSSFCell
)
cell
).
getRawValue
()
:
(
StringUtils
.
isNotBlank
(
cell
.
getStringCellValue
()))
?
cell
.
getStringCellValue
()
:
Double
.
toString
(
cell
.
getNumericCellValue
())));
}
else
{
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的数据
//还有就是把公式里的数据源放到内存,在所有算完之后再统一加数据源
//如果有正则匹配就进行更新公式解析
if
(
isFind
)
{
periodCellTemplateConfig
.
setParsedFormula
(
StringUtils
.
isNotBlank
(
resultFormula
)
?
resultFormula
:
null
);
if
(
periodCellTemplateConfig
.
getFormula
()
!=
null
&&
!
periodCellTemplateConfig
.
getFormula
().
contains
(
"BB("
))
periodCellTemplateConfig
.
setFormula
(
StringUtils
.
isNotBlank
(
periodCellTemplateConfig
.
getFormula
())
?
resultFormula
:
null
);
periodCellTemplateConfigMapper
.
updateByPrimaryKeySelective
(
periodCellTemplateConfig
);
}
String
regexNormalCell
=
"[A-Z]{1,2}((?!0)[0-9]{1,3})"
;
p
=
Pattern
.
compile
(
regexNormalCell
);
m
=
p
.
matcher
(
sourceFormula
);
while
(
m
.
find
())
{
//如果找到普通单元格的公式,就去workbook里查找对应的格子取数据,然后放到DataSource,作为普通单元格数据源的数据
//找到一个格子就加一条数据
String
findStr
=
m
.
group
();
//A12,A13,A15,how to get A and 12 or A and 13
String
regexColumn
=
"[A-Z]{1,2}"
;
Pattern
pp
=
Pattern
.
compile
(
regexColumn
);
Matcher
mm
=
pp
.
matcher
(
findStr
);
while
(
mm
.
find
())
{
String
colStr
=
mm
.
group
();
int
colNum
=
FormulaHelper
.
excelColStrToNum
(
colStr
,
colStr
.
length
());
int
rowNum
=
Integer
.
parseInt
(
StringUtils
.
removeStart
(
findStr
,
colStr
));
Row
row
=
sheet
.
getRow
(
rowNum
-
1
);
if
(
row
!=
null
)
{
Cell
cell
=
row
.
getCell
(
colNum
-
1
);
if
(
cell
!=
null
)
{
//开始取值然后存放到DataSource
PeriodDataSource
dataSource
=
new
PeriodDataSource
();
dataSource
.
setId
(
distributedIdService
.
nextId
());
dataSource
.
setColumnIndex
(
colNum
-
1
);
dataSource
.
setRowIndex
(
rowNum
-
1
);
if
(((
XSSFCell
)
cell
).
getRawValue
()
!=
"#VALUE!"
)
{
dataSource
.
setAmount
(
new
BigDecimal
(
((
XSSFCell
)
cell
).
getRawValue
()
!=
null
?
((
XSSFCell
)
cell
).
getRawValue
()
:
(
StringUtils
.
isNotBlank
(
cell
.
getStringCellValue
()))
?
cell
.
getStringCellValue
()
:
Double
.
toString
(
cell
.
getNumericCellValue
())));
}
else
{
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的数据
//还有就是把公式里的数据源放到内存,在所有算完之后再统一加数据源
}
}
}
}
Optional
<
PeriodCellTemplate
>
tempPeriodCellTemplate
=
resources
.
getPeriodCellTemplates
().
stream
()
.
filter
(
a
->
a
.
getCellTemplateId
().
equals
(
periodCellTemplateConfig
.
getCellTemplateId
()))
.
findFirst
();
if
(
tempPeriodCellTemplate
.
isPresent
())
{
PeriodCellData
cellData
=
new
PeriodCellData
();
Long
cellDataId
=
distributedIdService
.
nextId
();
cellData
.
setId
(
cellDataId
);
cellData
.
setReportId
(
reportId
);
cellData
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
String
data
;
if
(
sheet
.
getRow
(
tempPeriodCellTemplate
.
get
().
getRowIndex
())
!=
null
&&
sheet
.
getRow
(
tempPeriodCellTemplate
.
get
().
getRowIndex
())
.
getCell
(
tempPeriodCellTemplate
.
get
().
getColumnIndex
())
!=
null
)
{
Cell
cell
=
sheet
.
getRow
(
tempPeriodCellTemplate
.
get
().
getRowIndex
())
.
getCell
(
tempPeriodCellTemplate
.
get
().
getColumnIndex
());
data
=
((
XSSFCell
)
cell
).
getRawValue
();
if
(
data
!=
null
&&
data
.
equals
(
"#VALUE!"
))
{
data
=
"0.0"
;
}
//evaluator.evaluate(cell);
Optional
<
PeriodCellTemplate
>
tempPeriodCellTemplate
=
resources
.
getPeriodCellTemplates
().
stream
()
.
filter
(
a
->
a
.
getCellTemplateId
().
equals
(
periodCellTemplateConfig
.
getCellTemplateId
()))
.
findFirst
();
if
(
tempPeriodCellTemplate
.
isPresent
())
{
PeriodCellData
cellData
=
new
PeriodCellData
();
Long
cellDataId
=
distributedIdService
.
nextId
();
cellData
.
setId
(
cellDataId
);
cellData
.
setReportId
(
reportId
);
cellData
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
String
data
;
if
(
sheet
.
getRow
(
tempPeriodCellTemplate
.
get
().
getRowIndex
())
!=
null
&&
sheet
.
getRow
(
tempPeriodCellTemplate
.
get
().
getRowIndex
())
.
getCell
(
tempPeriodCellTemplate
.
get
().
getColumnIndex
())
!=
null
)
{
Cell
cell
=
sheet
.
getRow
(
tempPeriodCellTemplate
.
get
().
getRowIndex
())
.
getCell
(
tempPeriodCellTemplate
.
get
().
getColumnIndex
());
data
=
((
XSSFCell
)
cell
).
getRawValue
();
if
(
data
!=
null
&&
data
.
equals
(
"#VALUE!"
))
{
data
=
"0.0"
;
}
//evaluator.evaluate(cell);
// if (cell.getCellTypeEnum().equals(CellType.NUMERIC)||cell.getCellTypeEnum().equals(CellType.FORMULA)) {
// data = Double.toString(cell.getNumericCellValue());
// } else {
// data = cell.getStringCellValue();
// }
}
else
{
data
=
"0.0"
;
}
}
else
{
data
=
"0.0"
;
}
if
(
StringUtils
.
isNotBlank
(
data
))
{
Pattern
pattern
=
Pattern
.
compile
(
"[0-9.]*"
);
Matcher
isNum
=
pattern
.
matcher
(
data
);
if
(
isNum
.
matches
())
{
cellData
.
setData
(
new
BigDecimal
(
data
).
toString
());
}
else
{
cellData
.
setData
(
data
);
}
if
(
StringUtils
.
isNotBlank
(
data
))
{
Pattern
pattern
=
Pattern
.
compile
(
"[0-9.]*"
);
Matcher
isNum
=
pattern
.
matcher
(
data
);
if
(
isNum
.
matches
())
{
cellData
.
setData
(
new
BigDecimal
(
data
).
toString
());
}
else
{
cellData
.
setData
(
data
);
}
}
else
{
cellData
.
setData
(
data
);
}
//cellData.setData(new BigDecimal(data).toString());
//cellData.setData(new BigDecimal(data).toString());
// PeriodFormulaBlockExample periodFormulaBlockExample = new PeriodFormulaBlockExample();
// periodFormulaBlockExample.createCriteria().andPeriodEqualTo(period)
// .andCellTemplateIdEqualTo(tempPeriodCellTemplate.get().getCellTemplateId());
if
(
StringUtils
.
isBlank
(
resultFormula
))
{
resultFormula
=
null
;
}
if
(
StringUtils
.
isBlank
(
resultFormula
))
{
resultFormula
=
null
;
}
// if (isFind) {
cellData
.
setFormulaExp
(
resultFormula
);
cellData
.
setFormulaExp
(
resultFormula
);
// } else {
// cellData.setFormulaExp(EMPTY);
// }
cellData
.
setCreateBy
(
"Admin"
);
cellData
.
setCreateTime
(
new
Date
());
cellData
.
setUpdateBy
(
"Admin"
);
cellData
.
setUpdateTime
(
new
Date
());
cellData
.
setProjectId
(
projectId
);
cellData
.
setPeriod
(
period
);
//after insert celldata, insert the celldatasource for link celldata and datasource
PeriodDataSourceExample
dataSourceExample
=
new
PeriodDataSourceExample
();
dataSourceExample
.
createCriteria
().
andPeriodEqualTo
(
period
).
andProjectIdEqualTo
(
projectId
)
.
andCellTemplateIdEqualTo
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
()).
andTypeNotEqualTo
(
10
);
List
<
PeriodDataSource
>
dataSourceList
=
SpringContextUtil
.
periodDataSourceMapper
.
selectByExample
(
dataSourceExample
);
for
(
int
ii
=
0
;
ii
<
dataSourceList
.
size
();
ii
++)
{
PeriodDataSource
dataSource
=
dataSourceList
.
get
(
ii
);
cellData
.
setCreateBy
(
"Admin"
);
cellData
.
setCreateTime
(
new
Date
());
cellData
.
setUpdateBy
(
"Admin"
);
cellData
.
setUpdateTime
(
new
Date
());
cellData
.
setProjectId
(
projectId
);
cellData
.
setPeriod
(
period
);
//after insert celldata, insert the celldatasource for link celldata and datasource
PeriodDataSourceExample
dataSourceExample
=
new
PeriodDataSourceExample
();
dataSourceExample
.
createCriteria
().
andPeriodEqualTo
(
period
).
andProjectIdEqualTo
(
projectId
)
.
andCellTemplateIdEqualTo
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
()).
andTypeNotEqualTo
(
10
);
List
<
PeriodDataSource
>
dataSourceList
=
SpringContextUtil
.
periodDataSourceMapper
.
selectByExample
(
dataSourceExample
);
for
(
int
ii
=
0
;
ii
<
dataSourceList
.
size
();
ii
++)
{
PeriodDataSource
dataSource
=
dataSourceList
.
get
(
ii
);
PeriodCellDataSource
cellDataSource
=
new
PeriodCellDataSource
();
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
().
getCellTemplateId
());
cellDataSource
.
setCellDataId
(
cellDataId
);
cellDataSource
.
setDataSourceId
(
dataSource
.
getId
());
cellDataSource
.
setCreateTime
(
new
Date
());
cellDataSource
.
setUpdateTime
(
new
Date
());
cellDataSource
.
setPeriod
(
period
);
cellDataSource
.
setProjectId
(
projectId
);
SpringContextUtil
.
periodCellDataSourceMapper
.
insertSelective
(
cellDataSource
);
}
periodCellDataMapper
.
insertSelective
(
cellData
);
}
}
if
(
isMergeMunual
)
{
List
<
PeriodCellTemplateConfig
>
keyInCellTemplateConfigs
=
resources
.
getPeriodCellTemplateConfigs
().
stream
()
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
)
&&
a
.
getDataSourceType
().
equals
(
CellDataSourceType
.
KeyIn
.
getCode
()))
.
collect
(
Collectors
.
toList
());
for
(
PeriodCellTemplateConfig
keyInCellTemplateConfig
:
keyInCellTemplateConfigs
)
{
PeriodDataSourceExample
dataSourceExample
=
new
PeriodDataSourceExample
();
dataSourceExample
.
createCriteria
().
andPeriodEqualTo
(
period
).
andProjectIdEqualTo
(
projectId
)
.
andCellTemplateIdEqualTo
(
keyInCellTemplateConfig
.
getCellTemplateId
()).
andTypeEqualTo
(
10
);
List
<
PeriodDataSource
>
dataSourceList
=
SpringContextUtil
.
periodDataSourceMapper
.
selectByExample
(
dataSourceExample
);
if
(!
dataSourceList
.
isEmpty
()
&&
dataSourceList
.
size
()
==
1
)
{
PeriodCellDataExample
cellDataExample
=
new
PeriodCellDataExample
();
cellDataExample
.
createCriteria
().
andPeriodEqualTo
(
period
).
andProjectIdEqualTo
(
projectId
)
.
andCellTemplateIdEqualTo
(
keyInCellTemplateConfig
.
getCellTemplateId
());
List
<
PeriodCellData
>
cellDataList
=
periodCellDataMapper
.
selectByExample
(
cellDataExample
);
if
(
cellDataList
.
size
()
==
1
)
{
PeriodCellData
cellData
=
cellDataList
.
get
(
0
);
PeriodDataSource
dataSource
=
dataSourceList
.
get
(
0
);
cellData
.
setData
(
dataSource
.
getAmount
()
+
""
);
if
(
StringUtils
.
isEmpty
(
cellData
.
getFormulaExp
().
trim
()))
cellData
.
setFormulaExp
(
dataSource
.
getAmount
()
+
""
);
PeriodCellDataSource
cellDataSource
=
new
PeriodCellDataSource
();
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setCellTemplateId
(
tempPeriodCellTemplate
.
get
()
.
getCellTemplateId
());
cellDataSource
.
setCellDataId
(
cellData
Id
);
cellDataSource
.
setCellTemplateId
(
keyInCellTemplateConfig
.
getCellTemplateId
());
cellDataSource
.
setCellDataId
(
cellData
.
getId
()
);
cellDataSource
.
setDataSourceId
(
dataSource
.
getId
());
cellDataSource
.
setCreateTime
(
new
Date
());
cellDataSource
.
setUpdateTime
(
new
Date
());
cellDataSource
.
setPeriod
(
period
);
cellDataSource
.
setProjectId
(
projectId
);
SpringContextUtil
.
periodCellDataSourceMapper
.
insertSelective
(
cellDataSource
);
}
periodCellDataMapper
.
insertSelective
(
cellData
);
}
}
if
(
isMergeMunual
)
{
List
<
PeriodCellTemplateConfig
>
keyInCellTemplateConfigs
=
resources
.
getPeriodCellTemplateConfigs
().
stream
()
.
filter
(
a
->
a
.
getReportTemplateId
().
equals
(
templateId
)
&&
a
.
getDataSourceType
().
equals
(
CellDataSourceType
.
KeyIn
.
getCode
()))
.
collect
(
Collectors
.
toList
());
for
(
PeriodCellTemplateConfig
keyInCellTemplateConfig
:
keyInCellTemplateConfigs
)
{
PeriodDataSourceExample
dataSourceExample
=
new
PeriodDataSourceExample
();
dataSourceExample
.
createCriteria
().
andPeriodEqualTo
(
period
).
andProjectIdEqualTo
(
projectId
)
.
andCellTemplateIdEqualTo
(
keyInCellTemplateConfig
.
getCellTemplateId
()).
andTypeEqualTo
(
10
);
List
<
PeriodDataSource
>
dataSourceList
=
SpringContextUtil
.
periodDataSourceMapper
.
selectByExample
(
dataSourceExample
);
if
(!
dataSourceList
.
isEmpty
()
&&
dataSourceList
.
size
()
==
1
)
{
PeriodCellDataExample
cellDataExample
=
new
PeriodCellDataExample
();
cellDataExample
.
createCriteria
().
andPeriodEqualTo
(
period
).
andProjectIdEqualTo
(
projectId
)
.
andCellTemplateIdEqualTo
(
keyInCellTemplateConfig
.
getCellTemplateId
());
List
<
PeriodCellData
>
cellDataList
=
periodCellDataMapper
.
selectByExample
(
cellDataExample
);
if
(
cellDataList
.
size
()
==
1
)
{
PeriodCellData
cellData
=
cellDataList
.
get
(
0
);
PeriodDataSource
dataSource
=
dataSourceList
.
get
(
0
);
cellData
.
setData
(
dataSource
.
getAmount
()
+
""
);
if
(
StringUtils
.
isEmpty
(
cellData
.
getFormulaExp
().
trim
()))
cellData
.
setFormulaExp
(
dataSource
.
getAmount
()
+
""
);
PeriodCellDataSource
cellDataSource
=
new
PeriodCellDataSource
();
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setCellTemplateId
(
keyInCellTemplateConfig
.
getCellTemplateId
());
cellDataSource
.
setCellDataId
(
cellData
.
getId
());
cellDataSource
.
setDataSourceId
(
dataSource
.
getId
());
cellDataSource
.
setCreateTime
(
new
Date
());
cellDataSource
.
setUpdateTime
(
new
Date
());
cellDataSource
.
setPeriod
(
period
);
cellDataSource
.
setProjectId
(
projectId
);
SpringContextUtil
.
periodCellDataSourceMapper
.
insertSelective
(
cellDataSource
);
periodCellDataMapper
.
updateByPrimaryKeySelective
(
cellData
);
}
else
if
(
cellDataList
.
isEmpty
()){
PeriodCellData
cellData
=
new
PeriodCellData
();
Long
cellDataId
=
distributedIdService
.
nextId
();
cellData
.
setId
(
cellDataId
);
cellData
.
setReportId
(
reportId
);
cellData
.
setCellTemplateId
(
keyInCellTemplateConfig
.
getCellTemplateId
());
cellData
.
setCreateBy
(
"Admin"
);
cellData
.
setCreateTime
(
new
Date
());
cellData
.
setUpdateBy
(
"Admin"
);
cellData
.
setUpdateTime
(
new
Date
());
cellData
.
setProjectId
(
projectId
);
cellData
.
setPeriod
(
period
);
PeriodDataSource
dataSource
=
dataSourceList
.
get
(
0
);
cellData
.
setData
(
dataSource
.
getAmount
()
+
""
);
cellData
.
setFormulaExp
(
dataSource
.
getAmount
()
+
""
);
PeriodCellDataSource
cellDataSource
=
new
PeriodCellDataSource
();
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setCellTemplateId
(
keyInCellTemplateConfig
.
getCellTemplateId
());
cellDataSource
.
setCellDataId
(
cellData
.
getId
());
cellDataSource
.
setDataSourceId
(
dataSource
.
getId
());
cellDataSource
.
setCreateTime
(
new
Date
());
cellDataSource
.
setUpdateTime
(
new
Date
());
cellDataSource
.
setPeriod
(
period
);
cellDataSource
.
setProjectId
(
projectId
);
SpringContextUtil
.
periodCellDataSourceMapper
.
insertSelective
(
cellDataSource
);
periodCellDataMapper
.
insert
(
cellData
);
}
else
{
logger
.
warn
(
"should not be !!!"
);
}
periodCellDataMapper
.
updateByPrimaryKeySelective
(
cellData
);
}
else
if
(
cellDataList
.
isEmpty
())
{
PeriodCellData
cellData
=
new
PeriodCellData
();
Long
cellDataId
=
distributedIdService
.
nextId
();
cellData
.
setId
(
cellDataId
);
cellData
.
setReportId
(
reportId
);
cellData
.
setCellTemplateId
(
keyInCellTemplateConfig
.
getCellTemplateId
());
cellData
.
setCreateBy
(
"Admin"
);
cellData
.
setCreateTime
(
new
Date
());
cellData
.
setUpdateBy
(
"Admin"
);
cellData
.
setUpdateTime
(
new
Date
());
cellData
.
setProjectId
(
projectId
);
cellData
.
setPeriod
(
period
);
PeriodDataSource
dataSource
=
dataSourceList
.
get
(
0
);
cellData
.
setData
(
dataSource
.
getAmount
()
+
""
);
cellData
.
setFormulaExp
(
dataSource
.
getAmount
()
+
""
);
PeriodCellDataSource
cellDataSource
=
new
PeriodCellDataSource
();
cellDataSource
.
setId
(
distributedIdService
.
nextId
());
cellDataSource
.
setCellTemplateId
(
keyInCellTemplateConfig
.
getCellTemplateId
());
cellDataSource
.
setCellDataId
(
cellData
.
getId
());
cellDataSource
.
setDataSourceId
(
dataSource
.
getId
());
cellDataSource
.
setCreateTime
(
new
Date
());
cellDataSource
.
setUpdateTime
(
new
Date
());
cellDataSource
.
setPeriod
(
period
);
cellDataSource
.
setProjectId
(
projectId
);
SpringContextUtil
.
periodCellDataSourceMapper
.
insertSelective
(
cellDataSource
);
periodCellDataMapper
.
insert
(
cellData
);
}
else
{
logger
.
warn
(
"should not be !!!"
);
}
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
job
.
setStatus
(
WrapPeriodJobDto
.
STATUS_ERROR
);
job
.
setErrorMsg
(
"cacals report for code "
+
code
+
" failed with msg "
+
e
.
getMessage
());
throw
e
;
}
finally
{
periodJobMapper
.
updateByPrimaryKey
(
job
);
}
logger
.
info
(
"-------------------------------------End Job [{}]------------------------------------------------------"
,
code
);
setStatus
(
job
,
code
,
STATUS_END
);
periodJobMapper
.
updateByPrimaryKey
(
job
);
logger
.
info
(
"-------------------------------------End Job [{}]------------------------------------------------------"
,
code
);
}
}
private
List
<
PeriodReport
>
createReportsByTemplates
(
Workbook
workbook
,
List
<
PeriodTemplate
>
periodTemplateList
,
String
projectId
,
Integer
period
)
{
private
List
<
PeriodReport
>
createReportsByTemplates
(
Workbook
workbook
,
List
<
PeriodTemplate
>
periodTemplateList
,
String
projectId
,
Integer
period
)
{
List
<
PeriodReport
>
reports
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
workbook
.
getNumberOfSheets
();
i
++)
{
Sheet
sheet
=
workbook
.
getSheetAt
(
i
);
...
...
@@ -500,14 +493,16 @@ public class ReportGeneratorImpl {
return
periodTemplateMapper
.
selectByExample
(
periodTemplateExample
);
}
private
List
<
PeriodCellTemplate
>
queryPeriodCellTemplates
(
String
projectId
,
Integer
period
,
List
<
Long
>
periodTemplateIdList
)
{
private
List
<
PeriodCellTemplate
>
queryPeriodCellTemplates
(
String
projectId
,
Integer
period
,
List
<
Long
>
periodTemplateIdList
)
{
PeriodCellTemplateExample
periodCellTemplateExample
=
new
PeriodCellTemplateExample
();
if
(
periodTemplateIdList
.
isEmpty
())
periodTemplateIdList
.
add
(
Long
.
MAX_VALUE
);
periodCellTemplateExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andReportTemplateIdIn
(
periodTemplateIdList
).
andPeriodEqualTo
(
period
);
return
periodCellTemplateMapper
.
selectByExample
(
periodCellTemplateExample
);
}
private
List
<
PeriodCellTemplateConfig
>
queryPeriodCellTemplateConfigs
(
String
projectId
,
Integer
period
,
List
<
Long
>
periodTemplateIdList
)
{
private
List
<
PeriodCellTemplateConfig
>
queryPeriodCellTemplateConfigs
(
String
projectId
,
Integer
period
,
List
<
Long
>
periodTemplateIdList
)
{
PeriodCellTemplateConfigExample
periodCellTemplateConfigExample
=
new
PeriodCellTemplateConfigExample
();
periodCellTemplateConfigExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andReportTemplateIdIn
(
periodTemplateIdList
).
andPeriodEqualTo
(
period
);
return
periodCellTemplateConfigMapper
.
selectByExample
(
periodCellTemplateConfigExample
);
...
...
@@ -590,7 +585,8 @@ public class ReportGeneratorImpl {
workbook
.
addToolPack
(
udfToolpack
);
}
public
List
<
CellCalcInfoDto
>
getCellCalcInfo
(
List
<
Long
>
templateIdList
,
Integer
periodParam
,
String
projectId
)
{
public
List
<
CellCalcInfoDto
>
getCellCalcInfo
(
List
<
Long
>
templateIdList
,
Integer
periodParam
,
String
projectId
)
{
//already finished by 20180711
int
period
=
0
;
if
(
periodParam
!=
null
)
{
...
...
@@ -633,7 +629,8 @@ public class ReportGeneratorImpl {
return
cellCalcInfoDtos
;
}
private
void
fixedPCTParsedFormula
(
List
<
PeriodCellTemplateConfigExtendDto
>
periodCellTemplateConfigExtendDtos
,
String
projectId
,
int
period
)
{
private
void
fixedPCTParsedFormula
(
List
<
PeriodCellTemplateConfigExtendDto
>
periodCellTemplateConfigExtendDtos
,
String
projectId
,
int
period
)
{
Map
<
String
,
List
<
PCTEntity
>>
formulaMapToPCT
=
new
HashMap
<>();
Map
<
PeriodCellTemplateConfig
,
List
<
String
>>
configMapToPCTs
=
new
HashMap
<>();
Set
<
PCTEntity
>
parameter
=
new
HashSet
<>();
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
5b3df9e0
...
...
@@ -42,6 +42,8 @@ import java.util.regex.Matcher;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
import
static
pwc
.
taxtech
.
atms
.
dto
.
vatdto
.
WrapPeriodJobDto
.*;
@Component
public
class
ReportServiceImpl
{
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ReportServiceImpl
.
class
);
...
...
@@ -244,23 +246,16 @@ public class ReportServiceImpl {
}
@Transactional
public
void
updateConfig
(
String
projectId
,
Integer
period
,
Boolean
isMergeManualData
,
List
<
Template
>
templates
,
PeriodJob
job
)
{
try
{
job
.
setStatus
(
WrapPeriodJobDto
.
STATUS_BEGIN
);
List
<
Long
>
exceptTemplateIds
=
templateMapper
.
getIdsForExceptTemplate
();
clearPeriodData
(
projectId
,
period
,
exceptTemplateIds
,
isMergeManualData
);
private
void
updateConfig
(
String
projectId
,
Integer
period
,
Boolean
isMergeManualData
,
List
<
Template
>
templates
,
PeriodJob
job
)
{
setStatus
(
job
,
STATUS_BEGIN
);
periodJobMapper
.
updateByPrimaryKey
(
job
);
copyTemplateAndConfigFromAdmin
(
projectId
,
templates
,
period
);
List
<
Long
>
exceptTemplateIds
=
templateMapper
.
getIdsForExceptTemplate
();
clearPeriodData
(
projectId
,
period
,
exceptTemplateIds
,
isMergeManualData
);
copyTemplateAndConfigFromAdmin
(
projectId
,
templates
,
period
);
}
catch
(
Exception
ex
)
{
job
.
setStatus
(
WrapPeriodJobDto
.
STATUS_ERROR
);
job
.
setErrorMsg
(
"error update config with projectId "
+
projectId
+
" period"
+
period
);
logger
.
error
(
ex
.
getMessage
(),
ex
);
}
finally
{
periodJobMapper
.
updateByPrimaryKey
(
job
);
}
setStatus
(
job
,
STATUS_END
);
periodJobMapper
.
updateByPrimaryKey
(
job
);
}
private
List
<
Template
>
getTemplatesByProjectId
(
String
projectId
)
{
...
...
@@ -452,13 +447,13 @@ public class ReportServiceImpl {
public
OperationResultDto
generateData
(
String
projectId
,
EnumServiceType
serviceType
,
Boolean
isMergeManualData
,
Integer
periodParam
,
Integer
reportType
,
Optional
<
String
>
generator
)
{
OperationResultDto
operationResultDto
=
new
OperationResultDto
();
MyAsserts
.
assertEq
(
serviceType
,
EnumServiceType
.
VAT
,
new
NotFoundException
());
PeriodJobExample
example
=
new
PeriodJobExample
();
example
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andPeriodEqualTo
(
periodParam
)
.
andStatusEqualTo
(
WrapPeriodJobDto
.
STATUS_BEGIN
);
MyAsserts
.
assertEmpty
(
periodJobMapper
.
selectByExample
(
example
),
Exceptions
.
TASK_HAS_BEGINNING
);
String
status
=
periodApprovalMapper
.
getStatusByProjectIdAndPeriod
(
projectId
,
periodParam
);
MyAsserts
.
assertTrue
(
status
==
null
||
status
.
equals
(
Constant
.
APPROVAL_DISAGREED
),
Exceptions
.
REPORT_IN_PROCESS_OR_AGREED_EXCEPTION
);
MyAsserts
.
assertEq
(
serviceType
,
EnumServiceType
.
VAT
,
new
NotFoundException
());
PeriodJobExample
example
=
new
PeriodJobExample
();
example
.
createCriteria
().
andProjectIdEqualTo
(
projectId
).
andPeriodEqualTo
(
periodParam
)
.
andStatusEqualTo
(
WrapPeriodJobDto
.
STATUS_BEGIN
);
MyAsserts
.
assertEmpty
(
periodJobMapper
.
selectByExample
(
example
),
Exceptions
.
TASK_HAS_BEGINNING
);
String
status
=
periodApprovalMapper
.
getStatusByProjectIdAndPeriod
(
projectId
,
periodParam
);
MyAsserts
.
assertTrue
(
status
==
null
||
status
.
equals
(
Constant
.
APPROVAL_DISAGREED
),
Exceptions
.
REPORT_IN_PROCESS_OR_AGREED_EXCEPTION
);
try
{
if
(
serviceType
.
equals
(
EnumServiceType
.
VAT
)
&&
(
periodParam
==
null
||
periodParam
<=
0
))
{
...
...
@@ -489,13 +484,9 @@ public class ReportServiceImpl {
evaluator
.
evaluateAll
();
reportGenerator
.
updateWorkbookCaclsValueToDb
(
projectId
,
periodParam
,
workbook
,
resources
,
isMergeManualData
,
genJob
);
genJob
.
setStatus
(
WrapPeriodJobDto
.
STATUS_END
);
periodJobMapper
.
updateByPrimaryKey
(
genJob
);
}
catch
(
Exception
e
)
{
genJob
.
setStatus
(
WrapPeriodJobDto
.
STATUS_ERROR
);
genJob
.
setErrorMsg
(
"Sever error "
+
e
.
getMessage
());
setStatus
(
genJob
,
STATUS_ERROR
);
genJob
.
setErrorMsg
(
"Sever error "
+
e
.
getMessage
());
periodJobMapper
.
updateByPrimaryKey
(
genJob
);
e
.
printStackTrace
();
}
...
...
atms-api/src/main/resources/conf/conf_profile_dev.properties
View file @
5b3df9e0
jdbc_url
=
jdbc:oracle:thin:@10.158.230.144:11521:XE
jdbc_user
=
TAX_ADMIN
jdbc_password
=
tax
admin2018
jdbc_user
=
tax_admin_longi
jdbc_password
=
tax
_admin_longi
#jdbc_password=111111
jdbc_admin_db
=
tax_admin
jdbc_admin_db
=
tax_admin
_longi
#jdbc_url=jdbc:oracle:thin:@10.158.230.144:11521:XE
#jdbc_user=tax_admin_longi
...
...
atms-web/src/main/webapp/app/common/controls/vat-report-view/vat-report-view.ctrl.js
View file @
5b3df9e0
...
...
@@ -2579,6 +2579,8 @@
$scope
.
agreeApproval
=
function
(){
vatApproveService
.
checkTask
(
vatSessionService
.
approvalInfo
.
instanceId
,
'agreed'
,
$scope
.
comment
).
success
(
function
(){
vatCommonService
.
setProjectStatus
(
vatSessionService
.
project
.
id
,
vatSessionService
.
month
,
constant
.
ProjectStatusEnum
.
Completed
,
constant
.
DictionaryDictKey
.
WFDataProcess
,
enums
.
FinishStatusEnum
.
Finished
);
$
(
"#ApprovalComment"
).
modal
(
'hide'
);
});
}
...
...
atms-web/src/main/webapp/app/vat/reduction/vat-caculate-data/vat-caculate-data.ctrl.js
View file @
5b3df9e0
...
...
@@ -570,6 +570,8 @@
item
.
status
=
'completed'
;
if
(
$scope
.
timer
){
$interval
.
cancel
(
$scope
.
timer
);
vatCommonService
.
setProjectStatus
(
vatSessionService
.
project
.
id
,
vatSessionService
.
month
,
constant
.
ProjectStatusEnum
.
Generated
,
constant
.
DictionaryDictKey
.
WFDataProcess
,
enums
.
FinishStatusEnum
.
Finished
);
}
}
else
if
(
job
.
status
==
'Begin'
){
item
.
status
=
'processing'
;
...
...
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