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
e6df59e4
Commit
e6df59e4
authored
Apr 03, 2019
by
kevin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#
parent
9ddc9cd0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
20 deletions
+70
-20
FileExcelUtil.java
...main/java/pwc/taxtech/atms/common/util/FileExcelUtil.java
+6
-4
ReportController.java
...in/java/pwc/taxtech/atms/controller/ReportController.java
+12
-3
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+16
-7
tb-ebit-form.ctrl.js
...b/src/main/webapp/app/analysis/table/tb-ebit-form.ctrl.js
+29
-4
tb-ebit-form.html
...-web/src/main/webapp/app/analysis/table/tb-ebit-form.html
+7
-2
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/util/FileExcelUtil.java
View file @
e6df59e4
...
@@ -194,7 +194,7 @@ public class FileExcelUtil {
...
@@ -194,7 +194,7 @@ public class FileExcelUtil {
* @Param path 文件路径,包括zip文件夹路径
* @Param path 文件路径,包括zip文件夹路径
* @throws Exception
* @throws Exception
*/
*/
public
static
List
<
File
>
generateExcelToPath
(
Workbook
wb
,
String
path
)
throws
Exception
{
public
static
File
generateExcelToPath
(
Workbook
wb
,
String
path
)
throws
Exception
{
String
[]
pathArr
=
path
.
split
(
"\\\\"
);
String
[]
pathArr
=
path
.
split
(
"\\\\"
);
String
zipDir
=
pathArr
[
0
];
String
zipDir
=
pathArr
[
0
];
FileExcelUtil
.
createFile
(
zipDir
);
FileExcelUtil
.
createFile
(
zipDir
);
...
@@ -203,8 +203,11 @@ public class FileExcelUtil {
...
@@ -203,8 +203,11 @@ public class FileExcelUtil {
try
{
try
{
fos
=
new
FileOutputStream
(
path
);
fos
=
new
FileOutputStream
(
path
);
wb
.
write
(
fos
);
wb
.
write
(
fos
);
listFile
.
add
(
new
File
(
path
));
return
new
File
(
path
);
}
finally
{
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
null
;
}
finally
{
if
(
fos
!=
null
)
{
if
(
fos
!=
null
)
{
fos
.
flush
();
fos
.
flush
();
fos
.
close
();
fos
.
close
();
...
@@ -213,7 +216,6 @@ public class FileExcelUtil {
...
@@ -213,7 +216,6 @@ public class FileExcelUtil {
wb
.
close
();
wb
.
close
();
}
}
}
}
return
listFile
;
}
}
/**
/**
...
...
atms-api/src/main/java/pwc/taxtech/atms/controller/ReportController.java
View file @
e6df59e4
...
@@ -7,6 +7,7 @@ import org.springframework.http.MediaType;
...
@@ -7,6 +7,7 @@ import org.springframework.http.MediaType;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
pwc.taxtech.atms.common.message.ErrorMessage
;
import
pwc.taxtech.atms.common.message.ErrorMessage
;
import
pwc.taxtech.atms.common.util.FileExcelUtil
;
import
pwc.taxtech.atms.common.util.FileExcelUtil
;
import
pwc.taxtech.atms.constant.enums.EnumServiceType
;
import
pwc.taxtech.atms.constant.enums.EnumServiceType
;
...
@@ -34,6 +35,7 @@ import java.io.File;
...
@@ -34,6 +35,7 @@ import java.io.File;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.net.URISyntaxException
;
import
java.net.URISyntaxException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Optional
;
@RestController
@RestController
...
@@ -360,8 +362,9 @@ public class ReportController {
...
@@ -360,8 +362,9 @@ public class ReportController {
reportService
.
manyExport
(
requestParameterDto
,
zipName
,
request
,
response
,
zipPath
);
reportService
.
manyExport
(
requestParameterDto
,
zipName
,
request
,
response
,
zipPath
);
}
catch
(
URISyntaxException
e
)
{
}
catch
(
URISyntaxException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
operationResultDto
.
error
(
e
.
getMessage
());
return
operationResultDto
;
}
}
operationResultDto
.
setResult
(
null
);
return
operationResultDto
;
return
operationResultDto
;
}
}
...
@@ -370,8 +373,13 @@ public class ReportController {
...
@@ -370,8 +373,13 @@ public class ReportController {
* 将spread序列化字符串保存到数据库
* 将spread序列化字符串保存到数据库
*/
*/
@RequestMapping
(
"spreadToDb"
)
@RequestMapping
(
"spreadToDb"
)
public
OperationResultDto
spreadToDb
(
@RequestBody
RequestParameterDto
.
EbitParam
ebitParam
)
{
public
OperationResultDto
spreadToDb
(
@RequestBody
HttpServletRequest
request
)
{
return
reportService
.
spreadToDb
(
ebitParam
);
MultipartHttpServletRequest
multipartRequest
=
(
MultipartHttpServletRequest
)
request
;
Map
<
String
,
MultipartFile
>
fileMap
=
multipartRequest
.
getFileMap
();
MultipartFile
file
=
fileMap
.
get
(
"llb.xlsx"
);
//didiFileUploadService.uploadFile(file, );
return
null
;
//return reportService.spreadToDb(ebitParam);
}
}
}
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
e6df59e4
...
@@ -981,7 +981,7 @@ public class ReportServiceImpl extends BaseService {
...
@@ -981,7 +981,7 @@ public class ReportServiceImpl extends BaseService {
Workbook
workbook
=
reportGenerator
.
createWorkBookByPeriodTemplate
(
resources
.
getPeriodTemplates
(),
genJob
);
Workbook
workbook
=
reportGenerator
.
createWorkBookByPeriodTemplate
(
resources
.
getPeriodTemplates
(),
genJob
);
reportGenerator
.
addFunctionsAndContext
(
workbook
,
functions
,
reportGenerator
.
initContext
(
resources
,
periodParam
),
false
);
reportGenerator
.
addFunctionsAndContext
(
workbook
,
functions
,
reportGenerator
.
initContext
(
resources
,
periodParam
),
false
);
reportGenerator
.
setConfigAndDataToWorkBook
(
workbook
,
resources
);
reportGenerator
.
setConfigAndDataToWorkBook
(
workbook
,
resources
);
FormulaEvaluator
evaluator
=
workbook
.
getCreationHelper
().
createFormulaEvaluator
();
FormulaEvaluator
evaluator
=
workbook
.
getCreationHelper
().
createFormulaEvaluator
();
...
@@ -1023,7 +1023,7 @@ public class ReportServiceImpl extends BaseService {
...
@@ -1023,7 +1023,7 @@ public class ReportServiceImpl extends BaseService {
periodCellTemplateConfigDtos
.
forEach
(
a
->
{
periodCellTemplateConfigDtos
.
forEach
(
a
->
{
workbook4Validate
.
getSheetAt
(
a
.
getSheetNumber
()
-
1
).
getRow
(
a
.
getRowNumber
()).
getCell
(
a
.
getColNumber
()).
setCellFormula
(
a
.
getParsedValidation
());
workbook4Validate
.
getSheetAt
(
a
.
getSheetNumber
()
-
1
).
getRow
(
a
.
getRowNumber
()).
getCell
(
a
.
getColNumber
()).
setCellFormula
(
a
.
getParsedValidation
());
});
});
reportGenerator
.
addFunctionsAndContext
(
workbook4Validate
,
functions
,
reportGenerator
.
initContext
(
resources
,
periodParam
),
true
);
reportGenerator
.
addFunctionsAndContext
(
workbook4Validate
,
functions
,
reportGenerator
.
initContext
(
resources
,
periodParam
),
true
);
FormulaEvaluator
validateEvaluator
=
workbook4Validate
.
getCreationHelper
().
createFormulaEvaluator
();
FormulaEvaluator
validateEvaluator
=
workbook4Validate
.
getCreationHelper
().
createFormulaEvaluator
();
validateEvaluator
.
evaluateAll
();
validateEvaluator
.
evaluateAll
();
//todo: 4.then save the validation result to cellData table
//todo: 4.then save the validation result to cellData table
...
@@ -2406,7 +2406,9 @@ public class ReportServiceImpl extends BaseService {
...
@@ -2406,7 +2406,9 @@ public class ReportServiceImpl extends BaseService {
List
<
EbitCellData
>
ebitCellDataList
=
ebitCellDataMapper
.
selectByExample
(
example
);
//获取当前期间下所有的数据
List
<
EbitCellData
>
ebitCellDataList
=
ebitCellDataMapper
.
selectByExample
(
example
);
//获取当前期间下所有的数据
List
<
List
<
EbitCellData
>>
dataList
=
Lists
.
newArrayList
();
List
<
List
<
EbitCellData
>>
dataList
=
Lists
.
newArrayList
();
List
<
EbitCellData
>
orgList
=
ebitCellDataMapper
.
selectOrgType
(
requestParameterDto
.
getPeriod
());
List
<
EbitCellData
>
orgList
=
ebitCellDataMapper
.
selectOrgType
(
requestParameterDto
.
getPeriod
());
List
<
EbitCellData
>
orgTypeList
=
null
;
List
<
EbitCellData
>
orgTypeList
=
Lists
.
newArrayList
();
File
file
=
null
;
//要生成的Excel文件
List
<
File
>
filesList
=
Lists
.
newArrayList
();
for
(
int
i
=
0
;
i
<
orgList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
orgList
.
size
();
i
++)
{
orgTypeList
=
Lists
.
newArrayList
();
orgTypeList
=
Lists
.
newArrayList
();
for
(
EbitCellData
ebitCellData
:
ebitCellDataList
)
{
for
(
EbitCellData
ebitCellData
:
ebitCellDataList
)
{
...
@@ -2417,7 +2419,7 @@ public class ReportServiceImpl extends BaseService {
...
@@ -2417,7 +2419,7 @@ public class ReportServiceImpl extends BaseService {
}
}
dataList
.
add
(
orgTypeList
);
dataList
.
add
(
orgTypeList
);
}
}
if
(
dataList
.
size
()
==
0
)
{
if
(
dataList
.
size
()
==
0
)
{
throw
new
Exception
(
"没有可导出的数据"
);
throw
new
Exception
(
"没有可导出的数据"
);
}
}
if
(
template
.
getIsSystemType
())
{
if
(
template
.
getIsSystemType
())
{
...
@@ -2445,11 +2447,15 @@ public class ReportServiceImpl extends BaseService {
...
@@ -2445,11 +2447,15 @@ public class ReportServiceImpl extends BaseService {
Sheet
sheet
=
workbook
.
getSheetAt
(
0
);
Sheet
sheet
=
workbook
.
getSheetAt
(
0
);
if
(
isSheetEmpty
(
sheet
))
throw
new
Exception
(
"模板异常"
);
if
(
isSheetEmpty
(
sheet
))
throw
new
Exception
(
"模板异常"
);
for
(
EbitCellData
ebitCellData
:
ebitCellDataList1
)
{
for
(
EbitCellData
ebitCellData
:
ebitCellDataList1
)
{
loop1:
for
(
int
j
=
1
,
k
=
sheet
.
getLastRowNum
();
j
<
k
;
j
++)
{
for
(
int
j
=
1
,
k
=
sheet
.
getLastRowNum
();
j
<
k
;
j
++)
{
if
(
sheet
.
getRow
(
j
)
==
null
)
continue
;
for
(
int
m
=
1
,
n
=
sheet
.
getRow
(
j
).
getLastCellNum
();
m
<
n
;
m
++)
{
for
(
int
m
=
1
,
n
=
sheet
.
getRow
(
j
).
getLastCellNum
();
m
<
n
;
m
++)
{
cell
=
sheet
.
getRow
(
j
).
getCell
(
m
);
cell
=
sheet
.
getRow
(
j
).
getCell
(
m
);
if
(
""
.
equals
(
getCellStringValue
(
cell
))
&&
ebitCellData
.
getRow
()
==
j
&&
ebitCellData
.
getCol
()
==
m
)
{
if
(
cell
==
null
)
continue
;
if
(!
""
.
equals
(
getCellStringValue
(
cell
))
&&
ebitCellData
.
getRow
()
==
j
&&
ebitCellData
.
getCol
()
==
m
)
{
cell
.
setCellValue
(
ebitCellData
.
getData
());
cell
.
setCellValue
(
ebitCellData
.
getData
());
break
loop1
;
}
}
}
}
}
}
...
@@ -2457,9 +2463,12 @@ public class ReportServiceImpl extends BaseService {
...
@@ -2457,9 +2463,12 @@ public class ReportServiceImpl extends BaseService {
workbooksList
.
add
(
workbook
);
workbooksList
.
add
(
workbook
);
//将workbook生成file文件
//将workbook生成file文件
String
path
=
"\\\\zipDir\\\\"
+
requestParameterDto
.
getPeriod
()
+
Math
.
random
()
+
"利润表"
;
String
path
=
"\\\\zipDir\\\\"
+
requestParameterDto
.
getPeriod
()
+
Math
.
random
()
+
"利润表"
;
FileExcelUtil
.
downloadZip
(
request
,
response
,
zipFileName
,
FileExcelUtil
.
generateExcelToPath
(
workbook
,
path
),
zipPath
);
file
=
FileExcelUtil
.
generateExcelToPath
(
workbook
,
path
);
}
if
(
file
!=
null
)
filesList
.
add
(
file
);
}
FileExcelUtil
.
downloadZip
(
request
,
response
,
zipFileName
,
filesList
,
zipPath
);
//将workbook转成流
//将workbook转成流
/* ByteArrayOutputStream bos = new ByteArrayOutputStream();
/* ByteArrayOutputStream bos = new ByteArrayOutputStream();
workbook.write(bos);
workbook.write(bos);
...
...
atms-web/src/main/webapp/app/analysis/table/tb-ebit-form.ctrl.js
View file @
e6df59e4
...
@@ -2930,7 +2930,7 @@
...
@@ -2930,7 +2930,7 @@
});
});
}
}
var
spreadTODb
=
function
(){
var
spreadTODb
=
function
(){
//spread序列化参数
/
*/
/spread序列化参数
var serializationOption = {
var serializationOption = {
ignoreFormula: false, // indicate to ignore the style when convert workbook to json, default value is false
ignoreFormula: false, // indicate to ignore the style when convert workbook to json, default value is false
ignoreStyle: false, // indicate to ignore the formula when convert workbook to json, default value is false
ignoreStyle: false, // indicate to ignore the formula when convert workbook to json, default value is false
...
@@ -2946,6 +2946,30 @@
...
@@ -2946,6 +2946,30 @@
$http.post('/Report/spreadToDb', obj ,function(res){
$http.post('/Report/spreadToDb', obj ,function(res){
if(!res.result)
if(!res.result)
SweetAlert.error("保存表单到数据库失败");
SweetAlert.error("保存表单到数据库失败");
});*/
var
json
=
$scope
.
spread
.
toJSON
({
includeBindingSource
:
true
});
var
excelIo
=
new
GC
.
Spread
.
Excel
.
IO
();
var
url
=
apiInterceptor
.
webApiHostUrl
+
'/Report/spreadToDb'
;
// here is excel IO API
excelIo
.
save
(
json
,
function
(
blob
)
{
var
fd
=
new
FormData
(
document
.
forms
.
namedItem
(
"myform"
));
fd
.
append
(
"llb.xlsx"
,
blob
);
$
.
ajax
({
url
:
url
,
type
:
"POST"
,
contentType
:
false
,
processData
:
false
,
data
:
fd
,
success
:
function
(
data
)
{
if
(
data
.
result
){
//alert("上传成功!");
}
else
{
SweetAlert
.
error
(
data
.
resultMsg
);
}
},
error
:
function
(
ex
)
{
alert
(
"上传失败:"
+
ex
);
}
});
});
}
}
...
@@ -3045,7 +3069,7 @@
...
@@ -3045,7 +3069,7 @@
$scope
.
singleExport
=
function
(){
$scope
.
singleExport
=
function
(){
if
(
$scope
.
spread
!=
undefined
&&
$scope
.
spread
){
if
(
$scope
.
spread
!=
undefined
&&
$scope
.
spread
){
var
excelIo
=
new
GC
.
Spread
.
Excel
.
IO
();
var
excelIo
=
new
GC
.
Spread
.
Excel
.
IO
();
var
fileName
=
"利润表.xlsx"
;
var
fileName
=
"
-
利润表.xlsx"
;
if
(
fileName
.
substr
(
-
5
,
5
)
!==
'.xlsx'
)
{
if
(
fileName
.
substr
(
-
5
,
5
)
!==
'.xlsx'
)
{
fileName
+=
'.xlsx'
;
fileName
+=
'.xlsx'
;
}
}
...
@@ -3100,9 +3124,10 @@
...
@@ -3100,9 +3124,10 @@
$log.debug(mainSpread);
$log.debug(mainSpread);
}, 500);*/
}, 500);*/
vatReportService
.
manyExport
(
JSON
.
stringify
(
param
)).
success
(
function
(
res
){
vatReportService
.
manyExport
(
JSON
.
stringify
(
param
)).
success
(
function
(
res
){
if
(
!
res
.
result
)
SweetAlert
.
error
(
res
.
resultMsg
);
}).
error
(
function
(
error
){
}).
error
(
function
(
error
){
SweetAlert
.
error
(
error
+
"批量导出失败"
)
SweetAlert
.
error
(
"批量导出失败"
)
});
});
};
};
$scope
.
relation
.
_orgId
=
null
;
$scope
.
relation
.
_orgId
=
null
;
...
...
atms-web/src/main/webapp/app/analysis/table/tb-ebit-form.html
View file @
e6df59e4
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<div
class=
"row"
style=
" height: 71px; background: #ccc;"
>
<div
class=
"row"
style=
" height: 71px; background: #ccc;"
>
<div
class=
"col-sm-7"
style=
" margin-top: 20px;"
>
<div
class=
"col-sm-7"
style=
" margin-top: 20px;"
>
<div
class=
"col-sm-8"
>
<div
class=
"col-sm-8"
>
<span
class=
"text-bold"
translate=
"SelectedOrganization"
style=
" top: -
11
px; display: inline!important; position: relative; "
>
:
</span>
<span
class=
"text-bold"
translate=
"SelectedOrganization"
style=
" top: -
7
px; display: inline!important; position: relative; "
>
:
</span>
<!-- <div id="dx-select-industry" class="tab-content-select industry " style=" display: inline-block;"
<!-- <div id="dx-select-industry" class="tab-content-select industry " style=" display: inline-block;"
dx-select-box="dataSourceIndustryList" dx-item-alias="itemObj">
dx-select-box="dataSourceIndustryList" dx-item-alias="itemObj">
<div data-options="dxTemplate: { name: 'orgList' }" class="dx-item-content dx-list-item-content"
<div data-options="dxTemplate: { name: 'orgList' }" class="dx-item-content dx-list-item-content"
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
{{itemObj.code}}-{{itemObj.name}}
{{itemObj.code}}-{{itemObj.name}}
</div>
</div>
</div>-->
</div>-->
<div
dx-tag-box=
"selectOrgOptions"
style=
"width:
340
px;display: inline-block"
></div>
<div
dx-tag-box=
"selectOrgOptions"
style=
"width:
287
px;display: inline-block"
></div>
</div>
</div>
<div
class=
"col-sm-4"
class=
"dateClass"
>
<div
class=
"col-sm-4"
class=
"dateClass"
>
<span
class=
"text-bold"
translate=
"InvoiceQJ"
>
:
</span>
<span
class=
"text-bold"
translate=
"InvoiceQJ"
>
:
</span>
...
@@ -38,5 +38,9 @@
...
@@ -38,5 +38,9 @@
<table-report-sheet
report-source=
"reportData"
spread=
'spread'
template-id=
'templateId'
<table-report-sheet
report-source=
"reportData"
spread=
'spread'
template-id=
'templateId'
relation=
"relation"
>
relation=
"relation"
>
</table-report-sheet>
</table-report-sheet>
<form
name=
"myform"
style=
"disply:none;"
id=
"myform"
enctype=
"multipart/form-data"
method=
"post"
>
</form>
</div>
</div>
</div>
</div>
\ No newline at end of file
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