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
72fdc215
Commit
72fdc215
authored
Jun 13, 2024
by
lanbaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-06-13-4提交发布
parent
b5225176
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
403 additions
and
629 deletions
+403
-629
BpmCreateServiceFactoryImpl.java
...yudao/module/bpm/service/BpmCreateServiceFactoryImpl.java
+5
-2
OrderBusinessServiceImpl.java
...le/order/service/order/impl/OrderBusinessServiceImpl.java
+2
-2
ShipmentLoadExcelExportListener.java
...le/shipment/listener/ShipmentLoadExcelExportListener.java
+58
-277
ShipmentLoadExcelExportListener2.java
...e/shipment/listener/ShipmentLoadExcelExportListener2.java
+323
-345
MakeBillOfLadingServiceImpl.java
...service/makeBillOfLading/MakeBillOfLadingServiceImpl.java
+4
-1
MakeBillOfLadingController.java
...shipment/controller/admin/MakeBillOfLadingController.java
+2
-1
ReceiptItemReq.java
...er/yudao/module/wealth/vo/receiptItem/ReceiptItemReq.java
+5
-0
BankReceiptDetailsMapper.xml
...resources/mapper/ReceiptItem/BankReceiptDetailsMapper.xml
+4
-1
load.xlsx
yudao-server/src/main/resources/templates/load.xlsx
+0
-0
No files found.
yudao-module-bpm/yudao-module-bpm-base/src/main/java/cn/iocoder/yudao/module/bpm/service/BpmCreateServiceFactoryImpl.java
View file @
72fdc215
...
...
@@ -34,12 +34,15 @@ public class BpmCreateServiceFactoryImpl implements BpmCreateServiceFactory {
* @param copyUserId 抄送人列表,不需要传null
* @return 流程实例ID,需回写到表单对象中
*/
public
String
createBmp
(
Long
userId
,
Long
orderFormId
,
String
workFlowKey
,
String
businessNo
,
String
[]
copyUserId
)
{
public
String
createBmp
(
Long
userId
,
Long
orderFormId
,
String
workFlowKey
,
String
businessNo
,
String
[]
copyUserId
)
{
Map
<
String
,
Object
>
processInstanceVariables
=
new
HashMap
<>();
if
(
StrUtil
.
isNotBlank
(
businessNo
))
{
processInstanceVariables
.
put
(
"businessNo"
,
businessNo
);
}
String
processInstanceId
=
processInstanceApi
.
createProcessInstance
(
userId
,
new
BpmProcessInstanceCreateReqDTO
().
setProcessDefinitionKey
(
workFlowKey
).
setVariables
(
processInstanceVariables
).
setBusinessKey
(
String
.
valueOf
(
orderFormId
)).
setCopyUserIds
(
copyUserId
));
String
processInstanceId
=
processInstanceApi
.
createProcessInstance
(
userId
,
new
BpmProcessInstanceCreateReqDTO
().
setProcessDefinitionKey
(
workFlowKey
).
setVariables
(
processInstanceVariables
).
setBusinessKey
(
String
.
valueOf
(
orderFormId
)).
setCopyUserIds
(
copyUserId
));
return
processInstanceId
;
}
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/order/impl/OrderBusinessServiceImpl.java
View file @
72fdc215
...
...
@@ -2611,7 +2611,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
null
,
orderItemDO
.
getProdId
(),
CollectionUtil
.
newArrayList
(
OrderExceptionEnum
.
GOODS_OVERWEIGHT_EXCEPTION
.
getKey
(),
OrderExceptionEnum
.
LINE_WEIGHT_EXCEPTION
.
getKey
()));
/*
String s = "type=" + type.toString() + " TransportId=" +
orderDO.getTransportId().toString() +
" NeedOrderInquiry=" + orderItemDO.getNeedOrderInquiry().toString();
...
...
@@ -2647,7 +2647,7 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
zTest z = new zTest();
z.setTestname(s);
z.setCreatedate(new Date());
}
}
*/
//end lanbm 2024-06-06 添加的逻辑点
// 渠道重量超限异常 channel_packaging_overweight_exception
...
...
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/listener/ShipmentLoadExcelExportListener.java
View file @
72fdc215
...
...
@@ -5,7 +5,6 @@ import cn.hutool.core.util.StrUtil;
import
cn.iocoder.yudao.framework.apollo.core.event.export.ShipmentLoadExcelExportPushEvent
;
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.json.JsonUtils
;
import
cn.iocoder.yudao.framework.common.util.number.NumberUtils
;
import
cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
...
...
@@ -21,13 +20,9 @@ import cn.iocoder.yudao.module.order.dal.dataobject.orderWarehouseIn.OrderWareho
import
cn.iocoder.yudao.module.order.dto.OrderBackInfoDto
;
import
cn.iocoder.yudao.module.order.service.order.*
;
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.orderWarehouseIn.OrderWarehouseInBackItemDo
;
import
cn.iocoder.yudao.module.order.vo.orderWarehouseIn.OrderWarehouseInBackItemVO
;
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.productbrank.ProductBrankDO
;
import
cn.iocoder.yudao.module.product.service.product.ProductAttrService
;
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.BoxDO
;
...
...
@@ -36,7 +31,6 @@ import cn.iocoder.yudao.module.shipment.dto.PreloadDto;
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.boxPreloadGoods.BoxPreloadGoodsService
;
import
cn.iocoder.yudao.module.shipment.utils.CustomCellWriteHandler
;
import
cn.iocoder.yudao.module.shipment.utils.CustomMergeStrategy
;
import
cn.iocoder.yudao.module.shipment.vo.boxPreloadGoods.BoxPreloadGoodsBackVO
;
import
cn.iocoder.yudao.module.system.framework.ue.UeProperties
;
...
...
@@ -44,7 +38,6 @@ import com.alibaba.excel.EasyExcel;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.alibaba.excel.write.metadata.WriteTable
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -62,7 +55,6 @@ import java.math.BigDecimal;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
error
;
...
...
@@ -72,9 +64,7 @@ import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.HAVE_NOT
/**
* 自编号订单excel导出监听
* lanbm 2024-06-05 修改模板样式和添加列字段
* 海运已装单数据导出
* NG2408045L
*
* @author zhengYi
*/
@Component
(
"ShipmentLoadExcelExportListener"
)
...
...
@@ -113,20 +103,8 @@ public class ShipmentLoadExcelExportListener {
@Resource
private
OrderService
orderService
;
@Resource
private
ProductAttrService
productAttrService
;
private
static
List
<
Integer
>
colorList
=
new
ArrayList
<>();
static
{
colorList
.
add
(
22
);
colorList
.
add
(
41
);
colorList
.
add
(
42
);
colorList
.
add
(
43
);
colorList
.
add
(
44
);
colorList
.
add
(
45
);
colorList
.
add
(
46
);
colorList
.
add
(
47
);
}
// @Value("${ue.templates-url}")
// private String path;
/**
* 订单导出监听
...
...
@@ -134,132 +112,63 @@ public class ShipmentLoadExcelExportListener {
* @param event 编号记录
*/
@EventListener
(
ShipmentLoadExcelExportPushEvent
.
class
)
public
void
shipmentLoadExcelExportPushEvent
(
ShipmentLoadExcelExportPushEvent
event
)
{
public
void
shipmentLoadExcelExportPushEvent
(
ShipmentLoadExcelExportPushEvent
event
)
{
if
(
StringUtils
.
isNotBlank
(
event
.
getRequestParams
()))
{
try
{
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
DATA_FORMAT
);
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
DATA_FORMAT
);
String
nowTime
=
formatter
.
format
(
LocalDateTime
.
now
());
String
dir
=
ueProperties
.
getTempDir
().
concat
(
"/load/excel/"
);
String
fileName
=
event
.
getUserId
().
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"shipment_load.xlsx"
);
String
fileName
=
event
.
getUserId
().
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"shipment_load.xlsx"
);
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
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
event
.
getRequestParams
());
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
event
.
getRequestParams
());
Long
shipmentId
=
jsonObject
.
getLong
(
"shipmentId"
);
List
<
BoxPreloadGoodsBackVO
>
goodsItemList
=
boxPreloadGoodsService
.
getShipGoodItemList
(
shipmentId
);
List
<
BoxPreloadGoodsBackVO
>
goodsItemList
=
boxPreloadGoodsService
.
getShipGoodItemList
(
shipmentId
);
if
(
CollectionUtil
.
isEmpty
(
goodsItemList
))
{
event
.
setResult
(
HAVE_NOT_PRELOAD_GOODS
.
getMsg
());
}
BoxDO
box
=
boxService
.
getBox
(
shipmentId
);
CabinetDO
cabinet
=
cabinetService
.
getCabinet
(
box
.
getCabinetId
());
BoxApprovalDO
boxApprovalDO
=
boxApprovalService
.
getOne
(
new
LambdaQueryWrapperX
<
BoxApprovalDO
>().
eq
(
BoxApprovalDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxApprovalDO:
:
getApprovalType
,
2
).
last
(
"limit 1"
));
BoxApprovalDO
boxApprovalDO
=
boxApprovalService
.
getOne
(
new
LambdaQueryWrapperX
<
BoxApprovalDO
>().
eq
(
BoxApprovalDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxApprovalDO:
:
getApprovalType
,
2
).
last
(
"limit 1"
));
headMap
.
put
(
"selfNo"
,
box
.
getSelfNo
());
headMap
.
put
(
"ctnNo"
,
box
.
getCubNo
());
if
(
cabinet
!=
null
)
{
headMap
.
put
(
"ctnNo"
,
box
.
getCubNo
());
if
(
cabinet
!=
null
)
{
headMap
.
put
(
"cabinetName"
,
cabinet
.
getName
());
}
headMap
.
put
(
"exportDate"
,
DateUtils
.
formatDate
(
new
Date
()));
if
(
boxApprovalDO
!=
null
)
{
headMap
.
put
(
"date"
,
DateUtils
.
formatDate
(
boxApprovalDO
.
getCreateTime
()));
headMap
.
put
(
"date"
,
DateUtils
.
formatDate
(
boxApprovalDO
.
getCreateTime
()));
}
File
fileDir
=
new
File
(
dir
);
if
(!
fileDir
.
exists
())
{
if
(!
fileDir
.
exists
()){
// 不存在则创建一个目录
fileDir
.
mkdirs
();
}
//write 写入的文件路径
//withTemplate 使用的模板
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
dir
+
fileName
).
withTemplate
(
inputStream
).
build
();
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
dir
+
fileName
).
withTemplate
(
inputStream
).
build
();
WriteSheet
sheet
=
EasyExcel
.
writerSheet
(
0
).
build
();
excelWriter
.
fill
(
headMap
,
sheet
);
//商品属性获取 lanbm 2024-06-05 add
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 商品属性获取 lanbm 2024-06-05 add
if
(
box
.
getLdStatus
()
!=
null
&&
box
.
getLdStatus
()
>=
43
)
{
//43、已装柜、待封柜
if
(
box
.
getLdStatus
()
!=
null
&&
box
.
getLdStatus
()>=
43
)
{
//43、已装柜、待封柜
//以secId排序
goodsItemList
.
sort
(
Comparator
.
comparing
(
BoxPreloadGoodsBackVO:
:
getSecId
).
thenComparing
(
BoxPreloadGoodsBackVO:
:
getTidanNum
).
thenComparing
(
BoxPreloadGoodsBackVO:
:
getId
));
goodsItemList
.
sort
(
Comparator
.
comparing
(
BoxPreloadGoodsBackVO:
:
getSecId
).
thenComparing
(
BoxPreloadGoodsBackVO:
:
getTidanNum
).
thenComparing
(
BoxPreloadGoodsBackVO:
:
getId
));
int
allTotalNum
=
0
;
BigDecimal
allTotalVolume
=
new
BigDecimal
(
0
);
BigDecimal
allTotalWeight
=
new
BigDecimal
(
0
);
List
<
Long
>
secCount
=
goodsItemList
.
stream
().
map
(
BoxPreloadGoodsBackVO:
:
getSecId
).
distinct
().
sorted
().
collect
(
Collectors
.
toList
());
List
<
Long
>
secCount
=
goodsItemList
.
stream
().
map
(
BoxPreloadGoodsBackVO:
:
getSecId
).
distinct
().
sorted
().
collect
(
Collectors
.
toList
());
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
<
List
<
String
>>
headList
=
new
ArrayList
<>();
String
head
=
""
;
if
(
i
==
0
)
{
head
=
"第"
+
NumberUtils
.
int2chineseNum
(
i
+
1
)
+
"部分(Be loaded inside of the container)"
;
head
=
"第"
+
NumberUtils
.
int2chineseNum
(
i
+
1
)
+
"部分(Be loaded inside of the container)"
;
}
else
{
head
=
"第"
+
NumberUtils
.
int2chineseNum
(
i
+
1
)
+
"部分(after "
+
NumberUtils
.
format
(
i
+
1
)
+
" parts)"
;
head
=
"第"
+
NumberUtils
.
int2chineseNum
(
i
+
1
)+
"部分(after "
+
NumberUtils
.
format
(
i
+
1
)+
" parts)"
;
}
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
<>();
...
...
@@ -267,165 +176,71 @@ public class ShipmentLoadExcelExportListener {
BigDecimal
totalVolume
=
new
BigDecimal
(
0
);
BigDecimal
totalWeight
=
new
BigDecimal
(
0
);
Map
<
String
,
Integer
>
numMap
=
new
HashMap
();
Map
<
String
,
Integer
>
numMap
=
new
HashMap
();
Long
part
=
secCount
.
get
(
i
);
List
<
Integer
>
mergeCountList
=
new
ArrayList
();
List
<
Integer
>
colorRowList
=
new
ArrayList
<>();
AtomicInteger
colorRowNum
=
new
AtomicInteger
(
5
);
Map
<
String
,
Integer
>
colorMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
mergePkgCountMap
=
new
LinkedHashMap
<>();
int
colorIndex
=
0
;
//以订单ID分组
Map
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
orderMap
=
goodsItemList
.
stream
().
filter
(
item
->
item
.
getSecId
().
longValue
()
==
part
.
longValue
()
&&
StringUtils
.
isNotBlank
(
item
.
getWarehouseInInfo
()))
.
collect
(
Collectors
.
groupingBy
(
BoxPreloadGoodsBackVO:
:
getOrderId
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
for
(
Map
.
Entry
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
entry
:
orderMap
.
entrySet
())
{
Long
orderId
=
entry
.
getKey
();
List
<
OrderWarehouseInBackItemVO
>
orderWarehouseInBackItemVOS
=
orderWarehouseInService
.
getOrderWarehouseInListOrderByInTime
(
orderId
);
for
(
OrderWarehouseInBackItemVO
item
:
orderWarehouseInBackItemVOS
)
{
int
andIncrement
=
colorRowNum
.
getAndIncrement
();
if
(
StringUtils
.
isNotBlank
(
item
.
getOrderWarehouseInDetails
()))
{
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
item
.
getOrderWarehouseInDetails
());
if
(
jsonArray
.
size
()
>
0
)
{
colorMap
.
put
(
String
.
valueOf
(
andIncrement
),
colorList
.
get
(
colorIndex
));
colorRowList
.
add
(
andIncrement
);
//这里加1是为了设置颜色时过滤掉入仓记录那条
}
}
int
mergeCount
=
1
;
if
(
StringUtils
.
isNotBlank
(
item
.
getOrderWarehouseInDetails
()))
{
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(需要的参数))
//自定义单元格合并策略
Map
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
orderMap
=
goodsItemList
.
stream
().
filter
(
item
->
item
.
getSecId
().
longValue
()==
part
.
longValue
()
&&
StringUtils
.
isNotBlank
(
item
.
getWarehouseInInfo
()))
.
collect
(
Collectors
.
groupingBy
(
BoxPreloadGoodsBackVO:
:
getOrderId
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
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
))
.
registerWriteHandler
(
new
CustomMergeStrategy
(
orderMap
,
null
,
null
,
0
,
true
))
.
registerWriteHandler
(
new
CustomMergeStrategy
(
orderMap
,
null
,
null
,
1
,
true
))
.
registerWriteHandler
(
new
CustomMergeStrategy
(
orderMap
,
null
,
null
,
2
,
true
))
.
registerWriteHandler
(
new
CustomMergeStrategy
(
orderMap
,
null
,
null
,
7
,
true
))
.
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
());
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
();
preloadDto
.
setOrderNo
(
orderInfo
.
getOrderNo
());
if
(
numMap
.
get
(
orderInfo
.
getOrderNo
())
!=
null
)
{
preloadDto
.
setId
(
String
.
valueOf
(
numMap
.
get
(
orderInfo
.
getOrderNo
())));
}
else
{
preloadDto
.
setId
(
String
.
valueOf
(
numMap
.
size
()
+
1
));
numMap
.
put
(
orderInfo
.
getOrderNo
(),
numMap
.
size
()
+
1
);
preloadDto
.
setId
(
String
.
valueOf
(
numMap
.
size
()
+
1
));
numMap
.
put
(
orderInfo
.
getOrderNo
(),
numMap
.
size
()+
1
);
}
preloadDto
.
setMarks
(
orderInfo
.
getMarks
());
List
<
OrderGuanlianDO
>
guanlianList
=
orderGuanlianService
.
getGuanlianListByOrderId
(
orderInfo
.
getOrderId
());
List
<
OrderGuanlianDO
>
guanlianList
=
orderGuanlianService
.
getGuanlianListByOrderId
(
orderInfo
.
getOrderId
());
//rIdList为此订单的所有关联订单
List
<
Long
>
rIdList
=
new
ArrayList
<>();
for
(
OrderGuanlianDO
orderGuanlianDO
:
guanlianList
)
{
Long
oId
=
orderGuanlianDO
.
getOrderId
();
Long
rId
=
orderGuanlianDO
.
getRelateOrderId
();
if
(
oId
.
equals
(
orderId
))
{
if
(
oId
.
equals
(
orderId
))
{
rIdList
.
add
((
rId
));
}
else
if
(
rId
.
equals
(
orderId
))
{
}
else
if
(
rId
.
equals
(
orderId
))
{
rIdList
.
add
(
oId
);
}
}
if
(
CollectionUtil
.
isNotEmpty
(
rIdList
))
{
List
<
OrderDO
>
orderDOS
=
orderService
.
selectList
(
OrderDO:
:
getOrderId
,
rIdList
);
List
<
OrderDO
>
orderDOS
=
orderService
.
selectList
(
OrderDO:
:
getOrderId
,
rIdList
);
if
(
CollectionUtil
.
isNotEmpty
(
orderDOS
))
{
preloadDto
.
setRelateOrder
(
orderDOS
.
stream
().
map
(
OrderDO:
:
getOrderNo
).
collect
(
Collectors
.
joining
(
","
)));
preloadDto
.
setRelateOrder
(
orderDOS
.
stream
().
map
(
OrderDO:
:
getOrderNo
).
collect
(
Collectors
.
joining
(
","
)));
}
}
preloadDto
.
setProdTitleZh
(
item
.
getProdTitleZh
()
+
" "
+
item
.
getProdTitleEn
());
preloadDto
.
setProdTitleZh
(
item
.
getProdTitleZh
()
+
" "
+
item
.
getProdTitleEn
());
preloadDto
.
setMerge
(
orderInfo
.
getOldNumbers
());
ProductBrankDO
productBrank
=
productBrankService
.
getProductBrank
(
item
.
getBrand
());
if
(
productBrank
!=
null
&&
StringUtils
.
isNotBlank
(
productBrank
.
getTitleZh
()))
{
ProductBrankDO
productBrank
=
productBrankService
.
getProductBrank
(
item
.
getBrand
());
if
(
productBrank
!=
null
&&
StringUtils
.
isNotBlank
(
productBrank
.
getTitleZh
())){
preloadDto
.
setBrand
(
productBrank
.
getTitleZh
());
}
//材质
if
(
StringUtils
.
isNotBlank
(
item
.
getMaterial
()))
{
preloadDto
.
setMaterial
(
DictFrameworkUtils
.
getDictDataFromCache
(
"product_material"
,
item
.
getMaterial
()
+
""
).
getLabel
());
if
(
StringUtils
.
isNotBlank
(
item
.
getMaterial
())){
preloadDto
.
setMaterial
(
DictFrameworkUtils
.
getDictDataFromCache
(
"product_material"
,
item
.
getMaterial
()+
""
).
getLabel
());
}
//品牌
if
(
productBrank
!=
null
&&
productBrank
.
getFiling
()
!=
null
)
{
preloadDto
.
setProductRecord
(
productBrank
.
getFiling
().
equals
(
"0"
)
?
"N"
:
"Y"
);
if
(
productBrank
!=
null
&&
productBrank
.
getFiling
()!=
null
){
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
);
}
//商品特性赋值 lanbm 2024-06-05 add
String
sR
=
getAttrName
(
item
,
ProductAttrMap
);
preloadDto
.
setProdAttrIds
(
sR
);
preloadDto
.
setSumNum
(
item
.
getWarehouseInInfoVO
().
getCartonsNum
());
if
(
CollectionUtil
.
isNotEmpty
(
orderWarehouseInDOS
))
{
if
(
CollectionUtil
.
isNotEmpty
(
orderWarehouseInDOS
)){
String
warehousingSpecificationType
=
orderWarehouseInDOS
.
stream
().
map
(
j
->
{
return
DictFrameworkUtils
.
getDictDataFromCache
(
"warehousing_specification_type"
,
j
.
getSpecificationType
()
+
""
).
getLabel
();
}).
distinct
().
collect
(
Collectors
.
joining
(
"/"
));
...
...
@@ -437,10 +252,8 @@ public class ShipmentLoadExcelExportListener {
}
preloadDto
.
setSumVolume
(
item
.
getWarehouseInInfoVO
().
getVolume
());
preloadDto
.
setSumWeight
(
item
.
getWarehouseInInfoVO
().
getWeight
());
if
(
orderInfo
.
getCustomsType
()
!=
null
)
{
preloadDto
.
setCustomsType
(
DictFrameworkUtils
.
getDictDataFromCache
(
"customs_type"
,
orderInfo
.
getCustomsType
()
+
""
).
getLabel
());
if
(
orderInfo
.
getCustomsType
()!=
null
){
preloadDto
.
setCustomsType
(
DictFrameworkUtils
.
getDictDataFromCache
(
"customs_type"
,
orderInfo
.
getCustomsType
()+
""
).
getLabel
());
}
preloadDto
.
setWorth
(
item
.
getWorth
());
preloadDto
.
setQuantity
(
item
.
getWarehouseInInfoVO
().
getQuantityAll
());
...
...
@@ -459,7 +272,7 @@ public class ShipmentLoadExcelExportListener {
allTotalNum
=
allTotalNum
+
totalNum
;
allTotalVolume
=
allTotalVolume
.
add
(
totalVolume
);
allTotalWeight
=
allTotalWeight
.
add
(
totalWeight
);
if
(
i
==
secCount
.
size
()
-
1
)
{
if
(
i
==
secCount
.
size
()-
1
)
{
LoadDto
preloadDto1
=
new
LoadDto
();
preloadDto1
.
setId
(
"IN TOTAL"
);
preloadDto1
.
setSumNum
(
allTotalNum
);
...
...
@@ -467,12 +280,11 @@ public class ShipmentLoadExcelExportListener {
preloadDto1
.
setSumWeight
(
allTotalWeight
);
list
.
add
(
preloadDto1
);
}
excelWriter
.
write
(
list
,
sheet
,
writeTable
);
excelWriter
.
write
(
list
,
sheet
,
writeTable
);
}
}
}
excelWriter
.
finish
();
inputStream
.
close
();
// 获取到临时文件
...
...
@@ -490,8 +302,8 @@ public class ShipmentLoadExcelExportListener {
event
.
setFileName
(
fileDO
.
getPath
());
event
.
setUrl
(
fileDO
.
getUrl
());
event
.
setFileId
(
fileDO
.
getId
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
event
.
setResult
(
e
.
getMessage
());
}
...
...
@@ -500,35 +312,4 @@ public class ShipmentLoadExcelExportListener {
}
}
/*
lanbm 2024-06-05 添加商品属性转换函数
*/
private
String
getAttrName
(
OrderItemDO
item
,
Map
<
Long
,
String
>
ProductAttrMap
)
{
String
sReult
=
""
;
//lanbm 2024-06-05添加商品特性
if
(
item
.
getProdAttrIds
()
==
null
||
item
.
getProdAttrIds
().
length
()
==
0
)
{
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
;
}
}
//end lanbm 2024-06-05添加商品特性
return
sReult
;
}
}
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/listener/ShipmentLoadExcelExportListener2.java
View file @
72fdc215
...
...
@@ -12,11 +12,14 @@ 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.util.DictFrameworkUtils
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
cn.iocoder.yudao.module.ecw.dal.dataobject.cabinet.CabinetDO
;
import
cn.iocoder.yudao.module.ecw.service.cabinet.CabinetService
;
import
cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO
;
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.orderGuanlian.OrderGuanlianDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderWarehouseIn.OrderWarehouseInDO
;
import
cn.iocoder.yudao.module.order.dto.OrderBackInfoDto
;
import
cn.iocoder.yudao.module.order.service.order.*
;
import
cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInService
;
...
...
@@ -43,6 +46,7 @@ import cn.iocoder.yudao.module.shipment.service.boxPkgOrder.BoxPkgOrderService;
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.CustomMergeStrategy
;
import
cn.iocoder.yudao.module.shipment.vo.boxPreloadGoods.BoxPreloadGoodsBackVO
;
import
cn.iocoder.yudao.module.system.framework.ue.UeProperties
;
import
com.alibaba.excel.EasyExcel
;
...
...
@@ -72,6 +76,16 @@ import java.util.stream.Collectors;
import
static
cn
.
iocoder
.
yudao
.
framework
.
excel
.
constant
.
ExportConstant
.
DATA_FORMAT
;
import
static
cn
.
iocoder
.
yudao
.
module
.
shipment
.
enums
.
ErrorCodeConstants
.
HAVE_NOT_PRELOAD_GOODS
;
/**
* 自编号订单excel导出监听
* lanbm 2024-06-05 修改模板样式和添加列字段
* 海运已装单数据导出
* NG2408045L
* @author zhengYi
*/
@Component
(
"ShipmentLoadExcelExportListener2"
)
@AllArgsConstructor
@Slf4j
...
...
@@ -99,9 +113,6 @@ public class ShipmentLoadExcelExportListener2 {
@Resource
private
BoxApprovalService
boxApprovalService
;
@Resource
private
OrderLocationService
orderLocationService
;
@Resource
private
OrderGuanlianService
orderGuanlianService
;
...
...
@@ -111,18 +122,9 @@ public class ShipmentLoadExcelExportListener2 {
@Resource
private
OrderService
orderService
;
@Resource
private
ProductService
productService
;
@Resource
private
ProductAttrService
productAttrService
;
@Resource
private
BoxPkgOrderService
boxPkgOrderService
;
@Resource
private
BoxMergePkgService
boxMergePkgService
;
private
static
List
<
Integer
>
colorList
=
new
ArrayList
<>();
static
{
colorList
.
add
(
22
);
...
...
@@ -140,343 +142,346 @@ public class ShipmentLoadExcelExportListener2 {
*
* @param event 编号记录
*/
@EventListener
(
ShipmentLoadExcelExportPushEvent
2
.
class
)
public
void
shipment
Air
LoadExcelExportPushEvent
(
ShipmentLoadExcelExportPushEvent
2
event
)
{
@EventListener
(
ShipmentLoadExcelExportPushEvent
.
class
)
public
void
shipmentLoadExcelExportPushEvent
(
ShipmentLoadExcelExportPushEvent
event
)
{
if
(
StringUtils
.
isNotBlank
(
event
.
getRequestParams
()))
{
try
{
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
DATA_FORMAT
);
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
DATA_FORMAT
);
String
nowTime
=
formatter
.
format
(
LocalDateTime
.
now
());
String
dir
=
ueProperties
.
getTempDir
().
concat
(
"/load/excel/"
);
File
fileDir
=
new
File
(
dir
);
if
(!
fileDir
.
exists
()){
// 不存在则创建一个目录
fileDir
.
mkdirs
();
}
String
fileName
=
event
.
getUserId
().
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"shipment_load.xlsx"
);
String
fileName
=
event
.
getUserId
().
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"shipment_load.xlsx"
);
InputStream
inputStream
=
null
;
inputStream
=
this
.
getClass
().
getClassLoader
().
//获取模板 2024-06-05 添加注释
inputStream
=
getClass
().
getClassLoader
().
getResourceAsStream
(
ueProperties
.
getTemplatesUrl
()
+
"/load.xlsx"
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
event
.
getRequestParams
());
Long
shipmentId
=
jsonObject
.
getLong
(
"shipmentId"
);
Map
headMap
=
new
HashMap
();
List
<
BoxPreloadGoodsBackVO
>
goodsItemList
=
boxPreloadGoodsService
.
getShipGoodItemList
(
shipmentId
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
event
.
getRequestParams
());
Long
shipmentId
=
jsonObject
.
getLong
(
"shipmentId"
);
List
<
BoxPreloadGoodsBackVO
>
goodsItemList
=
boxPreloadGoodsService
.
getShipGoodItemList
(
shipmentId
);
if
(
CollectionUtil
.
isEmpty
(
goodsItemList
))
{
event
.
setResult
(
HAVE_NOT_PRELOAD_GOODS
.
getMsg
());
}
BoxDO
box
=
boxService
.
getBox
(
shipmentId
);
BoxApprovalDO
boxApprovalDO
=
boxApprovalService
.
getOne
(
new
LambdaQueryWrapperX
<
BoxApprovalDO
>().
eq
(
BoxApprovalDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxApprovalDO:
:
getApprovalType
,
1
).
last
(
"limit 1"
));
CabinetDO
cabinet
=
cabinetService
.
getCabinet
(
box
.
getCabinetId
());
BoxApprovalDO
boxApprovalDO
=
boxApprovalService
.
getOne
(
new
LambdaQueryWrapperX
<
BoxApprovalDO
>().
eq
(
BoxApprovalDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxApprovalDO:
:
getApprovalType
,
2
).
last
(
"limit 1"
));
headMap
.
put
(
"selfNo"
,
box
.
getSelfNo
());
headMap
.
put
(
"airChannel"
,
""
);
headMap
.
put
(
"ctnNo"
,
box
.
getCubNo
());
if
(
cabinet
!=
null
)
{
headMap
.
put
(
"cabinetName"
,
cabinet
.
getName
());
}
headMap
.
put
(
"exportDate"
,
DateUtils
.
formatDate
(
new
Date
()));
if
(
boxApprovalDO
!=
null
)
{
headMap
.
put
(
"date"
,
DateUtils
.
formatDate
(
boxApprovalDO
.
getUpdateTime
()));
headMap
.
put
(
"date"
,
DateUtils
.
formatDate
(
boxApprovalDO
.
getCreateTime
()));
}
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
dir
+
fileName
).
withTemplate
(
inputStream
).
build
();
File
fileDir
=
new
File
(
dir
);
if
(!
fileDir
.
exists
())
{
// 不存在则创建一个目录
fileDir
.
mkdirs
();
}
//write 写入的文件路径
//withTemplate 使用的模板
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
dir
+
fileName
).
withTemplate
(
inputStream
).
build
();
WriteSheet
sheet
=
EasyExcel
.
writerSheet
(
0
).
build
();
excelWriter
.
fill
(
headMap
,
sheet
);
//以secId排序
goodsItemList
.
sort
(
Comparator
.
comparing
(
BoxPreloadGoodsBackVO:
:
getPkgId
).
reversed
().
thenComparing
(
BoxPreloadGoodsBackVO:
:
getTidanNum
));
List
<
Long
>
pkgIds
=
goodsItemList
.
stream
().
filter
(
item
->
item
.
getPkgId
()
!=
null
&&
item
.
getPkgId
()
>
0L
).
map
(
BoxPreloadGoodsBackVO:
:
getPkgId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
if
(
CollectionUtil
.
isNotEmpty
(
pkgIds
))
{
map
=
boxPkgOrderService
.
getMergeOrderQualityByPkgIds
(
pkgIds
);
//商品属性获取 lanbm 2024-06-05 add
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
));
}
Long
disMergePkgCount
=
goodsItemList
.
stream
().
filter
(
item
->
item
.
getPkgId
()
!=
null
&&
item
.
getPkgId
()
>
0L
).
map
(
BoxPreloadGoodsBackVO:
:
getPkgId
).
distinct
().
count
();
int
sumMergeCount
=
disMergePkgCount
.
intValue
();
// goodsItemList.sort(Comparator.comparing(BoxPreloadGoodsBackVO::getSecId).thenComparing(BoxPreloadGoodsBackVO::getTidanNum).thenComparing(BoxPreloadGoodsBackVO::getId));
int
allTotalNum
=
0
;
BigDecimal
allTotalVolume
=
new
BigDecimal
(
0
);
BigDecimal
allTotalWeight
=
new
BigDecimal
(
0
);
Map
<
String
,
BigDecimal
>
mergeVolumnMap
=
new
HashMap
<>();
Map
<
String
,
BigDecimal
>
mergeWeightMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
mergeQualityMap
=
new
HashMap
<>();
int
totalMergeQuality
=
0
;
BigDecimal
totalMergeVolume
=
new
BigDecimal
(
"0"
);
BigDecimal
totalMergeWeight
=
new
BigDecimal
(
"0"
);
List
<
Long
>
secCount
=
goodsItemList
.
stream
().
map
(
BoxPreloadGoodsBackVO:
:
getSecId
).
distinct
().
sorted
().
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
secCount
))
{
for
(
int
i
=
0
;
i
<
secCount
.
size
();
i
++){
List
<
String
>
list1
=
new
ArrayList
();
List
<
List
<
String
>>
headList
=
new
ArrayList
<>();
String
head
=
""
;
if
(
i
==
0
)
{
head
=
"第"
+
NumberUtils
.
int2chineseNum
(
i
+
1
)
+
"部分(Be loaded inside of the container)"
;
}
else
{
head
=
"第"
+
NumberUtils
.
int2chineseNum
(
i
+
1
)+
"部分(after "
+
NumberUtils
.
format
(
i
+
1
)+
" parts)"
;
}
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
);
List
<
PreloadDto
>
list
=
new
ArrayList
<>();
int
totalNum
=
0
;
BigDecimal
totalVolume
=
new
BigDecimal
(
0
);
BigDecimal
totalWeight
=
new
BigDecimal
(
0
);
Map
<
String
,
Integer
>
numMap
=
new
HashMap
();
List
<
AirLoadDto
>
preloadDtoList
=
new
ArrayList
<>();
Long
part
=
secCount
.
get
(
i
);
List
<
Integer
>
mergeCountList
=
new
ArrayList
();
List
<
Integer
>
colorRowList
=
new
ArrayList
<>();
AtomicInteger
colorRowNum
=
new
AtomicInteger
(
5
);
Map
<
String
,
Integer
>
colorMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
mergePkgCountMap
=
new
LinkedHashMap
<>();
int
colorIndex
=
0
;
//以订单ID分组
Map
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
orderMap
=
goodsItemList
.
stream
().
filter
(
item
->
item
.
getSecId
().
longValue
()==
part
.
longValue
()
&&
StringUtils
.
isNotBlank
(
item
.
getWarehouseInInfo
()))
.
collect
(
Collectors
.
groupingBy
(
BoxPreloadGoodsBackVO:
:
getOrderId
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
for
(
Map
.
Entry
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
entry
:
orderMap
.
entrySet
())
{
Long
orderId
=
entry
.
getKey
();
Long
pkgId
=
entry
.
getValue
().
get
(
0
).
getPkgId
();
OrderBackInfoDto
orderInfo
=
orderQueryService
.
info
(
orderId
);
OrderDO
orderDO
=
orderService
.
selectOne
(
OrderDO:
:
getOrderId
,
orderId
);
List
<
OrderWarehouseInBackItemVO
>
orderWarehouseInBackItemVOS
=
orderWarehouseInService
.
getOrderWarehouseInListOrderByInTime
(
orderId
);
for
(
OrderWarehouseInBackItemVO
item
:
orderWarehouseInBackItemVOS
)
{
int
andIncrement
=
colorRowNum
.
getAndIncrement
();
if
(
StringUtils
.
isNotBlank
(
item
.
getOrderWarehouseInDetails
()))
{
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
item
.
getOrderWarehouseInDetails
());
if
(
jsonArray
.
size
()
>
0
)
{
colorMap
.
put
(
String
.
valueOf
(
andIncrement
),
colorList
.
get
(
colorIndex
));
colorRowList
.
add
(
andIncrement
);
//这里加1是为了设置颜色时过滤掉入仓记录那条
}
}
int
mergeCount
=
1
;
AirLoadDto
preloadDto
=
new
AirLoadDto
();
if
(
numMap
.
get
(
orderInfo
.
getOrderNo
())
!=
null
)
{
preloadDto
.
setId
(
String
.
valueOf
(
numMap
.
get
(
orderInfo
.
getOrderNo
())));
}
else
{
preloadDto
.
setId
(
String
.
valueOf
(
numMap
.
size
()+
1
));
numMap
.
put
(
orderInfo
.
getOrderNo
(),
numMap
.
size
()+
1
);
}
preloadDto
.
setOrderNo
(
orderInfo
.
getOrderNo
());
preloadDto
.
setMarks
(
orderInfo
.
getMarks
());
preloadDto
.
setProdTitleZh
(
item
.
getProdTitleZh
()+
" "
+
item
.
getProdTitleEn
());
preloadDto
.
setQuantity
(
item
.
getQuantityAll
());
ProductBrankDO
productBrank
=
productBrankService
.
getProductBrank
(
item
.
getBrand
());
if
(
productBrank
!=
null
&&
StringUtils
.
isNotBlank
(
productBrank
.
getTitleZh
())){
preloadDto
.
setBrand
(
productBrank
.
getTitleZh
());
}
if
(
productBrank
!=
null
&&
productBrank
.
getFiling
()!=
null
){
preloadDto
.
setProductRecord
(
productBrank
.
getFiling
().
equals
(
"0"
)?
"N"
:
"Y"
);
}
List
<
ProductAttrDO
>
productAttrDOList
=
productAttrService
.
getProductAttrList
();
Map
<
String
,
String
>
idNameMap
=
productAttrDOList
.
stream
()
.
collect
(
Collectors
.
toMap
(
attr
->
String
.
valueOf
(
attr
.
getId
()),
ProductAttrDO:
:
getAttrName
));
preloadDto
.
setProdAttr
(
getAttrNameByIds
(
item
.
getProdAttrIds
(),
idNameMap
));
if
(
orderInfo
.
getCustomsType
()!=
null
){
preloadDto
.
setCustomsType
(
DictFrameworkUtils
.
getDictDataFromCache
(
"customs_type"
,
orderInfo
.
getCustomsType
()+
""
).
getLabel
());
}
preloadDto
.
setSumNum
(
item
.
getCartonsNum
());
preloadDto
.
setPackageType
(
DictFrameworkUtils
.
getDictDataFromCache
(
"packaging_type"
,
item
.
getUnit
()).
getLabel
());
preloadDto
.
setBoxGauge
(
item
.
getBoxGauge
());
preloadDto
.
setSumVolume
(
item
.
getVolume
());
preloadDto
.
setSumWeight
(
item
.
getWeight
());
List
<
BoxPkgOrderDO
>
boxPkgOrderDOS
=
boxPkgOrderService
.
selectList
(
BoxPkgOrderDO:
:
getOrderId
,
orderId
);
if
(
CollectionUtil
.
isNotEmpty
(
boxPkgOrderDOS
))
{
preloadDto
.
setMergePkgNum
(
1
);
BoxMergePkgDO
boxMergePkg
=
boxMergePkgService
.
getBoxMergePkg
(
boxPkgOrderDOS
.
get
(
0
).
getPkgId
());
preloadDto
.
setMergePkgBoxGauge
(
boxMergePkg
.
getPkgLength
()+
"*"
+
boxMergePkg
.
getPkgWidth
()+
"*"
+
boxMergePkg
.
getPkgHight
());
preloadDto
.
setMergePkgVolume
(
boxMergePkg
.
getSumVolume
());
preloadDto
.
setMergePkgWeight
(
boxMergePkg
.
getSumWeight
());
preloadDto
.
setMergePkgQua
(
map
.
get
(
String
.
valueOf
(
boxMergePkg
.
getId
())));
preloadDto
.
setMergePkgCode
(
boxMergePkg
.
getPkgNum
());
if
(
mergeVolumnMap
.
get
(
String
.
valueOf
(
boxMergePkg
.
getId
()))
==
null
)
{
mergeVolumnMap
.
put
(
String
.
valueOf
(
boxMergePkg
.
getId
()),
boxMergePkg
.
getSumVolume
());
//end 商品属性获取 lanbm 2024-06-05 add
if
(
box
.
getLdStatus
()
!=
null
&&
box
.
getLdStatus
()
>=
43
)
{
//43、已装柜、待封柜
//以secId排序
goodsItemList
.
sort
(
Comparator
.
comparing
(
BoxPreloadGoodsBackVO:
:
getSecId
).
thenComparing
(
BoxPreloadGoodsBackVO:
:
getTidanNum
).
thenComparing
(
BoxPreloadGoodsBackVO:
:
getId
));
int
allTotalNum
=
0
;
BigDecimal
allTotalVolume
=
new
BigDecimal
(
0
);
BigDecimal
allTotalWeight
=
new
BigDecimal
(
0
);
List
<
Long
>
secCount
=
goodsItemList
.
stream
().
map
(
BoxPreloadGoodsBackVO:
:
getSecId
).
distinct
().
sorted
().
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
secCount
))
{
for
(
int
i
=
0
;
i
<
secCount
.
size
();
i
++)
{
List
<
String
>
list1
=
new
ArrayList
();
List
<
List
<
String
>>
headList
=
new
ArrayList
<>();
String
head
=
""
;
if
(
i
==
0
)
{
head
=
"第"
+
NumberUtils
.
int2chineseNum
(
i
+
1
)
+
"部分(Be loaded inside of the container)"
;
}
else
{
head
=
"第"
+
NumberUtils
.
int2chineseNum
(
i
+
1
)
+
"部分(after "
+
NumberUtils
.
format
(
i
+
1
)
+
" parts)"
;
}
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
);
List
<
LoadDto
>
list
=
new
ArrayList
<>();
int
totalNum
=
0
;
BigDecimal
totalVolume
=
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
>
colorRowList
=
new
ArrayList
<>();
AtomicInteger
colorRowNum
=
new
AtomicInteger
(
5
);
Map
<
String
,
Integer
>
colorMap
=
new
HashMap
<>();
Map
<
String
,
Integer
>
mergePkgCountMap
=
new
LinkedHashMap
<>();
int
colorIndex
=
0
;
//以订单ID分组
Map
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
orderMap
=
goodsItemList
.
stream
().
filter
(
item
->
item
.
getSecId
().
longValue
()
==
part
.
longValue
()
&&
StringUtils
.
isNotBlank
(
item
.
getWarehouseInInfo
()))
.
collect
(
Collectors
.
groupingBy
(
BoxPreloadGoodsBackVO:
:
getOrderId
,
LinkedHashMap:
:
new
,
Collectors
.
toList
()));
for
(
Map
.
Entry
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
entry
:
orderMap
.
entrySet
())
{
Long
orderId
=
entry
.
getKey
();
List
<
OrderWarehouseInBackItemVO
>
orderWarehouseInBackItemVOS
=
orderWarehouseInService
.
getOrderWarehouseInListOrderByInTime
(
orderId
);
for
(
OrderWarehouseInBackItemVO
item
:
orderWarehouseInBackItemVOS
)
{
int
andIncrement
=
colorRowNum
.
getAndIncrement
();
if
(
StringUtils
.
isNotBlank
(
item
.
getOrderWarehouseInDetails
()))
{
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
item
.
getOrderWarehouseInDetails
());
if
(
jsonArray
.
size
()
>
0
)
{
colorMap
.
put
(
String
.
valueOf
(
andIncrement
),
colorList
.
get
(
colorIndex
));
colorRowList
.
add
(
andIncrement
);
//这里加1是为了设置颜色时过滤掉入仓记录那条
}
}
if
(
mergeWeightMap
.
get
(
String
.
valueOf
(
boxMergePkg
.
getId
()))
==
null
)
{
mergeWeightMap
.
put
(
String
.
valueOf
(
boxMergePkg
.
getId
()),
boxMergePkg
.
getSumWeight
());
int
mergeCount
=
1
;
if
(
StringUtils
.
isNotBlank
(
item
.
getOrderWarehouseInDetails
()))
{
item
.
setOrderWarehouseInDetailsVOList
(
JsonUtils
.
parseArray
(
item
.
getOrderWarehouseInDetails
(),
OrderWarehouseInDetailsVO
.
class
));
}
if
(
mergeQualityMap
.
get
(
String
.
valueOf
(
boxMergePkg
.
getId
()))
==
null
)
{
mergeQualityMap
.
put
(
String
.
valueOf
(
boxMergePkg
.
getId
()),
map
.
get
(
String
.
valueOf
(
boxMergePkg
.
getId
())));
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
);
}
}
}
else
{
sumMergeCount
=
sumMergeCount
+
item
.
getCartonsNum
();
preloadDto
.
setMergePkgNum
(
item
.
getCartonsNum
());
preloadDto
.
setMergePkgBoxGauge
(
item
.
getBoxGauge
());
preloadDto
.
setMergePkgVolume
(
item
.
getVolume
());
preloadDto
.
setMergePkgWeight
(
item
.
getWeight
());
if
(
item
.
getQuantityAll
()
==
null
)
{
preloadDto
.
setMergePkgQua
(
null
);
mergeCountList
.
add
(
mergeCount
);
if
(
colorIndex
==
7
)
{
colorIndex
=
0
;
}
else
{
preloadDto
.
setMergePkgQua
(
item
.
getQuantityAll
());
totalMergeQuality
=
totalMergeQuality
+
item
.
getQuantityAll
();
colorIndex
++;
}
preloadDto
.
setMergePkgCode
(
orderInfo
.
getOrderNo
());
totalMergeVolume
=
totalMergeVolume
.
add
(
item
.
getVolume
());
totalMergeWeight
=
totalMergeWeight
.
add
(
item
.
getWeight
());
}
if
(
StringUtils
.
isNotBlank
(
item
.
getMaterial
())){
preloadDto
.
setMaterial
(
DictFrameworkUtils
.
getDictDataFromCache
(
"product_material"
,
item
.
getMaterial
()+
""
).
getLabel
());
}
preloadDto
.
setUsageIds
(
getUsageMsg
(
item
.
getUsageIds
()));
BigDecimal
totalWorth
=
orderInfo
.
getOrderItemVOList
().
stream
().
map
(
OrderItemBackVO:
:
getWorth
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
preloadDto
.
setWorth
(
totalWorth
);
preloadDto
.
setTotalVolume
(
orderDO
.
getSumVolumeFinishedWarehouseIn
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
?
orderInfo
.
getSumVolume
():
orderDO
.
getSumVolumeFinishedWarehouseIn
());
preloadDto
.
setTotalWeight
(
orderDO
.
getSumWeightFinishedWarehouseIn
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
?
orderInfo
.
getSumWeight
():
orderDO
.
getSumWeightFinishedWarehouseIn
());
preloadDtoList
.
add
(
preloadDto
);
if
(
StringUtils
.
isNotBlank
(
item
.
getOrderWarehouseInDetails
()))
{
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
++)
{
OrderWarehouseInDetailsVO
orderWarehouseInDetailsVO
=
orderWarehouseInDetailsVOList
.
get
(
j
);
int
andIncrement1
=
colorRowNum
.
getAndIncrement
();
colorMap
.
put
(
String
.
valueOf
(
andIncrement1
),
colorList
.
get
(
colorIndex
));
colorRowList
.
add
(
andIncrement1
);
AirLoadDto
preloadDto1
=
new
AirLoadDto
();
BeanUtil
.
copyProperties
(
preloadDto
,
preloadDto1
);
ProductBrankDO
productBrankDetail
=
productBrankService
.
getProductBrank
(
orderWarehouseInDetailsVO
.
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
(
orderWarehouseInDetailsVO
.
getQuantityAll
());
if
(
StringUtils
.
isNotBlank
(
orderWarehouseInDetailsVO
.
getMaterial
()))
{
preloadDto1
.
setMaterial
(
DictFrameworkUtils
.
getDictDataFromCache
(
"product_material"
,
orderWarehouseInDetailsVO
.
getMaterial
()+
""
).
getLabel
());
}
//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
();
preloadDto
.
setOrderNo
(
orderInfo
.
getOrderNo
());
if
(
numMap
.
get
(
orderInfo
.
getOrderNo
())
!=
null
)
{
preloadDto
.
setId
(
String
.
valueOf
(
numMap
.
get
(
orderInfo
.
getOrderNo
())));
}
else
{
preloadDto
.
setId
(
String
.
valueOf
(
numMap
.
size
()
+
1
));
numMap
.
put
(
orderInfo
.
getOrderNo
(),
numMap
.
size
()
+
1
);
}
preloadDto
.
setMarks
(
orderInfo
.
getMarks
());
List
<
OrderGuanlianDO
>
guanlianList
=
orderGuanlianService
.
getGuanlianListByOrderId
(
orderInfo
.
getOrderId
());
//rIdList为此订单的所有关联订单
List
<
Long
>
rIdList
=
new
ArrayList
<>();
for
(
OrderGuanlianDO
orderGuanlianDO
:
guanlianList
)
{
Long
oId
=
orderGuanlianDO
.
getOrderId
();
Long
rId
=
orderGuanlianDO
.
getRelateOrderId
();
if
(
oId
.
equals
(
orderId
))
{
rIdList
.
add
((
rId
));
}
else
if
(
rId
.
equals
(
orderId
))
{
rIdList
.
add
(
oId
);
}
preloadDto1
.
setProdAttr
(
getAttrNameByIds
(
orderWarehouseInDetailsVO
.
getProdAttrIds
(),
idNameMap
));
// if (StringUtils.isNotBlank(orderWarehouseInDetailsVO.getUnit())) {
// preloadDto1.setPackageType(DictFrameworkUtils.getDictDataFromCache("packaging_type",orderWarehouseInDetailsVO.getUnit()).getLabel());
// }
preloadDto1
.
setUsageIds
(
getUsageMsg
(
orderWarehouseInDetailsVO
.
getUsageIds
()));
// preloadDto1.setNumber(orderWarehouseInDetailsVO.getExpressNo());
ProductDO
product
=
productService
.
getProduct
(
orderWarehouseInDetailsVO
.
getProdId
());
if
(
product
!=
null
)
{
preloadDto1
.
setProdTitleZh
(
product
.
getTitleZh
()
+
""
+
product
.
getTitleEn
());
}
if
(
CollectionUtil
.
isNotEmpty
(
rIdList
))
{
List
<
OrderDO
>
orderDOS
=
orderService
.
selectList
(
OrderDO:
:
getOrderId
,
rIdList
);
if
(
CollectionUtil
.
isNotEmpty
(
orderDOS
))
{
preloadDto
.
setRelateOrder
(
orderDOS
.
stream
().
map
(
OrderDO:
:
getOrderNo
).
collect
(
Collectors
.
joining
(
","
)));
}
preloadDtoList
.
add
(
preloadDto1
);
}
}
mergeCountList
.
add
(
mergeCount
);
if
(
colorIndex
==
7
)
{
colorIndex
=
0
;
}
else
{
colorIndex
++;
}
//合包那几个列合并单元格计算
if
(
pkgId
.
longValue
()
!=
0L
)
{
if
(
mergePkgCountMap
.
get
(
String
.
valueOf
(
pkgId
))
==
null
)
{
mergePkgCountMap
.
put
(
String
.
valueOf
(
pkgId
),
mergeCount
);
preloadDto
.
setProdTitleZh
(
item
.
getProdTitleZh
()
+
" "
+
item
.
getProdTitleEn
());
preloadDto
.
setMerge
(
orderInfo
.
getOldNumbers
());
ProductBrankDO
productBrank
=
productBrankService
.
getProductBrank
(
item
.
getBrand
());
if
(
productBrank
!=
null
&&
StringUtils
.
isNotBlank
(
productBrank
.
getTitleZh
()))
{
preloadDto
.
setBrand
(
productBrank
.
getTitleZh
());
}
//材质
if
(
StringUtils
.
isNotBlank
(
item
.
getMaterial
()))
{
preloadDto
.
setMaterial
(
DictFrameworkUtils
.
getDictDataFromCache
(
"product_material"
,
item
.
getMaterial
()
+
""
).
getLabel
());
}
//品牌
if
(
productBrank
!=
null
&&
productBrank
.
getFiling
()
!=
null
)
{
preloadDto
.
setProductRecord
(
productBrank
.
getFiling
().
equals
(
"0"
)
?
"N"
:
"Y"
);
}
//用途
if
(
item
.
getUsageIds
()
==
null
||
item
.
getUsageIds
().
length
()
==
0
)
{
preloadDto
.
setUsageIds
(
""
);
}
else
{
Integer
sumMergePkgCount
=
mergePkgCountMap
.
get
(
String
.
valueOf
(
pkgId
))
+
mergeCount
;
mergePkgCountMap
.
put
(
String
.
valueOf
(
pkgId
),
sumMergePkgCount
);
//在缓存数据字典中获取用途信息
String
sUserdName
=
DictFrameworkUtils
.
getDictDataFromCache
(
"order_item_usage"
,
item
.
getUsageIds
()
+
""
).
getLabel
();
preloadDto
.
setUsageIds
(
sUserdName
);
}
}
else
{
mergePkgCountMap
.
put
(
String
.
valueOf
(
item
.
getId
()),
mergeCount
);
//商品特性赋值 lanbm 2024-06-05 add
String
sR
=
getAttrName
(
item
,
ProductAttrMap
);
preloadDto
.
setProdAttrIds
(
sR
);
preloadDto
.
setSumNum
(
item
.
getWarehouseInInfoVO
().
getCartonsNum
());
if
(
CollectionUtil
.
isNotEmpty
(
orderWarehouseInDOS
))
{
String
warehousingSpecificationType
=
orderWarehouseInDOS
.
stream
().
map
(
j
->
{
return
DictFrameworkUtils
.
getDictDataFromCache
(
"warehousing_specification_type"
,
j
.
getSpecificationType
()
+
""
).
getLabel
();
}).
distinct
().
collect
(
Collectors
.
joining
(
"/"
));
String
packagingType
=
orderWarehouseInDOS
.
stream
().
map
(
j
->
{
return
DictFrameworkUtils
.
getDictDataFromCache
(
"packaging_type"
,
j
.
getUnit
()).
getLabel
();
}).
distinct
().
collect
(
Collectors
.
joining
(
"/"
));
preloadDto
.
setUnit
(
warehousingSpecificationType
);
preloadDto
.
setPackageType
(
packagingType
);
}
preloadDto
.
setSumVolume
(
item
.
getWarehouseInInfoVO
().
getVolume
());
preloadDto
.
setSumWeight
(
item
.
getWarehouseInInfoVO
().
getWeight
());
if
(
orderInfo
.
getCustomsType
()
!=
null
)
{
preloadDto
.
setCustomsType
(
DictFrameworkUtils
.
getDictDataFromCache
(
"customs_type"
,
orderInfo
.
getCustomsType
()
+
""
).
getLabel
());
}
preloadDto
.
setWorth
(
item
.
getWorth
());
preloadDto
.
setQuantity
(
item
.
getWarehouseInInfoVO
().
getQuantityAll
());
list
.
add
(
preloadDto
);
totalNum
=
totalNum
+
item
.
getWarehouseInInfoVO
().
getCartonsNum
();
totalVolume
=
totalVolume
.
add
(
item
.
getWarehouseInInfoVO
().
getVolume
());
totalWeight
=
totalWeight
.
add
(
item
.
getWarehouseInInfoVO
().
getWeight
());
}
}
int
sumNum
=
orderWarehouseInBackItemVOS
.
stream
().
mapToInt
(
j
->
{
if
(
j
.
getOrderWarehouseInDetailsVOList
()
==
null
)
{
return
0
;
}
else
{
int
sum
=
j
.
getOrderWarehouseInDetailsVOList
().
stream
().
mapToInt
(
vo
->
Objects
.
isNull
(
vo
.
getCartonsNum
())
?
0
:
vo
.
getCartonsNum
()).
sum
();
return
sum
;
}
}).
sum
();
BigDecimal
sumVolume
=
orderWarehouseInBackItemVOS
.
stream
().
map
(
j
->
{
if
(
j
.
getOrderWarehouseInDetailsVOList
()
==
null
)
{
return
BigDecimal
.
ZERO
;
}
else
{
BigDecimal
decimal
=
j
.
getOrderWarehouseInDetailsVOList
().
stream
().
map
(
vo
->
Objects
.
isNull
(
vo
.
getVolume
())
?
BigDecimal
.
ZERO
:
vo
.
getVolume
()).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
return
decimal
;
}
}).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
sumWeight
=
orderWarehouseInBackItemVOS
.
stream
().
map
(
j
->
{
if
(
j
.
getOrderWarehouseInDetailsVOList
()
==
null
)
{
return
BigDecimal
.
ZERO
;
}
else
{
BigDecimal
decimal
=
j
.
getOrderWarehouseInDetailsVOList
().
stream
().
map
(
vo
->
Objects
.
isNull
(
vo
.
getWeight
())
?
BigDecimal
.
ZERO
:
vo
.
getWeight
()).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
return
decimal
;
}
}).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
totalNum
=
totalNum
+
sumNum
;
totalVolume
=
totalVolume
.
add
(
sumVolume
);
totalWeight
=
totalWeight
.
add
(
sumWeight
);
totalNum
=
totalNum
+
orderInfo
.
getSumNum
();
totalVolume
=
totalVolume
.
add
(
orderInfo
.
getSumVolume
());
totalWeight
=
totalWeight
.
add
(
orderInfo
.
getSumWeight
());
LoadDto
preloadDto
=
new
LoadDto
();
preloadDto
.
setId
(
"TOTAL"
);
preloadDto
.
setSumNum
(
totalNum
);
preloadDto
.
setSumVolume
(
totalVolume
);
preloadDto
.
setSumWeight
(
totalWeight
);
list
.
add
(
preloadDto
);
allTotalNum
=
allTotalNum
+
totalNum
;
allTotalVolume
=
allTotalVolume
.
add
(
totalVolume
);
allTotalWeight
=
allTotalWeight
.
add
(
totalWeight
);
if
(
i
==
secCount
.
size
()
-
1
)
{
LoadDto
preloadDto1
=
new
LoadDto
();
preloadDto1
.
setId
(
"IN TOTAL"
);
preloadDto1
.
setSumNum
(
allTotalNum
);
preloadDto1
.
setSumVolume
(
allTotalVolume
);
preloadDto1
.
setSumWeight
(
allTotalWeight
);
list
.
add
(
preloadDto1
);
}
excelWriter
.
write
(
list
,
sheet
,
writeTable
);
}
AirLoadDto
preloadDto
=
new
AirLoadDto
();
BigDecimal
volumeReduce
=
mergeVolumnMap
.
values
().
stream
().
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
weightReduce
=
mergeWeightMap
.
values
().
stream
().
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
totalMergeVolume
=
totalMergeVolume
.
add
(
volumeReduce
);
totalMergeWeight
=
totalMergeWeight
.
add
(
weightReduce
);
Integer
qualityReduce
=
mergeQualityMap
.
values
().
stream
().
reduce
(
0
,
Integer:
:
sum
);
totalMergeQuality
=
totalMergeQuality
+
qualityReduce
.
intValue
();
preloadDto
.
setId
(
"TOTAL"
);
preloadDto
.
setSumNum
(
totalNum
);
preloadDto
.
setSumVolume
(
totalVolume
);
preloadDto
.
setSumWeight
(
totalWeight
);
preloadDto
.
setMergePkgNum
(
sumMergeCount
);
preloadDto
.
setMergePkgVolume
(
totalMergeVolume
);
preloadDto
.
setMergePkgWeight
(
totalMergeWeight
);
preloadDto
.
setMergePkgQua
(
totalMergeQuality
);
preloadDtoList
.
add
(
preloadDto
);
allTotalNum
=
allTotalNum
+
totalNum
;
allTotalVolume
=
allTotalVolume
.
add
(
totalVolume
);
allTotalWeight
=
allTotalWeight
.
add
(
totalWeight
);
//2023-12-19 客户要求空运已装单取消一个总计,因为海运分部分有总计 空运不分部分
// if(i==secCount.size()-1){
// AirLoadDto preloadDto1 = new AirLoadDto();
// preloadDto1.setId("IN TOTAL");
// preloadDto1.setSumNum(allTotalNum);
// preloadDto1.setSumVolume(allTotalVolume);
// preloadDto1.setSumWeight(allTotalWeight);
// preloadDtoList.add(preloadDto1);
// }
List
<
Integer
>
mergePkgCountList
=
mergePkgCountMap
.
entrySet
().
stream
().
map
(
Map
.
Entry
::
getValue
).
collect
(
Collectors
.
toList
());
WriteTable
writeTable
=
EasyExcel
.
writerTable
(
i
)
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
null
,
0
,
1
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
null
,
1
,
1
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
null
,
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
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
null
,
8
,
1
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
null
,
9
,
2
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
null
,
10
,
2
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
null
,
11
,
2
))
// .registerWriteHandler(new CustomCellWriteHandler(colorRowList,11, colorMap))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
null
,
12
,
2
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
null
,
13
,
2
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
mergePkgCountList
,
14
,
3
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
mergePkgCountList
,
15
,
3
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
mergePkgCountList
,
16
,
3
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
mergePkgCountList
,
17
,
3
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
mergePkgCountList
,
18
,
3
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
mergePkgCountList
,
19
,
3
))
// .registerWriteHandler(new CustomMergeStrategyNew(preloadDtoList,mergeCountList,colorRowList,20,1))
.
registerWriteHandler
(
new
CustomCellWriteHandler
(
colorRowList
,
20
,
colorMap
))
.
registerWriteHandler
(
new
CustomCellWriteHandler
(
colorRowList
,
21
,
colorMap
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
null
,
22
,
1
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
null
,
23
,
1
))
.
registerWriteHandler
(
new
CustomAirLoadMergeStrategyNew
(
preloadDtoList
,
mergeCountList
,
colorRowList
,
null
,
24
,
1
))
.
automaticMergeHead
(
true
).
head
(
headList
).
needHead
(
true
).
build
();
excelWriter
.
write
(
preloadDtoList
,
sheet
,
writeTable
);
}
}
excelWriter
.
finish
();
inputStream
.
close
();
// 获取到临时文件
...
...
@@ -494,8 +499,8 @@ public class ShipmentLoadExcelExportListener2 {
event
.
setFileName
(
fileDO
.
getPath
());
event
.
setUrl
(
fileDO
.
getUrl
());
event
.
setFileId
(
fileDO
.
getId
());
}
catch
(
Exception
e
)
{
log
.
info
(
"预装单导出失败"
,
e
);
e
.
printStackTrace
();
event
.
setResult
(
e
.
getMessage
());
}
...
...
@@ -506,8 +511,8 @@ public class ShipmentLoadExcelExportListener2 {
}
/*
lanbm 2024-06-05 添加商品属性转换函数
*/
lanbm 2024-06-05 添加商品属性转换函数
*/
private
String
getAttrName
(
OrderItemDO
item
,
Map
<
Long
,
String
>
ProductAttrMap
)
{
String
sReult
=
""
;
//lanbm 2024-06-05添加商品特性
...
...
@@ -535,32 +540,5 @@ public class ShipmentLoadExcelExportListener2 {
//end lanbm 2024-06-05添加商品特性
return
sReult
;
}
private
String
getUsageMsg
(
String
usageIdsDetail
)
{
if
(
StringUtils
.
isNotEmpty
(
usageIdsDetail
))
{
StringJoiner
labelJoiner
=
new
StringJoiner
(
","
);
for
(
String
usageId
:
usageIdsDetail
.
split
(
","
))
{
DictDataRespDTO
usageValue
=
DictFrameworkUtils
.
getDictDataFromCache
(
"order_item_usage"
,
usageId
);
if
(
usageValue
!=
null
)
{
labelJoiner
.
add
(
usageValue
.
getLabel
());
}
}
return
labelJoiner
.
toString
();
}
else
{
return
""
;
}
}
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/service/makeBillOfLading/MakeBillOfLadingServiceImpl.java
View file @
72fdc215
...
...
@@ -263,6 +263,9 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
OrderDO
orderDO
=
orderService
.
selectOne
(
OrderDO:
:
getOrderId
,
createReqVO
.
getOrderId
());
//lanbm 2024-06-13 取消流程的创建
/*
String bpmProcessId =
bpmCreateServiceFactory.createBmp(
SecurityFrameworkUtils.getLoginUserId(),
...
...
@@ -270,8 +273,8 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
WorkFlowEmus.SHIPMENT_BILL_LADING.getKey(),
orderDO.getOrderNo(),
createReqVO.getCopyUserId());
makeBillOfLading.setBpmProcessId(bpmProcessId);
*/
//lanbm 2024-05-24 修改为自动审批通过
//ecw_make_bill_of_lading
/*
...
...
yudao-module-shipment/yudao-module-shipment-rest/src/main/java/cn/iocoder/yudao/module/shipment/controller/admin/MakeBillOfLadingController.java
View file @
72fdc215
...
...
@@ -192,7 +192,8 @@ public class MakeBillOfLadingController {
MakeBillOfLadingBackVO
vResult
=
MakeBillOfLadingConvert
.
INSTANCE
.
convert
(
lading
);
//前端是根据 status 来判断的,此处逻辑可以不用理会
//lanbm 2024-06-13 添加注释
if
(
lading
.
getBpmProcessId
()
==
null
||
lading
.
getBpmProcessId
().
length
()
==
0
)
{
vResult
.
setBpmStatus
(
"-1"
);
...
...
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/vo/receiptItem/ReceiptItemReq.java
View file @
72fdc215
...
...
@@ -76,4 +76,9 @@ public class ReceiptItemReq extends PageParam {
*/
private
String
accountNo
;
/*
审批状态 lanbm 2024-06-13 add
*/
private
String
status
;
}
yudao-module-wealth/yudao-module-wealth-rest/src/main/resources/mapper/ReceiptItem/BankReceiptDetailsMapper.xml
View file @
72fdc215
...
...
@@ -17,6 +17,9 @@
<sql
id=
"WherePage"
>
<where>
p.deleted=0
<if
test=
"status != null and status != ''"
>
AND p.status=#{status}
</if>
<if
test=
"accountNo != null and accountNo != ''"
>
AND p.account_no=#{accountNo}
</if>
...
...
@@ -38,7 +41,7 @@
<!--收款明细提交审批日期-->
<if
test=
"sDate2 != null and sDate2 != '' and
eDate2 != null and eDate2 != ''"
>
AND a.create_time BETWEEN #{sDate2} and #{eDate2}
)
AND a.create_time BETWEEN #{sDate2} and #{eDate2}
</if>
<!--收款明细提交审批通过日期-->
...
...
yudao-server/src/main/resources/templates/load.xlsx
View file @
72fdc215
No preview for this file type
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