提交 1c7b3203 authored 作者: liruixin's avatar liruixin

DTS运单数据同步

上级 4c2954ec
package com.clx.performance.data;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.math.BigDecimal;
@Getter
@Setter
@ToString
@NoArgsConstructor
public class OrderChildData {
@ApiModelProperty(value = "运单编号", example = "100000000")
private String childNo;
@ApiModelProperty(value = "运费单价(分)", example = "1.23")
private BigDecimal freightPrice;
@ApiModelProperty(value = "车牌号", example = "京A12345")
private String truckNo;
@ApiModelProperty(value="司机姓名",example = "张安")
private String driverName;
@ApiModelProperty(value="司机手机号",example = "12222222222")
private String driverMobile;
@ApiModelProperty("运单状态:10:已接单 30:前往货源地 40:到达货源地 50:装货成功 60:前往目的地 70:到达目的地 80:收货待确认")
private Integer status;
@ApiModelProperty(value="接单时间",example = "2020-01-01 10:10:10")
private String payTime;
@ApiModelProperty(value="装车时间",example = "2020-01-01 10:10:10")
private String loadTime;
@ApiModelProperty(value="装货净重",example = "10")
private BigDecimal loadNet;
@ApiModelProperty(value="卸车时间",example = "2020-01-01 10:10:10")
private String unloadTime;
@ApiModelProperty(value="卸货净重",example = "41")
private BigDecimal unloadNet;
}
...@@ -31,4 +31,10 @@ public class RabbitKeyConstants { ...@@ -31,4 +31,10 @@ public class RabbitKeyConstants {
public static final String TRUCK_EXCHANGE = "clx-user.truck.exchange"; public static final String TRUCK_EXCHANGE = "clx-user.truck.exchange";
public static final String TRUCK_ORDER_STATUS_UPDATE_KEY = "clx-user.truck.orderStatus.update.key"; public static final String TRUCK_ORDER_STATUS_UPDATE_KEY = "clx-user.truck.orderStatus.update.key";
//承运订单同步一部
public static final String DTS_EXCHANGE = "dts_data_sync_exchange";
public static final String CLX_PERFORMANCE_ORDER_CHILD_QUEUE = "clx_performance.order_child_queue";
public static final String CLX_PERFORMANCE_ORDER_CHILD_KEY = "clx_performance.order_child";
} }
package com.clx.performance.listener;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.clx.performance.constant.RabbitKeyConstants;
import com.clx.performance.data.OrderChildData;
import com.msl.common.utils.DtsMapConvertUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@RabbitListener(bindings = @QueueBinding(
value = @Queue(value = RabbitKeyConstants.CLX_PERFORMANCE_ORDER_CHILD_QUEUE),
exchange = @Exchange(name = RabbitKeyConstants.DTS_EXCHANGE),
key = RabbitKeyConstants.CLX_PERFORMANCE_ORDER_CHILD_KEY
), containerFactory="smartContainerFactory")
public class OrderChildDtsListener {
@RabbitHandler
public void dealMessage(byte[] message) {
try {
String msg = new String(message);
log.info("DTS消息同步开始, database:order_service, msg:{}", msg);
JSONObject object = JSON.parseObject(msg);
JSONObject beforeMap = object.getJSONObject("beforeMap");
JSONObject afterMap = object.getJSONObject("afterMap");
OrderChildData before = DtsMapConvertUtil.convert(beforeMap, new OrderChildData());
OrderChildData entity = DtsMapConvertUtil.convert(afterMap, new OrderChildData());
} catch (Exception e) {
log.info("DTS消息同步失败, database:order_service, error:{}", e.getMessage());
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论