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
c5517275
Commit
c5517275
authored
May 25, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed report display issue
parent
d62b1024
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
146 additions
and
54 deletions
+146
-54
TemplateController.java
.../java/pwc/taxtech/atms/controller/TemplateController.java
+18
-10
TemplateDto.java
atms-api/src/main/java/pwc/taxtech/atms/dto/TemplateDto.java
+8
-8
TemplateServiceImpl.java
...va/pwc/taxtech/atms/service/impl/TemplateServiceImpl.java
+1
-1
conf_profile_dev.properties
atms-api/src/main/resources/conf/conf_profile_dev.properties
+2
-1
Gruntfile.js
atms-web/src/main/webapp/Gruntfile.js
+4
-0
index.html
atms-web/src/main/webapp/WEB-INF/templates/index.html
+1
-0
template.svc.js
...eb/src/main/webapp/app/common/webservices/template.svc.js
+106
-28
common.js
atms-web/src/main/webapp/bundles/common.js
+0
-0
spreadio.js
atms-web/src/main/webapp/bundles/spreadio.js
+0
-0
systemConfiguration.js
atms-web/src/main/webapp/bundles/systemConfiguration.js
+6
-6
No files found.
atms-api/src/main/java/pwc/taxtech/atms/controller/TemplateController.java
View file @
c5517275
...
...
@@ -14,6 +14,7 @@ import pwc.taxtech.atms.service.TemplateService;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.net.URISyntaxException
;
import
java.util.Collections
;
import
java.util.List
;
...
...
@@ -34,37 +35,37 @@ public class TemplateController {
@RequestMapping
(
value
=
"get"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
@ResponseBody
List
<
TemplateDto
>
get
(
@RequestParam
String
templateGroupID
,
@RequestParam
Integer
reportType
)
{
List
<
TemplateDto
>
get
(
@RequestParam
String
templateGroupID
,
@RequestParam
String
reportType
)
{
if
(
StringUtils
.
isEmpty
(
templateGroupID
))
{
return
Collections
.
emptyList
();
}
try
{
return
templateService
.
get
(
templateGroupID
,
reportType
);
return
templateService
.
get
(
templateGroupID
,
(
reportType
!=
null
&&
!
reportType
.
equals
(
"null"
))
?
Integer
.
parseInt
(
reportType
)
:
null
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"GetCellConfigList"
,
e
);
}
return
Collections
.
emptyList
();
}
@RequestMapping
(
value
=
"getTemplateJson"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_
JSON_UTF8
_VALUE
)
@RequestMapping
(
value
=
"getTemplateJson"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_
OCTET_STREAM
_VALUE
)
public
@ResponseBody
void
getTemplateBlob
(
@RequestParam
String
templateID
,
HttpServletResponse
response
)
{
void
getTemplateBlob
(
@RequestParam
String
templateID
,
HttpServletResponse
response
)
throws
URISyntaxException
{
String
filePath
;
File
templateFile
;
InputStream
inputStream
=
null
;
String
templatePath
=
templateService
.
getTemplatePath
(
templateID
);
if
(
StringUtils
.
isEmpty
(
templateID
))
{
if
(
StringUtils
.
isEmpty
(
templateID
))
{
return
;
}
if
(
templatePath
==
null
||
StringUtils
.
isEmpty
(
templatePath
))
{
if
(
templatePath
==
null
||
StringUtils
.
isEmpty
(
templatePath
))
{
return
;
}
filePath
=
this
.
getClass
().
getResource
(
"/"
).
getPath
();
templateFile
=
new
File
(
filePath
+
templateService
.
getTemplatePath
(
templateID
));
filePath
=
this
.
getClass
().
getResource
(
""
).
toURI
().
getPath
();
String
tempPath
=
filePath
.
substring
(
0
,
filePath
.
indexOf
(
"classes"
)+
"\\classes"
.
length
());
templateFile
=
new
File
(
tempPath
+
templateService
.
getTemplatePath
(
templateID
));
try
{
inputStream
=
new
BufferedInputStream
(
new
FileInputStream
(
templateFile
));
...
...
@@ -72,7 +73,14 @@ public class TemplateController {
String
customFileName
=
"template_"
+
DateTime
.
now
().
toString
(
"yyyyMMddHHmmss"
)
+
".xlsx"
;
response
.
setHeader
(
"Content-Disposition"
,
String
.
format
(
"inline; filename=\""
+
customFileName
+
"\""
));
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
FileCopyUtils
.
copy
(
inputStream
,
response
.
getOutputStream
());
int
len
=
0
;
byte
[]
buffer
=
new
byte
[
1024
];
OutputStream
out
=
response
.
getOutputStream
();
while
((
len
=
inputStream
.
read
(
buffer
))>
0
){
out
.
write
(
buffer
,
0
,
len
);
}
//FileCopyUtils.copy(inputStream, response.getOutputStream());
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
Exception
e
)
{
...
...
atms-api/src/main/java/pwc/taxtech/atms/dto/TemplateDto.java
View file @
c5517275
...
...
@@ -120,20 +120,20 @@ public final class TemplateDto {
this
.
code
=
code
;
}
public
boolean
i
sSystemType
()
{
return
isSystemType
;
public
boolean
getI
sSystemType
()
{
return
this
.
isSystemType
;
}
public
void
set
SystemType
(
boolean
s
ystemType
)
{
isSystemType
=
s
ystemType
;
public
void
set
IsSystemType
(
boolean
isS
ystemType
)
{
this
.
isSystemType
=
isS
ystemType
;
}
public
boolean
i
sActiveAssociation
()
{
return
isActiveAssociation
;
public
boolean
getI
sActiveAssociation
()
{
return
this
.
isActiveAssociation
;
}
public
void
set
ActiveAssociation
(
boolean
a
ctiveAssociation
)
{
isActiveAssociation
=
a
ctiveAssociation
;
public
void
set
IsActiveAssociation
(
boolean
isA
ctiveAssociation
)
{
this
.
isActiveAssociation
=
isA
ctiveAssociation
;
}
public
List
<
CellTemplateDto
>
getCellTemplateDtos
()
{
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/TemplateServiceImpl.java
View file @
c5517275
...
...
@@ -43,7 +43,7 @@ public class TemplateServiceImpl extends AbstractService implements TemplateServ
if
(
template
!=
null
)
{
if
(
template
.
getPath
().
startsWith
(
"~"
))
{
result
=
template
.
getPath
().
substring
(
1
,
template
.
getPath
().
length
()
-
1
);
result
=
template
.
getPath
().
substring
(
1
,
template
.
getPath
().
length
());
}
else
{
result
=
template
.
getPath
();
}
...
...
atms-api/src/main/resources/conf/conf_profile_dev.properties
View file @
c5517275
...
...
@@ -7,6 +7,6 @@ mail_jdbc_user=sa
mail_jdbc_password
=
atmsunittestSQL
web.url
=
http://localhost:8080
#web.url=*
jwt.base64Secret
=
TXppQjFlZFBSbnJzMHc0Tg==
jwt.powerToken
=
xxxx
\ No newline at end of file
atms-web/src/main/webapp/Gruntfile.js
View file @
c5517275
...
...
@@ -274,6 +274,10 @@ grunt.initConfig({
src
:
[
"Scripts/spreadjs/gc.spread.sheets.all.11.0.0.min.js"
],
dest
:
'<%= pkg.bundleDest %>/spread.js'
},
spreadiojs
:
{
src
:
[
"Scripts/spreadjs/interop/gc.spread.excelio.11.0.0.min.js"
],
dest
:
'<%= pkg.bundleDest %>/spreadio.js'
},
ivhTreeview
:
{
src
:
[
"Scripts/angular-ivh-treeview/ivh-treeview.js"
,
"Scripts/angular-notify/angular-notify.js"
,
...
...
atms-web/src/main/webapp/WEB-INF/templates/index.html
View file @
c5517275
...
...
@@ -95,6 +95,7 @@
<script
type=
"text/javascript"
src=
"bundles/spread.js"
></script>
<script
type=
"text/javascript"
src=
"bundles/ivh-treeview.js"
></script>
<script
type=
"text/javascript"
src=
"bundles/ui-select.js"
></script>
<script
type=
"text/javascript"
src=
"bundles/spreadio.js"
></script>
<script
type=
"text/javascript"
>
//window.location.href = '/Home/Admin/#/userDetail/808b7a8c-0265-4497-9adb-6b7a757bd2f2';
...
...
atms-web/src/main/webapp/app/common/webservices/template.svc.js
View file @
c5517275
// web service proxy for standard account
webservices
.
factory
(
'templateService'
,
[
'$log'
,
'$http'
,
'$q'
,
'apiConfig'
,
'httpCacheService'
,
'$timeout'
,
'$rootScope'
,
'$interval'
,
function
(
$log
,
$http
,
$q
,
apiConfig
,
httpCacheService
,
$timeout
,
$rootScope
,
$interval
)
{
webservices
.
factory
(
'templateService'
,
[
'$log'
,
'$http'
,
'$q'
,
'apiConfig'
,
'httpCacheService'
,
'$timeout'
,
'$rootScope'
,
'$interval'
,
'loginContext'
,
function
(
$log
,
$http
,
$q
,
apiConfig
,
httpCacheService
,
$timeout
,
$rootScope
,
$interval
,
loginContext
)
{
'use strict'
;
var
getCookie
=
function
(
cname
)
{
var
name
=
cname
+
"="
;
var
ca
=
document
.
cookie
.
split
(
';'
);
for
(
var
i
=
0
;
i
<
ca
.
length
;
i
++
)
{
var
c
=
ca
[
i
].
trim
();
// if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
if
(
c
.
indexOf
(
name
)
==
0
)
return
ATMS_EXTRA
.
decodeCookieValue
(
c
.
substring
(
name
.
length
,
c
.
length
));
}
return
""
;
};
var
getTemplateJson
=
function
(
templateID
)
{
//return $http.get('/template/getTemplateJson?templateID=' + templateID, apiConfig.create());
// var result = httpCacheService.get('/template/getTemplateJson?templateID=' + templateID);
// if (result.finishedCache) {
// return result;
// } else {
var
thisConfig
=
apiConfig
.
create
();
thisConfig
.
responseType
=
"arraybuffer"
;
$http
.
post
(
'/template/getTemplateJson?templateID='
+
templateID
,
{},
apiConfig
.
create
()).
then
(
function
(
response
)
{
var
data
=
new
Blob
([
response
.
data
],
{
type
:
response
.
headers
(
'Content-Type'
)});
return
data
;
});
// var thisConfig = apiConfig.create();
// thisConfig.responseType = "blob";
// return $http.post('/template/getTemplateJson?templateID=' + templateID, {}, apiConfig.create());
// }
var
deferred
=
$q
.
defer
();
var
promise
=
deferred
.
promise
;
// var ajaxUrl = loginContext.apiHost + constant.webapi.prefix + '/template/getTemplateJson?templateID=' + templateID;
// var apiTokenObj = JSON.parse(getCookie('AtmsApiToken'));
// var apiToken = apiTokenObj.access_token;
// var tokenType = apiTokenObj.token_type;
// var ajaxSource = $.ajax({
// url: ajaxUrl,
// type: "POST",
// dataType:"blob",
// beforeSend: function (xhr) {
// xhr.setRequestHeader('Authorization', tokenType + ' ' + apiToken);
// //xhr.setRequestHeader('from', 'aabb@cn.pwc.com');
// //xhr.responseType = "blob";
// },
// success: function(data){
// deferred.resolve(data);
// },
// complete: function(data){
// deferred.resolve(data.responseText);
// }
// });
// ajaxSource.done(function (data) {
// deferred.resolve(data);
// });
return
promise
;
};
var
initSpreadExcel
=
function
(
id
,
ssjsondata
)
{
...
...
@@ -22,7 +58,7 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
var
deferred
=
$q
.
defer
();
var
promise
=
deferred
.
promise
;
var
spread
=
new
GC
.
Spread
.
Sheets
.
Spread
(
document
.
getElementById
(
id
));
var
spread
=
new
GC
.
Spread
.
Sheets
.
Workbook
(
document
.
getElementById
(
id
));
spread
.
showVerticalScrollbar
(
true
);
spread
.
showHorizontalScrollbar
(
true
);
spread
.
scrollbarMaxAlign
(
true
);
...
...
@@ -32,23 +68,23 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
spread
.
tabEditable
(
false
);
spread
.
tabStripVisible
(
false
);
spread
.
newTabVisible
(
false
);
spread
.
allowUndo
(
false
);
spread
.
allowUserResize
(
false
);
spread
.
canUserDragDrop
(
false
);
spread
.
canUserDragFill
(
false
);
spread
.
canUserEditFormula
(
false
);
spread
.
isPaintSuspended
(
true
);
spread
.
fromJSON
(
JSON
.
parse
(
ssjsondata
));
spread
.
isPaintSuspended
(
false
);
//
spread.allowUndo(false);
//
spread.allowUserResize(false);
//
spread.canUserDragDrop(false);
//
spread.canUserDragFill(false);
//
spread.canUserEditFormula(false);
//
//
spread.isPaintSuspended(true);
//
spread.fromJSON(JSON.parse(ssjsondata));
//
spread.isPaintSuspended(false);
var
sheet
=
spread
.
getActiveSheet
();
if
(
sheet
!=
null
)
{
sheet
.
setRowHeaderVisible
(
true
);
sheet
.
setColumnHeaderVisible
(
true
);
sheet
.
setGridlineOptions
({
showVerticalGridline
:
false
,
showHorizontalGridline
:
false
});
//
sheet.setRowHeaderVisible(true);
//
sheet.setColumnHeaderVisible(true);
//
sheet.setGridlineOptions({
//
showVerticalGridline: false, showHorizontalGridline: false
//
});
}
deferred
.
resolve
(
spread
);
...
...
@@ -60,21 +96,63 @@ webservices.factory('templateService', ['$log', '$http', '$q', 'apiConfig', 'htt
var
promise
=
deferred
.
promise
;
var
spreadSheet
;
getTemplateJson
(
templateID
).
success
(
function
(
result
)
{
var
url
=
loginContext
.
apiHost
+
constant
.
webapi
.
prefix
+
'/template/getTemplateJson?templateID='
+
templateID
;
var
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
'POST'
,
url
,
true
);
// 也可以使用POST方式,根据接口
xhr
.
responseType
=
"blob"
;
// 返回类型blob
var
apiTokenObj
=
JSON
.
parse
(
getCookie
(
'AtmsApiToken'
));
var
apiToken
=
apiTokenObj
.
access_token
;
var
tokenType
=
apiTokenObj
.
token_type
;
xhr
.
setRequestHeader
(
'Authorization'
,
tokenType
+
' '
+
apiToken
);
// xhr.setRequestHeader("Authorization","bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTUyNzMxNDA4NCwiaWF0IjoxNTI3MTQxMjg0LCJuYmYiOjE1MjcxNDA2ODQsImp0aSI6IjVGM0FGMTBDLTdFMEEtNDVDQy04RDVGLUREMTBFMDRCOUY4NCIsInVzZXJuYW1lIjoiYWRtaW4iLCJkYXRhYmFzZVVzZXJuYW1lIjoiQWRtaW4iLCJ1c2VyaWQiOiI2NjkzM0U3Qi1EQTc1LTRCMkUtQjdENi1BQjY1RENBMjBENTAifQ.M-dyU6W51LAPVQ66HIJZ-KAg6WjPSIt1GqpOc6etQ6XJfXp8KkUPA6A8qPZ8bhydWsKKMqpPlx-KRVhK2o5q0Q")
// 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
xhr
.
onload
=
function
()
{
// 请求完成
if
(
this
.
status
===
200
)
{
// 返回200
var
blob
=
this
.
response
;
var
excelIo
=
new
GC
.
Spread
.
Excel
.
IO
();
excelIo
.
open
(
result
,
function
(
json
)
{
var
workbookObj
=
json
;
excelIo
.
open
(
blob
,
function
(
json
)
{
//
var workbookObj = json;
//spread.fromJSON(workbookObj);
spreadSheet
=
initSpreadExcel
(
id
,
workbookObj
);
spreadSheet
=
initSpreadExcel
(
id
,
json
);
deferred
.
resolve
(
spreadSheet
);
},
function
(
e
)
{
// process error
alert
(
e
.
errorMessage
);
},
{});
// var reader = new FileReader();
// reader.readAsDataURL(blob); // 转换为base64,可以直接放入a表情href
// reader.onload = function (e) {
// // 转换完成,创建一个a标签用于下载
// var a = document.createElement('a');
// a.download = 'data.xlsx';
// a.href = e.target.result;
// $("body").append(a); // 修复firefox中无法触发click
// a.click();
// $(a).remove();
// }
}
};
// 发送ajax请求
xhr
.
send
();
// getTemplateJson(templateID).then(function (result) {
// //var data = new Blob(result, {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"});
// var excelIo = new GC.Spread.Excel.IO();
// excelIo.open(result, function (json) {
// //var workbookObj = json;
// //spread.fromJSON(workbookObj);
// spreadSheet = initSpreadExcel(id, json);
// deferred.resolve(spreadSheet);
// }, function (e) {
// // process error
// alert(e.errorMessage);
// }, {});
// spreadSheet = initSpreadExcel(id, result.data === undefined ? result : result.data);
//
// deferred.resolve(spreadSheet);
});
//
});
return
promise
;
};
...
...
atms-web/src/main/webapp/bundles/common.js
View file @
c5517275
This diff is collapsed.
Click to expand it.
atms-web/src/main/webapp/bundles/spreadio.js
0 → 100644
View file @
c5517275
This diff is collapsed.
Click to expand it.
atms-web/src/main/webapp/bundles/systemConfiguration.js
View file @
c5517275
...
...
@@ -576,14 +576,14 @@ systemConfigurationModule
setCellFormula
(
template
.
id
);
//给单元格增加双击事件
activeSheet
.
bind
(
G
c
Spread
.
Sheets
.
Events
.
CellDoubleClick
,
function
(
sender
,
args
)
{
activeSheet
.
bind
(
G
C
.
Spread
.
Sheets
.
Events
.
CellDoubleClick
,
function
(
sender
,
args
)
{
var
sheet
=
args
.
sheet
;
var
cell
=
sheet
.
getCell
(
args
.
row
,
args
.
col
);
showEditReportFormulaPop
(
template
,
args
.
row
,
args
.
col
,
true
);
});
//给单元格增加单击事件
activeSheet
.
bind
(
G
c
Spread
.
Sheets
.
Events
.
CellClick
,
function
(
sender
,
args
)
{
activeSheet
.
bind
(
G
C
.
Spread
.
Sheets
.
Events
.
CellClick
,
function
(
sender
,
args
)
{
var
sheet
=
args
.
sheet
;
var
cell
=
sheet
.
getCell
(
args
.
row
,
args
.
col
);
showEditReportFormulaPop
(
template
,
args
.
row
,
args
.
col
,
false
);
...
...
@@ -604,7 +604,7 @@ systemConfigurationModule
if
(
$scope
.
currentTemplate
.
isSystemType
)
{
isHideContextMenu
=
true
;
}
else
if
(
hitTestType
===
G
c
Spread
.
Sheets
.
SheetArea
.
colHeader
)
{
else
if
(
hitTestType
===
G
C
.
Spread
.
Sheets
.
SheetArea
.
colHeader
)
{
if
(
getCellInSelections
(
selections
,
row
,
col
)
===
null
)
{
sheet
.
setSelection
(
-
1
,
col
,
sheet
.
getRowCount
(),
1
);
}
...
...
@@ -612,7 +612,7 @@ systemConfigurationModule
$
(
".context-header"
).
show
();
$
(
".context-cell"
).
hide
();
}
}
else
if
(
hitTestType
===
G
c
Spread
.
Sheets
.
SheetArea
.
rowHeader
)
{
}
else
if
(
hitTestType
===
G
C
.
Spread
.
Sheets
.
SheetArea
.
rowHeader
)
{
if
(
getCellInSelections
(
selections
,
row
,
col
)
===
null
)
{
sheet
.
setSelection
(
row
,
-
1
,
1
,
sheet
.
getColumnCount
());
}
...
...
@@ -620,7 +620,7 @@ systemConfigurationModule
$
(
".context-header"
).
show
();
$
(
".context-cell"
).
hide
();
}
}
else
if
(
hitTestType
===
G
c
Spread
.
Sheets
.
SheetArea
.
viewport
)
{
}
else
if
(
hitTestType
===
G
C
.
Spread
.
Sheets
.
SheetArea
.
viewport
)
{
if
(
getCellInSelections
(
selections
,
row
,
col
)
===
null
)
{
sheet
.
clearSelection
();
sheet
.
setActiveCell
(
row
,
col
);
...
...
@@ -631,7 +631,7 @@ systemConfigurationModule
}
else
{
isHideContextMenu
=
true
;
}
}
else
if
(
hitTestType
===
G
c
Spread
.
Sheets
.
SheetArea
.
corner
)
{
}
else
if
(
hitTestType
===
G
C
.
Spread
.
Sheets
.
SheetArea
.
corner
)
{
sheet
.
setSelection
(
-
1
,
-
1
,
sheet
.
getRowCount
(),
sheet
.
getColumnCount
());
if
(
row
!==
undefined
&&
col
!==
undefined
)
{
$
(
".context-header"
).
hide
();
...
...
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