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
f6e2174c
Commit
f6e2174c
authored
Nov 02, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] bugfix and download report sheet impl
parent
5f760aa4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
6 deletions
+54
-6
pom.xml
atms-api/pom.xml
+7
-0
ReportController.java
...in/java/pwc/taxtech/atms/controller/ReportController.java
+11
-2
ReportExportDto.java
...ain/java/pwc/taxtech/atms/dto/vatdto/ReportExportDto.java
+14
-0
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+18
-0
vat-report-view.ctrl.js
...p/common/controls/vat-report-view/vat-report-view.ctrl.js
+4
-4
No files found.
atms-api/pom.xml
View file @
f6e2174c
...
...
@@ -367,6 +367,13 @@
<artifactId>
activiti-rest
</artifactId>
<version>
${activiti.version}
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.grapecity.documents/gcexcel -->
<dependency>
<groupId>
com.grapecity.documents
</groupId>
<artifactId>
gcexcel
</artifactId>
<version>
2.0.0
</version>
</dependency>
</dependencies>
<profiles>
...
...
atms-api/src/main/java/pwc/taxtech/atms/controller/ReportController.java
View file @
f6e2174c
...
...
@@ -3,6 +3,7 @@ package pwc.taxtech.atms.controller;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
pwc.taxtech.atms.constant.enums.EnumServiceType
;
import
pwc.taxtech.atms.dpo.ReportDto
;
...
...
@@ -21,6 +22,11 @@ public class ReportController {
@Autowired
ReportServiceImpl
reportService
;
@RequestMapping
(
value
=
"export"
,
method
=
RequestMethod
.
POST
)
public
ResponseEntity
getExportFile
(
ReportExportDto
report
)
{
return
ResponseEntity
.
ok
(
reportService
.
export
(
report
.
getReportData
(),
"~"
));
}
@RequestMapping
(
value
=
"template/{projectId}/{serviceType}/{period}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
OperationResultDto
<
List
<
ReportDto
>>
getTemplate
(
@PathVariable
String
projectId
,
@PathVariable
int
serviceType
,
@PathVariable
Integer
period
)
{
return
reportService
.
getReportTemplate
(
projectId
,
EnumServiceType
.
getEnumByCode
(
serviceType
),
period
);
...
...
@@ -128,7 +134,9 @@ public class ReportController {
}
@RequestMapping
(
value
=
"hasManualDataSource/{projectId}/{period}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Boolean
hasManualDataSource
(
@PathVariable
String
projectId
,
@PathVariable
Integer
period
)
{
return
reportService
.
hasManualDataSource
(
projectId
,
period
);
public
Boolean
hasManualDataSource
(
@PathVariable
String
projectId
,
@PathVariable
Integer
period
)
{
return
reportService
.
hasManualDataSource
(
projectId
,
period
);
}
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/ReportExportDto.java
0 → 100644
View file @
f6e2174c
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
@Setter
@Getter
public
class
ReportExportDto
{
@JsonProperty
(
"ReportType"
)
private
String
reportType
;
@JsonProperty
(
"ReportData"
)
private
String
reportData
;
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
f6e2174c
...
...
@@ -2,6 +2,7 @@ package pwc.taxtech.atms.vat.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
import
com.grapecity.documents.excel.Workbook
;
import
org.apache.commons.lang3.StringUtils
;
import
org.reflections.util.Utils
;
import
org.slf4j.Logger
;
...
...
@@ -27,6 +28,10 @@ import pwc.taxtech.atms.vat.dpo.InputVATInvoiceItemExtendDto;
import
pwc.taxtech.atms.vat.entity.*
;
import
pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.regex.Matcher
;
...
...
@@ -1220,4 +1225,17 @@ public class ReportServiceImpl {
public
Boolean
hasManualDataSource
(
String
projectId
,
Integer
period
)
{
return
periodReportMapper
.
hasManualDataSource
(
projectId
,
period
)
>
0
;
}
public
String
export
(
String
reportData
,
String
serverPath
)
{
String
filePath
=
String
.
format
(
"GeneratedReports\tt_{0}.xlsx"
,
UUID
.
randomUUID
().
toString
());
String
fullFilePath
=
combine
(
serverPath
,
filePath
);
Workbook
workbook
=
new
Workbook
();
workbook
.
fromJson
(
reportData
);
workbook
.
save
(
fullFilePath
);
return
filePath
;
}
private
String
combine
(
String
parent
,
String
child
)
{
return
String
.
format
(
"%s"
+
File
.
separator
+
"%s"
,
parent
,
child
);
}
}
atms-web/src/main/webapp/app/common/controls/vat-report-view/vat-report-view.ctrl.js
View file @
f6e2174c
...
...
@@ -1016,17 +1016,17 @@
function
exportSpread
(
exportReportData
)
{
$scope
.
exportReportData
=
exportReportData
;
$timeout
(
function
()
{
var
mainSpread
=
new
G
cSpread
.
Sheets
.
Spread
(
document
.
getElementById
(
"export"
),
{
sheetCount
:
1
});
var
mainSpread
=
new
G
C
.
Spread
.
Sheets
.
Workbook
(
document
.
getElementById
(
"export"
),
{
sheetCount
:
1
});
mainSpread
.
isPaintSuspended
(
true
);
mainSpread
.
sheets
.
pop
();
for
(
var
index
=
0
;
index
<
$scope
.
spreads
.
length
;
index
++
)
{
var
currentSheet
=
$scope
.
spreads
[
index
].
getActiveSheet
();
currentSheet
.
setIsProtected
(
false
)
;
currentSheet
.
options
.
isProtected
=
false
;
for
(
var
rowIndex
=
0
;
rowIndex
<
currentSheet
.
getRowCount
();
rowIndex
++
)
{
for
(
var
columnIndex
=
0
;
columnIndex
<
currentSheet
.
getColumnCount
();
columnIndex
++
)
{
var
cellStyle
=
currentSheet
.
getActualStyle
(
rowIndex
,
columnIndex
,
G
c
Spread
.
Sheets
.
SheetArea
.
viewport
,
true
);
currentSheet
.
setStyle
(
rowIndex
,
columnIndex
,
cellStyle
,
G
c
Spread
.
Sheets
.
SheetArea
.
viewport
);
var
cellStyle
=
currentSheet
.
getActualStyle
(
rowIndex
,
columnIndex
,
G
C
.
Spread
.
Sheets
.
SheetArea
.
viewport
,
true
);
currentSheet
.
setStyle
(
rowIndex
,
columnIndex
,
cellStyle
,
G
C
.
Spread
.
Sheets
.
SheetArea
.
viewport
);
}
}
...
...
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