新增 iwork 附件回调接口

This commit is contained in:
chenbowen
2025-11-28 18:47:21 +08:00
parent 0c22975df0
commit 6ab387cba0
5 changed files with 137 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.security.PermitAll;
import static com.zt.plat.framework.common.pojo.CommonResult.success; import static com.zt.plat.framework.common.pojo.CommonResult.success;
@@ -55,6 +56,13 @@ public class IWorkIntegrationController {
return success(integrationService.createWorkflow(reqVO)); return success(integrationService.createWorkflow(reqVO));
} }
@PermitAll
@PostMapping("/callback/file")
@Operation(summary = "iWork 文件回调:根据文件 URL 保存为附件并创建业务附件关联")
public CommonResult<Long> callbackFile(@Valid @RequestBody IWorkFileCallbackReqVO reqVO) {
return success(integrationService.handleFileCallback(reqVO));
}
@PostMapping("/workflow/void") @PostMapping("/workflow/void")
@Operation(summary = "作废 / 干预 iWork 流程") @Operation(summary = "作废 / 干预 iWork 流程")
public CommonResult<IWorkOperationRespVO> voidWorkflow(@Valid @RequestBody IWorkWorkflowVoidReqVO reqVO) { public CommonResult<IWorkOperationRespVO> voidWorkflow(@Valid @RequestBody IWorkWorkflowVoidReqVO reqVO) {

View File

@@ -0,0 +1,21 @@
package com.zt.plat.module.system.controller.admin.integration.iwork.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
@Schema(name = "IWorkFileCallbackReqVO", description = "iWork 文件回调请求 VO")
@Data
public class IWorkFileCallbackReqVO {
@Schema(description = "文件下载 URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://example.com/file.pdf")
@NotBlank(message = "文件 URL 不能为空")
private String fileUrl;
@Schema(description = "业务 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
@NotBlank(message = "业务 ID 不能为空")
private String businessId;
@Schema(description = "文件名称,可选", example = "合同附件.pdf")
private String fileName;
}

View File

@@ -1,5 +1,6 @@
package com.zt.plat.module.system.framework.rpc.config; package com.zt.plat.module.system.framework.rpc.config;
import com.zt.plat.module.infra.api.businessfile.BusinessFileApi;
import com.zt.plat.module.infra.api.config.ConfigApi; import com.zt.plat.module.infra.api.config.ConfigApi;
import com.zt.plat.module.infra.api.file.FileApi; import com.zt.plat.module.infra.api.file.FileApi;
import com.zt.plat.module.infra.api.websocket.WebSocketSenderApi; import com.zt.plat.module.infra.api.websocket.WebSocketSenderApi;
@@ -7,6 +8,6 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@Configuration(value = "systemRpcConfiguration", proxyBeanMethods = false) @Configuration(value = "systemRpcConfiguration", proxyBeanMethods = false)
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, ConfigApi.class}) @EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, ConfigApi.class, BusinessFileApi.class})
public class RpcConfiguration { public class RpcConfiguration {
} }

View File

@@ -4,6 +4,7 @@ import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkAuth
import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkAuthRegisterRespVO; import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkAuthRegisterRespVO;
import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkAuthTokenReqVO; import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkAuthTokenReqVO;
import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkAuthTokenRespVO; import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkAuthTokenRespVO;
import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkFileCallbackReqVO;
import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkOperationRespVO; import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkOperationRespVO;
import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkUserInfoReqVO; import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkUserInfoReqVO;
import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkUserInfoRespVO; import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkUserInfoRespVO;
@@ -39,4 +40,12 @@ public interface IWorkIntegrationService {
* 在 iWork 中对已有流程执行作废或干预。 * 在 iWork 中对已有流程执行作废或干预。
*/ */
IWorkOperationRespVO voidWorkflow(IWorkWorkflowVoidReqVO reqVO); IWorkOperationRespVO voidWorkflow(IWorkWorkflowVoidReqVO reqVO);
/**
* 处理来自 iWork 的文件回调:根据文件 URL 下载并保存为附件,同时创建业务附件关联记录。
*
* @param reqVO 回调请求
* @return 创建的业务附件关联记录 ID 或附件 ID视实现而定
*/
Long handleFileCallback(IWorkFileCallbackReqVO reqVO);
} }