From 16ddfc8e22559480a2b039b896f1e882f286c9c9 Mon Sep 17 00:00:00 2001
From: 6c <420680616@qq.com>
Date: 星期五, 12 十二月 2025 15:10:47 +0800
Subject: [PATCH] 接口集成
---
src/main/java/com/product/integration/controller/InterfaceIntegrationController.java | 84 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 82 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/product/integration/controller/InterfaceIntegrationController.java b/src/main/java/com/product/integration/controller/InterfaceIntegrationController.java
index 662470c..ae8ecd4 100644
--- a/src/main/java/com/product/integration/controller/InterfaceIntegrationController.java
+++ b/src/main/java/com/product/integration/controller/InterfaceIntegrationController.java
@@ -1,12 +1,14 @@
package com.product.integration.controller;
import com.product.admin.config.SystemCode;
+import com.product.common.lang.StringUtils;
import com.product.core.config.CoreConst;
import com.product.core.entity.FieldSetEntity;
import com.product.core.entity.RequestParameterEntity;
import com.product.core.exception.BaseException;
import com.product.core.spring.context.SpringMVCContextHolder;
import com.product.integration.config.CmnConst;
+import com.product.integration.config.IntegrationCode;
import com.product.integration.service.InterfaceIntegrationService;
import com.product.integration.service.idel.IInterfaceIntegrationService;
import com.product.module.sys.version.ApiVersion;
@@ -31,6 +33,46 @@
@Autowired
private InterfaceIntegrationService interfaceIntegrationService;
+ /**
+ * 鍗曚釜鏌ヨ
+ * @param request
+ * @return
+ */
+ @RequestMapping(value = "/find/{version}")
+ @ApiVersion(1)
+ public String find(HttpServletRequest request) {
+ try {
+ FieldSetEntity fse = null;
+ Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
+ if (bean != null) {
+ RequestParameterEntity reqp = (RequestParameterEntity) bean;
+ fse = reqp.getFormData();
+ }
+ if (bean == null || fse == null) {
+ SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
+ return error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
+ }
+ if (fse.getTableName() == null || !CmnConst.PRODUCT_SYS_INTERFACE_INTEGRATION.equals(fse.getTableName()) || StringUtils.isEmpty(fse.getUUID())) {
+ SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
+ return error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
+ }
+ return BaseUtil.success(interfaceIntegrationService.find(fse));
+ } catch (BaseException e) {
+ e.printStackTrace();
+ SpringMVCContextHolder.getSystemLogger().error(e);
+ return error(e);
+ } catch (Exception e) {
+ e.printStackTrace();
+ SpringMVCContextHolder.getSystemLogger().error(e);
+ return error(IntegrationCode.FIND_FAIL);
+ }
+ }
+
+ /**
+ * 淇濆瓨
+ * @param request
+ * @return
+ */
@RequestMapping(value = "/save/{version}")
@ApiVersion(1)
public String save(HttpServletRequest request) {
@@ -52,11 +94,49 @@
IInterfaceIntegrationService service = (IInterfaceIntegrationService) getProxyInstance(interfaceIntegrationService);
return BaseUtil.success(service.save(fse));
} catch (BaseException e) {
+ e.printStackTrace();
SpringMVCContextHolder.getSystemLogger().error(e);
- return error(e.getCode(), e.getMessageInfo());
+ return error(e);
} catch (Exception e) {
+ e.printStackTrace();
SpringMVCContextHolder.getSystemLogger().error(e);
- return error(e.getMessage());
+ return error(IntegrationCode.SAVE_FAIL);
+ }
+ }
+
+ /**
+ * 绔嬪嵆鎵ц
+ * @param request
+ * @return
+ */
+ @RequestMapping(value = "/execute/{version}")
+ @ApiVersion(1)
+ public String execute(HttpServletRequest request) {
+ try {
+ FieldSetEntity fse = null;
+ Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
+ if (bean != null) {
+ RequestParameterEntity reqp = (RequestParameterEntity) bean;
+ fse = reqp.getFormData();
+ }
+ if (bean == null || fse == null) {
+ SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
+ return error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
+ }
+ if (fse.getTableName() == null || !CmnConst.PRODUCT_SYS_INTERFACE_INTEGRATION.equals(fse.getTableName())) {
+ SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
+ return error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
+ }
+ interfaceIntegrationService.timedTaskTrigger(fse.getUUID());
+ return OK();
+ } catch (BaseException e) {
+ e.printStackTrace();
+ SpringMVCContextHolder.getSystemLogger().error(e);
+ return error(e);
+ } catch (Exception e) {
+ e.printStackTrace();
+ SpringMVCContextHolder.getSystemLogger().error(e);
+ return error(IntegrationCode.INTERFACE_INTEGRATION_EXECUTE_FAIL);
}
}
}
--
Gitblit v1.9.2