This commit is contained in:
van
2026-04-01 15:52:55 +08:00
parent 6a88a68320
commit 921c8a2374
9 changed files with 399 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ package com.ruoyi.web.controller.jarvis;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.jarvis.domain.dto.WeComInboundRequest;
import com.ruoyi.jarvis.service.IWeComInboundService;
import com.ruoyi.jarvis.service.IWeComInboundTraceService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
@@ -25,6 +26,8 @@ public class WeComInboundController {
@Resource
private IWeComInboundService weComInboundService;
@Resource
private IWeComInboundTraceService weComInboundTraceService;
@PostMapping("/inbound")
public AjaxResult inbound(
@@ -33,7 +36,9 @@ public class WeComInboundController {
if (!StringUtils.hasText(inboundSecret) || !inboundSecret.equals(secret)) {
return AjaxResult.error("拒绝访问");
}
String reply = weComInboundService.handleInbound(body != null ? body : new WeComInboundRequest());
WeComInboundRequest req = body != null ? body : new WeComInboundRequest();
String reply = weComInboundService.handleInbound(req);
weComInboundTraceService.recordInbound(req, reply);
Map<String, Object> data = new HashMap<>(2);
data.put("reply", reply != null ? reply : "");
return AjaxResult.success(data);

View File

@@ -0,0 +1,46 @@
package com.ruoyi.web.controller.jarvis;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.jarvis.domain.WeComInboundTrace;
import com.ruoyi.jarvis.service.IWeComInboundTraceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 企微 inbound 消息追踪查询
*/
@RestController
@RequestMapping("/jarvis/wecom/inboundTrace")
public class WeComInboundTraceController extends BaseController {
@Autowired
private IWeComInboundTraceService weComInboundTraceService;
@PreAuthorize("@ss.hasPermi('jarvis:wecom:inboundTrace:list')")
@GetMapping("/list")
public TableDataInfo list(WeComInboundTrace query) {
startPage();
List<WeComInboundTrace> list = weComInboundTraceService.selectWeComInboundTraceList(query);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('jarvis:wecom:inboundTrace:list')")
@GetMapping("/{id}")
public AjaxResult getInfo(@PathVariable Long id) {
return success(weComInboundTraceService.selectWeComInboundTraceById(id));
}
@PreAuthorize("@ss.hasPermi('jarvis:wecom:inboundTrace:remove')")
@Log(title = "企微消息跟踪", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(weComInboundTraceService.deleteWeComInboundTraceByIds(ids));
}
}