# hzero-common-interface-starter **Repository Path**: kenewstar/hzero-common-interface-starter ## Basic Information - **Project Name**: hzero-common-interface-starter - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-01 - **Last Updated**: 2026-02-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 使用方式 ## 表结构初始化 ```sql CREATE TABLE `interface_content` ( `id` bigint NOT NULL AUTO_INCREMENT, `content` longtext COLLATE utf8mb4_bin COMMENT '报文内容', `created_by` bigint NOT NULL DEFAULT '-1' COMMENT '创建人', `last_updated_by` bigint NOT NULL DEFAULT '-1' COMMENT '最近更新人', `creation_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `last_update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最近更新时间', `object_version_number` bigint NOT NULL DEFAULT '1' COMMENT '行版本号,用来处理锁', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=242 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='报文表'; CREATE TABLE `interface_log` ( `id` bigint NOT NULL AUTO_INCREMENT, `interface_type` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '接口类型代码', `request_id` varchar(64) COLLATE utf8mb4_bin NOT NULL COMMENT '请求id', `process_type` varchar(20) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '处理类型, single/batch', `inf_content_id` bigint NOT NULL COMMENT '报文id,interface_content.id', `business_key` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '业务主键', `batch_process_times` int DEFAULT NULL COMMENT '批次数量时长,毫秒', `single_process_times` int DEFAULT NULL COMMENT '单条处理时长,毫秒', `process_status` varchar(10) COLLATE utf8mb4_bin NOT NULL DEFAULT 'N' COMMENT 'N/C/S/E/P_S', `process_date` datetime DEFAULT NULL COMMENT '处理日期', `process_count` int NOT NULL DEFAULT '0' COMMENT '处理次数', `process_message` varchar(500) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '处理消息', `source_system_code` varchar(30) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '来源系统编码', `created_by` bigint NOT NULL DEFAULT '-1' COMMENT '创建人', `last_updated_by` bigint NOT NULL DEFAULT '-1' COMMENT '最近更新人', `creation_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `last_update_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最近更新时间', `object_version_number` bigint NOT NULL DEFAULT '1' COMMENT '行版本号,用来处理锁', `attribute_category` varchar(30) COLLATE utf8mb4_bin DEFAULT NULL, `attribute1` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute2` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute3` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute4` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute5` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute6` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute7` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute8` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute9` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute10` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute11` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute12` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute13` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute14` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, `attribute15` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL, PRIMARY KEY (`id`), KEY `interface_log_n1` (`inf_content_id`), KEY `interface_log_n2` (`business_key`), KEY `interface_log_n3` (`request_id`), KEY `interface_log_n4` (`interface_type`) ) ENGINE=InnoDB AUTO_INCREMENT=247 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='接口表,用于被动接收记录'; ``` ## 接口开发 实现类 ```java package com.kenewstar.springbootdemo.handler; import com.kenewstar.common.inf.annotation.InterfaceType; import com.kenewstar.common.inf.service.CommonBaseInfService; import org.springframework.stereotype.Component; @Component @InterfaceType("demo") public class DemoInfServiceImpl implements CommonBaseInfService { @Override public void processSingleData(DemoDTO singleData) { System.out.println(singleData); } } ``` Controller开发 ```java package com.kenewstar.springbootdemo.handler; import com.kenewstar.common.inf.dto.CommonRequestDTO; import com.kenewstar.common.inf.dto.CommonResponseDTO; import com.kenewstar.common.inf.service.BaseInvokeService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @Slf4j @RequestMapping("/demo") @RestController public class DemoController { @Autowired private BaseInvokeService baseInvokeService; @PostMapping("/demo") public CommonResponseDTO demoInf(@RequestBody CommonRequestDTO requestDTO) { return this.baseInvokeService.processInterfaceData("demo", requestDTO); } } ``` HTTP调用 ```http request ### 请求接口 POST http://localhost:8080/demo/demo Content-Type: application/json { "requestId": "192328394389438945", "sourceSystemCode": "ABC", "data": [ { "name": "hxk" } ] } ### 响应结果-成功 { "status": "success", "message": "处理成功", "requestId": "192328394389438945", "interfaceType": "demo", "sourceSystemCode": "ABC", "successTotal": 1, "errorTotal": 0, "data": [ { "processStatus": "S", "processMessage": "处理成功", "processDate": "2026-02-01 16:28:37", "name": "hxk", "abc": null } ] } ```