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
7574acd8
提交
7574acd8
authored
2月 12, 2025
作者:
吕本才
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、优化区分定时任务空执行和报错情况
上级
f99a75cc
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
18 行增加
和
9 行删除
+18
-9
FinanceSyncOrderDetailDto.java
.../com/sfa/job/pojo/response/FinanceSyncOrderDetailDto.java
+1
-0
FinanceOrderSyncServiceImpl.java
...a/job/service/order/impl/FinanceOrderSyncServiceImpl.java
+13
-6
FinanceOrderTask.java
src/main/java/com/sfa/job/xxljob/order/FinanceOrderTask.java
+4
-3
没有找到文件。
src/main/java/com/sfa/job/pojo/response/FinanceSyncOrderDetailDto.java
浏览文件 @
7574acd8
...
...
@@ -27,5 +27,6 @@ public class FinanceSyncOrderDetailDto {
* 错误信息
*/
private
String
message
;
private
Integer
code
=
200
;
}
src/main/java/com/sfa/job/service/order/impl/FinanceOrderSyncServiceImpl.java
浏览文件 @
7574acd8
...
...
@@ -2,6 +2,7 @@ package com.sfa.job.service.order.impl;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.http.HttpStatus
;
import
com.alibaba.fastjson2.JSONArray
;
import
com.alibaba.fastjson2.JSONReader
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
...
...
@@ -91,17 +92,22 @@ public class FinanceOrderSyncServiceImpl extends ServiceImpl<FinanceOrderMapper,
}
}
if
(
ObjectUtils
.
isEmpty
(
endTime
))
{
endTime
=
DateUtils
.
addMinutes
(
startTime
,
60
);
}
// 调用查询旺店通接口api 获取最新日期前的2小时
Date
currentLatest
=
DateUtils
.
addHours
(
new
Date
(),
-
2
);
if
(
currentLatest
.
compareTo
(
startTime
)
<
0
)
{
detailDto
.
setMessage
(
String
.
format
(
"开始时间%s不能大于当前时间%s"
,
startTime
,
currentLatest
));
log
.
warn
(
detailDto
.
getMessage
());
detailDto
.
setTotalCount
(
0
);
detailDto
.
setBatchNo
(
batchNo
);
detailDto
.
setStartTime
(
startTime
);
detailDto
.
setEndTime
(
endTime
);
detailDto
.
setMessage
(
String
.
format
(
"开始时间%s不能大于当前时间%s"
,
DateUtil
.
formatDateTime
(
startTime
),
DateUtil
.
formatDateTime
(
currentLatest
)
));
log
.
warn
(
String
.
format
(
"开始时间%s不能大于当前时间%s"
,
DateUtil
.
formatDateTime
(
startTime
),
DateUtil
.
formatDateTime
(
currentLatest
)
));
return
detailDto
;
}
if
(
ObjectUtils
.
isEmpty
(
endTime
))
{
endTime
=
DateUtils
.
addMinutes
(
startTime
,
60
);
}
log
.
info
(
"查询订单参数:开始时间{},结束时间{},当前页:{}"
,
DateUtil
.
formatDateTime
(
startTime
),
DateUtil
.
formatDateTime
(
endTime
),
beginPageNo
.
get
());
WangdiantongQueryVO
wangdiantongQueryVO
=
new
WangdiantongQueryVO
();
...
...
@@ -229,12 +235,13 @@ public class FinanceOrderSyncServiceImpl extends ServiceImpl<FinanceOrderMapper,
// 记录错误日志表 collect_error_info
CollectErrorInfo
errorInfo
=
new
CollectErrorInfo
();
errorInfo
.
setBatchNo
(
batchNo
);
errorInfo
.
setType
(
""
);
errorInfo
.
setType
(
"
xxlJob
"
);
errorInfo
.
setErrorMsg
(
e
.
getMessage
());
errorInfo
.
setEndTime
(
endTime
);
errorInfo
.
setStartTime
(
startTime
);
errorInfo
.
setCollectTime
(
new
Date
());
errorInfoDao
.
insert
(
errorInfo
);
detailDto
.
setCode
(
HttpStatus
.
HTTP_INTERNAL_ERROR
);
detailDto
.
setMessage
(
e
.
toString
());
}
return
detailDto
;
...
...
src/main/java/com/sfa/job/xxljob/order/FinanceOrderTask.java
浏览文件 @
7574acd8
...
...
@@ -2,6 +2,7 @@ package com.sfa.job.xxljob.order;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.http.HttpStatus
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.sfa.job.pojo.response.FinanceSyncOrderDetailDto
;
import
com.sfa.job.service.order.FinanceOrderSyncService
;
...
...
@@ -45,10 +46,10 @@ public class FinanceOrderTask {
XxlJobHelper
.
log
(
"xxl-job结束同步-旺店通订单明细api接口数据, 共同步订单{}条数据,订单明细{}条,订单批次号:{},订单的开始时间{}和结束时间{}"
,
detailDto
.
getOrderCount
(),
detailDto
.
getOrderDetailCount
(),
detailDto
.
getBatchNo
(),
DateUtil
.
formatDateTime
(
detailDto
.
getStartTime
()),
DateUtil
.
formatDateTime
(
detailDto
.
getEndTime
())
);
if
(
ObjectUtil
.
isNotEmpty
(
detailDto
.
getMessage
())
){
XxlJobHelper
.
handle
Fail
(
detailDto
.
getMessage
(
));
if
(
ObjectUtil
.
equals
(
HttpStatus
.
HTTP_OK
,
detailDto
.
getCode
())
){
XxlJobHelper
.
handle
Success
(
JSONObject
.
toJSONString
(
detailDto
));
}
else
{
XxlJobHelper
.
handle
Success
(
JSONObject
.
toJSONString
(
detailDto
));
XxlJobHelper
.
handle
Fail
(
detailDto
.
getMessage
(
));
}
return
detailDto
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论