Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-module-job
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-module-job
Commits
342136fc
提交
342136fc
authored
4月 23, 2026
作者:
douxy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加定时任务执行旺店通其他出入库库存数据获取
上级
141925c3
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
94 行增加
和
31 行删除
+94
-31
TestController.java
...ain/java/com/sfa/job/controller/order/TestController.java
+0
-31
WdtOtherStockSyncJobHandler.java
...com/sfa/job/xxljob/stock/WdtOtherStockSyncJobHandler.java
+94
-0
没有找到文件。
src/main/java/com/sfa/job/controller/order/TestController.java
deleted
100644 → 0
浏览文件 @
141925c3
package
com
.
sfa
.
job
.
controller
.
order
;
import
com.sfa.job.service.stock.IWdtOtherStockSyncService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Map
;
/**
* @Author: DouXinYu
* @Date: 2026-04-18 14:26
* @Description:
*/
@RestController
public
class
TestController
{
@Autowired
private
IWdtOtherStockSyncService
wdtOtherStockSyncService
;
@PostMapping
(
"/test"
)
public
void
get
(
@RequestBody
Map
<
String
,
String
>
params
){
wdtOtherStockSyncService
.
syncLastDayOtherStockOut
(
params
.
get
(
"startTime"
),
params
.
get
(
"endTime"
));
}
@PostMapping
(
"/testIn"
)
public
void
getIn
(
@RequestBody
Map
<
String
,
String
>
params
){
wdtOtherStockSyncService
.
syncLastDayOtherStockIn
(
params
.
get
(
"startTime"
),
params
.
get
(
"endTime"
));
}
}
src/main/java/com/sfa/job/xxljob/stock/WdtOtherStockSyncJobHandler.java
0 → 100644
浏览文件 @
342136fc
package
com
.
sfa
.
job
.
jobhandler
;
import
com.sfa.job.service.stock.IWdtOtherStockSyncService
;
import
com.xxl.job.core.context.XxlJobHelper
;
import
com.xxl.job.core.handler.annotation.XxlJob
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
/**
* 旺店通其他出入库单同步 XXL-Job 任务
*
* @Author: DouXinYu
* @Date: 2026-04-23
*/
@Slf4j
@Component
public
class
WdtOtherStockSyncJobHandler
{
@Autowired
private
IWdtOtherStockSyncService
wdtOtherStockSyncService
;
private
static
final
DateTimeFormatter
FORMATTER
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
/**
* 同步昨日其他出库单(XXL-Job 任务)
* 任务调度建议:0 0 1 * * ? 每天凌晨1点
*/
@XxlJob
(
"wdtSyncLastDayOtherStockOutJob"
)
public
void
syncLastDayOtherStockOutJob
()
{
log
.
info
(
"===== XXL-Job 开始执行:同步昨日旺店通其他出库单 ====="
);
XxlJobHelper
.
log
(
"XXL-Job 开始执行:同步昨日旺店通其他出库单"
);
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
yesterdayStart
=
now
.
minusDays
(
1
).
withHour
(
0
).
withMinute
(
0
).
withSecond
(
0
);
LocalDateTime
yesterdayEnd
=
now
.
minusDays
(
1
).
withHour
(
23
).
withMinute
(
59
).
withSecond
(
59
);
String
startTime
=
yesterdayStart
.
format
(
FORMATTER
);
String
endTime
=
yesterdayEnd
.
format
(
FORMATTER
);
log
.
info
(
"同步时间范围:{} ~ {}"
,
startTime
,
endTime
);
XxlJobHelper
.
log
(
"同步时间范围:{} ~ {}"
,
startTime
,
endTime
);
long
start
=
System
.
currentTimeMillis
();
try
{
wdtOtherStockSyncService
.
syncLastDayOtherStockOut
(
startTime
,
endTime
);
log
.
info
(
"===== XXL-Job 同步昨日其他出库单完成,耗时:{}ms ====="
,
System
.
currentTimeMillis
()
-
start
);
XxlJobHelper
.
log
(
"同步完成,耗时:{}ms"
,
System
.
currentTimeMillis
()
-
start
);
XxlJobHelper
.
handleSuccess
(
"同步昨日其他出库单成功"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"===== XXL-Job 同步昨日其他出库单异常 ====="
,
e
);
XxlJobHelper
.
log
(
"同步异常:%s"
,
e
.
getMessage
());
XxlJobHelper
.
handleFail
(
"同步昨日其他出库单失败:"
+
e
.
getMessage
());
}
}
/**
* 同步昨日其他入库单(XXL-Job 任务)
* 任务调度建议:0 10 1 * * ? 每天凌晨1点10分
*/
@XxlJob
(
"wdtSyncLastDayOtherStockInJob"
)
public
void
syncLastDayOtherStockInJob
()
{
log
.
info
(
"===== XXL-Job 开始执行:同步昨日旺店通其他入库单 ====="
);
XxlJobHelper
.
log
(
"XXL-Job 开始执行:同步昨日旺店通其他入库单"
);
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
yesterdayStart
=
now
.
minusDays
(
1
).
withHour
(
0
).
withMinute
(
0
).
withSecond
(
0
);
LocalDateTime
yesterdayEnd
=
now
.
minusDays
(
1
).
withHour
(
23
).
withMinute
(
59
).
withSecond
(
59
);
String
startTime
=
yesterdayStart
.
format
(
FORMATTER
);
String
endTime
=
yesterdayEnd
.
format
(
FORMATTER
);
log
.
info
(
"同步时间范围:{} ~ {}"
,
startTime
,
endTime
);
XxlJobHelper
.
log
(
"同步时间范围:{} ~ {}"
,
startTime
,
endTime
);
long
start
=
System
.
currentTimeMillis
();
try
{
wdtOtherStockSyncService
.
syncLastDayOtherStockIn
(
startTime
,
endTime
);
log
.
info
(
"===== XXL-Job 同步昨日其他入库单完成,耗时:{}ms ====="
,
System
.
currentTimeMillis
()
-
start
);
XxlJobHelper
.
log
(
"同步完成,耗时:{}ms"
,
System
.
currentTimeMillis
()
-
start
);
XxlJobHelper
.
handleSuccess
(
"同步昨日其他入库单成功"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"===== XXL-Job 同步昨日其他入库单异常 ====="
,
e
);
XxlJobHelper
.
log
(
"同步异常:%s"
,
e
.
getMessage
());
XxlJobHelper
.
handleFail
(
"同步昨日其他入库单失败:"
+
e
.
getMessage
());
}
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论