package com.kaidi.oa.web; import com.kaidi.oa.common.ApiResp; import com.kaidi.oa.domain.AutomationLog; import com.kaidi.oa.repository.AutomationLogRepository; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * H16 流程办结自动联动台账 (automation-logs). Read-only ledger of every downstream * effect the workflow engine fired on a form instance's 办结 transition * (TriggerRuleEngine). Listed newest-first; can also be filtered by instance. */ @RestController @RequestMapping("/api/oa/automation-logs") public class AutomationController { private final AutomationLogRepository automationLogRepo; public AutomationController(AutomationLogRepository automationLogRepo) { this.automationLogRepo = automationLogRepo; } /** Full触发台账, newest first. */ @GetMapping public ApiResp> list() { return ApiResp.ok(automationLogRepo.findAllByOrderByFiredAtDesc()); } /** All automation rows fired by one form instance. */ @GetMapping("/by-instance/{instanceId}") public ApiResp> byInstance(@PathVariable Long instanceId) { return ApiResp.ok(automationLogRepo.findByInstanceId(instanceId)); } }