目录
1.创建主程序------DwdOrderRelevantApp类
2.创建DWD层的事实表------来源于订单表和订单明细表
(3)创建交易域:下单事务事实表实体类,并整合(1)与(2),采用下单时间
(4)创建交易域:支付成功事务事实表实体类,并整合(1)与(2),采用支付时间和支付状态
(5)创建物流域:揽收(接单)事务事实表实体类,并整合(1)与(2),采用揽收时间
(6)创建物流域:发单事务事实表实体类,并整合(1)与(2),采用发货时间
(7)创建物流域:转运完成事务事实表实体类,并整合(1)与(2),采用转运完成时间
(8)创建物流域:派送成功事务事实表实体类,并整合(1)与(2),采用派送成功时间
(9)创建物流域:签收事务事实表实体类,并整合(1)与(2),采用签收时间
(10)创建交易域:取消运单事务事实表实体类,并整合(1)与(2),采用取消时间
1.创建主程序------DwdOrderRelevantApp类
java
package com.atguigu.tms.realtime.app.dwd;
/**
* 订单相关事实表准备
* 需要启动的进程
* zk、kafka、hdfs、OdsApp、DwdOrderRelevantApp
**/
public class DwdOrderRelevantApp {
public static void main(String[] args) throws Exception {
// TODO 1.环境准备
// 1.1 指定流处理环境以及检查点相关的设置
// 1.2 设置并行度,和kafka主题的分区数保持一致
// TODO 2.从kafka的tms_ods主题中读取
// 2.1 声明消费的主题
// 2.2 创建消费者对象
// 2.3 消费数据 封装为流
// TODO 3.筛选订单和订单明细数据
// TODO 4.对流中的数据类型进行转换 jsonStr -> jsonObj
// TODO 5.按照order_id进行分组
// TODO 6.定义侧输出流标签:匿名内部类
// 主流:下单
// 侧输出流:支付成功、取消订单、揽收(接单)、发单、转运完成、派送成功、签署
// TODO 7.分流
// TODO 8.从主流中提取侧输出流
// TODO 9.将不同流的数据写到kafka的不同主题中
}
}
2.创建DWD层的事实表------来源于订单表和订单明细表
(1)创建订单表实体类
java
package com.atguigu.tms.realtime.beans;
import lombok.Data;
import java.math.BigDecimal;
/**
* 订单实体类
*/
@Data
public class DwdOrderInfoOriginBean {
// 编号(主键)
String id;
// 运单号
String orderNo;
// 运单状态
String status;
// 取件类型,1为网点自寄,2为上门取件
String collectType;
// 客户id
String userId;
// 收件人小区id
String receiverComplexId;
// 收件人省份id
String receiverProvinceId;
// 收件人城市id
String receiverCityId;
// 收件人区县id
String receiverDistrictId;
// 收件人姓名
String receiverName;
// 发件人小区id
String senderComplexId;
// 发件人省份id
String senderProvinceId;
// 发件人城市id
String senderCityId;
// 发件人区县id
String senderDistrictId;
// 发件人姓名
String senderName;
// 支付方式
String paymentType;
// 货物个数
Integer cargoNum;
// 金额
BigDecimal amount;
// 预计到达时间
Long estimateArriveTime;
// 距离,单位:公里
BigDecimal distance;
// 创建时间
String createTime;
// 更新时间
String updateTime;
// 是否删除
String isDeleted;
}
(2)创建订单明细表实体类
java
package com.atguigu.tms.realtime.beans;
import lombok.Data;
import java.math.BigDecimal;
/**
*订单货物明细实体类
*/
@Data
public class DwdOrderDetailOriginBean {
// 编号(主键)
String id;
// 运单id
String orderId;
// 货物类型
String cargoType;
// 长cm
Integer volumnLength;
// 宽cm
Integer volumnWidth;
// 高cm
Integer volumnHeight;
// 重量 kg
BigDecimal weight;
// 创建时间
String createTime;
// 更新时间
String updateTime;
// 是否删除
String isDeleted;
}
(3)创建交易域:下单事务事实表实体类,并整合(1)与(2),采用下单时间
java
package com.atguigu.tms.realtime.beans;
import com.atguigu.tms.realtime.utils.DateFormatUtil;
import lombok.Data;
import java.math.BigDecimal;
/**
*交易域:下单事务事实表实体类
*/
@Data
public class DwdTradeOrderDetailBean {
// 运单明细ID
String id;
// 运单id
String orderId;
// 货物类型
String cargoType;
// 长cm
Integer volumeLength;
// 宽cm
Integer volumeWidth;
// 高cm
Integer volumeHeight;
// 重量 kg
BigDecimal weight;
// 下单时间
String orderTime;
// 运单号
String orderNo;
// 运单状态
String status;
// 取件类型,1为网点自寄,2为上门取件
String collectType;
// 客户id
String userId;
// 收件人小区id
String receiverComplexId;
// 收件人省份id
String receiverProvinceId;
// 收件人城市id
String receiverCityId;
// 收件人区县id
String receiverDistrictId;
// 收件人姓名
String receiverName;
// 发件人小区id
String senderComplexId;
// 发件人省份id
String senderProvinceId;
// 发件人城市id
String senderCityId;
// 发件人区县id
String senderDistrictId;
// 发件人姓名
String senderName;
// 支付方式
String paymentType;
// 货物个数
Integer cargoNum;
// 金额
BigDecimal amount;
// 预计到达时间
String estimateArriveTime;
// 距离,单位:公里
BigDecimal distance;
// 时间戳
Long ts;
public void mergeBean(DwdOrderDetailOriginBean detailOriginBean, DwdOrderInfoOriginBean infoOriginBean) {
// 合并原始明细字段
this.id = detailOriginBean.id;
this.orderId = detailOriginBean.orderId;
this.cargoType = detailOriginBean.cargoType;
this.volumeLength = detailOriginBean.volumnLength;
this.volumeWidth = detailOriginBean.volumnWidth;
this.volumeHeight = detailOriginBean.volumnHeight;
this.weight = detailOriginBean.weight;
this.orderTime =
DateFormatUtil.toYmdHms(DateFormatUtil.toTs(
detailOriginBean.createTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000);
this.ts = DateFormatUtil.toTs(
detailOriginBean.createTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000;
// 合并原始订单字段
this.orderNo = infoOriginBean.orderNo;
this.status = infoOriginBean.status;
this.collectType = infoOriginBean.collectType;
this.userId = infoOriginBean.userId;
this.receiverComplexId = infoOriginBean.receiverComplexId;
this.receiverProvinceId = infoOriginBean.receiverProvinceId;
this.receiverCityId = infoOriginBean.receiverCityId;
this.receiverDistrictId = infoOriginBean.receiverDistrictId;
this.receiverName = infoOriginBean.receiverName;
this.senderComplexId = infoOriginBean.senderComplexId;
this.senderProvinceId = infoOriginBean.senderProvinceId;
this.senderCityId = infoOriginBean.senderCityId;
this.senderDistrictId = infoOriginBean.senderDistrictId;
this.senderName = infoOriginBean.senderName;
this.paymentType = infoOriginBean.paymentType;
this.cargoNum = infoOriginBean.cargoNum;
this.amount = infoOriginBean.amount;
this.estimateArriveTime = DateFormatUtil.toYmdHms(
infoOriginBean.estimateArriveTime - 8 * 60 * 60 * 1000);
this.distance = infoOriginBean.distance;
}
}
(4)创建交易域:支付成功事务事实表实体类,并整合(1)与(2),采用支付时间和支付状态
java
package com.atguigu.tms.realtime.beans;
import com.atguigu.tms.realtime.utils.DateFormatUtil;
import lombok.Data;
import java.math.BigDecimal;
/**
*交易域:支付成功事务事实表实体类
*/
@Data
public class DwdTradePaySucDetailBean {
// 运单明细ID
String id;
// 运单id
String orderId;
// 货物类型
String cargoType;
// 长cm
Integer volumeLength;
// 宽cm
Integer volumeWidth;
// 高cm
Integer volumeHeight;
// 重量 kg
BigDecimal weight;
// 支付时间
String payTime;
// 运单号
String orderNo;
// 运单状态
String status;
// 取件类型,1为网点自寄,2为上门取件
String collectType;
// 客户id
String userId;
// 收件人小区id
String receiverComplexId;
// 收件人省份id
String receiverProvinceId;
// 收件人城市id
String receiverCityId;
// 收件人区县id
String receiverDistrictId;
// 收件人姓名
String receiverName;
// 发件人小区id
String senderComplexId;
// 发件人省份id
String senderProvinceId;
// 发件人城市id
String senderCityId;
// 发件人区县id
String senderDistrictId;
// 发件人姓名
String senderName;
// 支付方式
String paymentType;
// 货物个数
Integer cargoNum;
// 金额
BigDecimal amount;
// 预计到达时间
String estimateArriveTime;
// 距离,单位:公里
BigDecimal distance;
// 时间戳
Long ts;
public void mergeBean(DwdOrderDetailOriginBean detailOriginBean, DwdOrderInfoOriginBean infoOriginBean) {
// 合并原始明细字段
this.id = detailOriginBean.id;
this.orderId = detailOriginBean.orderId;
this.cargoType = detailOriginBean.cargoType;
this.volumeLength = detailOriginBean.volumnLength;
this.volumeWidth = detailOriginBean.volumnWidth;
this.volumeHeight = detailOriginBean.volumnHeight;
this.weight = detailOriginBean.weight;
// 合并原始订单字段
this.orderNo = infoOriginBean.orderNo;
this.status = infoOriginBean.status;
this.collectType = infoOriginBean.collectType;
this.userId = infoOriginBean.userId;
this.receiverComplexId = infoOriginBean.receiverComplexId;
this.receiverProvinceId = infoOriginBean.receiverProvinceId;
this.receiverCityId = infoOriginBean.receiverCityId;
this.receiverDistrictId = infoOriginBean.receiverDistrictId;
this.receiverName = infoOriginBean.receiverName;
this.senderComplexId = infoOriginBean.senderComplexId;
this.senderProvinceId = infoOriginBean.senderProvinceId;
this.senderCityId = infoOriginBean.senderCityId;
this.senderDistrictId = infoOriginBean.senderDistrictId;
this.senderName = infoOriginBean.senderName;
this.paymentType = infoOriginBean.paymentType;
this.cargoNum = infoOriginBean.cargoNum;
this.amount = infoOriginBean.amount;
this.estimateArriveTime = DateFormatUtil.toYmdHms(
infoOriginBean.estimateArriveTime - 8 * 60 * 60 * 1000);
this.distance = infoOriginBean.distance;
this.payTime =
DateFormatUtil.toYmdHms(DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000);
this.ts = DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000;
}
}
(5)创建物流域:揽收(接单)事务事实表实体类,并整合(1)与(2),采用揽收时间
java
package com.atguigu.tms.realtime.beans;
import com.atguigu.tms.realtime.utils.DateFormatUtil;
import lombok.Data;
import java.math.BigDecimal;
/**
*物流域:揽收(接单)事务事实表实体类
*/
@Data
public class DwdTransReceiveDetailBean {
// 运单明细ID
String id;
// 运单id
String orderId;
// 货物类型
String cargoType;
// 长cm
Integer volumeLength;
// 宽cm
Integer volumeWidth;
// 高cm
Integer volumeHeight;
// 重量 kg
BigDecimal weight;
// 揽收时间
String receiveTime;
// 运单号
String orderNo;
// 运单状态
String status;
// 取件类型,1为网点自寄,2为上门取件
String collectType;
// 客户id
String userId;
// 收件人小区id
String receiverComplexId;
// 收件人省份id
String receiverProvinceId;
// 收件人城市id
String receiverCityId;
// 收件人区县id
String receiverDistrictId;
// 收件人姓名
String receiverName;
// 发件人小区id
String senderComplexId;
// 发件人省份id
String senderProvinceId;
// 发件人城市id
String senderCityId;
// 发件人区县id
String senderDistrictId;
// 发件人姓名
String senderName;
// 支付方式
String paymentType;
// 货物个数
Integer cargoNum;
// 金额
BigDecimal amount;
// 预计到达时间
String estimateArriveTime;
// 距离,单位:公里
BigDecimal distance;
// 时间戳
Long ts;
public void mergeBean(DwdOrderDetailOriginBean detailOriginBean, DwdOrderInfoOriginBean infoOriginBean) {
// 合并原始明细字段
this.id = detailOriginBean.id;
this.orderId = detailOriginBean.orderId;
this.cargoType = detailOriginBean.cargoType;
this.volumeLength = detailOriginBean.volumnLength;
this.volumeWidth = detailOriginBean.volumnWidth;
this.volumeHeight = detailOriginBean.volumnHeight;
this.weight = detailOriginBean.weight;
// 合并原始订单字段
this.orderNo = infoOriginBean.orderNo;
this.status = infoOriginBean.status;
this.collectType = infoOriginBean.collectType;
this.userId = infoOriginBean.userId;
this.receiverComplexId = infoOriginBean.receiverComplexId;
this.receiverProvinceId = infoOriginBean.receiverProvinceId;
this.receiverCityId = infoOriginBean.receiverCityId;
this.receiverDistrictId = infoOriginBean.receiverDistrictId;
this.receiverName = infoOriginBean.receiverName;
this.senderComplexId = infoOriginBean.senderComplexId;
this.senderProvinceId = infoOriginBean.senderProvinceId;
this.senderCityId = infoOriginBean.senderCityId;
this.senderDistrictId = infoOriginBean.senderDistrictId;
this.senderName = infoOriginBean.senderName;
this.paymentType = infoOriginBean.paymentType;
this.cargoNum = infoOriginBean.cargoNum;
this.amount = infoOriginBean.amount;
this.estimateArriveTime = DateFormatUtil.toYmdHms(
infoOriginBean.estimateArriveTime - 8 * 60 * 60 * 1000);
this.distance = infoOriginBean.distance;
this.receiveTime =
DateFormatUtil.toYmdHms(DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000);
this.ts = DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000;
}
}
(6)创建物流域:发单事务事实表实体类,并整合(1)与(2),采用发货时间
java
package com.atguigu.tms.realtime.beans;
import com.atguigu.tms.realtime.utils.DateFormatUtil;
import lombok.Data;
import java.math.BigDecimal;
/**
*物流域:发单事务事实表实体类
*/
@Data
public class DwdTransDispatchDetailBean {
// 运单明细ID
String id;
// 运单id
String orderId;
// 货物类型
String cargoType;
// 长cm
Integer volumeLength;
// 宽cm
Integer volumeWidth;
// 高cm
Integer volumeHeight;
// 重量 kg
BigDecimal weight;
// 发单时间
String dispatchTime;
// 运单号
String orderNo;
// 运单状态
String status;
// 取件类型,1为网点自寄,2为上门取件
String collectType;
// 客户id
String userId;
// 收件人小区id
String receiverComplexId;
// 收件人省份id
String receiverProvinceId;
// 收件人城市id
String receiverCityId;
// 收件人区县id
String receiverDistrictId;
// 收件人姓名
String receiverName;
// 发件人小区id
String senderComplexId;
// 发件人省份id
String senderProvinceId;
// 发件人城市id
String senderCityId;
// 发件人区县id
String senderDistrictId;
// 发件人姓名
String senderName;
// 支付方式
String paymentType;
// 货物个数
Integer cargoNum;
// 金额
BigDecimal amount;
// 预计到达时间
String estimateArriveTime;
// 距离,单位:公里
BigDecimal distance;
// 时间戳
Long ts;
public void mergeBean(DwdOrderDetailOriginBean detailOriginBean, DwdOrderInfoOriginBean infoOriginBean) {
// 合并原始明细字段
this.id = detailOriginBean.id;
this.orderId = detailOriginBean.orderId;
this.cargoType = detailOriginBean.cargoType;
this.volumeLength = detailOriginBean.volumnLength;
this.volumeWidth = detailOriginBean.volumnWidth;
this.volumeHeight = detailOriginBean.volumnHeight;
this.weight = detailOriginBean.weight;
// 合并原始订单字段
this.orderNo = infoOriginBean.orderNo;
this.status = infoOriginBean.status;
this.collectType = infoOriginBean.collectType;
this.userId = infoOriginBean.userId;
this.receiverComplexId = infoOriginBean.receiverComplexId;
this.receiverProvinceId = infoOriginBean.receiverProvinceId;
this.receiverCityId = infoOriginBean.receiverCityId;
this.receiverDistrictId = infoOriginBean.receiverDistrictId;
this.receiverName = infoOriginBean.receiverName;
this.senderComplexId = infoOriginBean.senderComplexId;
this.senderProvinceId = infoOriginBean.senderProvinceId;
this.senderCityId = infoOriginBean.senderCityId;
this.senderDistrictId = infoOriginBean.senderDistrictId;
this.senderName = infoOriginBean.senderName;
this.paymentType = infoOriginBean.paymentType;
this.cargoNum = infoOriginBean.cargoNum;
this.amount = infoOriginBean.amount;
this.estimateArriveTime = DateFormatUtil.toYmdHms(
infoOriginBean.estimateArriveTime - 8 * 60 * 60 * 1000);
this.distance = infoOriginBean.distance;
this.dispatchTime =
DateFormatUtil.toYmdHms(DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000);
this.ts = DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000;
}
}
(7)创建物流域:转运完成事务事实表实体类,并整合(1)与(2),采用转运完成时间
java
package com.atguigu.tms.realtime.beans;
import com.atguigu.tms.realtime.utils.DateFormatUtil;
import lombok.Data;
import java.math.BigDecimal;
/**
*物流域:转运完成事务事实表实体类
*/
@Data
public class DwdTransBoundFinishDetailBean {
// 运单明细ID
String id;
// 运单id
String orderId;
// 货物类型
String cargoType;
// 长cm
Integer volumeLength;
// 宽cm
Integer volumeWidth;
// 高cm
Integer volumeHeight;
// 重量 kg
BigDecimal weight;
// 转运完成时间
String boundFinishTime;
// 运单号
String orderNo;
// 运单状态
String status;
// 取件类型,1为网点自寄,2为上门取件
String collectType;
// 客户id
String userId;
// 收件人小区id
String receiverComplexId;
// 收件人省份id
String receiverProvinceId;
// 收件人城市id
String receiverCityId;
// 收件人区县id
String receiverDistrictId;
// 收件人姓名
String receiverName;
// 发件人小区id
String senderComplexId;
// 发件人省份id
String senderProvinceId;
// 发件人城市id
String senderCityId;
// 发件人区县id
String senderDistrictId;
// 发件人姓名
String senderName;
// 支付方式
String paymentType;
// 货物个数
Integer cargoNum;
// 金额
BigDecimal amount;
// 预计到达时间
String estimateArriveTime;
// 距离,单位:公里
BigDecimal distance;
// 时间戳
Long ts;
public void mergeBean(DwdOrderDetailOriginBean detailOriginBean, DwdOrderInfoOriginBean infoOriginBean) {
// 合并原始明细字段
this.id = detailOriginBean.id;
this.orderId = detailOriginBean.orderId;
this.cargoType = detailOriginBean.cargoType;
this.volumeLength = detailOriginBean.volumnLength;
this.volumeWidth = detailOriginBean.volumnWidth;
this.volumeHeight = detailOriginBean.volumnHeight;
this.weight = detailOriginBean.weight;
// 合并原始订单字段
this.orderNo = infoOriginBean.orderNo;
this.status = infoOriginBean.status;
this.collectType = infoOriginBean.collectType;
this.userId = infoOriginBean.userId;
this.receiverComplexId = infoOriginBean.receiverComplexId;
this.receiverProvinceId = infoOriginBean.receiverProvinceId;
this.receiverCityId = infoOriginBean.receiverCityId;
this.receiverDistrictId = infoOriginBean.receiverDistrictId;
this.receiverName = infoOriginBean.receiverName;
this.senderComplexId = infoOriginBean.senderComplexId;
this.senderProvinceId = infoOriginBean.senderProvinceId;
this.senderCityId = infoOriginBean.senderCityId;
this.senderDistrictId = infoOriginBean.senderDistrictId;
this.senderName = infoOriginBean.senderName;
this.paymentType = infoOriginBean.paymentType;
this.cargoNum = infoOriginBean.cargoNum;
this.amount = infoOriginBean.amount;
this.estimateArriveTime = DateFormatUtil.toYmdHms(
infoOriginBean.estimateArriveTime - 8 * 60 * 60 * 1000);
this.distance = infoOriginBean.distance;
this.boundFinishTime =
DateFormatUtil.toYmdHms(DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000);
this.ts = DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000;
}
}
(8)创建物流域:派送成功事务事实表实体类,并整合(1)与(2),采用派送成功时间
java
package com.atguigu.tms.realtime.beans;
import com.atguigu.tms.realtime.utils.DateFormatUtil;
import lombok.Data;
import java.math.BigDecimal;
/**
*物流域:派送成功事务事实表实体类
*/
@Data
public class DwdTransDeliverSucDetailBean {
// 运单明细ID
String id;
// 运单id
String orderId;
// 货物类型
String cargoType;
// 长cm
Integer volumeLength;
// 宽cm
Integer volumeWidth;
// 高cm
Integer volumeHeight;
// 重量 kg
BigDecimal weight;
// 派送成功时间
String deliverTime;
// 运单号
String orderNo;
// 运单状态
String status;
// 取件类型,1为网点自寄,2为上门取件
String collectType;
// 客户id
String userId;
// 收件人小区id
String receiverComplexId;
// 收件人省份id
String receiverProvinceId;
// 收件人城市id
String receiverCityId;
// 收件人区县id
String receiverDistrictId;
// 收件人姓名
String receiverName;
// 发件人小区id
String senderComplexId;
// 发件人省份id
String senderProvinceId;
// 发件人城市id
String senderCityId;
// 发件人区县id
String senderDistrictId;
// 发件人姓名
String senderName;
// 支付方式
String paymentType;
// 货物个数
Integer cargoNum;
// 金额
BigDecimal amount;
// 预计到达时间
String estimateArriveTime;
// 距离,单位:公里
BigDecimal distance;
// 时间戳
Long ts;
public void mergeBean(DwdOrderDetailOriginBean detailOriginBean, DwdOrderInfoOriginBean infoOriginBean) {
// 合并原始明细字段
this.id = detailOriginBean.id;
this.orderId = detailOriginBean.orderId;
this.cargoType = detailOriginBean.cargoType;
this.volumeLength = detailOriginBean.volumnLength;
this.volumeWidth = detailOriginBean.volumnWidth;
this.volumeHeight = detailOriginBean.volumnHeight;
this.weight = detailOriginBean.weight;
// 合并原始订单字段
this.orderNo = infoOriginBean.orderNo;
this.status = infoOriginBean.status;
this.collectType = infoOriginBean.collectType;
this.userId = infoOriginBean.userId;
this.receiverComplexId = infoOriginBean.receiverComplexId;
this.receiverProvinceId = infoOriginBean.receiverProvinceId;
this.receiverCityId = infoOriginBean.receiverCityId;
this.receiverDistrictId = infoOriginBean.receiverDistrictId;
this.receiverName = infoOriginBean.receiverName;
this.senderComplexId = infoOriginBean.senderComplexId;
this.senderProvinceId = infoOriginBean.senderProvinceId;
this.senderCityId = infoOriginBean.senderCityId;
this.senderDistrictId = infoOriginBean.senderDistrictId;
this.senderName = infoOriginBean.senderName;
this.paymentType = infoOriginBean.paymentType;
this.cargoNum = infoOriginBean.cargoNum;
this.amount = infoOriginBean.amount;
this.estimateArriveTime = DateFormatUtil.toYmdHms(
infoOriginBean.estimateArriveTime - 8 * 60 * 60 * 1000);
this.distance = infoOriginBean.distance;
this.deliverTime =
DateFormatUtil.toYmdHms(DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000);
this.ts = DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000;
}
}
(9)创建物流域:签收事务事实表实体类,并整合(1)与(2),采用签收时间
java
package com.atguigu.tms.realtime.beans;
import com.atguigu.tms.realtime.utils.DateFormatUtil;
import lombok.Data;
import java.math.BigDecimal;
/**
* 物流域:签收事务事实表实体类
*/
@Data
public class DwdTransSignDetailBean {
// 运单明细ID
String id;
// 运单id
String orderId;
// 货物类型
String cargoType;
// 长cm
Integer volumeLength;
// 宽cm
Integer volumeWidth;
// 高cm
Integer volumeHeight;
// 重量 kg
BigDecimal weight;
// 签收时间
String signTime;
// 运单号
String orderNo;
// 运单状态
String status;
// 取件类型,1为网点自寄,2为上门取件
String collectType;
// 客户id
String userId;
// 收件人小区id
String receiverComplexId;
// 收件人省份id
String receiverProvinceId;
// 收件人城市id
String receiverCityId;
// 收件人区县id
String receiverDistrictId;
// 收件人姓名
String receiverName;
// 发件人小区id
String senderComplexId;
// 发件人省份id
String senderProvinceId;
// 发件人城市id
String senderCityId;
// 发件人区县id
String senderDistrictId;
// 发件人姓名
String senderName;
// 支付方式
String paymentType;
// 货物个数
Integer cargoNum;
// 金额
BigDecimal amount;
// 预计到达时间
String estimateArriveTime;
// 距离,单位:公里
BigDecimal distance;
// 时间戳
Long ts;
public void mergeBean(DwdOrderDetailOriginBean detailOriginBean, DwdOrderInfoOriginBean infoOriginBean) {
// 合并原始明细字段
this.id = detailOriginBean.id;
this.orderId = detailOriginBean.orderId;
this.cargoType = detailOriginBean.cargoType;
this.volumeLength = detailOriginBean.volumnLength;
this.volumeWidth = detailOriginBean.volumnWidth;
this.volumeHeight = detailOriginBean.volumnHeight;
this.weight = detailOriginBean.weight;
// 合并原始订单字段
this.orderNo = infoOriginBean.orderNo;
this.status = infoOriginBean.status;
this.collectType = infoOriginBean.collectType;
this.userId = infoOriginBean.userId;
this.receiverComplexId = infoOriginBean.receiverComplexId;
this.receiverProvinceId = infoOriginBean.receiverProvinceId;
this.receiverCityId = infoOriginBean.receiverCityId;
this.receiverDistrictId = infoOriginBean.receiverDistrictId;
this.receiverName = infoOriginBean.receiverName;
this.senderComplexId = infoOriginBean.senderComplexId;
this.senderProvinceId = infoOriginBean.senderProvinceId;
this.senderCityId = infoOriginBean.senderCityId;
this.senderDistrictId = infoOriginBean.senderDistrictId;
this.senderName = infoOriginBean.senderName;
this.paymentType = infoOriginBean.paymentType;
this.cargoNum = infoOriginBean.cargoNum;
this.amount = infoOriginBean.amount;
this.estimateArriveTime = DateFormatUtil.toYmdHms(
infoOriginBean.estimateArriveTime - 8 * 60 * 60 * 1000);
this.distance = infoOriginBean.distance;
this.signTime =
DateFormatUtil.toYmdHms(DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000);
this.ts = DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000;
}
}
(10)创建交易域:取消运单事务事实表实体类,并整合(1)与(2),采用取消时间
java
package com.atguigu.tms.realtime.beans;
import com.atguigu.tms.realtime.utils.DateFormatUtil;
import lombok.Data;
import java.math.BigDecimal;
/**
*交易域:取消运单事务事实表实体类
*/
@Data
public class DwdTradeCancelDetailBean {
// 运单明细ID
String id;
// 运单id
String orderId;
// 货物类型
String cargoType;
// 长cm
Integer volumeLength;
// 宽cm
Integer volumeWidth;
// 高cm
Integer volumeHeight;
// 重量 kg
BigDecimal weight;
// 取消时间
String cancelTime;
// 运单号
String orderNo;
// 运单状态
String status;
// 取件类型,1为网点自寄,2为上门取件
String collectType;
// 客户id
String userId;
// 收件人小区id
String receiverComplexId;
// 收件人省份id
String receiverProvinceId;
// 收件人城市id
String receiverCityId;
// 收件人区县id
String receiverDistrictId;
// 收件人姓名
String receiverName;
// 发件人小区id
String senderComplexId;
// 发件人省份id
String senderProvinceId;
// 发件人城市id
String senderCityId;
// 发件人区县id
String senderDistrictId;
// 发件人姓名
String senderName;
// 支付方式
String paymentType;
// 货物个数
Integer cargoNum;
// 金额
BigDecimal amount;
// 预计到达时间
String estimateArriveTime;
// 距离,单位:公里
BigDecimal distance;
// 时间戳
Long ts;
public void mergeBean(DwdOrderDetailOriginBean detailOriginBean, DwdOrderInfoOriginBean infoOriginBean) {
// 合并原始明细字段
this.id = detailOriginBean.id;
this.orderId = detailOriginBean.orderId;
this.cargoType = detailOriginBean.cargoType;
this.volumeLength = detailOriginBean.volumnLength;
this.volumeWidth = detailOriginBean.volumnWidth;
this.volumeHeight = detailOriginBean.volumnHeight;
this.weight = detailOriginBean.weight;
// 合并原始订单字段
this.orderNo = infoOriginBean.orderNo;
this.status = infoOriginBean.status;
this.collectType = infoOriginBean.collectType;
this.userId = infoOriginBean.userId;
this.receiverComplexId = infoOriginBean.receiverComplexId;
this.receiverProvinceId = infoOriginBean.receiverProvinceId;
this.receiverCityId = infoOriginBean.receiverCityId;
this.receiverDistrictId = infoOriginBean.receiverDistrictId;
this.receiverName = infoOriginBean.receiverName;
this.senderComplexId = infoOriginBean.senderComplexId;
this.senderProvinceId = infoOriginBean.senderProvinceId;
this.senderCityId = infoOriginBean.senderCityId;
this.senderDistrictId = infoOriginBean.senderDistrictId;
this.senderName = infoOriginBean.senderName;
this.paymentType = infoOriginBean.paymentType;
this.cargoNum = infoOriginBean.cargoNum;
this.amount = infoOriginBean.amount;
this.estimateArriveTime = DateFormatUtil.toYmdHms(
infoOriginBean.estimateArriveTime - 8 * 60 * 60 * 1000);
this.distance = infoOriginBean.distance;
this.cancelTime =
DateFormatUtil.toYmdHms(DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000);
this.ts = DateFormatUtil.toTs(
infoOriginBean.updateTime.replaceAll("T", " ")
.replaceAll("Z", ""), true)
+ 8 * 60 * 60 * 1000;
}
}