|
|
|
@ -3,6 +3,7 @@ package com.logpm.warehouse.service.impl;
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataClientEntity; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
|
|
|
@ -71,7 +72,9 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void waybillDataHandler(WaybillDTO waybillDTO) { |
|
|
|
|
String waybillNo = waybillDTO.getWaybillNo(); |
|
|
|
|
// String waybillNo = waybillDTO.getWaybillNo();
|
|
|
|
|
// 通过ID 获取老系统的订单数据
|
|
|
|
|
Integer wayBillId = waybillDTO.getId(); |
|
|
|
|
Integer allNum = waybillDTO.getNumber(); |
|
|
|
|
Date date = new Date(); |
|
|
|
|
Long waybillId = null; |
|
|
|
@ -80,19 +83,27 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
|
|
|
|
|
// Integer num = productDTO.getNum();
|
|
|
|
|
// allNum = allNum + num;
|
|
|
|
|
// }
|
|
|
|
|
log.info("###############waybillDataHandler: 处理数据开始 waybillNo={}", waybillNo); |
|
|
|
|
log.info("###############waybillDataHandler: 处理数据开始 waybillDTO={}", waybillDTO); |
|
|
|
|
|
|
|
|
|
WayBillEntity wayBillEntity = wayBillClient.getByWaybillId(wayBillId); |
|
|
|
|
|
|
|
|
|
if(ObjectUtils.isNull(wayBillEntity)){ |
|
|
|
|
log.warn("##############waybillDataHandler: 老系统中未找到对应运单waybillId={}", waybillDTO.getId()); |
|
|
|
|
throw new CustomerException("老系统中未找到对应运单"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String waybillNo =wayBillEntity.getWaybillNo(); |
|
|
|
|
//通过运单号先去查询新系统是否存在这个运单号
|
|
|
|
|
QueryWrapper<WarehouseWaybillEntity> waybillQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
waybillQueryWrapper.eq("waybill_no", waybillNo); |
|
|
|
|
WarehouseWaybillEntity warehouseWaybill = warehouseWaybillMapper.selectOne(waybillQueryWrapper); |
|
|
|
|
if (Objects.isNull(warehouseWaybill)) { |
|
|
|
|
//如果新系统中不存在这个运单,那么就去查询老系统的运单数据
|
|
|
|
|
WayBillEntity wayBillEntity = wayBillClient.getByWaybillNo(waybillNo); |
|
|
|
|
if (Objects.isNull(wayBillEntity)) { |
|
|
|
|
log.warn("##############waybillDataHandler: 老系统中未找到对应运单waybillNo={}", waybillNo); |
|
|
|
|
throw new CustomerException("老系统中未找到对应运单"); |
|
|
|
|
} |
|
|
|
|
// WayBillEntity wayBillEntity = wayBillClient.getByWaybillNo(waybillNo);
|
|
|
|
|
// if (Objects.isNull(wayBillEntity)) {
|
|
|
|
|
// log.warn("##############waybillDataHandler: 老系统中未找到对应运单waybillNo={}", waybillNo);
|
|
|
|
|
// throw new CustomerException("老系统中未找到对应运单");
|
|
|
|
|
// }
|
|
|
|
|
warehouseWaybill = saveWayBillData(wayBillEntity, allNum); |
|
|
|
|
waybillId = warehouseWaybill.getId(); |
|
|
|
|
|
|
|
|
|