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
d25958d5
Commit
d25958d5
authored
Nov 13, 2018
by
sherlock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
显示公式bug
parent
84b2aeb6
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
85 additions
and
15 deletions
+85
-15
ReportController.java
...in/java/pwc/taxtech/atms/controller/ReportController.java
+5
-0
TemplateGroupServiceImpl.java
...c/taxtech/atms/service/impl/TemplateGroupServiceImpl.java
+13
-1
TemplateServiceImpl.java
...va/pwc/taxtech/atms/service/impl/TemplateServiceImpl.java
+7
-5
ReportGeneratorImpl.java
...wc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
+27
-6
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+24
-1
TemplateExtendsMapper.xml
...es/pwc/taxtech/atms/dao/extends/TemplateExtendsMapper.xml
+1
-1
vatReportService.js
...rc/main/webapp/app/common/vatservices/vatReportService.js
+7
-0
vat-report-layout.ctrl.js
...pp/vat/report/vat-report-layout/vat-report-layout.ctrl.js
+1
-1
No files found.
atms-api/src/main/java/pwc/taxtech/atms/controller/ReportController.java
View file @
d25958d5
...
...
@@ -33,6 +33,11 @@ public class ReportController {
return
reportService
.
getReportTemplate
(
projectId
,
EnumServiceType
.
getEnumByCode
(
serviceType
),
period
);
}
@RequestMapping
(
value
=
"filterTemplate/{projectId}/{serviceType}/{period}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
OperationResultDto
<
List
<
ReportDto
>>
getFilterTemplate
(
@PathVariable
String
projectId
,
@PathVariable
int
serviceType
,
@PathVariable
Integer
period
)
{
return
reportService
.
getFilterReportTemplate
(
projectId
,
EnumServiceType
.
getEnumByCode
(
serviceType
),
period
);
}
@RequestMapping
(
value
=
"generateByTotal/{projectId}/{mergeManual}/{period}"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
OperationResultDto
generateAllData
(
@PathVariable
String
projectId
,
@PathVariable
Integer
period
,
@RequestParam
Optional
<
String
>
generator
,
@PathVariable
Boolean
mergeManual
)
{
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/TemplateGroupServiceImpl.java
View file @
d25958d5
...
...
@@ -346,7 +346,19 @@ public class TemplateGroupServiceImpl extends AbstractService {
throw
new
ServiceException
(
ErrorMessage
.
SystemError
);
}
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
optional
.
get
().
write
(
bos
);
Workbook
wtemp
=
optional
.
get
();
Sheet
temp
=
wtemp
.
getSheetAt
(
0
);
for
(
int
j
=
temp
.
getFirstRowNum
();
j
<
temp
.
getLastRowNum
();
j
++){
Row
row
=
temp
.
getRow
(
j
);
for
(
int
k
=
row
.
getFirstCellNum
();
k
<
row
.
getLastCellNum
();
k
++){
Cell
cell
=
row
.
getCell
(
k
);
if
(!
cell
.
getCellStyle
().
getLocked
()
&&
StringUtils
.
isNotBlank
(
cell
.
getStringCellValue
())
&&
cell
.
getStringCellValue
().
equalsIgnoreCase
(
"${KeyIn}"
)){
cell
.
setCellValue
(
""
);
}
}
}
wtemp
.
write
(
bos
);
String
tmpPath
=
httpFileService
.
uploadTemplate
(
newName
,
file
);
String
[]
arr
=
sheetName
.
split
(
"_"
);
String
name
=
arr
.
length
>=
2
?
arr
[
1
]
:
arr
[
0
];
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/TemplateServiceImpl.java
View file @
d25958d5
...
...
@@ -15,7 +15,9 @@ import pwc.taxtech.atms.dpo.TemplateUniqDto;
import
pwc.taxtech.atms.dto.*
;
import
pwc.taxtech.atms.dto.vatdto.TemplateByGroupDto
;
import
pwc.taxtech.atms.entity.*
;
import
pwc.taxtech.atms.vat.dao.PeriodReportMapper
;
import
pwc.taxtech.atms.vat.dao.PeriodTemplateMapper
;
import
pwc.taxtech.atms.vat.entity.PeriodReportExample
;
import
pwc.taxtech.atms.vat.entity.PeriodTemplateExample
;
import
java.util.*
;
...
...
@@ -27,7 +29,7 @@ import static java.util.stream.Collectors.groupingBy;
public
class
TemplateServiceImpl
extends
AbstractService
{
@Autowired
private
Period
TemplateMapper
periodTemplate
Mapper
;
private
Period
ReportMapper
periodReport
Mapper
;
public
void
addExistTemplate
(
TemplateAddExistDto
templateAddExistDto
){
TemplateExample
t
=
new
TemplateExample
();
...
...
@@ -308,10 +310,10 @@ public class TemplateServiceImpl extends AbstractService {
taxReturnGroup
.
setName
(
TemplateGroupType
.
TaxReturn
.
name
());
List
<
TemplateDto
>
templateDtos2
=
new
ArrayList
<>();
templates
.
stream
().
filter
(
x
->
{
Period
TemplateExample
periodTemplateExample
=
new
PeriodTemplate
Example
();
period
TemplateExample
.
createCriteria
().
andTemplateGroupIdEqualTo
(
templateGroupId
)
.
and
TemplateIdEqualTo
(
x
.
getId
()
);
return
x
.
getTemplateGroupId
().
equals
(
templateGroupId
)
&&
period
TemplateMapper
.
selectByExample
(
periodTemplate
Example
).
size
()
>
0
;
Period
ReportExample
periodReportExample
=
new
PeriodReport
Example
();
period
ReportExample
.
createCriteria
().
andTemplateIdEqualTo
(
x
.
getId
()
)
.
and
ProjectIdEqualTo
(
projectId
);
return
x
.
getTemplateGroupId
().
equals
(
templateGroupId
)
&&
period
ReportMapper
.
selectByExample
(
periodReport
Example
).
size
()
>
0
;
}).
collect
(
Collectors
.
toList
()).
forEach
(
a
->
{
TemplateDto
templateDto
=
new
TemplateDto
();
CommonUtils
.
copyProperties
(
a
,
templateDto
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportGeneratorImpl.java
View file @
d25958d5
...
...
@@ -10,6 +10,7 @@ import org.apache.poi.ss.formula.udf.DefaultUDFFinder;
import
org.apache.poi.ss.formula.udf.UDFFinder
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.xssf.usermodel.XSSFCell
;
import
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -89,6 +90,7 @@ public class ReportGeneratorImpl {
@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
();
...
...
@@ -196,12 +198,24 @@ public class ReportGeneratorImpl {
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
())));
if
(
StringUtils
.
isNotBlank
(
cell
.
getStringCellValue
())
&&
StringUtils
.
isNumeric
(
cell
.
getStringCellValue
().
replace
(
"."
,
""
))){
dataSource
.
setAmount
(
new
BigDecimal
(
cell
.
getStringCellValue
()));
}
else
if
(
StringUtils
.
isBlank
(
cell
.
getStringCellValue
())){
dataSource
.
setAmount
(
new
BigDecimal
(
Double
.
toString
(
cell
.
getNumericCellValue
())));
}
// else {
// cell.setCellFormula(cell.getStringCellValue());
// FormulaEvaluator formulaEvaluator = new XSSFFormulaEvaluator((XSSFWorkbook) workbook);
// dataSource.setAmount(new BigDecimal(formulaEvaluator.evaluate(cell).getNumberValue()));
// }
// 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"
));
}
...
...
@@ -241,10 +255,17 @@ public class ReportGeneratorImpl {
.
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!"
))
{
FormulaEvaluator
formulaEvaluator
=
new
XSSFFormulaEvaluator
((
XSSFWorkbook
)
workbook
);
try
{
data
=
formulaEvaluator
.
evaluate
(
cell
).
getStringValue
();
}
catch
(
Exception
e
){
logger
.
error
(
e
.
getStackTrace
().
toString
());
data
=
"0.0"
;
}
}
//evaluator.evaluate(cell);
// if (cell.getCellTypeEnum().equals(CellType.NUMERIC)||cell.getCellTypeEnum().equals(CellType.FORMULA)) {
// data = Double.toString(cell.getNumericCellValue());
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
d25958d5
...
...
@@ -3,6 +3,7 @@ package pwc.taxtech.atms.vat.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Sets
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.FormulaEvaluator
;
import
org.apache.poi.ss.usermodel.Workbook
;
...
...
@@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
pwc.taxtech.atms.common.CommonUtils
;
import
pwc.taxtech.atms.common.util.BeanUtil
;
import
pwc.taxtech.atms.common.util.MyAsserts
;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.constant.enums.*
;
...
...
@@ -30,7 +32,6 @@ import pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto;
import
pwc.taxtech.atms.vat.dpo.DataSourceExtendDto
;
import
pwc.taxtech.atms.vat.dpo.InputVATInvoiceItemExtendDto
;
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
java.io.File
;
...
...
@@ -103,6 +104,25 @@ public class ReportServiceImpl {
@Autowired
private
PeriodJobMapper
periodJobMapper
;
public
OperationResultDto
<
List
<
ReportDto
>>
getFilterReportTemplate
(
String
projectId
,
EnumServiceType
serviceType
,
Integer
periodParam
)
{
OperationResultDto
<
List
<
ReportDto
>>
result
=
new
OperationResultDto
<>();
CommonUtils
.
copyProperties
(
getReportTemplate
(
projectId
,
serviceType
,
periodParam
),
result
);
if
(!
result
.
getResult
()
||
CollectionUtils
.
isEmpty
(
result
.
getData
()))
return
result
;
int
period
=
periodParam
!=
null
?
periodParam
:
0
;
PeriodTemplateExample
periodTemplateExample
=
new
PeriodTemplateExample
();
periodTemplateExample
.
createCriteria
().
andProjectIdEqualTo
(
projectId
)
.
andPeriodEqualTo
(
period
);
List
<
PeriodTemplate
>
periodTemplateList
=
periodTemplateMapper
.
selectByExample
(
periodTemplateExample
);
List
<
String
>
ids
=
Lists
.
newArrayList
();
periodTemplateList
.
stream
().
forEach
(
x
->
ids
.
add
(
x
.
getTemplateId
()
+
""
));
List
<
ReportDto
>
reportDtos
=
result
.
getData
().
stream
().
filter
(
x
->
{
return
ids
.
contains
(
x
.
getTemplateId
());
}).
collect
(
Collectors
.
toList
());
result
.
setData
(
reportDtos
);
return
result
;
}
public
OperationResultDto
<
List
<
ReportDto
>>
getReportTemplate
(
String
projectId
,
EnumServiceType
serviceType
,
Integer
periodParam
)
{
int
period
=
periodParam
!=
null
?
periodParam
:
0
;
OperationResultDto
<
List
<
ReportDto
>>
operationResult
=
new
OperationResultDto
<>();
...
...
@@ -155,7 +175,10 @@ public class ReportServiceImpl {
map
.
put
(
"projectId"
,
projectId
);
map
.
put
(
"templateGroupID"
,
templateGroupId
);
List
<
ReportDto
>
reportDtos
=
templateMapper
.
getTemplateLeftJoinReport
(
map
);
if
(
reportDtos
.
isEmpty
())
{
operationResult
.
setResultMsg
(
"No Template"
);
return
operationResult
;
...
...
atms-dao/src/main/resources/pwc/taxtech/atms/dao/extends/TemplateExtendsMapper.xml
View file @
d25958d5
...
...
@@ -98,7 +98,7 @@
</where>
</select>
<resultMap
id=
"reportDto"
type=
"pwc.taxtech.atms.d
to.vatdt
o.ReportDto"
>
<resultMap
id=
"reportDto"
type=
"pwc.taxtech.atms.d
p
o.ReportDto"
>
<id
column=
"ID"
jdbcType=
"VARCHAR"
property=
"id"
/>
<result
column=
"PERIOD"
jdbcType=
"INTEGER"
property=
"period"
/>
<result
column=
"TEMPLATE_ID"
jdbcType=
"INTEGER"
property=
"templateId"
/>
...
...
atms-web/src/main/webapp/app/common/vatservices/vatReportService.js
View file @
d25958d5
...
...
@@ -76,6 +76,13 @@
return
$http
.
get
(
'/Report/template/'
+
projectId
+
'/'
+
serviceType
+
'/'
+
period
,
apiConfig
.
createVat
());
},
getFilterTemplate
:
function
(
projectId
,
serviceType
,
period
)
{
if
(
!
_
.
isNumber
(
period
))
{
period
=
0
;
}
return
$http
.
get
(
'/Report/filterTemplate/'
+
projectId
+
'/'
+
serviceType
+
'/'
+
period
,
apiConfig
.
createVat
());
},
getCellVoucher
:
function
(
cellDataID
)
{
return
$http
.
get
(
'/Report/cellVoucher/'
+
cellDataID
,
apiConfig
.
createVat
());
},
...
...
atms-web/src/main/webapp/app/vat/report/vat-report-layout/vat-report-layout.ctrl.js
View file @
d25958d5
...
...
@@ -19,7 +19,7 @@
//projectID = '0cf0945f-d41c-4df3-8235-ae693d5e724d';
$q
.
all
([
templateGroupService
.
getGroupTemplateByGroupID
(
48372654336679936
,
projectID
),
vatReportService
.
getTemplate
(
vatSessionService
.
project
.
id
,
constant
.
serviceType
.
VAT
,
vatSessionService
.
month
)
vatReportService
.
get
Filter
Template
(
vatSessionService
.
project
.
id
,
constant
.
serviceType
.
VAT
,
vatSessionService
.
month
)
]).
then
(
function
(
result
)
{
if
(
!
_
.
isEmpty
(
result
[
0
])
&&
!
_
.
isEmpty
(
result
[
0
].
data
)
&&
!
_
.
isEmpty
(
result
[
0
].
data
.
data
)
&&
!
_
.
isEmpty
(
result
[
1
])
&&
!
_
.
isEmpty
(
result
[
1
].
data
)
&&
!
_
.
isEmpty
(
result
[
1
].
data
.
data
))
{
...
...
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