9 changed files with 485 additions and 0 deletions
-
25src/main/java/com/gaotao/config/RestTemplateConfig.java
-
11src/main/java/com/gaotao/modules/sys/controller/InterfaceLogController.java
-
21src/main/java/com/gaotao/modules/sys/dao/ApiInterfaceDao.java
-
20src/main/java/com/gaotao/modules/sys/dao/InterfaceLogDao.java
-
41src/main/java/com/gaotao/modules/sys/entity/ApiInterfaceEntity.java
-
5src/main/java/com/gaotao/modules/sys/service/InterfaceLogService.java
-
289src/main/java/com/gaotao/modules/sys/service/impl/InterfaceLogServiceImpl.java
-
25src/main/resources/mapper/sys/ApiInterfaceDao.xml
-
48src/main/resources/mapper/sys/InterfaceLogDao.xml
@ -0,0 +1,25 @@ |
|||
package com.gaotao.config; |
|||
|
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.http.client.SimpleClientHttpRequestFactory; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
/** |
|||
* RestTemplate配置 |
|||
*/ |
|||
@Configuration |
|||
public class RestTemplateConfig { |
|||
|
|||
@Bean |
|||
public RestTemplate restTemplate() { |
|||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); |
|||
// 设置连接超时时间(毫秒) |
|||
factory.setConnectTimeout(30000); |
|||
// 设置读取超时时间(毫秒) |
|||
factory.setReadTimeout(60000); |
|||
|
|||
return new RestTemplate(factory); |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,21 @@ |
|||
package com.gaotao.modules.sys.dao; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.gaotao.modules.sys.entity.ApiInterfaceEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* 接口配置Dao |
|||
*/ |
|||
@Mapper |
|||
public interface ApiInterfaceDao extends BaseMapper<ApiInterfaceEntity> { |
|||
|
|||
/** |
|||
* 根据site、buNo和interfaceName查询接口配置 |
|||
*/ |
|||
ApiInterfaceEntity getByInterfaceName(@Param("site") String site, |
|||
@Param("buNo") String buNo, |
|||
@Param("interfaceName") String interfaceName); |
|||
} |
|||
|
|||
@ -0,0 +1,41 @@ |
|||
package com.gaotao.modules.sys.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 接口配置表 |
|||
*/ |
|||
@Data |
|||
@TableName("api_Interface") |
|||
public class ApiInterfaceEntity implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 站点 |
|||
*/ |
|||
private String site; |
|||
|
|||
/** |
|||
* 业务单元编号 |
|||
*/ |
|||
private String buNo; |
|||
|
|||
/** |
|||
* 接口名称 |
|||
*/ |
|||
private String interfaceName; |
|||
|
|||
/** |
|||
* 接口IP |
|||
*/ |
|||
private String interfaceIp; |
|||
|
|||
/** |
|||
* 接口路径 |
|||
*/ |
|||
private String interfaceValue; |
|||
} |
|||
|
|||
@ -0,0 +1,25 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.gaotao.modules.sys.dao.ApiInterfaceDao"> |
|||
|
|||
<!-- 可根据自己的需求,是否要使用 --> |
|||
<resultMap type="com.gaotao.modules.sys.entity.ApiInterfaceEntity" id="apiInterfaceMap"> |
|||
<result property="site" column="site"/> |
|||
<result property="buNo" column="bu_no"/> |
|||
<result property="interfaceName" column="interface_name"/> |
|||
<result property="interfaceIp" column="interface_IP"/> |
|||
<result property="interfaceValue" column="interface_value"/> |
|||
</resultMap> |
|||
|
|||
<!-- 根据接口名称查询接口配置 --> |
|||
<select id="getByInterfaceName" resultMap="apiInterfaceMap"> |
|||
SELECT site, bu_no, interface_name, interface_IP, interface_value |
|||
FROM api_Interface WITH(NOLOCK) |
|||
WHERE site = #{site} |
|||
AND bu_no = #{buNo} |
|||
AND interface_name = #{interfaceName} |
|||
</select> |
|||
|
|||
</mapper> |
|||
|
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue