记得上下班打卡 | 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
1d02e14f
Commit
1d02e14f
authored
May 07, 2022
by
limingyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出商城订单修改状态无效
parent
456be1ef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
216 additions
and
216 deletions
+216
-216
GoblinExportServiceImpl.java
...zhengzai/goblin/service/impl/GoblinExportServiceImpl.java
+211
-211
GoblinStoreOrderMapper.xml
...iquidnet.service.goblin.mapper/GoblinStoreOrderMapper.xml
+4
-4
GoblinExportServiceImpl.java
...platform/service/impl/goblin/GoblinExportServiceImpl.java
+1
-1
No files found.
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/goblin/service/impl/GoblinExportServiceImpl.java
View file @
1d02e14f
package
com
.
liquidnet
.
client
.
admin
.
zhengzai
.
goblin
.
service
.
impl
;
//
package com.liquidnet.client.admin.zhengzai.goblin.service.impl;
//
import
com.liquidnet.client.admin.common.core.domain.AjaxResult
;
//
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import
com.liquidnet.client.admin.common.exception.BusinessException
;
//
import com.liquidnet.client.admin.common.exception.BusinessException;
import
com.liquidnet.client.admin.common.utils.poi.ExcelUtil
;
//
import com.liquidnet.client.admin.common.utils.poi.ExcelUtil;
import
com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinExportService
;
//
import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinExportService;
import
com.liquidnet.service.goblin.dto.MallOrdertDao
;
//
import com.liquidnet.service.goblin.dto.MallOrdertDao;
import
com.liquidnet.service.goblin.mapper.GoblinStoreOrderMapper
;
//
import com.liquidnet.service.goblin.mapper.GoblinStoreOrderMapper;
import
lombok.extern.slf4j.Slf4j
;
//
import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.lang3.StringUtils
;
//
import org.apache.commons.lang3.StringUtils;
import
org.apache.poi.xssf.usermodel.*
;
//
import org.apache.poi.xssf.usermodel.*;
import
org.springframework.beans.factory.annotation.Autowired
;
//
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
//
import org.springframework.stereotype.Service;
//
import
java.io.FileOutputStream
;
//
import java.io.FileOutputStream;
import
java.io.IOException
;
//
import java.io.IOException;
import
java.io.OutputStream
;
//
import java.io.OutputStream;
import
java.text.ParseException
;
//
import java.text.ParseException;
import
java.text.SimpleDateFormat
;
//
import java.text.SimpleDateFormat;
import
java.util.*
;
//
import java.util.*;
//
@Service
//
@Service
@Slf4j
//
@Slf4j
public
class
GoblinExportServiceImpl
implements
IGoblinExportService
{
//
public class GoblinExportServiceImpl implements IGoblinExportService {
//
@Autowired
//
@Autowired
GoblinStoreOrderMapper
goblinStoreOrderMapper
;
//
GoblinStoreOrderMapper goblinStoreOrderMapper;
//
@Override
//
@Override
public
AjaxResult
exportMallOrder
(
String
beginTime
,
String
endTime
,
String
state
,
Integer
mailType
)
{
//
public AjaxResult exportMallOrder(String beginTime, String endTime, String state, Integer mailType) {
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
//
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try
{
//
try {
Date
beginDate
=
sdf
.
parse
(
beginTime
);
//
Date beginDate = sdf.parse(beginTime);
Date
endDate
=
sdf
.
parse
(
endTime
);
//
Date endDate = sdf.parse(endTime);
List
<
String
>
states
=
null
;
//
List<String> states = null;
if
(
StringUtils
.
isNotBlank
(
state
))
{
//
if (StringUtils.isNotBlank(state)) {
states
=
Arrays
.
asList
(
state
.
split
(
","
));
//
states = Arrays.asList(state.split(","));
}
//
}
List
<
MallOrdertDao
>
voList
=
goblinStoreOrderMapper
.
exportMallOrder
(
beginDate
,
endDate
,
states
,
mailType
);
//
List<MallOrdertDao> voList = goblinStoreOrderMapper.exportMallOrder(beginDate, endDate, states ,mailType);
AjaxResult
ajaxResult
=
null
;
//
AjaxResult ajaxResult = null;
Map
<
String
,
List
<
String
>>
map
=
new
HashMap
<>();
//
Map<String, List<String>> map = new HashMap<>();
int
max
=
0
;
//
int max = 0;
//将数据保存到list中
//
//将数据保存到list中
if
(
voList
!=
null
&&
voList
.
size
()
>
0
)
{
//
if (voList != null && voList.size() > 0) {
for
(
MallOrdertDao
te
:
voList
)
{
//
for (MallOrdertDao te : voList) {
String
orderCode
=
te
.
getOrderCode
();
//
String orderCode = te.getOrderCode();
if
(
map
.
get
(
orderCode
)
==
null
)
{
//
if (map.get(orderCode) == null) {
List
<
String
>
list
=
new
ArrayList
<>();
//
List<String> list = new ArrayList<>();
list
.
add
(
te
.
getOrderCode
());
//
list.add(te.getOrderCode());
list
.
add
(
te
.
getUserMobile
());
//
list.add(te.getUserMobile());
list
.
add
(
te
.
getPriceExpress
());
//
list.add(te.getPriceExpress());
list
.
add
(
te
.
getPriceCoupon
());
//
list.add(te.getPriceCoupon());
list
.
add
(
te
.
getStorePriceCoupon
());
//
list.add(te.getStorePriceCoupon());
list
.
add
(
te
.
getExpressContacts
());
//
list.add(te.getExpressContacts());
list
.
add
(
te
.
getExpressPhone
());
//
list.add(te.getExpressPhone());
list
.
add
(
te
.
getExpressDetailAddress
());
//
list.add(te.getExpressDetailAddress());
list
.
add
(
te
.
getPayType
());
//
list.add(te.getPayType());
list
.
add
(
te
.
getPayTime
());
//
list.add(te.getPayTime());
list
.
add
(
te
.
getCreatedAt
());
//
list.add(te.getCreatedAt());
list
.
add
(
te
.
getLogisticsCompany
());
//
list.add(te.getLogisticsCompany());
list
.
add
(
te
.
getMailNo
());
//
list.add(te.getMailNo());
list
.
add
(
te
.
getSpuId
());
//
list.add(te.getSpuId());
list
.
add
(
te
.
getName
());
//
list.add(te.getName());
list
.
add
(
te
.
getCate1Name
());
//
list.add(te.getCate1Name());
list
.
add
(
te
.
getCate2Name
());
//
list.add(te.getCate2Name());
list
.
add
(
te
.
getSkuName
());
//
list.add(te.getSkuName());
list
.
add
(
te
.
getNum
());
//
list.add(te.getNum());
list
.
add
(
te
.
getSkuPrice
());
//
list.add(te.getSkuPrice());
list
.
add
(
te
.
getSkuPriceActual
());
//
list.add(te.getSkuPriceActual());
list
.
add
(
te
.
getOrderSkuId
());
//
list.add(te.getOrderSkuId());
max
=
Math
.
max
(
max
,
list
.
size
());
//
max = Math.max(max, list.size());
map
.
put
(
orderCode
,
list
);
//
map.put(orderCode, list);
continue
;
//
continue;
}
//
}
if
(
map
.
get
(
orderCode
)
!=
null
)
{
//
if (map.get(orderCode) != null) {
List
<
String
>
list
=
map
.
get
(
orderCode
);
//
List<String> list = map.get(orderCode);
list
.
add
(
te
.
getSpuId
());
//
list.add(te.getSpuId());
list
.
add
(
te
.
getName
());
//
list.add(te.getName());
list
.
add
(
te
.
getCate1Name
());
//
list.add(te.getCate1Name());
list
.
add
(
te
.
getCate2Name
());
//
list.add(te.getCate2Name());
list
.
add
(
te
.
getSkuName
());
//
list.add(te.getSkuName());
list
.
add
(
te
.
getNum
());
//
list.add(te.getNum());
list
.
add
(
te
.
getSkuPrice
());
//
list.add(te.getSkuPrice());
list
.
add
(
te
.
getSkuPriceActual
());
//
list.add(te.getSkuPriceActual());
list
.
add
(
te
.
getOrderSkuId
());
//
list.add(te.getOrderSkuId());
max
=
Math
.
max
(
max
,
list
.
size
());
//
max = Math.max(max, list.size());
map
.
put
(
orderCode
,
list
);
//
map.put(orderCode, list);
}
//
}
}
//
}
return
exportexcel
(
map
,
"order"
,
max
);
//
return exportexcel(map, "order", max);
}
//
}
return
AjaxResult
.
error
(
"查无信息!"
);
//
return AjaxResult.error("查无信息!");
}
catch
(
ParseException
e
)
{
//
} catch (ParseException e) {
e
.
printStackTrace
();
//
e.printStackTrace();
throw
new
BusinessException
(
"导出Excel失败,请联系网站管理员!"
);
//
throw new BusinessException("导出Excel失败,请联系网站管理员!");
}
//
}
}
//
}
//
//导出Excel
//
//导出Excel
private
AjaxResult
exportexcel
(
Map
<
String
,
List
<
String
>>
map
,
String
name
,
int
max
)
{
//
private AjaxResult exportexcel(Map<String, List<String>> map, String name, int max) {
//实例化XSSFWorkbook对象,相当于新建一个Excel文件
//
//实例化XSSFWorkbook对象,相当于新建一个Excel文件
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
//
XSSFWorkbook workbook = new XSSFWorkbook();
//根据XSSFWorkbook获取Sheet
//
//根据XSSFWorkbook获取Sheet
XSSFSheet
sheet
=
workbook
.
createSheet
();
//
XSSFSheet sheet = workbook.createSheet();
//添加一行作为表格头
//
//添加一行作为表格头
XSSFRow
header
=
sheet
.
createRow
(
0
);
//
XSSFRow header = sheet.createRow(0);
//
//创建表格样式
//
//创建表格样式
XSSFCellStyle
cellStyle
=
workbook
.
createCellStyle
();
//
XSSFCellStyle cellStyle = workbook.createCellStyle();
//cellStyle.setAlignment(CellStyle.ALIGN_CENTER);//内容居中显示
//
//cellStyle.setAlignment(CellStyle.ALIGN_CENTER);//内容居中显示
//
//创建头部表格
//
//创建头部表格
XSSFCell
cell
=
null
;
//
XSSFCell cell = null;
int
index
=
0
;
//
int index = 0;
//固定表头
//
//固定表头
List
<
String
>
fixedCells
=
fixedCells
();
//
List<String> fixedCells = fixedCells();
for
(
String
cname
:
fixedCells
)
{
//
for (String cname : fixedCells) {
cell
=
header
.
createCell
(
index
);
//
cell = header.createCell(index);
cell
.
setCellStyle
(
cellStyle
);
//
cell.setCellStyle(cellStyle);
cell
.
setCellValue
(
cname
);
//
cell.setCellValue(cname);
index
++;
//
index++;
}
//
}
//
int
n
=
13
;
//固定表头13个
//
int n = 13; //固定表头13个
int
indext
=
0
;
//
int indext = 0;
//追加表头
//
//追加表头
List
<
String
>
cells
=
appendCells
();
//
List<String> cells = appendCells();
while
(
n
<
max
)
{
//
while (n < max) {
indext
++;
//
indext++;
for
(
String
cname
:
cells
)
{
//
for (String cname : cells) {
cell
=
header
.
createCell
(
n
);
//
cell = header.createCell(n);
cell
.
setCellStyle
(
cellStyle
);
//
cell.setCellStyle(cellStyle);
cell
.
setCellValue
(
cname
+
indext
);
//
cell.setCellValue(cname + indext);
n
++;
//
n++;
}
//
}
}
//
}
int
z
=
1
;
//
int z = 1;
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
map
.
entrySet
())
{
//
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
List
<
String
>
list
=
entry
.
getValue
();
//
List<String> list = entry.getValue();
//获取每行
//
//获取每行
XSSFRow
content
=
sheet
.
createRow
(
z
);
//
XSSFRow content = sheet.createRow(z);
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
//
for (int i = 0; i < list.size(); i++) {
//创建单元格并设置值
//
//创建单元格并设置值
content
.
createCell
(
i
).
setCellValue
(
list
.
get
(
i
));
//
content.createCell(i).setCellValue(list.get(i));
}
//
}
z
++;
//
z++;
}
//
}
OutputStream
fileOutputStream
=
null
;
//
OutputStream fileOutputStream = null;
try
{
//
try {
ExcelUtil
<
MallOrdertDao
>
util
=
new
ExcelUtil
(
MallOrdertDao
.
class
);
//
ExcelUtil<MallOrdertDao> util = new ExcelUtil(MallOrdertDao.class);
String
filename
=
util
.
encodingFilename
(
name
);
//
String filename = util.encodingFilename(name);
//写入文件
//
//写入文件
fileOutputStream
=
new
FileOutputStream
(
util
.
getAbsoluteFile
(
filename
));
//
fileOutputStream = new FileOutputStream(util.getAbsoluteFile(filename));
workbook
.
write
(
fileOutputStream
);
//
workbook.write(fileOutputStream);
return
AjaxResult
.
success
(
"导出成功!"
,
filename
);
//
return AjaxResult.success("导出成功!",filename);
}
catch
(
IOException
e
)
{
//
} catch (IOException e) {
e
.
printStackTrace
();
//
e.printStackTrace();
throw
new
BusinessException
(
"导出Excel失败,请联系网站管理员!"
);
//
throw new BusinessException("导出Excel失败,请联系网站管理员!");
}
finally
{
//
} finally {
if
(
workbook
!=
null
)
{
//
if (workbook != null) {
try
{
//
try {
workbook
.
close
();
//
workbook.close();
}
catch
(
IOException
e
)
{
//
} catch (IOException e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
}
//
}
if
(
fileOutputStream
!=
null
)
{
//
if (fileOutputStream != null) {
try
{
//
try {
fileOutputStream
.
close
();
//
fileOutputStream.close();
}
catch
(
IOException
e
)
{
//
} catch (IOException e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
//
}
}
//
}
}
//
}
}
//
}
//
//固定表头
//
//固定表头
private
List
<
String
>
fixedCells
()
{
//
private List<String> fixedCells() {
List
<
String
>
cells
=
new
ArrayList
<>();
//
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
(
"收货人电话"
);
//
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("物流单号");
return
cells
;
//
return cells;
}
//
}
//
//追加表头
//
//追加表头
private
List
<
String
>
appendCells
()
{
//
private List<String> appendCells() {
List
<
String
>
cells
=
new
ArrayList
<>();
//
List<String> cells = new ArrayList<>();
cells
.
add
(
"商品id"
);
//
cells.add("商品id");
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
(
"价格"
);
//
cells.add("价格");
cells
.
add
(
"订单skuId"
);
//
cells.add("订单skuId");
return
cells
;
//
return cells;
}
//
}
//
}
//
}
liquidnet-bus-do/liquidnet-service-goblin-do/src/main/resources/com.liquidnet.service.goblin.mapper/GoblinStoreOrderMapper.xml
View file @
1d02e14f
...
@@ -73,11 +73,11 @@
...
@@ -73,11 +73,11 @@
${item}
${item}
</foreach>
</foreach>
</if>
</if>
<if
test=
"mailType != null and mailType ==
'1'
"
>
<if
test=
"mailType != null and mailType ==
1
"
>
and gm.mail_no is null
;
and gm.mail_no is null
</if>
</if>
<if
test=
"mailType != null and mailType ==
'2'
"
>
<if
test=
"mailType != null and mailType ==
2
"
>
and gm.mail_no is not null
;
and gm.mail_no is not null
</if>
</if>
</where>
</where>
group by gos.order_sku_id
group by gos.order_sku_id
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/goblin/GoblinExportServiceImpl.java
View file @
1d02e14f
...
@@ -109,7 +109,7 @@ public class GoblinExportServiceImpl implements IGoblinExportService {
...
@@ -109,7 +109,7 @@ public class GoblinExportServiceImpl implements IGoblinExportService {
cells
.
add
(
"下单时间"
);
cells
.
add
(
"下单时间"
);
cells
.
add
(
"快递公司"
);
cells
.
add
(
"快递公司"
);
cells
.
add
(
"物流单号"
);
cells
.
add
(
"物流单号"
);
int
j
=
(
max
-
1
3
)
/
9
;
int
j
=
(
max
-
1
4
)
/
9
;
for
(
int
i
=
1
;
i
<=
j
;
i
++)
{
for
(
int
i
=
1
;
i
<=
j
;
i
++)
{
cells
.
add
(
"商品id"
+
i
);
cells
.
add
(
"商品id"
+
i
);
cells
.
add
(
"商品名"
+
i
);
cells
.
add
(
"商品名"
+
i
);
...
...
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