Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-api-boot-master
Commits
c8f909d3
Commit
c8f909d3
authored
Aug 10, 2024
by
huyf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
海运应收汇总bug&海运已装单需求
parent
e8820b96
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
273 additions
and
265 deletions
+273
-265
LoadDto.java
...in/java/cn/iocoder/yudao/module/shipment/dto/LoadDto.java
+9
-3
ShipmentLoadExcelExportListener2.java
...e/shipment/listener/ShipmentLoadExcelExportListener2.java
+159
-258
ShipmentReceivableExcelExportListener2.java
...ment/listener/ShipmentReceivableExcelExportListener2.java
+3
-2
CustomLoadMergeStrategyNew.java
...dao/module/shipment/utils/CustomLoadMergeStrategyNew.java
+100
-0
DownloadLogServiceImpl.java
...le/system/service/downloadLog/DownloadLogServiceImpl.java
+2
-2
No files found.
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/dto/LoadDto.java
View file @
c8f909d3
...
@@ -21,12 +21,18 @@ public class LoadDto {
...
@@ -21,12 +21,18 @@ public class LoadDto {
@ExcelProperty
(
"prodTitleZh"
)
@ExcelProperty
(
"prodTitleZh"
)
private
String
prodTitleZh
;
private
String
prodTitleZh
;
@ExcelProperty
(
"quantity"
)
private
Integer
quantity
;
@ExcelProperty
(
"brand"
)
@ExcelProperty
(
"brand"
)
private
String
brand
;
private
String
brand
;
@ExcelProperty
(
"productRecord"
)
@ExcelProperty
(
"productRecord"
)
private
String
productRecord
;
private
String
productRecord
;
@ExcelProperty
(
"prodAttr"
)
private
String
prodAttr
;
//特性
@ExcelProperty
(
"sumNum"
)
@ExcelProperty
(
"sumNum"
)
private
Integer
sumNum
;
private
Integer
sumNum
;
...
@@ -45,6 +51,9 @@ public class LoadDto {
...
@@ -45,6 +51,9 @@ public class LoadDto {
@ExcelProperty
(
"material"
)
@ExcelProperty
(
"material"
)
private
String
material
;
private
String
material
;
@ExcelProperty
(
"usageIds"
)
private
String
usageIds
;
//用途
@ExcelProperty
(
"merge"
)
@ExcelProperty
(
"merge"
)
private
String
merge
;
private
String
merge
;
...
@@ -57,7 +66,4 @@ public class LoadDto {
...
@@ -57,7 +66,4 @@ public class LoadDto {
@ExcelProperty
(
"worth"
)
@ExcelProperty
(
"worth"
)
private
BigDecimal
worth
;
private
BigDecimal
worth
;
@ExcelProperty
(
"quantity"
)
private
Integer
quantity
;
}
}
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/listener/ShipmentLoadExcelExportListener2.java
View file @
c8f909d3
...
@@ -3,11 +3,10 @@ package cn.iocoder.yudao.module.shipment.listener;
...
@@ -3,11 +3,10 @@ package cn.iocoder.yudao.module.shipment.listener;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.apollo.core.event.export.ShipmentAirLoadExcelExportPushEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.export.ShipmentLoadExcelExportPushEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.export.ShipmentLoadExcelExportPushEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.export.ShipmentLoadExcelExportPushEvent2
;
import
cn.iocoder.yudao.framework.apollo.core.event.export.ShipmentLoadExcelExportPushEvent2
;
import
cn.iocoder.yudao.framework.apollo.core.event.export.ShipmentPreloadExcelExportPushEvent
;
import
cn.iocoder.yudao.framework.common.util.date.DateUtils
;
import
cn.iocoder.yudao.framework.common.util.date.DateUtils
;
import
cn.iocoder.yudao.framework.common.util.json.JsonUtils
;
import
cn.iocoder.yudao.framework.common.util.number.NumberUtils
;
import
cn.iocoder.yudao.framework.common.util.number.NumberUtils
;
import
cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO
;
import
cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO
;
import
cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils
;
import
cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils
;
...
@@ -19,13 +18,14 @@ import cn.iocoder.yudao.module.infra.service.file.FileService;
...
@@ -19,13 +18,14 @@ import cn.iocoder.yudao.module.infra.service.file.FileService;
import
cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderGuanlian.OrderGuanlianDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderGuanlian.OrderGuanlianDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderLocation.OrderLocationDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderWarehouseIn.OrderWarehouseInDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderWarehouseIn.OrderWarehouseInDO
;
import
cn.iocoder.yudao.module.order.dto.OrderBackInfoDto
;
import
cn.iocoder.yudao.module.order.dto.OrderBackInfoDto
;
import
cn.iocoder.yudao.module.order.service.order.*
;
import
cn.iocoder.yudao.module.order.service.order.*
;
import
cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInService
;
import
cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInService
;
import
cn.iocoder.yudao.module.order.vo.order.OrderWarehouseInDetailsVO
;
import
cn.iocoder.yudao.module.order.vo.order.OrderWarehouseInDetailsVO
;
import
cn.iocoder.yudao.module.order.vo.order
Item.OrderItemBackVO
;
import
cn.iocoder.yudao.module.order.vo.order
WarehouseIn.OrderWarehouseInBackItemDo
;
import
cn.iocoder.yudao.module.order.vo.orderWarehouseIn.OrderWarehouseInBack
Item
VO
;
import
cn.iocoder.yudao.module.order.vo.orderWarehouseIn.OrderWarehouseInBackVO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.productbrank.ProductBrankDO
;
import
cn.iocoder.yudao.module.product.dal.dataobject.productbrank.ProductBrankDO
;
...
@@ -34,18 +34,13 @@ import cn.iocoder.yudao.module.product.service.product.ProductService;
...
@@ -34,18 +34,13 @@ import cn.iocoder.yudao.module.product.service.product.ProductService;
import
cn.iocoder.yudao.module.product.service.productbrank.ProductBrankService
;
import
cn.iocoder.yudao.module.product.service.productbrank.ProductBrankService
;
import
cn.iocoder.yudao.module.shipment.dal.dataobject.BoxApprovalDO
;
import
cn.iocoder.yudao.module.shipment.dal.dataobject.BoxApprovalDO
;
import
cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO
;
import
cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO
;
import
cn.iocoder.yudao.module.shipment.dal.dataobject.BoxMergePkgDO
;
import
cn.iocoder.yudao.module.shipment.dal.dataobject.BoxPkgOrderDO
;
import
cn.iocoder.yudao.module.shipment.dto.AirLoadDto
;
import
cn.iocoder.yudao.module.shipment.dto.LoadDto
;
import
cn.iocoder.yudao.module.shipment.dto.LoadDto
;
import
cn.iocoder.yudao.module.shipment.dto.PreloadDto
;
import
cn.iocoder.yudao.module.shipment.dto.PreloadDto
;
import
cn.iocoder.yudao.module.shipment.service.box.BoxService
;
import
cn.iocoder.yudao.module.shipment.service.box.BoxService
;
import
cn.iocoder.yudao.module.shipment.service.boxApproval.BoxApprovalService
;
import
cn.iocoder.yudao.module.shipment.service.boxApproval.BoxApprovalService
;
import
cn.iocoder.yudao.module.shipment.service.boxMergePkg.BoxMergePkgService
;
import
cn.iocoder.yudao.module.shipment.service.boxPkgOrder.BoxPkgOrderService
;
import
cn.iocoder.yudao.module.shipment.service.boxPreloadGoods.BoxPreloadGoodsService
;
import
cn.iocoder.yudao.module.shipment.service.boxPreloadGoods.BoxPreloadGoodsService
;
import
cn.iocoder.yudao.module.shipment.utils.CustomAirLoadMergeStrategyNew
;
import
cn.iocoder.yudao.module.shipment.utils.CustomCellWriteHandler
;
import
cn.iocoder.yudao.module.shipment.utils.CustomCellWriteHandler
;
import
cn.iocoder.yudao.module.shipment.utils.CustomLoadMergeStrategyNew
;
import
cn.iocoder.yudao.module.shipment.utils.CustomMergeStrategy
;
import
cn.iocoder.yudao.module.shipment.utils.CustomMergeStrategy
;
import
cn.iocoder.yudao.module.shipment.vo.boxPreloadGoods.BoxPreloadGoodsBackVO
;
import
cn.iocoder.yudao.module.shipment.vo.boxPreloadGoods.BoxPreloadGoodsBackVO
;
import
cn.iocoder.yudao.module.system.framework.ue.UeProperties
;
import
cn.iocoder.yudao.module.system.framework.ue.UeProperties
;
...
@@ -66,6 +61,7 @@ import javax.annotation.Resource;
...
@@ -66,6 +61,7 @@ import javax.annotation.Resource;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
...
@@ -73,17 +69,14 @@ import java.util.*;
...
@@ -73,17 +69,14 @@ import java.util.*;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
error
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
excel
.
constant
.
ExportConstant
.
DATA_FORMAT
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
excel
.
constant
.
ExportConstant
.
DATA_FORMAT
;
import
static
cn
.
iocoder
.
yudao
.
module
.
shipment
.
enums
.
ErrorCodeConstants
.
HAVE_NOT_PRELOAD_GOODS
;
import
static
cn
.
iocoder
.
yudao
.
module
.
shipment
.
enums
.
ErrorCodeConstants
.
HAVE_NOT_PRELOAD_GOODS
;
/**
/**
* 自编号订单excel导出监听
* 自编号订单excel导出监听
* 修改模板样式和添加列字段
*
* 海运已装单数据导出
* NG2408045L
* @author zhengYi
* @author zhengYi
*/
*/
@Component
(
"ShipmentLoadExcelExportListener2"
)
@Component
(
"ShipmentLoadExcelExportListener2"
)
...
@@ -122,6 +115,9 @@ public class ShipmentLoadExcelExportListener2 {
...
@@ -122,6 +115,9 @@ public class ShipmentLoadExcelExportListener2 {
@Resource
@Resource
private
OrderService
orderService
;
private
OrderService
orderService
;
@Resource
private
ProductService
productService
;
@Resource
@Resource
private
ProductAttrService
productAttrService
;
private
ProductAttrService
productAttrService
;
...
@@ -137,304 +133,158 @@ public class ShipmentLoadExcelExportListener2 {
...
@@ -137,304 +133,158 @@ public class ShipmentLoadExcelExportListener2 {
colorList
.
add
(
47
);
colorList
.
add
(
47
);
}
}
// @Value("${ue.templates-url}")
// private String path;
/**
/**
* 订单导出监听
* 订单导出监听
*
*
* @param event 编号记录
* @param event 编号记录
*/
*/
@EventListener
(
ShipmentLoadExcelExportPushEvent
.
class
)
@EventListener
(
ShipmentLoadExcelExportPushEvent2
.
class
)
public
void
shipmentLoadExcelExportPushEvent
(
public
void
shipmentLoadExcelExportPushEvent
(
ShipmentLoadExcelExportPushEvent2
event
)
{
ShipmentLoadExcelExportPushEvent
event
)
{
if
(
StringUtils
.
isNotBlank
(
event
.
getRequestParams
()))
{
if
(
StringUtils
.
isNotBlank
(
event
.
getRequestParams
()))
{
try
{
try
{
DateTimeFormatter
formatter
=
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
DATA_FORMAT
);
DateTimeFormatter
.
ofPattern
(
DATA_FORMAT
);
String
nowTime
=
formatter
.
format
(
LocalDateTime
.
now
());
String
nowTime
=
formatter
.
format
(
LocalDateTime
.
now
());
String
dir
=
ueProperties
.
getTempDir
().
concat
(
"/load/excel/"
);
String
dir
=
ueProperties
.
getTempDir
().
concat
(
"/load/excel/"
);
String
fileName
=
event
.
getUserId
().
String
fileName
=
event
.
getUserId
().
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"shipment_load.xlsx"
);
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"shipment_load.xlsx"
);
InputStream
inputStream
=
null
;
InputStream
inputStream
=
null
;
//获取模板 2024-06-05 添加注释
inputStream
=
getClass
().
getClassLoader
().
getResourceAsStream
(
ueProperties
.
getTemplatesUrl
()
+
"/load.xlsx"
);
inputStream
=
getClass
().
getClassLoader
().
getResourceAsStream
(
ueProperties
.
getTemplatesUrl
()
+
"/load.xlsx"
);
Map
headMap
=
new
HashMap
();
Map
headMap
=
new
HashMap
();
JSONObject
jsonObject
=
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
event
.
getRequestParams
());
JSONObject
.
parseObject
(
event
.
getRequestParams
());
Long
shipmentId
=
jsonObject
.
getLong
(
"shipmentId"
);
Long
shipmentId
=
jsonObject
.
getLong
(
"shipmentId"
);
List
<
BoxPreloadGoodsBackVO
>
goodsItemList
=
List
<
BoxPreloadGoodsBackVO
>
goodsItemList
=
boxPreloadGoodsService
.
getShipGoodItemList
(
shipmentId
);
boxPreloadGoodsService
.
getShipGoodItemList
(
shipmentId
);
if
(
CollectionUtil
.
isEmpty
(
goodsItemList
))
{
if
(
CollectionUtil
.
isEmpty
(
goodsItemList
))
{
event
.
setResult
(
HAVE_NOT_PRELOAD_GOODS
.
getMsg
());
event
.
setResult
(
HAVE_NOT_PRELOAD_GOODS
.
getMsg
());
}
}
BoxDO
box
=
boxService
.
getBox
(
shipmentId
);
BoxDO
box
=
boxService
.
getBox
(
shipmentId
);
CabinetDO
cabinet
=
cabinetService
.
getCabinet
(
box
.
getCabinetId
());
CabinetDO
cabinet
=
cabinetService
.
getCabinet
(
box
.
getCabinetId
());
BoxApprovalDO
boxApprovalDO
=
BoxApprovalDO
boxApprovalDO
=
boxApprovalService
.
getOne
(
new
LambdaQueryWrapperX
<
BoxApprovalDO
>().
eq
(
BoxApprovalDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxApprovalDO:
:
getApprovalType
,
2
).
last
(
"limit 1"
));
boxApprovalService
.
getOne
(
new
LambdaQueryWrapperX
<
BoxApprovalDO
>().
eq
(
BoxApprovalDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxApprovalDO:
:
getApprovalType
,
2
).
last
(
"limit 1"
));
headMap
.
put
(
"selfNo"
,
box
.
getSelfNo
());
headMap
.
put
(
"selfNo"
,
box
.
getSelfNo
());
headMap
.
put
(
"ctnNo"
,
box
.
getCubNo
());
headMap
.
put
(
"ctnNo"
,
box
.
getCubNo
());
if
(
cabinet
!=
null
)
{
if
(
cabinet
!=
null
)
{
headMap
.
put
(
"cabinetName"
,
cabinet
.
getName
());
headMap
.
put
(
"cabinetName"
,
cabinet
.
getName
());
}
}
headMap
.
put
(
"exportDate"
,
DateUtils
.
formatDate
(
new
Date
()));
headMap
.
put
(
"exportDate"
,
DateUtils
.
formatDate
(
new
Date
()));
if
(
boxApprovalDO
!=
null
)
{
if
(
boxApprovalDO
!=
null
)
{
headMap
.
put
(
"date"
,
headMap
.
put
(
"date"
,
DateUtils
.
formatDate
(
boxApprovalDO
.
getCreateTime
()));
DateUtils
.
formatDate
(
boxApprovalDO
.
getCreateTime
()));
}
}
File
fileDir
=
new
File
(
dir
);
File
fileDir
=
new
File
(
dir
);
if
(!
fileDir
.
exists
())
{
if
(!
fileDir
.
exists
()){
// 不存在则创建一个目录
// 不存在则创建一个目录
fileDir
.
mkdirs
();
fileDir
.
mkdirs
();
}
}
//write 写入的文件路径
List
<
ProductAttrDO
>
productAttrDOList
=
productAttrService
.
getProductAttrList
();
//withTemplate 使用的模板
Map
<
String
,
String
>
idNameMap
=
productAttrDOList
.
stream
()
ExcelWriter
excelWriter
=
.
collect
(
Collectors
.
toMap
(
attr
->
String
.
valueOf
(
attr
.
getId
()),
ProductAttrDO:
:
getAttrName
));
EasyExcel
.
write
(
dir
+
fileName
).
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
dir
+
fileName
).
withTemplate
(
inputStream
).
build
();
withTemplate
(
inputStream
).
build
();
WriteSheet
sheet
=
EasyExcel
.
writerSheet
(
0
).
build
();
WriteSheet
sheet
=
EasyExcel
.
writerSheet
(
0
).
build
();
excelWriter
.
fill
(
headMap
,
sheet
);
excelWriter
.
fill
(
headMap
,
sheet
);
if
(
box
.
getLdStatus
()
!=
null
&&
box
.
getLdStatus
()>=
43
)
{
//43、已装柜、待封柜
//商品属性获取
List
<
ProductAttrDO
>
ProductAttrList
=
productAttrService
.
getProductAttrList
();
Map
<
Long
,
String
>
ProductAttrMap
=
null
;
if
(
CollectionUtil
.
isEmpty
(
ProductAttrList
)
==
false
)
{
ProductAttrMap
=
ProductAttrList
.
stream
().
collect
(
Collectors
.
toMap
(
ProductAttrDO:
:
getId
,
ProductAttrDO:
:
getAttrName
));
}
//end 商品属性获取
if
(
box
.
getLdStatus
()
!=
null
&&
box
.
getLdStatus
()
>=
43
)
{
//43、已装柜、待封柜
//以secId排序
//以secId排序
goodsItemList
.
sort
(
Comparator
.
comparing
(
goodsItemList
.
sort
(
Comparator
.
comparing
(
BoxPreloadGoodsBackVO:
:
getSecId
).
thenComparing
(
BoxPreloadGoodsBackVO:
:
getTidanNum
).
thenComparing
(
BoxPreloadGoodsBackVO:
:
getId
));
BoxPreloadGoodsBackVO:
:
getSecId
).
thenComparing
(
BoxPreloadGoodsBackVO:
:
getTidanNum
).
thenComparing
(
BoxPreloadGoodsBackVO:
:
getId
));
int
allTotalNum
=
0
;
int
allTotalNum
=
0
;
BigDecimal
allTotalVolume
=
new
BigDecimal
(
0
);
BigDecimal
allTotalVolume
=
new
BigDecimal
(
0
);
BigDecimal
allTotalWeight
=
new
BigDecimal
(
0
);
BigDecimal
allTotalWeight
=
new
BigDecimal
(
0
);
List
<
Long
>
secCount
=
List
<
Long
>
secCount
=
goodsItemList
.
stream
().
map
(
BoxPreloadGoodsBackVO:
:
getSecId
).
distinct
().
sorted
().
collect
(
Collectors
.
toList
());
goodsItemList
.
stream
().
AtomicInteger
colorRowNum
=
new
AtomicInteger
(
6
);
map
(
BoxPreloadGoodsBackVO:
:
getSecId
).
distinct
().
sorted
().
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
secCount
))
{
if
(!
CollectionUtils
.
isEmpty
(
secCount
))
{
for
(
int
i
=
0
;
i
<
secCount
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
secCount
.
size
();
i
++)
{
List
<
String
>
list1
=
new
ArrayList
();
List
<
String
>
list1
=
new
ArrayList
();
List
<
List
<
String
>>
headList
=
new
ArrayList
<>();
List
<
List
<
String
>>
headList
=
new
ArrayList
<>();
String
head
=
""
;
String
head
=
""
;
if
(
i
==
0
)
{
if
(
i
==
0
)
{
head
=
"第"
+
NumberUtils
.
int2chineseNum
(
i
+
1
)
head
=
"第"
+
NumberUtils
.
int2chineseNum
(
i
+
1
)
+
"部分(Be loaded inside of the container)"
;
+
"部分(Be loaded inside of the container)"
;
}
else
{
}
else
{
head
=
"第"
+
NumberUtils
.
int2chineseNum
(
i
+
1
)
head
=
"第"
+
NumberUtils
.
int2chineseNum
(
i
+
1
)+
"部分(after "
+
NumberUtils
.
format
(
i
+
1
)+
" parts)"
;
+
"部分(after "
+
NumberUtils
.
format
(
i
+
1
)
+
" parts)"
;
}
}
list1
.
add
(
head
);
list1
.
add
(
head
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
//headList.add(list1);headList.add(list1);
headList
.
add
(
list1
);
//headList.add(list1);headList.add(list1);
headList
.
add
(
list1
);
headList
.
add
(
list1
);
List
<
LoadDto
>
list
=
new
ArrayList
<>();
List
<
LoadDto
>
list
=
new
ArrayList
<>();
int
totalNum
=
0
;
int
totalNum
=
0
;
BigDecimal
totalVolume
=
new
BigDecimal
(
0
);
BigDecimal
totalVolume
=
new
BigDecimal
(
0
);
BigDecimal
totalWeight
=
new
BigDecimal
(
0
);
BigDecimal
totalWeight
=
new
BigDecimal
(
0
);
Map
<
String
,
Integer
>
numMap
=
new
HashMap
();
Long
part
=
secCount
.
get
(
i
);
List
<
Integer
>
mergeCountList
=
new
ArrayList
();
List
<
Integer
>
mergeCountList
=
new
ArrayList
();
List
<
Integer
>
colorRowList
=
new
ArrayList
<>();
List
<
Integer
>
colorRowList
=
new
ArrayList
<>();
AtomicInteger
colorRowNum
=
new
AtomicInteger
(
5
);
Map
<
String
,
Integer
>
numMap
=
new
HashMap
(
);
Map
<
String
,
Integer
>
colorMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
colorMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
mergePkgCountMap
=
new
LinkedHashMap
<>(
);
Long
part
=
secCount
.
get
(
i
);
int
colorIndex
=
0
;
int
colorIndex
=
0
;
//以订单ID分组
//以订单ID分组
Map
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
orderMap
=
Map
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
orderMap
=
goodsItemList
.
stream
().
filter
(
item
->
item
.
getSecId
().
longValue
()==
part
.
longValue
()
&&
StringUtils
.
isNotBlank
(
item
.
getWarehouseInInfo
()))
goodsItemList
.
stream
().
filter
(
item
->
item
.
getSecId
().
longValue
()
==
.
collect
(
Collectors
.
groupingBy
(
BoxPreloadGoodsBackVO:
:
getOrderId
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
part
.
longValue
()
&&
StringUtils
.
isNotBlank
(
item
.
getWarehouseInInfo
()))
.
collect
(
Collectors
.
groupingBy
(
BoxPreloadGoodsBackVO:
:
getOrderId
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
for
(
Map
.
Entry
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
entry
:
orderMap
.
entrySet
())
{
for
(
Map
.
Entry
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
entry
:
orderMap
.
entrySet
())
{
Long
orderId
=
entry
.
getKey
();
Long
orderId
=
entry
.
getKey
();
List
<
OrderWarehouseInBackItemVO
>
orderWarehouseInBackItemVOS
=
OrderBackInfoDto
orderInfo
=
orderQueryService
.
info
(
orderId
);
orderWarehouseInService
.
getOrderWarehouseInListOrderByInTime
(
orderId
);
List
<
BoxPreloadGoodsBackVO
>
boxPreload
=
entry
.
getValue
();
List
<
OrderItemDO
>
orderItems
=
boxPreload
.
stream
().
map
(
item
->
orderItemService
.
getOrderItem
(
item
.
getOrderItemId
())).
collect
(
Collectors
.
toList
());
for
(
OrderWarehouseInBackItemVO
item
:
orderWarehouseInBackItemVOS
)
{
for
(
OrderItemDO
item
:
orderItems
)
{
int
andIncrement
=
colorRowNum
.
getAndIncrement
();
List
<
OrderWarehouseInDO
>
orderWarehouseInDOS
=
orderWarehouseInService
.
selectList
(
OrderWarehouseInDO:
:
getOrderItemId
,
item
.
getOrderItemId
());
for
(
OrderWarehouseInDO
orderWarehouseInDO
:
orderWarehouseInDOS
)
{
if
(
StringUtils
.
isNotBlank
(
item
.
getOrderWarehouseInDetails
()))
{
if
(
CollectionUtil
.
isNotEmpty
(
orderWarehouseInDO
.
getOrderWarehouseInDetailsVOList
()))
{
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
item
.
getOrderWarehouseInDetails
());
int
andIncrement
=
colorRowNum
.
getAndIncrement
();
if
(
jsonArray
.
size
()
>
0
)
{
colorMap
.
put
(
String
.
valueOf
(
andIncrement
),
colorList
.
get
(
colorIndex
));
colorMap
.
put
(
String
.
valueOf
(
andIncrement
),
colorList
.
get
(
colorIndex
));
colorRowList
.
add
(
andIncrement
);
//这里加1是为了设置颜色时过滤掉入仓记录那条
colorRowList
.
add
(
andIncrement
);
//这里加1是为了设置颜色时过滤掉入仓记录那条
break
;
}
}
}
}
int
mergeCount
=
1
;
int
mergeCount
=
1
;
if
(
StringUtils
.
isNotBlank
(
item
.
getOrderWarehouseInDetails
()))
{
int
mixedMergeCount
=
1
;
item
.
setOrderWarehouseInDetailsVOList
(
JsonUtils
.
parseArray
(
item
.
getOrderWarehouseInDetails
(),
OrderWarehouseInDetailsVO
.
class
));
}
if
(
CollectionUtil
.
isNotEmpty
(
item
.
getOrderWarehouseInDetailsVOList
()))
{
mergeCount
=
mergeCount
+
item
.
getOrderWarehouseInDetailsVOList
().
size
();
List
<
OrderWarehouseInDetailsVO
>
orderWarehouseInDetailsVOList
=
item
.
getOrderWarehouseInDetailsVOList
();
for
(
int
j
=
0
;
j
<
orderWarehouseInDetailsVOList
.
size
();
j
++)
{
int
andIncrement1
=
colorRowNum
.
getAndIncrement
();
colorMap
.
put
(
String
.
valueOf
(
andIncrement1
),
colorList
.
get
(
colorIndex
));
colorRowList
.
add
(
andIncrement1
);
}
}
mergeCountList
.
add
(
mergeCount
);
if
(
colorIndex
==
7
)
{
colorIndex
=
0
;
}
else
{
colorIndex
++;
}
}
}
//registerWriteHandler(new XXXStrategy(需要的参数))
//自定义单元格合并策略
WriteTable
writeTable
=
EasyExcel
.
writerTable
(
i
)
.
registerWriteHandler
(
new
CustomMergeStrategy
(
orderMap
,
null
,
null
,
0
,
true
))
.
registerWriteHandler
(
new
CustomMergeStrategy
(
orderMap
,
null
,
null
,
1
,
true
))
.
registerWriteHandler
(
new
CustomMergeStrategy
(
orderMap
,
null
,
null
,
2
,
true
))
//2024-06-11 begin
.
registerWriteHandler
(
new
CustomCellWriteHandler
(
colorRowList
,
3
,
colorMap
))
.
registerWriteHandler
(
new
CustomCellWriteHandler
(
colorRowList
,
4
,
colorMap
))
.
registerWriteHandler
(
new
CustomCellWriteHandler
(
colorRowList
,
5
,
colorMap
))
.
registerWriteHandler
(
new
CustomCellWriteHandler
(
colorRowList
,
6
,
colorMap
))
.
registerWriteHandler
(
new
CustomCellWriteHandler
(
colorRowList
,
7
,
colorMap
))
//.registerWriteHandler(new CustomMergeStrategy(orderMap, null, null, 7, true)) //end
.
registerWriteHandler
(
new
CustomMergeStrategy
(
orderMap
,
null
,
null
,
10
,
true
))
.
registerWriteHandler
(
new
CustomMergeStrategy
(
orderMap
,
null
,
null
,
12
,
true
))
.
registerWriteHandler
(
new
CustomMergeStrategy
(
orderMap
,
null
,
null
,
13
,
true
))
.
registerWriteHandler
(
new
CustomMergeStrategy
(
orderMap
,
null
,
null
,
14
,
true
))
.
automaticMergeHead
(
true
).
head
(
headList
).
needHead
(
true
).
build
();
for
(
Map
.
Entry
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
entry
:
orderMap
.
entrySet
())
{
Long
orderId
=
entry
.
getKey
();
OrderBackInfoDto
orderInfo
=
orderQueryService
.
info
(
orderId
);
List
<
BoxPreloadGoodsBackVO
>
boxPreload
=
entry
.
getValue
();
List
<
OrderItemDO
>
orderItems
=
boxPreload
.
stream
().
map
(
item
->
orderItemService
.
getOrderItem
(
item
.
getOrderItemId
())).
collect
(
Collectors
.
toList
());
for
(
OrderItemDO
item
:
orderItems
)
{
List
<
OrderWarehouseInDO
>
orderWarehouseInDOS
=
orderWarehouseInService
.
selectList
(
OrderWarehouseInDO:
:
getOrderItemId
,
item
.
getOrderItemId
());
LoadDto
preloadDto
=
new
LoadDto
();
LoadDto
preloadDto
=
new
LoadDto
();
preloadDto
.
setOrderNo
(
orderInfo
.
getOrderNo
());
preloadDto
.
setOrderNo
(
orderInfo
.
getOrderNo
());
if
(
numMap
.
get
(
orderInfo
.
getOrderNo
())
!=
null
)
{
if
(
numMap
.
get
(
orderInfo
.
getOrderNo
())
!=
null
)
{
preloadDto
.
setId
(
String
.
valueOf
(
numMap
.
get
(
orderInfo
.
getOrderNo
())));
preloadDto
.
setId
(
String
.
valueOf
(
numMap
.
get
(
orderInfo
.
getOrderNo
())));
}
else
{
}
else
{
preloadDto
.
setId
(
String
.
valueOf
(
numMap
.
size
()
+
1
));
preloadDto
.
setId
(
String
.
valueOf
(
numMap
.
size
()
+
1
));
numMap
.
put
(
orderInfo
.
getOrderNo
(),
numMap
.
size
()
+
1
);
numMap
.
put
(
orderInfo
.
getOrderNo
(),
numMap
.
size
()+
1
);
}
}
preloadDto
.
setMarks
(
orderInfo
.
getMarks
());
preloadDto
.
setMarks
(
orderInfo
.
getMarks
());
List
<
OrderGuanlianDO
>
guanlianList
=
List
<
OrderGuanlianDO
>
guanlianList
=
orderGuanlianService
.
getGuanlianListByOrderId
(
orderInfo
.
getOrderId
());
orderGuanlianService
.
getGuanlianListByOrderId
(
orderInfo
.
getOrderId
());
//rIdList为此订单的所有关联订单
//rIdList为此订单的所有关联订单
List
<
Long
>
rIdList
=
new
ArrayList
<>();
List
<
Long
>
rIdList
=
new
ArrayList
<>();
for
(
OrderGuanlianDO
orderGuanlianDO
:
guanlianList
)
{
for
(
OrderGuanlianDO
orderGuanlianDO
:
guanlianList
)
{
Long
oId
=
orderGuanlianDO
.
getOrderId
();
Long
oId
=
orderGuanlianDO
.
getOrderId
();
Long
rId
=
orderGuanlianDO
.
getRelateOrderId
();
Long
rId
=
orderGuanlianDO
.
getRelateOrderId
();
if
(
oId
.
equals
(
orderId
))
{
if
(
oId
.
equals
(
orderId
))
{
rIdList
.
add
((
rId
));
rIdList
.
add
((
rId
));
}
else
if
(
rId
.
equals
(
orderId
))
{
}
else
if
(
rId
.
equals
(
orderId
))
{
rIdList
.
add
(
oId
);
rIdList
.
add
(
oId
);
}
}
}
}
if
(
CollectionUtil
.
isNotEmpty
(
rIdList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
rIdList
))
{
List
<
OrderDO
>
orderDOS
=
List
<
OrderDO
>
orderDOS
=
orderService
.
selectList
(
OrderDO:
:
getOrderId
,
rIdList
);
orderService
.
selectList
(
OrderDO:
:
getOrderId
,
rIdList
);
if
(
CollectionUtil
.
isNotEmpty
(
orderDOS
))
{
if
(
CollectionUtil
.
isNotEmpty
(
orderDOS
))
{
preloadDto
.
setRelateOrder
(
orderDOS
.
stream
().
map
(
preloadDto
.
setRelateOrder
(
orderDOS
.
stream
().
map
(
OrderDO:
:
getOrderNo
).
collect
(
Collectors
.
joining
(
","
)));
OrderDO:
:
getOrderNo
).
collect
(
Collectors
.
joining
(
","
)));
}
}
}
}
preloadDto
.
setProdTitleZh
(
item
.
getProdTitleZh
()
+
" "
+
item
.
getProdTitleEn
());
preloadDto
.
setProdTitleZh
(
item
.
getProdTitleZh
()
+
" "
+
item
.
getProdTitleEn
());
preloadDto
.
setMerge
(
orderInfo
.
getOldNumbers
());
preloadDto
.
setMerge
(
orderInfo
.
getOldNumbers
());
ProductBrankDO
productBrank
=
ProductBrankDO
productBrank
=
productBrankService
.
getProductBrank
(
item
.
getBrand
());
productBrankService
.
getProductBrank
(
item
.
getBrand
());
if
(
productBrank
!=
null
&&
StringUtils
.
isNotBlank
(
productBrank
.
getTitleZh
())){
if
(
productBrank
!=
null
&&
StringUtils
.
isNotBlank
(
productBrank
.
getTitleZh
()))
{
preloadDto
.
setBrand
(
productBrank
.
getTitleZh
());
preloadDto
.
setBrand
(
productBrank
.
getTitleZh
());
}
}
//材质
if
(
StringUtils
.
isNotBlank
(
item
.
getMaterial
())){
if
(
StringUtils
.
isNotBlank
(
item
.
getMaterial
()))
{
preloadDto
.
setMaterial
(
DictFrameworkUtils
.
getDictDataFromCache
(
"product_material"
,
item
.
getMaterial
()+
""
).
getLabel
());
preloadDto
.
setMaterial
(
DictFrameworkUtils
.
getDictDataFromCache
(
"product_material"
,
item
.
getMaterial
()
+
""
).
getLabel
());
}
}
//品牌
if
(
productBrank
!=
null
&&
productBrank
.
getFiling
()!=
null
){
if
(
productBrank
!=
null
&&
productBrank
.
getFiling
()
!=
null
)
{
preloadDto
.
setProductRecord
(
productBrank
.
getFiling
().
equals
(
"0"
)?
"N"
:
"Y"
);
preloadDto
.
setProductRecord
(
productBrank
.
getFiling
().
equals
(
"0"
)
?
"N"
:
"Y"
);
}
}
//用途
if
(
item
.
getUsageIds
()
==
null
||
item
.
getUsageIds
().
length
()
==
0
)
{
//preloadDto.setUsageIds("");
}
else
{
//在缓存数据字典中获取用途信息
String
sUserdName
=
DictFrameworkUtils
.
getDictDataFromCache
(
"order_item_usage"
,
item
.
getUsageIds
()
+
""
).
getLabel
();
//preloadDto.setUsageIds(sUserdName);
}
//商品特性赋值
String
sR
=
getAttrName
(
item
,
ProductAttrMap
);
//preloadDto.setProdAttrIds(sR);
preloadDto
.
setSumNum
(
item
.
getWarehouseInInfoVO
().
getCartonsNum
());
preloadDto
.
setSumNum
(
item
.
getWarehouseInInfoVO
().
getCartonsNum
());
if
(
CollectionUtil
.
isNotEmpty
(
orderWarehouseInDOS
)){
if
(
CollectionUtil
.
isNotEmpty
(
orderWarehouseInDOS
))
{
String
warehousingSpecificationType
=
orderWarehouseInDOS
.
stream
().
map
(
j
->
{
String
warehousingSpecificationType
=
orderWarehouseInDOS
.
stream
().
map
(
j
->
{
return
DictFrameworkUtils
.
getDictDataFromCache
(
"warehousing_specification_type"
,
j
.
getSpecificationType
()
+
""
).
getLabel
();
return
DictFrameworkUtils
.
getDictDataFromCache
(
"warehousing_specification_type"
,
j
.
getSpecificationType
()
+
""
).
getLabel
();
}).
distinct
().
collect
(
Collectors
.
joining
(
"/"
));
}).
distinct
().
collect
(
Collectors
.
joining
(
"/"
));
...
@@ -445,20 +295,59 @@ public class ShipmentLoadExcelExportListener2 {
...
@@ -445,20 +295,59 @@ public class ShipmentLoadExcelExportListener2 {
preloadDto
.
setPackageType
(
packagingType
);
preloadDto
.
setPackageType
(
packagingType
);
}
}
preloadDto
.
setSumVolume
(
item
.
getWarehouseInInfoVO
().
getVolume
());
preloadDto
.
setSumVolume
(
item
.
getWarehouseInInfoVO
().
getVolume
());
preloadDto
.
setSumWeight
(
item
.
getWarehouseInInfoVO
().
getWeight
());
preloadDto
.
setSumWeight
(
item
.
getWarehouseInInfoVO
().
getWeight
());
if
(
orderInfo
.
getCustomsType
()
!=
null
)
{
if
(
orderInfo
.
getCustomsType
()!=
null
){
preloadDto
.
setCustomsType
(
preloadDto
.
setCustomsType
(
DictFrameworkUtils
.
getDictDataFromCache
(
"customs_type"
,
orderInfo
.
getCustomsType
()+
""
).
getLabel
());
DictFrameworkUtils
.
getDictDataFromCache
(
"customs_type"
,
orderInfo
.
getCustomsType
()
+
""
).
getLabel
());
}
}
preloadDto
.
setWorth
(
item
.
getWorth
());
preloadDto
.
setWorth
(
item
.
getWorth
());
preloadDto
.
setQuantity
(
item
.
getWarehouseInInfoVO
().
getQuantityAll
());
preloadDto
.
setQuantity
(
item
.
getWarehouseInInfoVO
().
getQuantityAll
());
list
.
add
(
preloadDto
);
list
.
add
(
preloadDto
);
if
(
CollectionUtil
.
isNotEmpty
(
orderWarehouseInDOS
))
{
for
(
OrderWarehouseInDO
j
:
orderWarehouseInDOS
)
{
if
(
CollectionUtil
.
isNotEmpty
(
j
.
getOrderWarehouseInDetailsVOList
()))
{
mergeCount
=
mergeCount
+
j
.
getOrderWarehouseInDetailsVOList
().
size
();
for
(
OrderWarehouseInDetailsVO
k
:
j
.
getOrderWarehouseInDetailsVOList
())
{
int
andIncrement1
=
colorRowNum
.
getAndIncrement
();
colorMap
.
put
(
String
.
valueOf
(
andIncrement1
),
colorList
.
get
(
colorIndex
));
colorRowList
.
add
(
andIncrement1
);
LoadDto
preloadDto1
=
new
LoadDto
();
BeanUtil
.
copyProperties
(
preloadDto
,
preloadDto1
);
ProductBrankDO
productBrankDetail
=
productBrankService
.
getProductBrank
(
k
.
getBrand
());
if
(
productBrankDetail
!=
null
&&
StringUtils
.
isNotBlank
(
productBrankDetail
.
getTitleZh
())){
preloadDto1
.
setBrand
(
productBrankDetail
.
getTitleZh
());
}
if
(
productBrank
!=
null
&&
productBrank
.
getFiling
()!=
null
){
preloadDto1
.
setProductRecord
(
productBrank
.
getFiling
().
equals
(
"0"
)?
"N"
:
"Y"
);
}
preloadDto1
.
setQuantity
(
k
.
getQuantityAll
());
if
(
StringUtils
.
isNotBlank
(
k
.
getMaterial
()))
{
preloadDto1
.
setMaterial
(
DictFrameworkUtils
.
getDictDataFromCache
(
"product_material"
,
k
.
getMaterial
()+
""
).
getLabel
());
}
preloadDto1
.
setProdAttr
(
getAttrNameByIds
(
k
.
getProdAttrIds
(),
idNameMap
));
preloadDto1
.
setUsageIds
(
getUsageMsg
(
k
.
getUsageIds
()));
ProductDO
product
=
productService
.
getProduct
(
k
.
getProdId
());
if
(
product
!=
null
)
{
preloadDto1
.
setProdTitleZh
(
product
.
getTitleZh
()
+
""
+
product
.
getTitleEn
());
}
list
.
add
(
preloadDto1
);
}
}
}
}
mergeCountList
.
add
(
mergeCount
);
if
(
colorIndex
==
7
)
{
colorIndex
=
0
;
}
else
{
colorIndex
++;
}
totalNum
=
totalNum
+
item
.
getWarehouseInInfoVO
().
getCartonsNum
();
totalNum
=
totalNum
+
item
.
getWarehouseInInfoVO
().
getCartonsNum
();
totalVolume
=
totalVolume
.
add
(
item
.
getWarehouseInInfoVO
().
getVolume
());
totalVolume
=
totalVolume
.
add
(
item
.
getWarehouseInInfoVO
().
getVolume
());
totalWeight
=
totalWeight
.
add
(
item
.
getWarehouseInInfoVO
().
getWeight
());
totalWeight
=
totalWeight
.
add
(
item
.
getWarehouseInInfoVO
().
getWeight
());
colorRowNum
.
getAndIncrement
();
}
}
}
}
colorRowNum
.
getAndAdd
(
2
);
LoadDto
preloadDto
=
new
LoadDto
();
LoadDto
preloadDto
=
new
LoadDto
();
preloadDto
.
setId
(
"TOTAL"
);
preloadDto
.
setId
(
"TOTAL"
);
preloadDto
.
setSumNum
(
totalNum
);
preloadDto
.
setSumNum
(
totalNum
);
...
@@ -468,7 +357,7 @@ public class ShipmentLoadExcelExportListener2 {
...
@@ -468,7 +357,7 @@ public class ShipmentLoadExcelExportListener2 {
allTotalNum
=
allTotalNum
+
totalNum
;
allTotalNum
=
allTotalNum
+
totalNum
;
allTotalVolume
=
allTotalVolume
.
add
(
totalVolume
);
allTotalVolume
=
allTotalVolume
.
add
(
totalVolume
);
allTotalWeight
=
allTotalWeight
.
add
(
totalWeight
);
allTotalWeight
=
allTotalWeight
.
add
(
totalWeight
);
if
(
i
==
secCount
.
size
()
-
1
)
{
if
(
i
==
secCount
.
size
()-
1
)
{
LoadDto
preloadDto1
=
new
LoadDto
();
LoadDto
preloadDto1
=
new
LoadDto
();
preloadDto1
.
setId
(
"IN TOTAL"
);
preloadDto1
.
setId
(
"IN TOTAL"
);
preloadDto1
.
setSumNum
(
allTotalNum
);
preloadDto1
.
setSumNum
(
allTotalNum
);
...
@@ -476,12 +365,28 @@ public class ShipmentLoadExcelExportListener2 {
...
@@ -476,12 +365,28 @@ public class ShipmentLoadExcelExportListener2 {
preloadDto1
.
setSumWeight
(
allTotalWeight
);
preloadDto1
.
setSumWeight
(
allTotalWeight
);
list
.
add
(
preloadDto1
);
list
.
add
(
preloadDto1
);
}
}
excelWriter
.
write
(
list
,
sheet
,
writeTable
);
WriteTable
writeTable
=
EasyExcel
.
writerTable
(
i
)
.
registerWriteHandler
(
new
CustomLoadMergeStrategyNew
(
list
,
mergeCountList
,
0
,
1
))
.
registerWriteHandler
(
new
CustomLoadMergeStrategyNew
(
list
,
mergeCountList
,
1
,
1
))
.
registerWriteHandler
(
new
CustomLoadMergeStrategyNew
(
list
,
mergeCountList
,
2
,
1
))
.
registerWriteHandler
(
new
CustomCellWriteHandler
(
colorRowList
,
3
,
colorMap
))
.
registerWriteHandler
(
new
CustomCellWriteHandler
(
colorRowList
,
4
,
colorMap
))
.
registerWriteHandler
(
new
CustomCellWriteHandler
(
colorRowList
,
5
,
colorMap
))
.
registerWriteHandler
(
new
CustomCellWriteHandler
(
colorRowList
,
6
,
colorMap
))
.
registerWriteHandler
(
new
CustomCellWriteHandler
(
colorRowList
,
7
,
colorMap
))
.
registerWriteHandler
(
new
CustomLoadMergeStrategyNew
(
list
,
mergeCountList
,
8
,
2
))
.
registerWriteHandler
(
new
CustomLoadMergeStrategyNew
(
list
,
mergeCountList
,
9
,
1
))
.
registerWriteHandler
(
new
CustomLoadMergeStrategyNew
(
list
,
mergeCountList
,
10
,
2
))
.
registerWriteHandler
(
new
CustomLoadMergeStrategyNew
(
list
,
mergeCountList
,
11
,
2
))
.
registerWriteHandler
(
new
CustomLoadMergeStrategyNew
(
list
,
mergeCountList
,
12
,
1
))
.
registerWriteHandler
(
new
CustomLoadMergeStrategyNew
(
list
,
mergeCountList
,
17
,
1
))
.
registerWriteHandler
(
new
CustomLoadMergeStrategyNew
(
list
,
mergeCountList
,
18
,
2
))
.
automaticMergeHead
(
true
).
head
(
headList
).
needHead
(
true
).
build
();
excelWriter
.
write
(
list
,
sheet
,
writeTable
);
}
}
}
}
}
}
excelWriter
.
finish
();
excelWriter
.
finish
();
inputStream
.
close
();
inputStream
.
close
();
// 获取到临时文件
// 获取到临时文件
...
@@ -499,8 +404,8 @@ public class ShipmentLoadExcelExportListener2 {
...
@@ -499,8 +404,8 @@ public class ShipmentLoadExcelExportListener2 {
event
.
setFileName
(
fileDO
.
getPath
());
event
.
setFileName
(
fileDO
.
getPath
());
event
.
setUrl
(
fileDO
.
getUrl
());
event
.
setUrl
(
fileDO
.
getUrl
());
event
.
setFileId
(
fileDO
.
getId
());
event
.
setFileId
(
fileDO
.
getId
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
event
.
setResult
(
e
.
getMessage
());
event
.
setResult
(
e
.
getMessage
());
}
}
...
@@ -510,35 +415,31 @@ public class ShipmentLoadExcelExportListener2 {
...
@@ -510,35 +415,31 @@ public class ShipmentLoadExcelExportListener2 {
}
}
/*
private
String
getUsageMsg
(
String
usageIdsDetail
)
{
添加商品属性转换函数
if
(
StringUtils
.
isNotEmpty
(
usageIdsDetail
))
{
*/
StringJoiner
labelJoiner
=
new
StringJoiner
(
","
);
private
String
getAttrName
(
OrderItemDO
item
,
Map
<
Long
,
String
>
ProductAttrMap
)
{
for
(
String
usageId
:
usageIdsDetail
.
split
(
","
))
{
String
sReult
=
""
;
DictDataRespDTO
usageValue
=
DictFrameworkUtils
.
getDictDataFromCache
(
"order_item_usage"
,
usageId
);
//添加商品特性
if
(
usageValue
!=
null
)
{
if
(
item
.
getProdAttrIds
()
==
null
||
item
.
getProdAttrIds
().
length
()
==
0
)
{
labelJoiner
.
add
(
usageValue
.
getLabel
());
return
sReult
;
}
else
{
if
(
ProductAttrMap
==
null
)
{
return
sReult
;
}
else
{
String
sAttrName
=
""
;
List
<
String
>
resultList
=
Arrays
.
asList
(
item
.
getProdAttrIds
().
split
(
","
));
for
(
String
sId
:
resultList
)
{
Long
l
=
Long
.
parseLong
(
sId
);
if
(
sAttrName
.
length
()
!=
0
)
{
sAttrName
+=
","
+
ProductAttrMap
.
get
(
l
);
}
else
{
sAttrName
+=
ProductAttrMap
.
get
(
l
);
}
}
}
sReult
=
sAttrName
;
}
}
return
labelJoiner
.
toString
();
}
else
{
return
""
;
}
}
//end 添加商品特性
return
sReult
;
}
}
}
private
String
getAttrNameByIds
(
String
attrIds
,
Map
<
String
,
String
>
idNameMap
)
{
StringJoiner
labelJoiner
=
new
StringJoiner
(
","
);
if
(
StringUtils
.
isNotBlank
(
attrIds
))
{
String
[]
attrIdArray
=
attrIds
.
split
(
","
);
for
(
String
attrId
:
attrIdArray
)
{
//map一定包含数据,否则是数据错误
labelJoiner
.
add
(
idNameMap
.
get
(
attrId
));
}
return
labelJoiner
.
toString
();
}
return
""
;
}
}
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/listener/ShipmentReceivableExcelExportListener2.java
View file @
c8f909d3
...
@@ -470,9 +470,10 @@ public class ShipmentReceivableExcelExportListener2 {
...
@@ -470,9 +470,10 @@ public class ShipmentReceivableExcelExportListener2 {
map
.
put
(
"sumNum"
,
orderInfo
.
getSumNum
());
map
.
put
(
"sumNum"
,
orderInfo
.
getSumNum
());
sum14
=
sum14
+
orderInfo
.
getSumNum
();
sum14
=
sum14
+
orderInfo
.
getSumNum
();
}
}
map
.
put
(
"sumVolume"
,
orderInfo
.
getOrderItemVOList
().
stream
().
map
(
OrderItemBackVO:
:
getChargeVolume
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
BigDecimal
volume
=
orderInfo
.
getOrderItemVOList
().
stream
().
map
(
OrderItemBackVO:
:
getChargeVolume
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
map
.
put
(
"sumVolume"
,
volume
);
// map.put("sumVolume", orderInfo.getSumVolume());
// map.put("sumVolume", orderInfo.getSumVolume());
sum15
=
sum15
.
add
(
orderInfo
.
getSumVolume
()
);
sum15
=
sum15
.
add
(
volume
);
map
.
put
(
"sumWeight"
,
orderInfo
.
getSumWeight
());
map
.
put
(
"sumWeight"
,
orderInfo
.
getSumWeight
());
sum16
=
sum16
.
add
(
orderInfo
.
getSumWeight
());
sum16
=
sum16
.
add
(
orderInfo
.
getSumWeight
());
map
.
put
(
"vWeight"
,
orderInfo
.
getVWeight
());
map
.
put
(
"vWeight"
,
orderInfo
.
getVWeight
());
...
...
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/utils/CustomLoadMergeStrategyNew.java
0 → 100644
View file @
c8f909d3
package
cn
.
iocoder
.
yudao
.
module
.
shipment
.
utils
;
import
cn.iocoder.yudao.module.shipment.dto.AirLoadDto
;
import
cn.iocoder.yudao.module.shipment.dto.LoadDto
;
import
com.alibaba.excel.metadata.Head
;
import
com.alibaba.excel.write.merge.AbstractMergeStrategy
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author huyufeng
* @date 2022/12/14
* @description 自定义单元格合并策略
*/
public
class
CustomLoadMergeStrategyNew
extends
AbstractMergeStrategy
{
/**
* 分组,每几行合并一次
*/
private
List
<
Integer
>
exportFieldGroupCountList
;
private
List
<
Integer
>
partMergeList
;
private
int
mergeType
;
/**
* 目标合并列index
*/
private
Integer
targetColumnIndex
;
// 需要开始合并单元格的首行index
private
Integer
rowIndex
;
// exportDataList为待合并目标列的值 partMerge为另外一种合并方式计算好的合并行数,mergeType 合并类型 1为订单维度合并 2为入仓记录维度的合并
public
CustomLoadMergeStrategyNew
(
List
<
LoadDto
>
exportDataList
,
List
<
Integer
>
partMergeList
,
Integer
targetColumnIndex
,
int
mergeType
)
{
this
.
exportFieldGroupCountList
=
getGroupCountList
(
exportDataList
,
targetColumnIndex
);
this
.
partMergeList
=
partMergeList
;
this
.
mergeType
=
mergeType
;
this
.
targetColumnIndex
=
targetColumnIndex
;
}
@Override
protected
void
merge
(
Sheet
sheet
,
Cell
cell
,
Head
head
,
Integer
relativeRowIndex
)
{
if
(
null
==
rowIndex
)
{
rowIndex
=
cell
.
getRowIndex
();
}
// 仅从首行以及目标列的单元格开始合并,忽略其他
if
(
cell
.
getRowIndex
()
==
rowIndex
&&
cell
.
getColumnIndex
()
==
targetColumnIndex
)
{
if
(
mergeType
==
1
)
{
mergeGroupColumn
(
sheet
,
exportFieldGroupCountList
);
}
else
if
(
mergeType
==
2
)
{
mergeGroupColumn
(
sheet
,
partMergeList
);
}
}
}
private
void
mergeGroupColumn
(
Sheet
sheet
,
List
<
Integer
>
list
)
{
int
rowCount
=
rowIndex
;
for
(
Integer
count
:
list
)
{
if
(
count
==
1
)
{
rowCount
+=
count
;
continue
;
}
// 合并单元格
CellRangeAddress
cellRangeAddress
=
new
CellRangeAddress
(
rowCount
,
rowCount
+
count
-
1
,
targetColumnIndex
,
targetColumnIndex
);
sheet
.
addMergedRegionUnsafe
(
cellRangeAddress
);
rowCount
+=
count
;
}
}
// 该方法将目标列根据值是否相同连续可合并,存储可合并的行数
private
List
<
Integer
>
getGroupCountList
(
List
<
LoadDto
>
exportDataList
,
Integer
targetColumnIndex
)
{
if
(
CollectionUtils
.
isEmpty
(
exportDataList
))
{
return
new
ArrayList
<>();
}
List
<
Integer
>
groupCountList
=
new
ArrayList
<>();
int
count
=
1
;
LinkedHashMap
<
String
,
List
<
LoadDto
>>
collect
=
exportDataList
.
stream
().
collect
(
Collectors
.
groupingBy
(
LoadDto:
:
getId
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
for
(
Map
.
Entry
<
String
,
List
<
LoadDto
>>
entry
:
collect
.
entrySet
())
{
groupCountList
.
add
(
entry
.
getValue
().
size
());
}
return
groupCountList
;
}
}
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/downloadLog/DownloadLogServiceImpl.java
View file @
c8f909d3
...
@@ -282,9 +282,9 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
...
@@ -282,9 +282,9 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
break
;
break
;
//已装单导出
//已装单导出
case
SHIPMENT_LOAD_EXCEL_EXPORT:
case
SHIPMENT_LOAD_EXCEL_EXPORT:
shipmentLoadExcelExportPushEvent
(
downloadLog
);
//
shipmentLoadExcelExportPushEvent(downloadLog);
//总体切换
//总体切换
//
shipmentLoadExcelExportPushEvent2(downloadLog);
shipmentLoadExcelExportPushEvent2
(
downloadLog
);
break
;
break
;
//应收汇总导出修改导出Excel样式
//应收汇总导出修改导出Excel样式
case
SHIPMENT_RECEIVABLE_EXCEL_EXPORT:
case
SHIPMENT_RECEIVABLE_EXCEL_EXPORT:
...
...
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