提交 22f2307a authored 作者: 吕本才's avatar 吕本才

refactor(order): 重构旺店通订单同步任务以使用请求对象

将直接传递参数改为使用SyncStockoutRequest对象封装请求参数,提高代码可维护性
上级 f5a2a4ea
...@@ -10,10 +10,10 @@ public class SyncStockoutRequest { ...@@ -10,10 +10,10 @@ public class SyncStockoutRequest {
// 出库单状态:5已取消, 10待放回(拣货待放回)小于该值的都是已取消的单子, 50待审核, 51缺货, 52缺货待入库, // 出库单状态:5已取消, 10待放回(拣货待放回)小于该值的都是已取消的单子, 50待审核, 51缺货, 52缺货待入库,
// 53 WMS已接单, 54 获取电子面单, 58 档口锁定, 60 待分配, 61 排队中, 63 待补货, 65 待处理, // 53 WMS已接单, 54 获取电子面单, 58 档口锁定, 60 待分配, 61 排队中, 63 待补货, 65 待处理,
// 70 待发货, 73 爆款锁定, 74 预打包, 75 待拣货, 77 拣货中,PDA拣货后, 79 已拣货, 90 延时发货, 110已完成 // 70 待发货, 73 爆款锁定, 74 预打包, 75 待拣货, 77 拣货中,PDA拣货后, 79 已拣货, 90 延时发货, 110已完成
private String status = "50,51,52,53,54,58,60,61,63,65,70,73,74,75,77,79,90,110"; private String status = "50,51,52,53,54,58,60,61,63,65,70,73,74,75,77,79,90,110";
private Integer statusType = 3; private Integer statusType = 3;
private Date startTime; private Date startTime;
private Date endTime; private Date endTime;
// 同步类型:0 定时同步 1 手动同步
private Integer syncType; private Integer syncType;
} }
...@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpStatus; import cn.hutool.http.HttpStatus;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.sfa.job.pojo.order.request.SyncStockoutRequest;
import com.sfa.job.pojo.response.SyncOrderDetailDto; import com.sfa.job.pojo.response.SyncOrderDetailDto;
import com.sfa.job.service.order.IWdtQimenStockoutOrderSyncService; import com.sfa.job.service.order.IWdtQimenStockoutOrderSyncService;
import com.xxl.job.core.context.XxlJobContext; import com.xxl.job.core.context.XxlJobContext;
...@@ -43,10 +44,22 @@ public class WdtQimenStockoutOrderTask { ...@@ -43,10 +44,22 @@ public class WdtQimenStockoutOrderTask {
boolean jsonFlag = JSONUtil.isJson(jobParam); boolean jsonFlag = JSONUtil.isJson(jobParam);
Date startTime = null; Date startTime = null;
Date endTime = null; Date endTime = null;
String status = null;
Integer statusType = null;
SyncStockoutRequest syncStockoutRequest = new SyncStockoutRequest();
// 同步类型 ,接口为1手动同步,0 xxljob自动同步
syncStockoutRequest.setSyncType(0);
if (jsonFlag) { if (jsonFlag) {
JSONObject jobParamJson = JSONObject.parseObject(jobParam); JSONObject jobParamJson = JSONObject.parseObject(jobParam);
startTime = jobParamJson.getDate("startTime"); startTime = jobParamJson.getDate("startTime");
endTime = jobParamJson.getDate("endTime"); endTime = jobParamJson.getDate("endTime");
status = jobParamJson.getString("status");
statusType = jobParamJson.getInteger("statusType");
syncStockoutRequest.setStatus(status);
syncStockoutRequest.setStatusType(statusType);
syncStockoutRequest.setStartTime(startTime);
syncStockoutRequest.setEndTime(endTime);
} }
// 简单模拟分片处理,这里输出每个分片的信息 // 简单模拟分片处理,这里输出每个分片的信息
...@@ -54,7 +67,7 @@ public class WdtQimenStockoutOrderTask { ...@@ -54,7 +67,7 @@ public class WdtQimenStockoutOrderTask {
XxlJobHelper.log("xxl-job开始同步-旺店通订单明细api接口数据"); XxlJobHelper.log("xxl-job开始同步-旺店通订单明细api接口数据");
// 定时任务不设定开始时间和结束时间 // 定时任务不设定开始时间和结束时间
SyncOrderDetailDto detailDto = stockoutOrderSyncService.syncStockoutOrder(startTime, endTime, 0, 200); SyncOrderDetailDto detailDto = stockoutOrderSyncService.syncStockoutOrder(syncStockoutRequest, 200);
XxlJobHelper.log("xxl-job结束同步-旺店通订单明细api接口数据, 共同步订单{}条数据,订单明细{}条,订单批次号:{},订单的开始时间{}和结束时间{}", XxlJobHelper.log("xxl-job结束同步-旺店通订单明细api接口数据, 共同步订单{}条数据,订单明细{}条,订单批次号:{},订单的开始时间{}和结束时间{}",
detailDto.getOrderCount(), detailDto.getOrderDetailCount(), detailDto.getBatchNo(), detailDto.getOrderCount(), detailDto.getOrderDetailCount(), detailDto.getBatchNo(),
DateUtil.formatDateTime(detailDto.getStartTime()), DateUtil.formatDateTime(detailDto.getEndTime())); DateUtil.formatDateTime(detailDto.getStartTime()), DateUtil.formatDateTime(detailDto.getEndTime()));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论