1
This commit is contained in:
@@ -48,6 +48,12 @@ public class TencentDocController extends BaseController {
|
||||
@Autowired
|
||||
private com.ruoyi.jarvis.mapper.TencentDocOperationLogMapper operationLogMapper;
|
||||
|
||||
@Autowired
|
||||
private com.ruoyi.jarvis.service.ITencentDocBatchPushService batchPushService;
|
||||
|
||||
@Autowired
|
||||
private com.ruoyi.jarvis.service.ITencentDocDelayedPushService delayedPushService;
|
||||
|
||||
/** Redis key前缀,用于存储上次处理的最大行数 */
|
||||
private static final String LAST_PROCESSED_ROW_KEY_PREFIX = "tendoc:last_row:";
|
||||
|
||||
@@ -1570,5 +1576,104 @@ public class TencentDocController extends BaseController {
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取批量推送记录列表(带操作日志)
|
||||
*/
|
||||
@GetMapping("/batchPushRecords")
|
||||
public AjaxResult getBatchPushRecords(@RequestParam(required = false) String fileId,
|
||||
@RequestParam(required = false) String sheetId,
|
||||
@RequestParam(defaultValue = "10") Integer limit) {
|
||||
try {
|
||||
// 如果没有指定文件ID,使用配置的默认值
|
||||
if (fileId == null || fileId.trim().isEmpty()) {
|
||||
fileId = tencentDocConfig.getFileId();
|
||||
}
|
||||
if (sheetId == null || sheetId.trim().isEmpty()) {
|
||||
sheetId = tencentDocConfig.getSheetId();
|
||||
}
|
||||
|
||||
List<com.ruoyi.jarvis.domain.TencentDocBatchPushRecord> records =
|
||||
batchPushService.getBatchPushRecordListWithLogs(fileId, sheetId, limit);
|
||||
|
||||
return AjaxResult.success(records);
|
||||
} catch (Exception e) {
|
||||
log.error("查询批量推送记录失败", e);
|
||||
return AjaxResult.error("查询批量推送记录失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取批量推送记录详情(包含操作日志)
|
||||
*/
|
||||
@GetMapping("/batchPushRecord/{batchId}")
|
||||
public AjaxResult getBatchPushRecordDetail(@PathVariable String batchId) {
|
||||
try {
|
||||
com.ruoyi.jarvis.domain.TencentDocBatchPushRecord record =
|
||||
batchPushService.getBatchPushRecord(batchId);
|
||||
|
||||
if (record == null) {
|
||||
return AjaxResult.error("未找到批次记录");
|
||||
}
|
||||
|
||||
return AjaxResult.success(record);
|
||||
} catch (Exception e) {
|
||||
log.error("查询批量推送记录详情失败", e);
|
||||
return AjaxResult.error("查询批量推送记录详情失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取推送状态和倒计时信息
|
||||
*/
|
||||
@GetMapping("/pushStatus")
|
||||
public AjaxResult getPushStatus() {
|
||||
try {
|
||||
Map<String, Object> status = batchPushService.getPushStatusAndCountdown();
|
||||
|
||||
// 添加最后一次成功的推送记录信息
|
||||
String fileId = tencentDocConfig.getFileId();
|
||||
String sheetId = tencentDocConfig.getSheetId();
|
||||
|
||||
if (fileId != null && sheetId != null) {
|
||||
com.ruoyi.jarvis.domain.TencentDocBatchPushRecord lastSuccess =
|
||||
batchPushService.getLastSuccessRecord(fileId, sheetId);
|
||||
status.put("lastSuccessRecord", lastSuccess);
|
||||
}
|
||||
|
||||
return AjaxResult.success(status);
|
||||
} catch (Exception e) {
|
||||
log.error("查询推送状态失败", e);
|
||||
return AjaxResult.error("查询推送状态失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动触发立即推送
|
||||
*/
|
||||
@PostMapping("/triggerPushNow")
|
||||
public AjaxResult triggerPushNow() {
|
||||
try {
|
||||
delayedPushService.executePushNow();
|
||||
return AjaxResult.success("推送已触发");
|
||||
} catch (Exception e) {
|
||||
log.error("触发推送失败", e);
|
||||
return AjaxResult.error("触发推送失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消待推送任务
|
||||
*/
|
||||
@PostMapping("/cancelPendingPush")
|
||||
public AjaxResult cancelPendingPush() {
|
||||
try {
|
||||
delayedPushService.cancelPendingPush();
|
||||
return AjaxResult.success("待推送任务已取消");
|
||||
} catch (Exception e) {
|
||||
log.error("取消待推送任务失败", e);
|
||||
return AjaxResult.error("取消待推送任务失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user