记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
a993b21d
Commit
a993b21d
authored
May 05, 2022
by
limingyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出订单信息,导入对订单发货
parent
1bcb0804
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
398 additions
and
0 deletions
+398
-0
IGoblinExportService.java
...iquidnet/service/goblin/service/IGoblinExportService.java
+11
-0
CollectionUtil.java
.../java/com/liquidnet/commons/lang/util/CollectionUtil.java
+4
-0
pom.xml
...dnet-service-goblin/liquidnet-service-goblin-impl/pom.xml
+6
-0
GoblinImportController.java
...net/service/goblin/controller/GoblinImportController.java
+36
-0
OrderMallOrderVo.java
...va/com/liquidnet/service/goblin/dto/OrderMallOrderVo.java
+54
-0
GoblinImportServiceImpl.java
.../service/goblin/service/impl/GoblinImportServiceImpl.java
+33
-0
IGoblinImportService.java
...net/service/goblin/service/impl/IGoblinImportService.java
+11
-0
GoblinExportDataController.java
...latform/controller/goblin/GoblinExportDataController.java
+38
-0
GoblinExportServiceImpl.java
...platform/service/impl/goblin/GoblinExportServiceImpl.java
+205
-0
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/service/IGoblinExportService.java
0 → 100644
View file @
a993b21d
package
com
.
liquidnet
.
service
.
goblin
.
service
;
import
com.liquidnet.service.base.ResponseDto
;
import
javax.servlet.http.HttpServletResponse
;
public
interface
IGoblinExportService
{
//导出商城订单信息
ResponseDto
<
Boolean
>
exportMallOrder
(
HttpServletResponse
response
,
String
beginTime
,
String
endTime
,
String
state
,
Integer
mailType
);
}
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/util/CollectionUtil.java
View file @
a993b21d
...
...
@@ -9,6 +9,7 @@ import java.util.function.Predicate;
public
class
CollectionUtil
{
private
static
final
HashMap
<
String
,
String
>
STRING_STRING_HASH_MAP
=
new
HashMap
<>();
private
static
final
HashMap
<
String
,
Object
>
STRING_OBJECT_HASH_MAP
=
new
HashMap
<>();
private
static
final
HashMap
<
String
,
List
<
String
>>
STRING_LIST_HASH_MAP
=
new
HashMap
<>();
private
static
final
HashMap
<
String
,
Integer
>
STRING_INTEGER_HASH_MAP
=
new
HashMap
<>();
private
static
final
LinkedList
<
String
>
STRING_LINKED_LIST
=
new
LinkedList
<>();
private
static
final
LinkedList
<
Object
[]>
OBJECTS_LINKED_LIST
=
new
LinkedList
<>();
...
...
@@ -24,6 +25,9 @@ public class CollectionUtil {
public
static
HashMap
<
String
,
String
>
mapStringString
()
{
return
(
HashMap
<
String
,
String
>)
STRING_STRING_HASH_MAP
.
clone
();
}
public
static
HashMap
<
String
,
List
<
String
>>
mapStringList
()
{
return
(
HashMap
<
String
,
List
<
String
>>)
STRING_LIST_HASH_MAP
.
clone
();
}
public
static
HashMap
<
String
,
Object
>
mapStringObject
()
{
return
(
HashMap
<
String
,
Object
>)
STRING_OBJECT_HASH_MAP
.
clone
();
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/pom.xml
View file @
a993b21d
...
...
@@ -84,6 +84,12 @@
<groupId>
com.alibaba
</groupId>
<artifactId>
easyexcel
</artifactId>
</dependency>
<dependency>
<groupId>
com.liquidnet
</groupId>
<artifactId>
liquidnet-client-admin-common
</artifactId>
<version>
4.6.1
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<build>
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/GoblinImportController.java
0 → 100644
View file @
a993b21d
package
com
.
liquidnet
.
service
.
goblin
.
controller
;
import
com.liquidnet.client.admin.common.core.domain.AjaxResult
;
import
com.liquidnet.client.admin.common.utils.poi.ExcelUtil
;
import
com.liquidnet.service.goblin.dto.OrderMallOrderVo
;
import
com.liquidnet.service.goblin.service.impl.IGoblinImportService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
@Controller
@RequestMapping
(
"/import"
)
public
class
GoblinImportController
{
private
String
prefix
=
"zhengzai/kylin/performances/orderImport"
;
@Autowired
IGoblinImportService
iGoblinImportService
;
/**
* 导入对订单发货
*/
@PostMapping
(
"/OrderExpress"
)
@ResponseBody
public
AjaxResult
importOrderExpress
(
MultipartFile
file
)
throws
Exception
{
ExcelUtil
<
OrderMallOrderVo
>
util
=
new
ExcelUtil
(
OrderMallOrderVo
.
class
);
List
<
OrderMallOrderVo
>
MallOrdertVoList
=
util
.
importExcel
(
file
.
getInputStream
());
String
message
=
iGoblinImportService
.
importExpress
(
MallOrdertVoList
);
return
AjaxResult
.
success
(
message
);
}
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/dto/OrderMallOrderVo.java
0 → 100644
View file @
a993b21d
package
com
.
liquidnet
.
service
.
goblin
.
dto
;
import
com.liquidnet.client.admin.common.annotation.Excel
;
import
lombok.Data
;
@Data
public
class
OrderMallOrderVo
{
@Excel
(
name
=
"订单编号"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
orderCode
;
@Excel
(
name
=
"购买人手机号"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
userMobile
;
@Excel
(
name
=
"快递费"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
priceExpress
;
@Excel
(
name
=
"平台券优惠金额"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
priceCoupon
;
@Excel
(
name
=
"店铺券优惠金额"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
storePriceCoupon
;
@Excel
(
name
=
"收货人"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
expressContacts
;
@Excel
(
name
=
"收货人电话"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
expressPhone
;
@Excel
(
name
=
"快递地址"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
expressDetailAddress
;
@Excel
(
name
=
"支付方式"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
payType
;
@Excel
(
name
=
"支付时间"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
payTime
;
@Excel
(
name
=
"下单时间"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
createdAt
;
@Excel
(
name
=
"快递公司"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
logisticsCompany
;
@Excel
(
name
=
"物流单号"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
mailNo
;
@Excel
(
name
=
"商品id1"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
spuId
;
@Excel
(
name
=
"商品名1"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
name
;
@Excel
(
name
=
"一级分类1"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
cate1Name
;
@Excel
(
name
=
"二级分类1"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
cate2Name
;
@Excel
(
name
=
"款式1"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
skuName
;
@Excel
(
name
=
"数量1"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
num
;
@Excel
(
name
=
"单价1"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
skuPrice
;
@Excel
(
name
=
"价格1"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
skuPriceActual
;
@Excel
(
name
=
"订单skuId1"
,
cellType
=
Excel
.
ColumnType
.
STRING
)
private
String
orderSkuId
;
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinImportServiceImpl.java
0 → 100644
View file @
a993b21d
package
com
.
liquidnet
.
service
.
goblin
.
service
.
impl
;
import
com.liquidnet.client.admin.common.exception.BusinessException
;
import
com.liquidnet.client.admin.common.utils.StringUtils
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.dto.OrderMallOrderVo
;
import
com.liquidnet.service.goblin.service.manage.IGoblinStoreOrderService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
@Slf4j
public
class
GoblinImportServiceImpl
implements
IGoblinImportService
{
@Autowired
private
IGoblinStoreOrderService
iGoblinStoreOrderService
;
@Override
public
String
importExpress
(
List
<
OrderMallOrderVo
>
mallOrdertVoList
)
{
if
(
StringUtils
.
isNull
(
mallOrdertVoList
)
||
mallOrdertVoList
.
size
()
==
0
)
{
throw
new
BusinessException
(
"导入用户数据不能为空!"
);
}
int
count
=
0
;
for
(
OrderMallOrderVo
mallOrderVo
:
mallOrdertVoList
)
{
ResponseDto
<
Boolean
>
express
=
iGoblinStoreOrderService
.
express
(
mallOrderVo
.
getOrderCode
(),
null
,
mallOrderVo
.
getMailNo
());
count
++;
}
return
String
.
valueOf
(
count
);
}
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/IGoblinImportService.java
0 → 100644
View file @
a993b21d
package
com
.
liquidnet
.
service
.
goblin
.
service
.
impl
;
import
com.liquidnet.service.goblin.dto.OrderMallOrderVo
;
import
java.util.List
;
public
interface
IGoblinImportService
{
//导入对订单发货
String
importExpress
(
List
<
OrderMallOrderVo
>
orderOutLineVoList
);
}
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/controller/goblin/GoblinExportDataController.java
0 → 100644
View file @
a993b21d
package
com
.
liquidnet
.
service
.
platform
.
controller
.
goblin
;
import
com.liquidnet.service.goblin.service.IGoblinExportService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
javax.servlet.http.HttpServletResponse
;
@Api
(
tags
=
"商城-订单信息导出"
)
@Controller
@RequestMapping
(
"/tools/export"
)
@Validated
public
class
GoblinExportDataController
{
@Autowired
IGoblinExportService
iGoblinExportService
;
/**
* 导出商城订单信息
*
* @param beginTime
* @param endTime
* @return
*/
@GetMapping
(
"/exportMallOrder"
)
@ApiOperation
(
value
=
"excel订单信息导出"
)
public
void
exportMallOrder
(
HttpServletResponse
response
,
@RequestParam
(
"beginTime"
)
String
beginTime
,
@RequestParam
(
"endTime"
)
String
endTime
,
@RequestParam
(
"state"
)
String
state
,
@RequestParam
(
"mailType"
)
Integer
mailType
)
{
iGoblinExportService
.
exportMallOrder
(
response
,
beginTime
,
endTime
,
state
,
mailType
);
}
}
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/goblin/GoblinExportServiceImpl.java
0 → 100644
View file @
a993b21d
package
com
.
liquidnet
.
service
.
platform
.
service
.
impl
.
goblin
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.write.metadata.style.WriteCellStyle
;
import
com.alibaba.excel.write.metadata.style.WriteFont
;
import
com.alibaba.excel.write.style.HorizontalCellStyleStrategy
;
import
com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.dto.MallOrdertDao
;
import
com.liquidnet.service.goblin.mapper.GoblinStoreOrderMapper
;
import
com.liquidnet.service.goblin.service.IGoblinExportService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.OutputStream
;
import
java.net.URLEncoder
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.util.*
;
@Service
@Slf4j
public
class
GoblinExportServiceImpl
implements
IGoblinExportService
{
@Autowired
GoblinStoreOrderMapper
goblinStoreOrderMapper
;
@Override
public
ResponseDto
<
Boolean
>
exportMallOrder
(
HttpServletResponse
response
,
String
beginTime
,
String
endTime
,
String
state
,
Integer
mailType
)
{
if
(!
timeIsNotNull
(
beginTime
,
endTime
))
{
return
ResponseDto
.
failure
(
"起始和结束时间不能为空!"
);
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
try
{
Date
beginDate
=
sdf
.
parse
(
beginTime
);
Date
endDate
=
sdf
.
parse
(
endTime
);
List
<
String
>
states
=
null
;
if
(
StringUtils
.
isNotBlank
(
state
))
{
states
=
Arrays
.
asList
(
state
.
split
(
","
));
}
List
<
MallOrdertDao
>
voList
=
goblinStoreOrderMapper
.
exportMallOrder
(
beginDate
,
endDate
,
states
,
mailType
);
Map
<
String
,
List
<
String
>>
map
=
CollectionUtil
.
mapStringList
();
int
max
=
0
;
//将数据保存到list中
if
(
voList
!=
null
&&
voList
.
size
()
>
0
)
{
for
(
MallOrdertDao
te
:
voList
)
{
String
orderCode
=
te
.
getOrderCode
();
if
(
map
.
get
(
orderCode
)
==
null
)
{
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
te
.
getOrderCode
());
list
.
add
(
te
.
getUserMobile
());
list
.
add
(
te
.
getPriceExpress
());
list
.
add
(
te
.
getPriceCoupon
());
list
.
add
(
te
.
getStorePriceCoupon
());
list
.
add
(
te
.
getExpressContacts
());
list
.
add
(
te
.
getExpressPhone
());
list
.
add
(
te
.
getExpressDetailAddress
());
list
.
add
(
te
.
getPayType
());
list
.
add
(
te
.
getPayTime
());
list
.
add
(
te
.
getCreatedAt
());
list
.
add
(
te
.
getLogisticsCompany
());
list
.
add
(
te
.
getMailNo
());
list
.
add
(
te
.
getSpuId
());
list
.
add
(
te
.
getName
());
list
.
add
(
te
.
getCate1Name
());
list
.
add
(
te
.
getCate2Name
());
list
.
add
(
te
.
getSkuName
());
list
.
add
(
te
.
getNum
());
list
.
add
(
te
.
getSkuPrice
());
list
.
add
(
te
.
getSkuPriceActual
());
list
.
add
(
te
.
getOrderSkuId
());
max
=
Math
.
max
(
max
,
list
.
size
());
map
.
put
(
orderCode
,
list
);
continue
;
}
if
(
map
.
get
(
orderCode
)
!=
null
)
{
List
<
String
>
list
=
map
.
get
(
orderCode
);
list
.
add
(
te
.
getSpuId
());
list
.
add
(
te
.
getName
());
list
.
add
(
te
.
getCate1Name
());
list
.
add
(
te
.
getCate2Name
());
list
.
add
(
te
.
getSkuName
());
list
.
add
(
te
.
getNum
());
list
.
add
(
te
.
getSkuPrice
());
list
.
add
(
te
.
getSkuPriceActual
());
list
.
add
(
te
.
getOrderSkuId
());
max
=
Math
.
max
(
max
,
list
.
size
());
map
.
put
(
orderCode
,
list
);
}
}
List
<
String
>
cells
=
new
ArrayList
<>();
cells
.
add
(
"订单编号"
);
cells
.
add
(
"购买人手机号"
);
cells
.
add
(
"快递费"
);
cells
.
add
(
"平台券优惠券金额"
);
cells
.
add
(
"店铺券优惠金额"
);
cells
.
add
(
"收货人"
);
cells
.
add
(
"收货人电话"
);
cells
.
add
(
"快递地址"
);
cells
.
add
(
"支付方式"
);
cells
.
add
(
"支付时间"
);
cells
.
add
(
"下单时间"
);
cells
.
add
(
"快递公司"
);
cells
.
add
(
"物流单号"
);
int
j
=
(
max
-
13
)/
9
;
for
(
int
i
=
1
;
i
<=
j
;
i
++)
{
cells
.
add
(
"商品id"
+
i
);
cells
.
add
(
"商品名"
+
i
);
cells
.
add
(
"一级分类"
+
i
);
cells
.
add
(
"二级分类"
+
i
);
cells
.
add
(
"款式"
+
i
);
cells
.
add
(
"数量"
+
i
);
cells
.
add
(
"单价"
+
i
);
cells
.
add
(
"价格"
+
i
);
cells
.
add
(
"订单skuId"
+
i
);
}
String
[]
header
=
cells
.
toArray
(
new
String
[
cells
.
size
()]);
List
<
Object
>
objectList
=
new
ArrayList
<>();
map
.
entrySet
().
stream
().
forEach
(
ms
->
{
objectList
.
add
(
ms
.
getValue
());
});
String
fileName
=
"商城订单信息"
;
// 标题样式
WriteCellStyle
headWriteCellStyle
=
getHeadStyle
();
// 这个策略是 头是头的样式 内容是内容的样式 其他的策略可以自己实现
HorizontalCellStyleStrategy
horizontalCellStyleStrategy
=
new
HorizontalCellStyleStrategy
(
headWriteCellStyle
,
new
WriteCellStyle
());
EasyExcel
.
write
(
getOutputStream
(
fileName
,
response
))
//设置默认样式及写入头信息开始的行数
// .useDefaultStyle(true).relativeHeadRowIndex(0)
// 表头、内容样式设置
.
registerWriteHandler
(
horizontalCellStyleStrategy
)
// 统一列宽,如需设置自动列宽则new LongestMatchColumnWidthStyleStrategy()
.
registerWriteHandler
(
new
SimpleColumnWidthStyleStrategy
(
25
))
.
sheet
(
fileName
)
// 这里放入动态头
.
head
(
head
(
header
))
// 当然这里数据也可以用 List<List<String>> 去传入
.
doWrite
(
objectList
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"导出Excel失败,请联系网站管理员!"
);
}
return
ResponseDto
.
success
();
}
private
boolean
timeIsNotNull
(
String
beginTime
,
String
endTime
)
{
return
StringUtils
.
isNotBlank
(
beginTime
)
&&
StringUtils
.
isNotBlank
(
endTime
)
?
true
:
false
;
}
/*动态头传入*/
private
static
List
<
List
<
String
>>
head
(
String
[]
header
)
{
List
<
String
>
head0
=
null
;
List
<
List
<
String
>>
list
=
new
LinkedList
<
List
<
String
>>();
for
(
String
h
:
header
)
{
head0
=
new
LinkedList
<>();
// head0.add(bigTitle);
head0
.
add
(
h
);
list
.
add
(
head0
);
}
return
list
;
}
private
static
WriteCellStyle
getHeadStyle
(){
// 头的策略
WriteCellStyle
headWriteCellStyle
=
new
WriteCellStyle
();
// 背景颜色
headWriteCellStyle
.
setFillForegroundColor
(
IndexedColors
.
WHITE
.
getIndex
());
headWriteCellStyle
.
setFillPatternType
(
FillPatternType
.
SOLID_FOREGROUND
);
// 字体
WriteFont
headWriteFont
=
new
WriteFont
();
headWriteFont
.
setFontName
(
"黑体"
);
//设置字体名字
headWriteFont
.
setFontHeightInPoints
((
short
)
15
);
//设置字体大小
headWriteFont
.
setBold
(
true
);
//字体加粗
headWriteCellStyle
.
setWriteFont
(
headWriteFont
);
//在样式用应用设置的字体;
// 样式
headWriteCellStyle
.
setBorderBottom
(
BorderStyle
.
THIN
);
//设置底边框;
headWriteCellStyle
.
setBottomBorderColor
((
short
)
0
);
//设置底边框颜色;
headWriteCellStyle
.
setBorderLeft
(
BorderStyle
.
THIN
);
//设置左边框;
headWriteCellStyle
.
setLeftBorderColor
((
short
)
0
);
//设置左边框颜色;
headWriteCellStyle
.
setBorderRight
(
BorderStyle
.
THIN
);
//设置右边框;
headWriteCellStyle
.
setRightBorderColor
((
short
)
0
);
//设置右边框颜色;
headWriteCellStyle
.
setBorderTop
(
BorderStyle
.
THIN
);
//设置顶边框;
headWriteCellStyle
.
setTopBorderColor
((
short
)
0
);
//设置顶边框颜色;
headWriteCellStyle
.
setWrapped
(
true
);
//设置自动换行;
headWriteCellStyle
.
setHorizontalAlignment
(
HorizontalAlignment
.
CENTER
);
//设置水平对齐的样式为居中对齐;
headWriteCellStyle
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
//设置垂直对齐的样式为居中对齐;
// headWriteCellStyle.setShrinkToFit(true);//设置文本收缩至合适
return
headWriteCellStyle
;
}
private
static
OutputStream
getOutputStream
(
String
fileName
,
HttpServletResponse
response
)
throws
Exception
{
fileName
=
URLEncoder
.
encode
(
fileName
,
"UTF-8"
);
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename="
+
fileName
+
"-"
+
LocalDate
.
now
()
+
".xlsx"
);
return
response
.
getOutputStream
();
}
}
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