@ -1,6 +1,7 @@
package com.logpm.trunkline.service.impl ;
import cn.hutool.core.collection.CollUtil ;
import cn.hutool.core.util.NumberUtil ;
import cn.hutool.core.util.ObjectUtil ;
import com.alibaba.excel.EasyExcel ;
import com.alibaba.fastjson.JSON ;
@ -38,11 +39,17 @@ import org.springblade.common.annotations.RepeatSubmit;
import org.springblade.common.constant.CodeNumConstant ;
import org.springblade.common.constant.DictBizConstant ;
import org.springblade.common.constant.IncomingTypeEnum ;
import org.springblade.common.constant.WorkNodeEnums ;
import org.springblade.common.constant.broadcast.FanoutConstants ;
import org.springblade.common.constant.order.* ;
import org.springblade.common.enums.BizOperationEnums ;
import org.springblade.common.enums.PackageTypeEnums ;
import org.springblade.common.exception.CustomerException ;
import org.springblade.common.model.FanoutMsg ;
import org.springblade.common.model.NodeFanoutMsg ;
import org.springblade.common.model.PackageData ;
import org.springblade.common.utils.CommonUtil ;
import org.springblade.core.redis.cache.BladeRedis ;
import org.springblade.core.secure.utils.AuthUtil ;
import org.springblade.core.tool.api.R ;
import org.springblade.core.tool.utils.BeanUtil ;
@ -102,6 +109,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
private final IDistributionReservationStockarticleClient reservationStockarticleClient ;
private final ISendFanoutService sendFanoutService ;
private final IOrderInfoClient orderInfoClient ;
private final BladeRedis bladeRedis ;
@Override
@ -306,12 +314,29 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
}
//组装货物数据
List < AdvanceDetailGoodsVO > goodsList = advanceDetailService . findGoodsListByAdvanceIds ( advanceIds ) ;
BasicdataFreightApiVO basicdataFreightApiVO = new BasicdataFreightApiVO ( ) ;
basicdataFreightApiVO . setItemName ( openOrderVO . getConsigneeClientId ( ) + "" ) ;
basicdataFreightApiVO . setIssueWarehouse ( openOrderVO . getDepartureWarehouseId ( ) + "" ) ;
basicdataFreightApiVO . setDestination ( openOrderVO . getDestinationCode ( ) ) ;
basicdataFreightApiVO . setArrivalWarehouse ( openOrderVO . getDestinationWarehouseId ( ) + "" ) ;
List < AdvanceDetailGoodsVO > goodsList = new ArrayList < > ( ) ;
// BasicdataFreightApiVO basicdataFreightApiVO = new BasicdataFreightApiVO();
// basicdataFreightApiVO.setItemName(openOrderVO.getConsigneeClientId() + "");
// basicdataFreightApiVO.setIssueWarehouse(openOrderVO.getDepartureWarehouseId() + "");
// basicdataFreightApiVO.setDestination(openOrderVO.getDestinationCode());
// basicdataFreightApiVO.setArrivalWarehouse(openOrderVO.getDestinationWarehouseId() + "");
Integer hasPackage = list . get ( 0 ) . getHasPackage ( ) ;
if ( hasPackage = = 0 ) {
List < AdvanceDetailGoodsVO > addList = new ArrayList < > ( ) ;
list . forEach ( t - > {
String packName = t . getPackName ( ) ;
AdvanceDetailGoodsVO goodsVO = new AdvanceDetailGoodsVO ( ) ;
goodsVO . setGoodsName ( packName ) ;
goodsVO . setNum ( t . getTotalNum ( ) ) ;
addList . add ( goodsVO ) ;
} ) ;
goodsList . addAll ( addList ) ;
} else {
goodsList = advanceDetailService . findGoodsListByAdvanceIds ( advanceIds ) ;
}
// if (goodsList.isEmpty()) {
// List<AdvanceDetailGoodsVO> ls = new ArrayList<>();
@ -680,6 +705,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
//发布开单广播
// openOrderAsyncService.sendOpenWaybillFanout(waybillEntity, details, advanceIds);
advanceDetailService . sendReportAdvanceOpenData ( AuthUtil . getNickName ( ) , AuthUtil . getUserId ( ) , warehouseId , warehouseName , updateAdvanceDetailList , waybillEntity ) ;
Map < String , Object > map = new HashMap < > ( ) ;
map . put ( "waybillId" , waybillId ) ;
@ -901,11 +927,61 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
//发布开单广播
openOrderAsyncService . sendOpenWaybillFanout ( waybillEntity , details , null ) ;
//发送零担开单广播
sendOpenZeroWaybillFanout ( AuthUtil . getUserId ( ) , AuthUtil . getNickName ( ) , warehouseId , warehouseName , waybillEntity , details ) ;
Map < String , Object > map = new HashMap < > ( ) ;
map . put ( "waybillId" , waybillId ) ;
return R . data ( map ) ;
}
private void sendOpenZeroWaybillFanout ( Long userId , String nickName , Long warehouseId , String warehouseName , WarehouseWaybillEntity waybillEntity , List < WarehouseWayBillDetail > details ) {
// String key = AuthUtil.getTenantId()+":brandList";
//
// Map<String, Long> brandMap = bladeRedis.hGetAll(key);
//
// if(CollUtil.isEmpty(brandMap)){
// List<JSONObject> allList = basicdataBrandClient.findAllList();
// Map<String, Long> brandIdMap = new HashMap<>();
// allList.forEach(jsonObject -> {
// brandIdMap.put(jsonObject.getString("brandName"),jsonObject.getLong("brandId"));
// });
// brandMap.putAll(brandIdMap);
// }
NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg ( ) ;
nodeFanoutMsg . setNode ( WorkNodeEnums . OPEN_ORDER ) ;
nodeFanoutMsg . setBizOperation ( BizOperationEnums . ADD ) ;
nodeFanoutMsg . setOperator ( nickName ) ;
nodeFanoutMsg . setOperatorId ( userId ) ;
nodeFanoutMsg . setWarehouse ( warehouseName ) ;
nodeFanoutMsg . setWarehouseId ( warehouseId ) ;
nodeFanoutMsg . setOperatorTime ( new Date ( ) ) ;
nodeFanoutMsg . setMain ( waybillEntity ) ;
//组装包件数据
List < PackageData > packageDataList = new ArrayList < > ( ) ;
details . forEach ( detailEntity - > {
PackageData packageData = new PackageData ( ) ;
packageData . setOrderCode ( detailEntity . getWaybillNo ( ) ) ;
packageData . setProductId ( detailEntity . getProductId ( ) ) ;
packageData . setProductName ( detailEntity . getProductName ( ) ) ;
packageData . setNum ( detailEntity . getNum ( ) ) ;
packageData . setWeight ( detailEntity . getWeight ( ) ) ;
packageData . setVolume ( detailEntity . getVolume ( ) ) ;
packageData . setPackageType ( PackageTypeEnums . LTL ) ;
packageData . setWaybillNumber ( detailEntity . getWaybillNo ( ) ) ;
packageDataList . add ( packageData ) ;
} ) ;
nodeFanoutMsg . setDetails ( packageDataList ) ;
FanoutMsg fanoutMsg = FanoutMsg . builder ( ) . exchange ( FanoutConstants . trunkline . REPORTDATA . EXCHANGE ) . msg ( JSONObject . toJSONString ( nodeFanoutMsg ) ) . build ( ) ;
sendFanoutService . sendFanoutMsg ( fanoutMsg ) ;
}
@Override
public void updateCustomerInfo ( AdvanceDTO advanceDTO ) {
List < Long > advanceIds = advanceDTO . getAdvanceIds ( ) ;
@ -1204,6 +1280,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
// detailEntities.add(advanceDetailEntity);
// }
advanceDetailService . saveBatch ( detailEntities ) ;
//发送报表基础数据广播
advanceDetailService . sendReportBasicdataFanout ( AuthUtil . getNickName ( ) , AuthUtil . getUserId ( ) , openLabelDTO . getWarehouseId ( ) , openLabelDTO . getWarehouseName ( ) , new Date ( ) , detailEntities , advanceEntity . getDealerCode ( ) , advanceEntity . getDealerName ( ) ) ;
return R . success ( "保存成功" ) ;
}
@ -1359,7 +1439,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceEntity . setCustomerName ( pacakgeDetailExcelDTO . getCustomerName ( ) ) ;
advanceEntity . setCustomerPhone ( pacakgeDetailExcelDTO . getCustomerTelephone ( ) ) ;
advanceEntity . setCustomerAddress ( pacakgeDetailExcelDTO . getCustomerAddress ( ) ) ;
advanceEntity . setSystemType ( "线上 " ) ;
advanceEntity . setSystemType ( "线下 " ) ;
advanceEntity . setServiceNum ( pacakgeDetailExcelDTO . getServiceNum ( ) ) ;
advanceEntity . setMatingType ( "1" ) ;
advanceEntity . setTrainNumber ( trainNumber ) ;
@ -1429,12 +1509,13 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
Map < Long , List < String > > map = advanceDetailEntityList . parallelStream ( ) . collect ( Collectors . groupingBy ( TrunklineAdvanceDetailEntity : : getAdvanceId , Collectors . mapping ( TrunklineAdvanceDetailEntity : : getOrderPackageCode , Collectors . toList ( ) ) ) ) ;
Map < String , Long > materialMap = new HashMap < > ( ) ;
Map < Long , TrunklineAdvanceEntity > advanceMapByAdvanceId = new HashMap < > ( ) ;
listMap . keySet ( ) . forEach ( str - > {
List < PacakgeDetailExcelDTO > pacakgeDetailExcelList = listMap . get ( str ) ;
TrunklineAdvanceEntity advanceEntity = advanceEntityMap . get ( str ) ;
if ( ! Objects . isNull ( advanceEntity ) ) {
Long advanceId = advanceEntity . getId ( ) ;
advanceMapByAdvanceId . put ( advanceId , advanceEntity ) ;
String orderCode = advanceEntity . getOrderCode ( ) ;
List < String > orderPackageCodes = map . get ( advanceId ) ;
pacakgeDetailExcelList . forEach ( pacakgeDetailExcelDTO - > {
@ -1452,7 +1533,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
brandEntity = brandMap . get ( "其他" ) ;
advanceDetailModel . setBrand ( brandEntity . getBrandName ( ) ) ;
}
advanceDetailModel . setSystemType ( "线上 " ) ;
advanceDetailModel . setSystemType ( "线下 " ) ;
advanceDetailModel . setTrainNumber ( advanceEntity . getTrainNumber ( ) ) ;
String firsts = pacakgeDetailExcelDTO . getFirsts ( ) ;
advanceDetailModel . setFirstPackName ( firsts ) ;
@ -1544,6 +1625,16 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
carsLoadAsyncService . sendRabbitMessageLoadScanData ( advanceEntityList ) ;
}
//发送报表基础数据广播
//把advanceDetailEntities通过advanceId进行分组
Map < Long , List < TrunklineAdvanceDetailEntity > > advanceDetailEntityMap = advanceDetailEntities . stream ( ) . collect ( Collectors . groupingBy ( TrunklineAdvanceDetailEntity : : getAdvanceId ) ) ;
advanceDetailEntityMap . keySet ( ) . forEach ( advanceId - > {
TrunklineAdvanceEntity advanceEntity = advanceMapByAdvanceId . get ( advanceId ) ;
List < TrunklineAdvanceDetailEntity > advanceDetailEntities1 = advanceDetailEntityMap . get ( advanceId ) ;
advanceDetailService . sendReportBasicdataFanout ( AuthUtil . getNickName ( ) , AuthUtil . getUserId ( ) , warehouseId , warehouseName , new Date ( ) , advanceDetailEntities1 , advanceEntity . getDealerCode ( ) , advanceEntity . getDealerName ( ) ) ;
} ) ;
int successNum = advanceDetailEntities . size ( ) ;
return R . success ( "成功处理包件" + successNum + "件" ) ;
@ -1695,7 +1786,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceEntity . setCustomerName ( importCustomizedOuPaiDTO . getCustomerName ( ) ) ;
advanceEntity . setCustomerPhone ( importCustomizedOuPaiDTO . getCustomerPhone ( ) ) ;
advanceEntity . setCustomerAddress ( importCustomizedOuPaiDTO . getCustomerAddress ( ) ) ;
advanceEntity . setSystemType ( "线上 " ) ;
advanceEntity . setSystemType ( "线下 " ) ;
advanceEntity . setServiceNum ( importCustomizedOuPaiDTO . getServiceNum ( ) ) ;
advanceEntity . setMatingType ( "1" ) ;
advanceEntity . setWaybillStatus ( "0" ) ;
@ -1765,13 +1856,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
//把advanceDetailEntityList通过advanceId分组并且把集合转化为orderPackageCode的集合
Map < Long , List < String > > map = advanceDetailEntityList . parallelStream ( ) . collect ( Collectors . groupingBy ( TrunklineAdvanceDetailEntity : : getAdvanceId , Collectors . mapping ( TrunklineAdvanceDetailEntity : : getOrderPackageCode , Collectors . toList ( ) ) ) ) ;
Map < Long , TrunklineAdvanceEntity > advanceMapByAdvanceId = new HashMap < > ( ) ;
listMap . keySet ( ) . forEach ( str - > {
List < ImportCustomizedOuPaiDTO > importCustomizedOuPaiDTOList = listMap . get ( str ) ;
TrunklineAdvanceEntity advanceEntity = advanceEntityMap . get ( str ) ;
if ( ! Objects . isNull ( advanceEntity ) ) {
Long advanceId = advanceEntity . getId ( ) ;
advanceMapByAdvanceId . put ( advanceId , advanceEntity ) ;
String orderCode = advanceEntity . getOrderCode ( ) ;
List < String > orderPackageCodes = map . get ( advanceId ) ;
importCustomizedOuPaiDTOList . forEach ( importCustomizedOuPaiDTO - > {
@ -1784,7 +1876,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceDetailModel . setOrderCode ( orderCode ) ;
advanceDetailModel . setOrderPackageCode ( orderPackageCode ) ;
advanceDetailModel . setBrand ( advanceEntity . getBrand ( ) ) ;
advanceDetailModel . setSystemType ( "线上 " ) ;
advanceDetailModel . setSystemType ( "线下 " ) ;
advanceDetailModel . setSiteName ( importCustomizedOuPaiDTO . getSiteName ( ) ) ;
advanceDetailModel . setSupple ( importCustomizedOuPaiDTO . getSupple ( ) ) ;
advanceDetailModel . setManifest ( importCustomizedOuPaiDTO . getManifest ( ) ) ;
@ -1840,6 +1932,15 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
carsLoadAsyncService . sendRabbitMessageLoadScanData ( advanceEntityList ) ;
}
//发送报表基础数据广播
//把advanceDetailEntities通过advanceId进行分组
Map < Long , List < TrunklineAdvanceDetailEntity > > advanceDetailEntityMap = advanceDetailEntities . stream ( ) . collect ( Collectors . groupingBy ( TrunklineAdvanceDetailEntity : : getAdvanceId ) ) ;
advanceDetailEntityMap . keySet ( ) . forEach ( advanceId - > {
TrunklineAdvanceEntity advanceEntity = advanceMapByAdvanceId . get ( advanceId ) ;
List < TrunklineAdvanceDetailEntity > advanceDetailEntities1 = advanceDetailEntityMap . get ( advanceId ) ;
advanceDetailService . sendReportBasicdataFanout ( AuthUtil . getNickName ( ) , AuthUtil . getUserId ( ) , warehouseId , warehouseName , new Date ( ) , advanceDetailEntities1 , advanceEntity . getDealerCode ( ) , advanceEntity . getDealerName ( ) ) ;
} ) ;
return R . success ( "成功导入" + size + "条" ) ;
}
@ -2009,7 +2110,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceEntity . setCustomerPhone ( importStandardOuPaiDTO . getCustomerPhone ( ) ) ;
advanceEntity . setCustomerAddress ( importStandardOuPaiDTO . getCustomerAddress ( ) ) ;
advanceEntity . setSenderFactory ( importStandardOuPaiDTO . getSendFactory ( ) ) ;
advanceEntity . setSystemType ( "线上 " ) ;
advanceEntity . setSystemType ( "线下 " ) ;
advanceEntity . setMatingType ( "1" ) ;
advanceEntity . setWaybillStatus ( "0" ) ;
advanceEntity . setTrainNumber ( importStandardOuPaiDTO . getTrainNumber ( ) ) ;
@ -2076,12 +2177,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
Map < Long , List < String > > map = advanceDetailEntityList . parallelStream ( ) . collect ( Collectors . groupingBy ( TrunklineAdvanceDetailEntity : : getAdvanceId , Collectors . mapping ( TrunklineAdvanceDetailEntity : : getOrderPackageCode , Collectors . toList ( ) ) ) ) ;
Map < String , Long > materialMap = new HashMap < > ( ) ;
Map < Long , TrunklineAdvanceEntity > advanceMapByAdvanceId = new HashMap < > ( ) ;
listMap . keySet ( ) . forEach ( str - > {
List < ImportStandardOuPaiDTO > importStandardOuPaiDTOList = listMap . get ( str ) ;
TrunklineAdvanceEntity advanceEntity = advanceEntityMap . get ( str ) ;
if ( ! Objects . isNull ( advanceEntity ) ) {
Long advanceId = advanceEntity . getId ( ) ;
advanceMapByAdvanceId . put ( advanceId , advanceEntity ) ;
String orderCode = advanceEntity . getOrderCode ( ) ;
String brand = advanceEntity . getBrand ( ) ;
List < String > orderPackageCodes = map . get ( advanceId ) ;
@ -2095,7 +2198,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceDetailModel . setOrderCode ( orderCode ) ;
advanceDetailModel . setOrderPackageCode ( orderPackageCode ) ;
advanceDetailModel . setBrand ( brand ) ;
advanceDetailModel . setSystemType ( "线上 " ) ;
advanceDetailModel . setSystemType ( "线下 " ) ;
advanceDetailModel . setSiteName ( importStandardOuPaiDTO . getSiteName ( ) ) ;
advanceDetailModel . setReturnNum ( importStandardOuPaiDTO . getReturnNum ( ) ) ;
advanceDetailModel . setSendDateStr ( importStandardOuPaiDTO . getSendDateStr ( ) ) ;
@ -2203,6 +2306,16 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceDetailService . updateBatchById ( updateMaterialList ) ;
}
//发送报表基础数据广播
//把advanceDetailEntities通过advanceId进行分组
Map < Long , List < TrunklineAdvanceDetailEntity > > advanceDetailEntityMap = advanceDetailEntities . stream ( ) . collect ( Collectors . groupingBy ( TrunklineAdvanceDetailEntity : : getAdvanceId ) ) ;
advanceDetailEntityMap . keySet ( ) . forEach ( advanceId - > {
TrunklineAdvanceEntity advanceEntity = advanceMapByAdvanceId . get ( advanceId ) ;
List < TrunklineAdvanceDetailEntity > advanceDetailEntities1 = advanceDetailEntityMap . get ( advanceId ) ;
advanceDetailService . sendReportBasicdataFanout ( AuthUtil . getNickName ( ) , AuthUtil . getUserId ( ) , warehouseId , warehouseName , new Date ( ) , advanceDetailEntities1 , advanceEntity . getDealerCode ( ) , advanceEntity . getDealerName ( ) ) ;
} ) ;
int successNum = advanceDetailEntities . size ( ) ;
return R . success ( "成功导入" + successNum + "条" ) ;
@ -2271,6 +2384,37 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
log . warn ( "#############updateWaybill: 运单已作废 waybillId={}" , waybillId ) ;
return R . fail ( 405 , "运单已作废" ) ;
}
Integer waybillType = waybillEntity . getWaybillType ( ) ;
if ( waybillType . equals ( 2 ) ) {
//零担改单限制
Long departureWarehouseId = waybillEntity . getDepartureWarehouseId ( ) ;
Long destinationWarehouseId = waybillEntity . getDestinationWarehouseId ( ) ;
Integer totalCount = waybillEntity . getTotalCount ( ) ;
DistributionStockArticleEntity startStockArticleEntity = distributionStockArticleClient . findZeroByOrderCodeAndWarehouseId ( waybillNo , departureWarehouseId ) ;
if ( Objects . isNull ( startStockArticleEntity ) ) {
log . warn ( "#############updateWaybill: 订单信息不存在 waybillId={}" , waybillId ) ;
return R . fail ( 405 , "订单信息不存在" ) ;
}
Integer handQuantity = startStockArticleEntity . getHandQuantity ( ) ;
if ( NumberUtil . equals ( handQuantity , 0 ) ) {
DistributionStockArticleEntity endStockArticleEntity = distributionStockArticleClient . findZeroByOrderCodeAndWarehouseId ( waybillNo , destinationWarehouseId ) ;
if ( Objects . isNull ( endStockArticleEntity ) ) {
log . warn ( "#############updateWaybill: 订单信息不存在! waybillId={}" , waybillId ) ;
return R . fail ( 405 , "订单信息不存在!" ) ;
}
handQuantity = endStockArticleEntity . getHandQuantity ( ) ;
if ( ! NumberUtil . equals ( handQuantity , totalCount ) ) {
log . warn ( "#############updateWaybill: 目的仓数据还未完全到达 waybillId={}" , waybillId ) ;
return R . fail ( 405 , "目的仓数据还未完全到达" ) ;
}
} else {
if ( ! NumberUtil . equals ( handQuantity , totalCount ) ) {
log . warn ( "#############updateWaybill: 始发仓数据已发运 waybillId={}" , waybillId ) ;
return R . fail ( 405 , "始发仓数据已发运" ) ;
}
}
}
//验证运单是否有配送任务
//查询运单下所有订单号
@ -2300,7 +2444,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
// List<WarehouseWayBillDetail> wayBillDetailList = warehouseWaybillDetailClient.findListByWaybillNo(waybillNo);
Integer waybillType = waybillEntity . getWaybillType ( ) ;
Long consigneeId = waybillEntity . getConsigneeId ( ) ;
String consignee = waybillEntity . getConsignee ( ) ;
String consigneeName = waybillEntity . getConsigneeName ( ) ;
@ -2403,6 +2546,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
List < DistributionStockArticleEntity > orderList = distributionStockArticleClient . findListByWaybillNumber ( waybillNo ) ;
orderList . forEach ( stockArticleEntity - > {
stockArticleEntity . setMallId ( consigneeId ) ;
stockArticleEntity . setTotalNumber ( totalCount ) ;
if ( ! Objects . isNull ( basicdataClientEntity ) ) {
stockArticleEntity . setMallCode ( basicdataClientEntity . getClientCode ( ) ) ;
} else {
@ -2417,6 +2561,12 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
stockArticleEntity . setSendWarehouseName ( departureWarehouseName ) ;
stockArticleEntity . setAcceptWarehouseId ( destinationWarehouseId ) ;
stockArticleEntity . setAcceptWarehouseName ( destinationWarehouseName ) ;
String orderCode = stockArticleEntity . getOrderCode ( ) ;
if ( orderCode . equals ( waybillNo ) ) {
stockArticleEntity . setCustomerName ( consigneeName ) ;
stockArticleEntity . setCustomerTelephone ( consigneeMobile ) ;
stockArticleEntity . setCustomerAddress ( consigneeAddress ) ;
}
} ) ;
List < DistributionParcelListEntity > parcelListEntityList = distributionParcelListClient . findByWaybillNumber ( waybillNo ) ;
@ -2445,10 +2595,47 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
trunklineWaybillPackageService . updateWaybillStatus ( waybillEntity ) ;
sendUpdateWaybillFanout ( AuthUtil . getNickName ( ) , AuthUtil . getUserId ( ) , warehouseId , warehouseName , waybillEntity ) ;
// openOrderAsyncService.sendUpdateWaybillFanout(waybillEntity,wayBillDetailList,advanceIds,oldConsignee);
return R . success ( "改单成功" ) ;
}
private void sendUpdateWaybillFanout ( String nickName , Long userId , Long warehouseId , String warehouseName , WarehouseWaybillEntity waybillEntity ) {
String key = AuthUtil . getTenantId ( ) + ":brandList" ;
Map < String , Long > brandMap = bladeRedis . hGetAll ( key ) ;
if ( CollUtil . isEmpty ( brandMap ) ) {
List < JSONObject > allList = basicdataBrandClient . findAllList ( ) ;
Map < String , Long > brandIdMap = new HashMap < > ( ) ;
allList . forEach ( jsonObject - > {
brandIdMap . put ( jsonObject . getString ( "brandName" ) , jsonObject . getLong ( "brandId" ) ) ;
} ) ;
brandMap . putAll ( brandIdMap ) ;
}
NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg ( ) ;
nodeFanoutMsg . setNode ( WorkNodeEnums . CHANGE_ORDER ) ;
nodeFanoutMsg . setBizOperation ( BizOperationEnums . MODIFY ) ;
nodeFanoutMsg . setOperator ( nickName ) ;
nodeFanoutMsg . setOperatorId ( userId ) ;
nodeFanoutMsg . setWarehouse ( warehouseName ) ;
nodeFanoutMsg . setWarehouseId ( warehouseId ) ;
nodeFanoutMsg . setOperatorTime ( new Date ( ) ) ;
nodeFanoutMsg . setMain ( waybillEntity ) ;
//组装包件数据
List < PackageData > packageDataList = new ArrayList < > ( ) ;
nodeFanoutMsg . setDetails ( packageDataList ) ;
FanoutMsg fanoutMsg = FanoutMsg . builder ( ) . exchange ( FanoutConstants . trunkline . REPORTDATA . EXCHANGE ) . msg ( JSONObject . toJSONString ( nodeFanoutMsg ) ) . build ( ) ;
sendFanoutService . sendFanoutMsg ( fanoutMsg ) ;
}
@Override
public R updateWaybillVerify ( OpenOrderDTO openOrderDTO ) {
Long waybillId = openOrderDTO . getWaybillId ( ) ;
@ -2582,7 +2769,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceEntity . setSenderPhone ( importOrderNoPackageExcelDTO . getShipperMobile ( ) ) ;
advanceEntity . setSenderAddress ( importOrderNoPackageExcelDTO . getShipperAddress ( ) ) ;
advanceEntity . setTrainNumber ( importOrderNoPackageExcelDTO . getTrainNumber ( ) ) ;
advanceEntity . setSystemType ( "线上 " ) ;
advanceEntity . setSystemType ( "线下 " ) ;
advanceEntity . setMatingType ( "1" ) ;
advanceEntity . setWaybillStatus ( "0" ) ;
advanceEntity . setFreezeStatus ( "0" ) ;
@ -2611,7 +2798,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceDetailModel . setAdvanceId ( advanceEntity . getId ( ) ) ;
advanceDetailModel . setOrderCode ( advanceEntity . getOrderCode ( ) ) ;
advanceDetailModel . setBrand ( advanceEntity . getBrand ( ) ) ;
advanceDetailModel . setSystemType ( "线上 " ) ;
advanceDetailModel . setSystemType ( "线下 " ) ;
advanceDetailModel . setFirstPackName ( firsts ) ;
String sencods = importOrderNoPackageExcelDTO . getSeconds ( ) ;
@ -2679,6 +2866,19 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
CompletableFuture . allOf ( comlist . toArray ( new CompletableFuture [ 0 ] ) ) . join ( ) ;
}
//发送报表基础数据广播
//把advanceDetailEntities通过advanceId进行分组
Map < Long , List < TrunklineAdvanceDetailEntity > > advanceDetailEntityMap = advanceDetailEntities . stream ( ) . collect ( Collectors . groupingBy ( TrunklineAdvanceDetailEntity : : getAdvanceId ) ) ;
list . forEach ( advanceEntity - > {
Long advanceId = advanceEntity . getId ( ) ;
String dealerCode = advanceEntity . getDealerCode ( ) ;
String dealerName = advanceEntity . getDealerName ( ) ;
List < TrunklineAdvanceDetailEntity > advanceDetailEntities1 = advanceDetailEntityMap . get ( advanceId ) ;
advanceDetailService . sendReportBasicdataFanout ( AuthUtil . getNickName ( ) , AuthUtil . getUserId ( ) , warehouseId , warehouseName , new Date ( ) , advanceDetailEntities1 , dealerCode , dealerName ) ;
} ) ;
return R . success ( "添加成功" ) ;
}
@ -2853,7 +3053,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceEntity . setSenderPhone ( importOrderNoPackageExcelDTO . getShipperMobile ( ) ) ;
advanceEntity . setSenderAddress ( importOrderNoPackageExcelDTO . getShipperAddress ( ) ) ;
advanceEntity . setTrainNumber ( importOrderNoPackageExcelDTO . getTrainNumber ( ) ) ;
advanceEntity . setSystemType ( "线上 " ) ;
advanceEntity . setSystemType ( "线下 " ) ;
advanceEntity . setMatingType ( "1" ) ;
advanceEntity . setWaybillStatus ( "0" ) ;
advanceEntity . setFreezeStatus ( "0" ) ;