prefs: rest template init.

Signed-off-by: feihu.wang <wfh45678@163.com>
This commit is contained in:
feihu.wang
2020-01-06 19:41:19 +08:00
parent af5c31f7f6
commit 345debab86
8 changed files with 144 additions and 58 deletions

View File

@@ -1,8 +1,5 @@
package com.pgmmers.radar.config;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
@@ -11,11 +8,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.util.HashSet;

View File

@@ -0,0 +1,20 @@
package com.pgmmers.radar.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
@Configuration
public class RestTemplateConfig {
@Autowired
private RestTemplateBuilder restTemplateBuilder;
@Bean
public RestTemplate getRestTemplate() {
return restTemplateBuilder.build();
}
}

View File

@@ -44,6 +44,8 @@ public class ModelConfVO implements Serializable {
private String type;
private String comment;
public Long getId() {
return id;
}
@@ -107,4 +109,12 @@ public class ModelConfVO implements Serializable {
public void setType(String type) {
this.type = type;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
}

View File

@@ -4,4 +4,4 @@ import com.pgmmers.radar.model.ModelConfPO;
import tk.mybatis.mapper.common.Mapper;
public interface ModelConfMapper extends Mapper<ModelConfPO> {
}
}

View File

@@ -1,95 +1,155 @@
package com.pgmmers.radar.model;
import javax.persistence.Table;
import java.util.Date;
import javax.persistence.*;
@Table(name = "engine_model_conf")
public class ModelConfPO {
/**
* 自增ID主键
*/
private Long id;
private Long modelId;
/**
* 模型名称
*/
@Id
@GeneratedValue(generator = "JDBC")
private Integer id;
@Column(name = "model_id")
private Integer modelId;
private String name;
/**
* 模型文件路径
*/
private String path;
private String tag;
private String operation;
/**
* 模型更新时间
*/
@Column(name = "update_date")
private Date updateDate;
/**
* 模型类型
*/
private String type;
public Long getId() {
private String comment;
/**
* @return id
*/
public Integer getId() {
return id;
}
public void setId(Long id) {
/**
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return model_id
*/
public Integer getModelId() {
return modelId;
}
/**
* @param modelId
*/
public void setModelId(Integer modelId) {
this.modelId = modelId;
}
/**
* @return name
*/
public String getName() {
return name;
}
/**
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
* @return path
*/
public String getPath() {
return path;
}
/**
* @param path
*/
public void setPath(String path) {
this.path = path;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Long getModelId() {
return modelId;
}
public void setModelId(Long modelId) {
this.modelId = modelId;
}
/**
* @return tag
*/
public String getTag() {
return tag;
}
/**
* @param tag
*/
public void setTag(String tag) {
this.tag = tag;
}
/**
* @return operation
*/
public String getOperation() {
return operation;
}
/**
* @param operation
*/
public void setOperation(String operation) {
this.operation = operation;
}
}
/**
* @return update_date
*/
public Date getUpdateDate() {
return updateDate;
}
/**
* @param updateDate
*/
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
/**
* @return type
*/
public String getType() {
return type;
}
/**
* @param type
*/
public void setType(String type) {
this.type = type;
}
/**
* @return comment
*/
public String getComment() {
return comment;
}
/**
* @param comment
*/
public void setComment(String comment) {
this.comment = comment;
}
}

View File

@@ -86,6 +86,9 @@
<table tableName="DATA_MOBLE_INFO" domainObjectName="MobileInfo" selectByExampleQueryId="false">
<generatedKey column="ID" sqlStatement="JDBC" />
</table>
<table tableName="ENGINE_MODEL_CONF" domainObjectName="ModelConf" selectByExampleQueryId="false">
<generatedKey column="ID" sqlStatement="JDBC" />
</table>
</context>
</generatorConfiguration>

View File

@@ -47,10 +47,10 @@ mongodb:
url: mongodb://localhost:27017/radar
mobile:
info:
path: D:/soft/moble_info.csv # 手机号码归属地文件
path: D:/radar/moble_info.csv # 手机号码归属地文件
ip2region:
db:
path: D:/soft/ip2region.db # IP地址库文件
path: D:/radar/ip2region.db # IP地址库文件
elasticsearch:
ip: localhost
port: 9300
@@ -68,5 +68,6 @@ sys:
app: engine # admin 或者 engine 根据启动的项目名称进行选择
entity-duplicate-insert: false # 事件是否允许重复插入
mongo-restore-days: 93 # 事件保存时间默认3个月
workdir: d:\\radar
server:
port: 9090

View File

@@ -254,7 +254,7 @@ public class AntiFraudEngineImpl implements AntiFraudEngine {
result.getAdaptationMap().put("score", score);
}
result.setSuccess(true);
data.put("adapations", result.getAdaptationMap());
data.put("adaptations", result.getAdaptationMap());
return result;
}