Browse Source

1.延迟更新订单信息

dev
zhenghaoyu 2 months ago
parent
commit
3b30dcdea9
  1. 7
      blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java
  2. 41
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/OrderInfoUpdateHandler.java
  3. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java
  4. 26
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java
  5. 1
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml

7
blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java

@ -241,7 +241,12 @@ public interface RabbitConstant {
String AFTERSALES_OVER_TIME_ROUTING = "aftersales_over_time_routing" + ModuleNameConstant.DEVAUTH;
/**
* 更新订单信息
*/
String ORDER_INFO_UPDATE_QUEUE = "order_info_update_queue" + ModuleNameConstant.DEVAUTH;
String ORDER_INFO_UPDATE_EXCHANGE = "order_info_update_exchange" + ModuleNameConstant.DEVAUTH;
String ORDER_INFO_UPDATE_ROUTING = "order_info_update_routing" + ModuleNameConstant.DEVAUTH;
}

41
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/OrderInfoUpdateHandler.java

@ -0,0 +1,41 @@
package com.logpm.distribution.receiver;
import cn.hutool.json.JSONUtil;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.service.IDistributionStockArticleService;
import com.rabbitmq.client.Channel;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.constant.factorydata.FactoryDataConstants;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@AllArgsConstructor
public class OrderInfoUpdateHandler {
private final IDistributionStockArticleService distributionStockArticleService;
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = RabbitConstant.ORDER_INFO_UPDATE_QUEUE, durable = "true"),
exchange = @Exchange(name = RabbitConstant.ORDER_INFO_UPDATE_EXCHANGE,
type = ExchangeTypes.DIRECT,
delayed = FactoryDataConstants.Mq.DELAYED)
))
public void updateOrderInfo(String msg, Channel channel) {
if(StringUtil.isNotBlank(msg)){
DistributionStockArticleEntity bean = JSONUtil.toBean(msg, DistributionStockArticleEntity.class);
distributionStockArticleService.updateOrderInfoByDistributionStockArticleEntity(bean);
}
}
}

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

@ -332,4 +332,6 @@ public interface IDistributionStockArticleService extends BaseService<Distributi
R getOrderWarehouseDetail(String orderCode);
IPage<DistributionStockArticleVO> pageListOweNew(IPage<Object> page, Map<String, Object> distributionStockArticle);
void updateOrderInfoByDistributionStockArticleEntity(DistributionStockArticleEntity bean);
}

26
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -51,6 +51,8 @@ import com.logpm.distribution.vo.app.queryOrderVO;
import com.logpm.distribution.wrapper.DistributionParcelListWrapper;
import com.logpm.distribution.wrapper.DistributionStockArticleNewWrapper;
import com.logpm.distribution.wrapper.DistributionStockArticleWrapper;
import com.logpm.factorydata.feign.IFactoryDataClient;
import com.logpm.factorydata.vo.SendMsg;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.feign.ITrunklineAdvanceDetailClient;
import com.logpm.warehouse.entity.WarehouseWayBillDetail;
@ -60,6 +62,7 @@ import com.logpm.warehouse.feign.IWarehouseWaybillDetailClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.loading.LoadingStatusConstant;
import org.springblade.common.constant.order.OrderReservationStatusConstant;
@ -140,6 +143,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
private final IWarehouseWaybillDetailClient warehouseWaybillDetailClient;
private final ITrunklineAdvanceDetailClient trunklineAdvanceDetailClient;
private final ISysClient sysClient;
private final IFactoryDataClient factoryDataClient;
@Override
public IPage<DistributionStockArticleVO> selectDistributionStockArticlePage(IPage<DistributionStockArticleVO> page, DistributionStockArticleVO distributionStockArticle) {
@ -1502,6 +1506,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
}
@Override
public void updateOrderInfoByDistributionStockArticleEntity(DistributionStockArticleEntity stockArticleEntity) {
if (Objects.isNull(stockArticleEntity)) {
@ -1694,7 +1699,16 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
if (Objects.isNull(stockArticleEntity)) {
return;
}
updateOrderInfoByDistributionStockArticleEntity(stockArticleEntity);
factoryDataClient.sendMessage(SendMsg.builder()
.exchange(RabbitConstant.ORDER_INFO_UPDATE_EXCHANGE)
.routingKey(RabbitConstant.ORDER_INFO_UPDATE_ROUTING)
.message(JSONUtil.toJsonStr(stockArticleEntity))
.delay(1000)
.build());
// updateOrderInfoByDistributionStockArticleEntity(stockArticleEntity);
}
@ -1728,9 +1742,17 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
return;
}
factoryDataClient.sendMessage(SendMsg.builder()
.exchange(RabbitConstant.ORDER_INFO_UPDATE_EXCHANGE)
.routingKey(RabbitConstant.ORDER_INFO_UPDATE_ROUTING)
.message(JSONUtil.toJsonStr(stockArticleEntity))
.delay(1000)
.build());
//查询入库件数
// updateStockArticleByextracted(warehouseId, stockArticleEntity);
updateOrderInfoByDistributionStockArticleEntity(stockArticleEntity);
// updateOrderInfoByDistributionStockArticleEntity(stockArticleEntity);
log.info(">>>>> T updateOrdersInfo end");
}

1
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceMapper.xml

@ -12,6 +12,7 @@
</select>
<select id="advancePageList" resultType="com.logpm.trunkline.vo.TrunklineAdvanceVO">
/*FORCE_MASTER*/
select lta.*,
if( NOW() > DATE_ADD(lta.create_time, INTERVAL 24 HOUR), 1,0) isTimeOut,
lbc.client_name htMallName

Loading…
Cancel
Save