Browse Source

Merge branch 'dev' into pre-production

pre-production
pref_mail@163.com 3 days ago
parent
commit
dff07372f4
  1. 15
      blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java
  2. 50
      blade-biz-common/src/main/java/org/springblade/common/model/TripartiteVO.java
  3. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java
  4. 86
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

15
blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java

@ -142,6 +142,21 @@ public abstract class FanoutConstants {
}
/**
* 备货节点
*
* @see org.springblade.common.model.StockUpVO
**/
interface tripartite {
String EXCHANGE = "fanout.trunkline.tripartite" + ModuleNameConstant.DEVAUTH;
interface QUEUE {
String SIGN = "fanout.trunkline.tripartite.sign" + ModuleNameConstant.DEVAUTH;
}
}
}

50
blade-biz-common/src/main/java/org/springblade/common/model/TripartiteVO.java

@ -0,0 +1,50 @@
package org.springblade.common.model;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
public class TripartiteVO implements Serializable {
/** 发车批次号 */
private String carsNo ;
/** 司机id */
private Long driverId ;
/** 司机名称 */
private String driverName ;
/** 司机电话 */
private String driverMobile ;
/** 副驾id */
private Long assistantId ;
/** 副驾i名称 */
private String assistantName ;
/** 副驾i电话 */
private String assistantMobile ;
/** 车辆id */
private Long carId ;
/** 送货方式:1=自提,2=送货 */
private String deliveryType ;
/** 客户类型:1=商场,2=C端客户[多选] */
private String customerType ;
/** 承运商id */
private Long carrierId ;
/** 承运商名称 */
private String carrierName ;
/** 承运单号 */
private String carrierOrderCode ;
/** 承运时间 */
private Date carrierTime ;
/** 车牌号 */
private String carNumber ;
private List<PackageData> packageDataList;
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java

@ -98,7 +98,7 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
}else{
boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity);
if(saveFlag){
bladeRedis.setEx(key,distributionStockArticle.getId(),30L);
bladeRedis.setEx(key,distributionStockArticleEntity.getId(),30L);
return distributionStockArticleEntity.getId();
}else{
return 0L;

86
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

@ -54,12 +54,19 @@ import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.springblade.common.annotations.RepeatSubmit;
import org.springblade.common.constant.*;
import org.springblade.common.constant.broadcast.FanoutConstants;
import org.springblade.common.constant.carsload.CarsLoadLogTypeConstant;
import org.springblade.common.enums.BizOperationEnums;
import org.springblade.common.enums.PackageTypeEnums;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.PackageData;
import org.springblade.common.model.TripartiteVO;
import org.springblade.common.utils.CommonUtil;
import org.springblade.common.utils.QRCodeUtil;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
@ -9746,6 +9753,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
// 推送签收数据给工厂
sendFactorySignTriparite(warehouseId, orderPackageCodes, warehouseEntity);
List<PackageData> packageDataList = new ArrayList<>();
List<TrunklineCarsLoadScanEntity> loadScanEntityList = trunklineCarsLoadScanService.findListByIds(loadScanIds);
//把loadScanEntityList中所有元素通过type进行分组
Map<Integer, List<TrunklineCarsLoadScanEntity>> map = loadScanEntityList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getType));
@ -9757,30 +9766,107 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
List<String> scanCodes = trunklineCarsLoadScanEntities.stream().map(TrunklineCarsLoadScanEntity::getScanCode).collect(Collectors.toList());
//TODO 暂时注释
// carsLoadAsyncService.sendReportPackageSignData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,scanCodes);
FindParamterDTO findParamterDTO = new FindParamterDTO();
findParamterDTO.setOrderPackageCodeList(scanCodes);
findParamterDTO.setWarehouseId(warehouseId);
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO);
parcelListEntityList.forEach(parcelListEntity -> {
PackageData packageData = new PackageData();
packageData.setWaybillNumber(parcelListEntity.getWaybillNumber());
packageData.setBrand(parcelListEntity.getBrandName());
packageData.setPackageCode(parcelListEntity.getOrderPackageCode());
packageData.setMaterialCode(parcelListEntity.getMaterialCode());
packageData.setMaterialName(parcelListEntity.getMaterialName());
packageData.setNumber(1);
packageData.setOrderCode(parcelListEntity.getOrderCode());
packageData.setPackageType(PackageTypeEnums.CMP);
packageDataList.add(packageData);
});
}else{
trunklineCarsLoadScanEntities.forEach(carsLoadScanEntity -> {
Long scanId = carsLoadScanEntity.getId();
List<TrunklineScanZeroDetailVO> zeroDetailVOList = scanZeroDetailService.findListByCarsLoadScanId(scanId);
//把zeroDetailList中所有元素的packageId放入一个List
List<Long> packageIds = zeroDetailVOList.stream().map(TrunklineScanZeroDetailEntity::getPackageId).collect(Collectors.toList());
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByIds(packageIds);
//把parcelListEntityList转成以id为key的Map
Map<Long, DistributionParcelListEntity> parcelListMap = parcelListEntityList.stream().collect(Collectors.toMap(DistributionParcelListEntity::getId, Function.identity()));
List<TrunklineScanZeroDetailEntity> zeroDetailList = new ArrayList<>();
zeroDetailVOList.forEach(zeroDetailVO -> {
TrunklineScanZeroDetailEntity entity = new TrunklineScanZeroDetailEntity();
BeanUtil.copy(zeroDetailVO, entity);
zeroDetailList.add(entity);
Long packageId = zeroDetailVO.getPackageId();
DistributionParcelListEntity parcelList = parcelListMap.get(packageId);
if(!Objects.isNull(parcelList)){
PackageData packageData = new PackageData();
packageData.setWaybillNumber(parcelList.getWaybillNumber());
packageData.setBrand(parcelList.getBrandName());
packageData.setProductId(zeroDetailVO.getGoodsId());
packageData.setProductName(zeroDetailVO.getGoodsName());
packageData.setNumber(zeroDetailVO.getUnloadNum());
packageData.setOrderCode(parcelList.getOrderCode());
packageData.setPackageType(PackageTypeEnums.LTL);
packageDataList.add(packageData);
}
});
//TODO 暂时注释
// carsLoadAsyncService.sendReportZeroPackageSignData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseName, zeroDetailList, carsLoadScanEntity, carsLoadEntity);
});
}
});
NodeFanoutMsg<TripartiteVO> tripartiteVONodeFanoutMsg = buildNodeFanoutMessage(carsLoadEntity, packageDataList, warehouseId);
if(!Objects.isNull(tripartiteVONodeFanoutMsg)){
rabbitTemplate.convertAndSend(FanoutConstants.trunkline.tripartite.EXCHANGE, null, com.alibaba.fastjson.JSONObject.toJSONString(tripartiteVONodeFanoutMsg));
}
return R.success("签收成功");
}
private NodeFanoutMsg<TripartiteVO> buildNodeFanoutMessage(TrunklineCarsLoadEntity carsLoadEntity, List<PackageData> packageDataList,Long warehouseId) {
try {
BladeUser user = AuthUtil.getUser();
NodeFanoutMsg<TripartiteVO> nodeFanoutMsg = new NodeFanoutMsg<TripartiteVO>();
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD);
nodeFanoutMsg.setNode(WorkNodeEnums.SIGN_TRIPARTITE_TRANSFER_DEPART);
BasicdataWarehouseEntity entityWarehouse = basicdataWarehouseClient.getEntityWarehouseId(warehouseId);
if (entityWarehouse != null) {
nodeFanoutMsg.setWarehouse(entityWarehouse.getName());
}
nodeFanoutMsg.setWarehouseId(warehouseId);
nodeFanoutMsg.setOperator(user.getNickName());
nodeFanoutMsg.setOperatorTime(new Date());
TripartiteVO tripartiteVO = new TripartiteVO();
BeanUtil.copy(carsLoadEntity, tripartiteVO);
// ReservationVO reservationVO = distributionReservationService.getReservationVO(reservationEntity);
tripartiteVO.setPackageDataList(packageDataList);
nodeFanoutMsg.setMain(tripartiteVO);
nodeFanoutMsg.setTenantId(AuthUtil.getTenantId());
return nodeFanoutMsg;
} catch (Exception e) {
log.warn("三方中转签收:发送三方中转签收节点消息失败", e);
}
return null;
}
private void sendFactorySignTriparite(Long warehouseId, List<String> orderPackageCodes, BasicdataWarehouseEntity warehouseEntity) {
try {
FindParamterDTO paramterDTO = new FindParamterDTO();

Loading…
Cancel
Save