package com.taoke.autopay.factory.js2;
|
|
import com.taoke.autopay.entity.ClientAdditionalInfo;
|
import com.taoke.autopay.entity.js2.OrderTask;
|
import com.taoke.autopay.entity.js2.OrderTaskExecutionDetail;
|
import com.taoke.autopay.utils.TimeUtil;
|
import com.taoke.autopay.vo.OrderTaskExecutionDetailVO;
|
import org.yeshi.utils.StringUtil;
|
|
/**
|
* @author
|
* @title: OrderTaskExecutionDetailFactory
|
* @description: 下单任务执行详情工厂类
|
* @date 2025/8/8
|
*/
|
public class OrderTaskExecutionDetailFactory {
|
|
/**
|
* 根据OrderTask、OrderTaskExecutionDetail和ClientAdditionalInfo创建OrderTaskExecutionDetailVO
|
*
|
* @param orderTask 下单任务实体
|
* @param orderTaskExecutionDetail 下单任务执行详情实体
|
* @param clientAdditionalInfo 客户端附加信息
|
* @return OrderTaskExecutionDetailVO对象
|
*/
|
public static OrderTaskExecutionDetailVO createOrderTaskExecutionDetailVO(
|
OrderTask orderTask,
|
OrderTaskExecutionDetail orderTaskExecutionDetail,
|
ClientAdditionalInfo clientAdditionalInfo) {
|
|
if (orderTask == null || orderTaskExecutionDetail == null) {
|
return null;
|
}
|
|
OrderTaskExecutionDetailVO.OrderTaskExecutionDetailVOBuilder builder = OrderTaskExecutionDetailVO.builder();
|
|
// 设置基本字段
|
builder.id(orderTaskExecutionDetail.getId())
|
.taskId(orderTaskExecutionDetail.getTaskId())
|
.clientId(orderTaskExecutionDetail.getClientId())
|
.orderNo(orderTaskExecutionDetail.getOrderNo())
|
.productName(orderTaskExecutionDetail.getProductName())
|
.shopName(orderTaskExecutionDetail.getShopName());
|
|
// 设置客户端附加信息
|
if (clientAdditionalInfo != null) {
|
builder.mobile(clientAdditionalInfo.getMobile())
|
.alipayAccount(clientAdditionalInfo.getAlipayAccount())
|
.alipayPassword(clientAdditionalInfo.getAlipayPassword());
|
}
|
|
// 根据执行状态设置执行类型
|
Integer executionStatus = orderTaskExecutionDetail.getExecutionStatus();
|
if (executionStatus != null) {
|
if (executionStatus == OrderTaskExecutionDetail.STATUS_NOT_ORDERED) {
|
builder.executionType(OrderTaskExecutionDetailVO.EXECUTION_TYPE_ORDER);
|
} else if (executionStatus == OrderTaskExecutionDetail.STATUS_ORDERED) {
|
builder.executionType(OrderTaskExecutionDetailVO.EXECUTION_TYPE_RECEIVE);
|
} else if (executionStatus == OrderTaskExecutionDetail.STATUS_RECEIVE_SUCCESS) {
|
builder.executionType(OrderTaskExecutionDetailVO.EXECUTION_TYPE_REVIEW);
|
}
|
}
|
|
// 设置口令内容作为key
|
if (!StringUtil.isNullOrEmpty(orderTask.getKeywordContent())) {
|
builder.key(orderTask.getKeywordContent());
|
}
|
|
// 处理时间字段
|
if (orderTaskExecutionDetail.getCreateTime() != null) {
|
builder.createTime(TimeUtil.getGernalTime(orderTaskExecutionDetail.getCreateTime().getTime(), "yyyy-MM-dd HH:mm:ss"));
|
}
|
|
|
return builder.build();
|
}
|
}
|