mirror of
https://gitee.com/freshday/radar.git
synced 2026-03-22 04:37:16 +08:00
11
README.md
11
README.md
@@ -12,7 +12,8 @@
|
||||
现在使用Springboot进行升级,并删除了很多本地化功能,只保留风控引擎核心,更具通用型,二次开发成本低。
|
||||
|
||||
## 项目架构
|
||||
前后端分离,单页面应用
|
||||
|
||||
前后端分离架构
|
||||
后端采用: SpringBoot + Mysql + MongoDB + Redis + Groovy
|
||||
---
|
||||
前端采用: React(SPA)
|
||||
@@ -45,9 +46,17 @@ Groovy: 脚本引擎,风控规则最后都生成 groovy 脚本, 可以动
|
||||
### Rule: 规则
|
||||
在计算 abstraction 和 activation 之前,需要先检查数据是否正常,检查就是按照rule 进行检测。
|
||||
|
||||
---
|
||||
## Manual
|
||||
### 模型配置
|
||||

|
||||

|
||||
|
||||
### 系统API对接
|
||||

|
||||

|
||||
---
|
||||
|
||||
## Contact to
|
||||
Copyright by feihu wang,
|
||||
Any Question mail to wfh45678@163.com , qq 240159429
|
||||
198
pom.xml
Normal file
198
pom.xml
Normal file
@@ -0,0 +1,198 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<modules>
|
||||
<module>radar-admin</module>
|
||||
<module>radar-engine</module>
|
||||
<module>radar-dal</module>
|
||||
<module>radar-dao</module>
|
||||
<module>radar-service</module>
|
||||
<module>radar-commons</module>
|
||||
<module>radar-service-impl</module>
|
||||
</modules>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.7.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.pgmmers</groupId>
|
||||
<artifactId>radar</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>radar</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>2.1.7.RELEASE</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<version>2.1.7.RELEASE</version>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>2.1.7.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<version>2.1.7.RELEASE</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.generator</groupId>
|
||||
<artifactId>mybatis-generator-core</artifactId>
|
||||
<version>1.3.7</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
<version>5.1.10</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper-spring-boot-starter</artifactId>
|
||||
<version>2.1.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.58</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mongodb</groupId>
|
||||
<artifactId>mongo-java-driver</artifactId>
|
||||
<version>3.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.lionsoul</groupId>
|
||||
<artifactId>ip2region</artifactId>
|
||||
<version>1.7.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>2.3.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
<version>2.1.7.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
<version>2.1.7.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-redis</artifactId>
|
||||
<version>2.1.10.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>2.1.7.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.2.10</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.47</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
<version>2.1.7.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.1.16</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
<version>2.1.7.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
||||
140
radar-admin/pom.xml
Normal file
140
radar-admin/pom.xml
Normal file
@@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>radar</artifactId>
|
||||
<groupId>com.pgmmers</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>radar-admin</artifactId>
|
||||
<name>radar-admin</name>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<properties>
|
||||
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/tk.mybatis/mapper -->
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper</artifactId>
|
||||
<version>4.0.3</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/tk.mybatis/mapper-spring-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper-spring-boot-starter</artifactId>
|
||||
<version>2.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ThymeLeaf 依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pgmmers</groupId>
|
||||
<artifactId>radar-service</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pgmmers</groupId>
|
||||
<artifactId>radar-service-impl</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>radar-admin</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.1.7.RELEASE</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
14
radar-admin/src/main/java/com/pgmmers/AdminApplication.java
Normal file
14
radar-admin/src/main/java/com/pgmmers/AdminApplication.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.pgmmers;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import tk.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.pgmmers.radar.mapper")
|
||||
public class AdminApplication
|
||||
{
|
||||
public static void main( String[] args ){
|
||||
SpringApplication.run(AdminApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.pgmmers.radar.aop;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
/**
|
||||
* method log and cost time.
|
||||
* @author by feihu.wang
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class LogAspect {
|
||||
public static Logger logger = LoggerFactory.getLogger(LogAspect.class);
|
||||
|
||||
@Pointcut("execution(public * com.pgmmers.radar.controller.*.*(..))")
|
||||
public void logControllerAspect(){}
|
||||
|
||||
@Pointcut("execution(public * com.pgmmers.radar.service.*.*.*(..))")
|
||||
public void logServiceAspect(){}
|
||||
|
||||
|
||||
@Pointcut("logControllerAspect() || logServiceAspect()")
|
||||
public void logAspect(){
|
||||
}
|
||||
|
||||
|
||||
@Around("logAspect()")
|
||||
public Object deAround(ProceedingJoinPoint joinPoint) throws Throwable{
|
||||
long begin = System.currentTimeMillis();
|
||||
logger.info("start exec:{}", joinPoint.getSignature().toString());
|
||||
Object object = joinPoint.proceed();
|
||||
long end = System.currentTimeMillis();
|
||||
logger.info("finished...{}, exec cost {}", joinPoint.getSignature().toString(), end-begin);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.pgmmers.radar.config;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Configuration
|
||||
@AutoConfigureBefore(RedisAutoConfiguration.class)
|
||||
public class RedisCacheAutoConfig {
|
||||
|
||||
@Bean("redisTemplate")
|
||||
public RedisTemplate<String, Serializable> redisTemplate(LettuceConnectionFactory redisConnectionFactory) {
|
||||
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
|
||||
GenericJackson2JsonRedisSerializer jackson2JsonRedisSerializer = new GenericJackson2JsonRedisSerializer();
|
||||
RedisTemplate<String, Serializable> template = new RedisTemplate<>();
|
||||
template.setKeySerializer(stringRedisSerializer);
|
||||
template.setValueSerializer(jackson2JsonRedisSerializer);
|
||||
template.setConnectionFactory(redisConnectionFactory);
|
||||
template.setHashKeySerializer(stringRedisSerializer);// Hash key序列化
|
||||
template.setHashValueSerializer(jackson2JsonRedisSerializer);// Hash value序列化
|
||||
return template;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
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;
|
||||
import org.springframework.cache.interceptor.KeyGenerator;
|
||||
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;
|
||||
import java.util.Set;
|
||||
|
||||
@Configuration
|
||||
//@EnableCaching // 开启缓存支持
|
||||
public class RedisConfig extends CachingConfigurerSupport {
|
||||
|
||||
@Resource
|
||||
private LettuceConnectionFactory lettuceConnectionFactory;
|
||||
|
||||
@Bean
|
||||
public KeyGenerator keyGenerator() {
|
||||
return new KeyGenerator() {
|
||||
@Override
|
||||
public Object generate(Object target, Method method, Object... params) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(target.getClass().getName());
|
||||
sb.append(method.getName());
|
||||
for (Object obj : params) {
|
||||
sb.append(obj.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 缓存管理器
|
||||
@Bean
|
||||
public CacheManager cacheManager() {
|
||||
RedisCacheManager.RedisCacheManagerBuilder builder = RedisCacheManager.RedisCacheManagerBuilder
|
||||
.fromConnectionFactory(lettuceConnectionFactory);
|
||||
@SuppressWarnings("serial")
|
||||
Set<String> cacheNames = new HashSet<String>() {
|
||||
{
|
||||
add("codeNameCache");
|
||||
}
|
||||
};
|
||||
builder.initialCacheNames(cacheNames);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* RedisTemplate配置
|
||||
*/
|
||||
//@Bean
|
||||
public RedisTemplate<String, Object> redisTemplate(LettuceConnectionFactory lettuceConnectionFactory) {
|
||||
// 设置序列化
|
||||
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
|
||||
jackson2JsonRedisSerializer.setObjectMapper(om);
|
||||
// 配置redisTemplate
|
||||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
||||
redisTemplate.setConnectionFactory(lettuceConnectionFactory);
|
||||
RedisSerializer<?> stringSerializer = new StringRedisSerializer();
|
||||
redisTemplate.setKeySerializer(stringSerializer);// key序列化
|
||||
redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);// value序列化
|
||||
redisTemplate.setHashKeySerializer(stringSerializer);// Hash key序列化
|
||||
redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);// Hash value序列化
|
||||
redisTemplate.afterPropertiesSet();
|
||||
return redisTemplate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.pgmmers.radar.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.pgmmers.radar.dal.bean.AbstractionQuery;
|
||||
import com.pgmmers.radar.enums.PluginType;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.service.engine.vo.DataColumnInfo;
|
||||
import com.pgmmers.radar.service.enums.DataType;
|
||||
import com.pgmmers.radar.service.model.AbstractionService;
|
||||
import com.pgmmers.radar.service.model.FieldService;
|
||||
import com.pgmmers.radar.service.model.PreItemService;
|
||||
import com.pgmmers.radar.vo.model.AbstractionVO;
|
||||
import com.pgmmers.radar.vo.model.FieldVO;
|
||||
import com.pgmmers.radar.vo.model.PreItemVO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/services/v1/abstraction")
|
||||
public class AbstractionApiController {
|
||||
|
||||
@Autowired
|
||||
private AbstractionService abstractionService;
|
||||
|
||||
@Autowired
|
||||
private FieldService fieldService;
|
||||
@Autowired
|
||||
private PreItemService preItemService;
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public CommonResult get(@PathVariable Long id) {
|
||||
CommonResult result = new CommonResult();
|
||||
AbstractionVO abstractionVO = abstractionService.get(id);
|
||||
if (abstractionVO != null) {
|
||||
result.setSuccess(true);
|
||||
result.getData().put("abstraction", abstractionVO);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/list/{modelId}")
|
||||
public CommonResult list(@PathVariable Long modelId) {
|
||||
return abstractionService.list(modelId);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public CommonResult query(@RequestBody AbstractionQuery query) {
|
||||
return abstractionService.query(query);
|
||||
}
|
||||
|
||||
@GetMapping("/datacolumns/{modelId}")
|
||||
public CommonResult getDataColumns(@PathVariable Long modelId) {
|
||||
List<DataColumnInfo> list = new ArrayList<>();
|
||||
// 1、Data
|
||||
DataColumnInfo ds = new DataColumnInfo(DataType.FIELDS.getDesc(), DataType.FIELDS.getName());
|
||||
List<FieldVO> listField = fieldService.listField(modelId);
|
||||
if(listField!=null&&listField.size()!=0){
|
||||
for (FieldVO field : listField) {
|
||||
ds.addChildren(field.getLabel(), field.getFieldName(), field.getFieldType());
|
||||
}
|
||||
list.add(ds);
|
||||
}
|
||||
|
||||
// 2、PREPARE
|
||||
ds = new DataColumnInfo(DataType.PREITEMS.getDesc(), DataType.PREITEMS.getName());
|
||||
List<PreItemVO> listPreItem = preItemService.listPreItem(modelId);
|
||||
if(listPreItem!=null&&listPreItem.size()!=0){
|
||||
for (PreItemVO preItem : listPreItem) {
|
||||
PluginType pt = PluginType.get(preItem.getPlugin());
|
||||
if (StringUtils.isNoneBlank(pt.getType())) {
|
||||
ds.addChildren(preItem.getLabel(), preItem.getDestField(), pt.getType());
|
||||
} else {
|
||||
List<DataColumnInfo> children = new ArrayList<DataColumnInfo>();
|
||||
JSONArray array = JSONArray.parseArray(pt.getMeta());
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject obj = array.getJSONObject(i);
|
||||
children.add(new DataColumnInfo(obj.getString("title"), obj.getString("column"), obj
|
||||
.getString("type")));
|
||||
}
|
||||
ds.addChildren(preItem.getLabel(), preItem.getDestField(), children);
|
||||
}
|
||||
}
|
||||
list.add(ds);
|
||||
}
|
||||
|
||||
CommonResult result = new CommonResult();
|
||||
result.setSuccess(true);
|
||||
result.getData().put("list", list);
|
||||
return result;
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public CommonResult save(@RequestBody AbstractionVO abstraction) {
|
||||
return abstractionService.save(abstraction);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
public CommonResult delete(@RequestBody Long[] id) {
|
||||
return abstractionService.delete(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.pgmmers.radar.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.ActivationQuery;
|
||||
import com.pgmmers.radar.enums.FieldType;
|
||||
import com.pgmmers.radar.enums.PluginType;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.service.engine.vo.DataColumnInfo;
|
||||
import com.pgmmers.radar.service.enums.DataType;
|
||||
import com.pgmmers.radar.service.model.*;
|
||||
import com.pgmmers.radar.vo.model.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/services/v1/activation")
|
||||
public class ActivationApiController {
|
||||
|
||||
@Autowired
|
||||
private ActivationService activationService;
|
||||
|
||||
@Autowired
|
||||
private FieldService fieldService;
|
||||
@Autowired
|
||||
private AbstractionService abstractionService;
|
||||
@Autowired
|
||||
private PreItemService preItemService;
|
||||
@Autowired
|
||||
private RuleService ruleService;
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public CommonResult get(@PathVariable Long id) {
|
||||
CommonResult result = new CommonResult();
|
||||
ActivationVO activationVO = activationService.get(id);
|
||||
if (activationVO != null) {
|
||||
result.setSuccess(true);
|
||||
result.getData().put("activation", activationVO);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public CommonResult query(@RequestBody ActivationQuery query) {
|
||||
return activationService.query(query);
|
||||
}
|
||||
|
||||
@GetMapping("/datacolumns/{modelId}")
|
||||
public CommonResult getDataColumns(@PathVariable Long modelId) {
|
||||
List<DataColumnInfo> list = new ArrayList<DataColumnInfo>();
|
||||
// 1、Data
|
||||
DataColumnInfo ds = new DataColumnInfo(DataType.FIELDS.getDesc(), DataType.FIELDS.getName());
|
||||
List<FieldVO> listField = fieldService.listField(modelId);
|
||||
for (FieldVO field : listField) {
|
||||
ds.addChildren(field.getLabel(), field.getFieldName(), field.getFieldType());
|
||||
}
|
||||
list.add(ds);
|
||||
|
||||
// 2、PREPARE
|
||||
ds = new DataColumnInfo(DataType.PREITEMS.getDesc(), DataType.PREITEMS.getName());
|
||||
List<PreItemVO> listPreItem = preItemService.listPreItem(modelId);
|
||||
for (PreItemVO preItem : listPreItem) {
|
||||
PluginType pt = PluginType.get(preItem.getPlugin());
|
||||
if (StringUtils.isNoneBlank(pt.getType())) {
|
||||
ds.addChildren(preItem.getLabel(), preItem.getDestField(), pt.getType());
|
||||
} else {
|
||||
List<DataColumnInfo> children = new ArrayList<>();
|
||||
JSONArray array = JSONArray.parseArray(pt.getMeta());
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject obj = array.getJSONObject(i);
|
||||
children.add(new DataColumnInfo(obj.getString("title"), obj.getString("column"), obj
|
||||
.getString("type")));
|
||||
}
|
||||
ds.addChildren(preItem.getLabel(), preItem.getDestField(), children);
|
||||
}
|
||||
}
|
||||
list.add(ds);
|
||||
|
||||
// 3、ABSTRACTION
|
||||
List<AbstractionVO> listAbstract = abstractionService.listAbstraction(modelId);
|
||||
ds = new DataColumnInfo(DataType.ABSTRACTIONS.getDesc(), DataType.ABSTRACTIONS.getName());
|
||||
if (listAbstract != null) {
|
||||
for (AbstractionVO abs : listAbstract) {
|
||||
ds.addChildren(abs.getLabel(), abs.getName(), FieldType.DOUBLE.name());
|
||||
}
|
||||
}
|
||||
|
||||
list.add(ds);
|
||||
|
||||
CommonResult result = new CommonResult();
|
||||
result.setSuccess(true);
|
||||
result.getData().put("list", list);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/rulecolumns/{modelId}")
|
||||
public CommonResult getRuleColumns(@PathVariable Long modelId) {
|
||||
List<DataColumnInfo> list = new ArrayList<>();
|
||||
List<ActivationVO> listActivation=activationService.listActivation(modelId);
|
||||
if(listActivation!=null){
|
||||
for(ActivationVO activation:listActivation){
|
||||
DataColumnInfo ds=new DataColumnInfo(activation.getLabel(),activation.getActivationName());
|
||||
List<RuleVO> listRule=ruleService.listRule(activation.getId());
|
||||
for(RuleVO rule:listRule){
|
||||
ds.addChildren(rule.getLabel(), rule.getName(),rule.getId()+"");
|
||||
}
|
||||
list.add(ds);
|
||||
}
|
||||
}
|
||||
|
||||
CommonResult result = new CommonResult();
|
||||
result.setSuccess(true);
|
||||
result.getData().put("list", list);
|
||||
return result;
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public CommonResult save(@RequestBody ActivationVO activation) {
|
||||
return activationService.save(activation);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
public CommonResult delete(@RequestBody Long[] id) {
|
||||
return activationService.delete(id);
|
||||
}
|
||||
|
||||
@PostMapping("/updateOrder")
|
||||
public CommonResult updateOrder(@RequestParam Long activationId, @RequestParam String ruleOrder) {
|
||||
return activationService.updateOrder(activationId,ruleOrder);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.pgmmers.radar.controller;
|
||||
|
||||
|
||||
import com.pgmmers.radar.enums.FieldType;
|
||||
import com.pgmmers.radar.enums.PluginType;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.util.RandomValidateCode;
|
||||
import com.pgmmers.radar.vo.common.PluginVO;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/services/v1/common")
|
||||
public class CommonApiController {
|
||||
|
||||
public static Logger logger = LoggerFactory.getLogger(CommonApiController.class);
|
||||
|
||||
|
||||
@GetMapping("/plugins")
|
||||
public CommonResult plugins() {
|
||||
CommonResult result = new CommonResult();
|
||||
List<PluginVO> plugins = new ArrayList<PluginVO>();
|
||||
for (PluginType pt : PluginType.values()) {
|
||||
plugins.add(new PluginVO(pt));
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.getData().put("plugins", plugins);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/fieldtypes")
|
||||
public CommonResult fieldTypes() {
|
||||
CommonResult result = new CommonResult();
|
||||
List<HashMap<String,Object>> fields = new ArrayList<HashMap<String,Object>>();
|
||||
for (FieldType ft : FieldType.values()) {
|
||||
//fields.add(ft.name());
|
||||
HashMap<String,Object> map=new LinkedHashMap<String,Object>();
|
||||
map.put("name", ft.name());
|
||||
map.put("desc", ft.getDesc());
|
||||
fields.add(map);
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.getData().put("fields", fields);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getCaptcha")
|
||||
public void getCaptcha(HttpServletRequest request, HttpServletResponse response) {
|
||||
response.setContentType("image/jpeg");// 设置相应类型,告诉浏览器输出的内容为图片
|
||||
response.setHeader("Pragma", "No-cache");// 设置响应头信息,告诉浏览器不要缓存此内容
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setDateHeader("Expire", 0);
|
||||
RandomValidateCode randomValidateCode = new RandomValidateCode();
|
||||
try {
|
||||
randomValidateCode.genRandcode(request, response);//输出图片方法
|
||||
} catch (Exception e) {
|
||||
logger.error("get captcha error", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.pgmmers.radar.controller;
|
||||
|
||||
|
||||
import com.pgmmers.radar.dal.bean.DataListQuery;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.service.model.DataListsService;
|
||||
import com.pgmmers.radar.vo.model.DataListsVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/services/v1/datalist")
|
||||
public class DataListApiController {
|
||||
|
||||
@Autowired
|
||||
private DataListsService dataListsService;
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public CommonResult get(@PathVariable Long id) {
|
||||
CommonResult result = new CommonResult();
|
||||
DataListsVO dataList = dataListsService.get(id);
|
||||
if (dataList != null) {
|
||||
result.setSuccess(true);
|
||||
result.getData().put("datalist", dataList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/list/{modelId}")
|
||||
public CommonResult list(@PathVariable Long modelId) {
|
||||
return dataListsService.list(modelId);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public CommonResult query(@RequestBody DataListQuery query) {
|
||||
return dataListsService.query(query);
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
public CommonResult save(@RequestBody DataListsVO dataList) {
|
||||
return dataListsService.save(dataList);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
public CommonResult delete(@RequestBody Long[] id) {
|
||||
return dataListsService.delete(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.pgmmers.radar.controller;
|
||||
|
||||
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.service.model.DataListsService;
|
||||
import com.pgmmers.radar.vo.model.DataListMetaVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/services/v1/datalistmeta")
|
||||
public class DataListMetaApiController {
|
||||
|
||||
@Autowired
|
||||
private DataListsService dataListsService;
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public CommonResult get(@PathVariable Long id) {
|
||||
CommonResult result = new CommonResult();
|
||||
DataListMetaVO dataListMeta = dataListsService.getMeta(id);
|
||||
if (dataListMeta != null) {
|
||||
result.setSuccess(true);
|
||||
result.getData().put("meta", dataListMeta);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/list/{dataListId}")
|
||||
public CommonResult list(@PathVariable Long dataListId) {
|
||||
return dataListsService.listMeta(dataListId);
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
public CommonResult save(@RequestBody List<DataListMetaVO> listDataListMeta) {
|
||||
return dataListsService.saveMeta(listDataListMeta);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
public CommonResult delete(List<Long> listId) {
|
||||
return dataListsService.deleteMeta(listId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.pgmmers.radar.controller;
|
||||
|
||||
|
||||
import com.pgmmers.radar.dal.bean.DataListRecordQuery;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.service.model.DataListsService;
|
||||
import com.pgmmers.radar.vo.model.DataListRecordVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/services/v1/datalistrecord")
|
||||
public class DataListRecordApiController {
|
||||
|
||||
@Autowired
|
||||
private DataListsService dataListsService;
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public CommonResult get(@PathVariable Long id) {
|
||||
CommonResult result = new CommonResult();
|
||||
DataListRecordVO dataListRecord = dataListsService.getRecord(id);
|
||||
if (dataListRecord != null) {
|
||||
result.setSuccess(true);
|
||||
result.getData().put("record", dataListRecord);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public CommonResult query(@RequestBody DataListRecordQuery query) {
|
||||
return dataListsService.queryRecord(query);
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
public CommonResult save(@RequestBody DataListRecordVO dataListRecord) {
|
||||
return dataListsService.saveRecord(dataListRecord);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
public CommonResult delete(@RequestBody Long[] id) {
|
||||
return dataListsService.deleteRecord(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,319 @@
|
||||
package com.pgmmers.radar.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.EventExportQuery;
|
||||
import com.pgmmers.radar.dal.bean.EventQuery;
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.dal.bean.TermQuery;
|
||||
import com.pgmmers.radar.enums.PluginType;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.service.engine.vo.DataColumnInfo;
|
||||
import com.pgmmers.radar.service.enums.DataType;
|
||||
import com.pgmmers.radar.service.logs.EventService;
|
||||
import com.pgmmers.radar.service.model.ActivationService;
|
||||
import com.pgmmers.radar.service.model.FieldService;
|
||||
import com.pgmmers.radar.service.model.PreItemService;
|
||||
import com.pgmmers.radar.service.model.RuleService;
|
||||
import com.pgmmers.radar.vo.common.FieldValueVO;
|
||||
import com.pgmmers.radar.vo.model.ActivationVO;
|
||||
import com.pgmmers.radar.vo.model.FieldVO;
|
||||
import com.pgmmers.radar.vo.model.PreItemVO;
|
||||
import com.pgmmers.radar.vo.model.RuleVO;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@RestController
|
||||
@RequestMapping("/services/v1/event")
|
||||
public class EventApiController {
|
||||
|
||||
@Autowired
|
||||
private EventService eventService;
|
||||
@Autowired
|
||||
private FieldService fieldService;
|
||||
@Autowired
|
||||
private PreItemService preItemService;
|
||||
|
||||
@Autowired
|
||||
private ActivationService activationService;
|
||||
|
||||
@Autowired
|
||||
private RuleService ruleService;
|
||||
|
||||
|
||||
@PostMapping("/query")
|
||||
public CommonResult query(@RequestBody EventQuery query) {
|
||||
CommonResult result = new CommonResult();
|
||||
List<Object> list = eventService.query(query);
|
||||
result.getData().put("page", list);
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/search")
|
||||
public CommonResult search(@RequestBody TermQuery term, HttpSession session) {
|
||||
CommonResult result = new CommonResult();
|
||||
PageResult<Object> page = new PageResult<>(1, 10, 0, new ArrayList<>());
|
||||
//page = eventService.query(term);
|
||||
if (page != null) {
|
||||
result.getData().put("page", page);
|
||||
result.setSuccess(true);
|
||||
} else {
|
||||
page = new PageResult<>(1, 10, 0, new ArrayList<>());
|
||||
result.getData().put("page", page);
|
||||
result.setSuccess(true);
|
||||
result.setMsg("查询失败");
|
||||
}
|
||||
session.setAttribute("searchTerm", term);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/export")
|
||||
public CommonResult exportExcel(EventExportQuery query, HttpSession session) {
|
||||
session.setAttribute("exportQuery", query);
|
||||
CommonResult result = new CommonResult();
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/download")
|
||||
public void downloadExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
TermQuery term = (TermQuery) request.getSession().getAttribute("searchTerm");
|
||||
if (term == null || term.getModelId() == null) {
|
||||
return;
|
||||
}
|
||||
EventExportQuery query = (EventExportQuery) request.getSession().getAttribute("exportQuery");
|
||||
|
||||
if (query == null) {
|
||||
return;
|
||||
}
|
||||
String[] fieldIds = query.getFields();
|
||||
String[] preItems = query.getPreItems();
|
||||
String[] activations = query.getActivations();
|
||||
String[] rules = query.getRules();
|
||||
|
||||
Map<String, String> fieldIdMap = new HashMap<String, String>();
|
||||
Map<String, String> itemsIdMap = new HashMap<String, String>();
|
||||
Map<String, String> actIdMap = new HashMap<String, String>();
|
||||
Map<String, String> ruleIdMap = new HashMap<String, String>();
|
||||
|
||||
for (int i = 0; i < fieldIds.length; i++) {
|
||||
fieldIdMap.put(fieldIds[i], "");
|
||||
}
|
||||
|
||||
for (int i = 0; i < preItems.length; i++) {
|
||||
itemsIdMap.put(preItems[i], "");
|
||||
}
|
||||
|
||||
for (int i = 0; i < activations.length; i++) {
|
||||
actIdMap.put(activations[i], "");
|
||||
}
|
||||
|
||||
for (int i = 0; i < rules.length; i++) {
|
||||
ruleIdMap.put(rules[i], "");
|
||||
}
|
||||
|
||||
term.setPageNo(1);
|
||||
// 暂时限制最大导出1W条
|
||||
term.setPageSize(10000);
|
||||
|
||||
PageResult<Object> page = eventService.query(term);
|
||||
List<Object> records = page.getList();
|
||||
|
||||
List<FieldVO> fieldList = fieldService.listField(term.getModelId());
|
||||
List<PreItemVO> preitemList = preItemService.listPreItem(term
|
||||
.getModelId());
|
||||
List<ActivationVO> activationList = activationService
|
||||
.listActivation(term.getModelId());
|
||||
List<RuleVO> ruleList = ruleService
|
||||
.listRuleByModelId(term.getModelId());
|
||||
|
||||
// 关联 rule id 与 activation
|
||||
for (ActivationVO act : activationList) {
|
||||
List<RuleVO> ruleVOList = ruleService.listRule(act.getId());
|
||||
for (RuleVO rule : ruleVOList) {
|
||||
if (ruleIdMap.containsKey(rule.getName())) {
|
||||
ruleIdMap.put(rule.getName(), act.getActivationName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置title 和 字段 key
|
||||
List<String> keyList4Field = new ArrayList<>();
|
||||
List<String> titleList4Field = new ArrayList<>();
|
||||
|
||||
for (FieldVO field : fieldList) {
|
||||
if (!fieldIdMap.containsKey(field.getFieldName())) {
|
||||
continue;
|
||||
}
|
||||
keyList4Field.add(field.getFieldName());
|
||||
titleList4Field.add(field.getLabel());
|
||||
}
|
||||
|
||||
// preitem field
|
||||
List<Object> keyList4Item = new ArrayList<>();
|
||||
List<String> titleList4Item = new ArrayList<>();
|
||||
for (PreItemVO item : preitemList) {
|
||||
if (!itemsIdMap.containsKey(item.getDestField())) {
|
||||
continue;
|
||||
}
|
||||
PluginType plugin = Enum
|
||||
.valueOf(PluginType.class, item.getPlugin());
|
||||
String type = plugin.getType();
|
||||
String meta = plugin.getMeta();
|
||||
|
||||
if (type != null) {
|
||||
keyList4Item.add(item.getDestField());
|
||||
titleList4Item.add(item.getLabel());
|
||||
} else {
|
||||
List<JSONObject> metaArray = JSONArray.parseArray(meta,
|
||||
JSONObject.class);
|
||||
for (JSONObject col : metaArray) {
|
||||
keyList4Item.add(new FieldValueVO(item.getDestField(), col
|
||||
.getString("column")));
|
||||
titleList4Item.add(item.getLabel() + "."
|
||||
+ col.getString("title"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// activation field
|
||||
List<Object> keyList4Act = new ArrayList<>();
|
||||
List<String> titleList4Act = new ArrayList<>();
|
||||
for (ActivationVO act : activationList) {
|
||||
if (!actIdMap.containsKey(act.getActivationName())) {
|
||||
continue;
|
||||
}
|
||||
keyList4Act.add(new FieldValueVO(act.getActivationName(), "risk"));
|
||||
keyList4Act.add(new FieldValueVO(act.getActivationName(), "score"));
|
||||
titleList4Act.add(act.getLabel() + "." + "风险级别");
|
||||
titleList4Act.add(act.getLabel() + "." + "分数");
|
||||
}
|
||||
|
||||
// rule field
|
||||
List<Object> keyList4Rule = new ArrayList<>();
|
||||
List<String> titleList4Rule = new ArrayList<>();
|
||||
for (RuleVO rule : ruleList) {
|
||||
if (!ruleIdMap.containsKey(rule.getName())) {
|
||||
continue;
|
||||
}
|
||||
// keyList4Rule.add(new FieldValueVO(ruleIdMap.get(rule.getId()),
|
||||
// "rule_" + rule.getId(), "key"));
|
||||
keyList4Rule.add(new FieldValueVO(ruleIdMap.get(rule.getName()),
|
||||
"rule_" + rule.getId(), "desc"));
|
||||
keyList4Rule.add(new FieldValueVO(ruleIdMap.get(rule.getName()),
|
||||
"rule_" + rule.getId(), "value"));
|
||||
|
||||
// titleList4Rule.add(rule.getLabel() + ".key");
|
||||
titleList4Rule.add(rule.getLabel() + ".desc");
|
||||
titleList4Rule.add(rule.getLabel() + ".value");
|
||||
|
||||
}
|
||||
|
||||
Workbook workbook = eventService.createExcel(records, keyList4Field,
|
||||
titleList4Field, keyList4Item, titleList4Item, keyList4Act,
|
||||
titleList4Act, keyList4Rule, titleList4Rule);
|
||||
String file = "e:\\tmp\\" + System.currentTimeMillis() + ".xlsx";
|
||||
FileOutputStream fos = null;
|
||||
|
||||
|
||||
response.setContentType("application/ms-excel");// 设置相应类型,告诉浏览器输出的内容为图片
|
||||
response.setHeader("Pragma", "No-cache");// 设置响应头信息,告诉浏览器不要缓存此内容
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setDateHeader("Expire", 0);
|
||||
OutputStream os = null;
|
||||
try {
|
||||
// fos = new FileOutputStream(new File(file));
|
||||
// workbook.write(fos);
|
||||
|
||||
os = response.getOutputStream();
|
||||
workbook.write(os);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (os != null) {
|
||||
try {
|
||||
os.flush();
|
||||
os.close();
|
||||
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/datacolumns/{modelId}")
|
||||
public CommonResult getDataColumns(@PathVariable Long modelId) {
|
||||
List<DataColumnInfo> list = new ArrayList<DataColumnInfo>();
|
||||
// 1、Data
|
||||
DataColumnInfo ds = new DataColumnInfo(DataType.FIELDS.getDesc(),
|
||||
DataType.FIELDS.getName());
|
||||
List<FieldVO> listField = fieldService.listField(modelId);
|
||||
if (listField != null && listField.size() != 0) {
|
||||
for (FieldVO field : listField) {
|
||||
ds.addChildren(field.getLabel(), field.getFieldName(), "");
|
||||
}
|
||||
list.add(ds);
|
||||
}
|
||||
|
||||
// 2、PREPARE
|
||||
ds = new DataColumnInfo(DataType.PREITEMS.getDesc(),
|
||||
DataType.PREITEMS.getName());
|
||||
List<PreItemVO> listPreItem = preItemService.listPreItem(modelId);
|
||||
if (listPreItem != null && listPreItem.size() != 0) {
|
||||
for (PreItemVO preItem : listPreItem) {
|
||||
ds.addChildren(preItem.getLabel(), preItem.getDestField(), "");
|
||||
}
|
||||
list.add(ds);
|
||||
}
|
||||
|
||||
// 3、ACTIVATION
|
||||
ds = new DataColumnInfo(DataType.ACTIVATIONS.getDesc(),
|
||||
DataType.ACTIVATIONS.getName());
|
||||
List<ActivationVO> listActivation = activationService
|
||||
.listActivation(modelId);
|
||||
if (listActivation != null && listActivation.size() != 0) {
|
||||
for (ActivationVO activation : listActivation) {
|
||||
ds.addChildren(activation.getLabel(),
|
||||
activation.getActivationName(), "");
|
||||
}
|
||||
list.add(ds);
|
||||
}
|
||||
|
||||
// 4、 RULE
|
||||
ds = new DataColumnInfo(DataType.RULES.getDesc(),
|
||||
DataType.RULES.getName());
|
||||
List<RuleVO> listRule = ruleService.listRuleByModelId(modelId);
|
||||
if (listRule != null && listRule.size() != 0) {
|
||||
for (RuleVO rule : listRule) {
|
||||
ds.addChildren(rule.getLabel(), rule.getName(), "");
|
||||
}
|
||||
list.add(ds);
|
||||
}
|
||||
|
||||
CommonResult result = new CommonResult();
|
||||
result.setSuccess(true);
|
||||
result.getData().put("list", list);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.pgmmers.radar.controller;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.FieldQuery;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.service.model.FieldService;
|
||||
import com.pgmmers.radar.vo.model.FieldVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/services/v1/field")
|
||||
public class FieldApiController {
|
||||
|
||||
@Autowired
|
||||
private FieldService fieldService;
|
||||
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public CommonResult get(@PathVariable Long id) {
|
||||
CommonResult result = new CommonResult();
|
||||
FieldVO fieldVO = fieldService.get(id);
|
||||
if (fieldVO != null) {
|
||||
result.setSuccess(true);
|
||||
result.getData().put("field", fieldVO);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public CommonResult query(@RequestBody FieldQuery query) {
|
||||
return fieldService.query(query);
|
||||
}
|
||||
|
||||
@GetMapping("/list/{modelId}")
|
||||
public CommonResult list(@PathVariable Long modelId) {
|
||||
CommonResult result = new CommonResult();
|
||||
result.setSuccess(true);
|
||||
result.getData().put("field", fieldService.listField(modelId));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
public CommonResult save(@RequestBody FieldVO field) {
|
||||
return fieldService.save(field);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
public CommonResult delete(@RequestBody Long[] id) {
|
||||
return fieldService.delete(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.pgmmers.radar.controller;
|
||||
|
||||
|
||||
import com.pgmmers.radar.dal.bean.ModelQuery;
|
||||
import com.pgmmers.radar.enums.StatusType;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.service.model.ModelService;
|
||||
import com.pgmmers.radar.vo.admin.UserVO;
|
||||
import com.pgmmers.radar.vo.model.ModelVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/services/v1/model")
|
||||
public class ModelApiController {
|
||||
|
||||
public static Logger logger = LoggerFactory.getLogger(ModelApiController.class);
|
||||
|
||||
@Autowired
|
||||
private ModelService modelService;
|
||||
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public CommonResult get(@PathVariable Long id) {
|
||||
CommonResult result = new CommonResult();
|
||||
ModelVO modelVO = modelService.get(id);
|
||||
if (modelVO != null) {
|
||||
result.setSuccess(true);
|
||||
result.getData().put("model", modelVO);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public CommonResult list(HttpServletRequest request) {
|
||||
HttpSession session = request.getSession();
|
||||
UserVO user = (UserVO) session.getAttribute("user");
|
||||
CommonResult result = new CommonResult();
|
||||
if (user == null) {
|
||||
result.setMsg("session已过期");
|
||||
return result;
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.getData().put("modelList", modelService.listModel(user.getCode(), null));
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/list/{merchantCode}")
|
||||
public CommonResult list(@PathVariable String merchantCode) {
|
||||
CommonResult result = new CommonResult();
|
||||
result.setSuccess(true);
|
||||
result.getData().put("modelList", modelService.listModel(merchantCode, null));
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public CommonResult query(@RequestBody ModelQuery query, HttpServletRequest request) {
|
||||
CommonResult result = new CommonResult();
|
||||
|
||||
HttpSession session = request.getSession();
|
||||
UserVO user = (UserVO) session.getAttribute("user");
|
||||
if (user == null) {
|
||||
result.setMsg("session已过期");
|
||||
return result;
|
||||
}
|
||||
query.setMerchantCode(user.getCode());
|
||||
return modelService.query(query);
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
public CommonResult save(@RequestBody ModelVO model, HttpServletRequest request) {
|
||||
HttpSession session = request.getSession();
|
||||
UserVO user = (UserVO) session.getAttribute("user");
|
||||
model.setCode(user.getCode());
|
||||
return modelService.save(model);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
public CommonResult delete(@RequestBody Long[] id) {
|
||||
return modelService.delete(id);
|
||||
}
|
||||
|
||||
@PostMapping("/build/{id}")
|
||||
public CommonResult build(@PathVariable Long id) {
|
||||
CommonResult result = new CommonResult();
|
||||
try {
|
||||
result = modelService.build(id);
|
||||
} catch (Exception e) {
|
||||
logger.error("", e);
|
||||
result.setMsg("错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/enable/{id}")
|
||||
public CommonResult enable(@PathVariable Long id) {
|
||||
ModelVO modelVO = modelService.get(id);
|
||||
modelVO.setStatus(StatusType.ACTIVE.getKey());
|
||||
return modelService.save(modelVO);
|
||||
}
|
||||
|
||||
@PostMapping("/disable/{id}")
|
||||
public CommonResult disable(@PathVariable Long id) {
|
||||
ModelVO modelVO = modelService.get(id);
|
||||
modelVO.setStatus(StatusType.INACTIVE.getKey());
|
||||
return modelService.save(modelVO);
|
||||
}
|
||||
|
||||
@PostMapping("/copy")
|
||||
public CommonResult copy(@RequestBody ModelVO model, HttpServletRequest request) {
|
||||
HttpSession session = request.getSession();
|
||||
UserVO user = (UserVO) session.getAttribute("user");
|
||||
return modelService.copy(model.getId(), user.getCode(), model.getModelName(), model.getLabel());
|
||||
}
|
||||
|
||||
@GetMapping("/list/template")
|
||||
public CommonResult template() {
|
||||
CommonResult result = new CommonResult();
|
||||
result.setSuccess(true);
|
||||
result.getData().put("modelList", modelService.listTemplateModel(true));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.pgmmers.radar.controller;
|
||||
|
||||
|
||||
import com.pgmmers.radar.dal.bean.PreItemQuery;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.service.model.PreItemService;
|
||||
import com.pgmmers.radar.vo.model.PreItemVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/services/v1/preitem")
|
||||
public class PreItemApiController {
|
||||
|
||||
@Autowired
|
||||
private PreItemService preItemService;
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public CommonResult get(@PathVariable Long id) {
|
||||
CommonResult result = new CommonResult();
|
||||
PreItemVO preItemVO = preItemService.get(id);
|
||||
if (preItemVO != null) {
|
||||
result.setSuccess(true);
|
||||
result.getData().put("preItem", preItemVO);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/list/{modelId}")
|
||||
public CommonResult list(@PathVariable Long modelId) {
|
||||
CommonResult result = new CommonResult();
|
||||
result.setSuccess(true);
|
||||
result.getData().put("list", preItemService.listPreItem(modelId));
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public CommonResult query(@RequestBody PreItemQuery query) {
|
||||
return preItemService.query(query);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public CommonResult save(@RequestBody PreItemVO preItem) {
|
||||
return preItemService.save(preItem);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
public CommonResult delete(@RequestBody Long[] id) {
|
||||
return preItemService.delete(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.pgmmers.radar.controller;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.RuleHistoryQuery;
|
||||
import com.pgmmers.radar.dal.bean.RuleQuery;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.service.model.ModelService;
|
||||
import com.pgmmers.radar.service.model.RuleService;
|
||||
import com.pgmmers.radar.vo.admin.UserVO;
|
||||
import com.pgmmers.radar.vo.model.ModelVO;
|
||||
import com.pgmmers.radar.vo.model.RuleVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
@RestController
|
||||
@RequestMapping("/services/v1/rule")
|
||||
public class RuleApiController {
|
||||
|
||||
@Autowired
|
||||
private RuleService ruleService;
|
||||
|
||||
@Autowired
|
||||
private ModelService modelService;
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public CommonResult get(@PathVariable Long id) {
|
||||
CommonResult result = new CommonResult();
|
||||
RuleVO ruleVO = ruleService.get(id);
|
||||
if (ruleVO != null) {
|
||||
result.setSuccess(true);
|
||||
result.getData().put("rule", ruleVO);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public CommonResult query(@RequestBody RuleQuery query) {
|
||||
return ruleService.query(query);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public CommonResult save(@RequestBody RuleVO rule, HttpServletRequest request) {
|
||||
HttpSession session = request.getSession();
|
||||
UserVO user = (UserVO) session.getAttribute("user");
|
||||
return ruleService.save(rule, user.getUserName());
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
public CommonResult delete(@RequestBody Long[] id) {
|
||||
return ruleService.delete(id);
|
||||
}
|
||||
|
||||
@GetMapping("/hitsSort/{modelId}")
|
||||
public CommonResult hitsSort(@PathVariable Long modelId) {
|
||||
CommonResult result = new CommonResult();
|
||||
ModelVO modelVO = modelService.getModelById(modelId);
|
||||
if (modelVO == null) {
|
||||
return result;
|
||||
}
|
||||
return ruleService.getHitSorts(modelId);
|
||||
}
|
||||
|
||||
@PostMapping("/ruleHistory")
|
||||
public CommonResult queryRuleHistory(@RequestBody RuleHistoryQuery query) {
|
||||
return ruleService.queryHistory(query);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.pgmmers.radar.controller;
|
||||
|
||||
|
||||
import com.pgmmers.radar.dal.bean.UserQuery;
|
||||
import com.pgmmers.radar.service.admin.UserService;
|
||||
import com.pgmmers.radar.service.common.CommonResult;
|
||||
import com.pgmmers.radar.util.CryptUtils;
|
||||
import com.pgmmers.radar.vo.admin.UserVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/services/v1")
|
||||
public class SysLoginApiController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SysLoginApiController.class);
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
|
||||
@PostMapping("/merchant/login")
|
||||
public CommonResult login(String loginName, String passwd, String captcha, HttpServletRequest request) {
|
||||
CommonResult ret = new CommonResult();
|
||||
|
||||
|
||||
HttpSession session = request.getSession(true);
|
||||
String sourceCaptcha = (String) session.getAttribute("captcha");
|
||||
session.removeAttribute("captcha");
|
||||
if (captcha == null || !captcha.equalsIgnoreCase(sourceCaptcha) ) {
|
||||
ret.setMsg("验证码无效");
|
||||
return ret;
|
||||
}
|
||||
|
||||
String encrypt = CryptUtils.sha(passwd, loginName).toUpperCase();
|
||||
logger.info("passwd sha:{}" , encrypt);
|
||||
UserQuery userQuery = new UserQuery();
|
||||
userQuery.setUserName(loginName);
|
||||
userQuery.setPasswd(encrypt);
|
||||
Optional<List<UserVO>> list = userService.list(loginName, encrypt);
|
||||
if (list.isPresent()) {
|
||||
List<UserVO> users = list.get();
|
||||
session.setAttribute("user", users.get(0));
|
||||
ret.setSuccess(true);
|
||||
} else {
|
||||
ret.setMsg("用户名和密码错误!");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@GetMapping("/merchant/logout")
|
||||
public CommonResult logout(HttpServletRequest request) {
|
||||
CommonResult ret = new CommonResult();
|
||||
|
||||
request.getSession(true).invalidate();
|
||||
ret.setSuccess(true);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.pgmmers.radar.intercpt;
|
||||
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class AuthInterceptor implements HandlerInterceptor {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AuthInterceptor.class);
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
HandlerMethod method = (HandlerMethod) handler;
|
||||
logger.info("Interceptor preHandle, {}", method.getMethod().getName());
|
||||
String uri = request.getRequestURI();
|
||||
logger.info("uri:{}", uri);
|
||||
Object user = request.getSession().getAttribute("user");
|
||||
if (uri.startsWith("/services")&& !uri.contains("/merchant") && !uri.contains("/common")) {
|
||||
|
||||
if (user == null) {
|
||||
logger.info("session expired, redirect to index.html");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||
ModelAndView modelAndView) throws Exception {
|
||||
|
||||
HandlerMethod method = (HandlerMethod) handler;
|
||||
logger.info("HandlerInterceptor postHandle, {}", method.getMethod().getName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
|
||||
throws Exception {
|
||||
|
||||
HandlerMethod method = (HandlerMethod) handler;
|
||||
logger.info("HandlerInterceptor afterCompletion, {}", method.getMethod().getName());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.pgmmers.radar.intercpt;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
|
||||
@Configuration
|
||||
public class InterceptorConfig extends WebMvcConfigurerAdapter {
|
||||
|
||||
// 注册拦截器
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
|
||||
registry.addInterceptor(new AuthInterceptor()).addPathPatterns("/services/**");
|
||||
super.addInterceptors(registry);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.pgmmers.radar.util;
|
||||
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
/**
|
||||
* RandomValidateCode class.
|
||||
*
|
||||
* @author feihu.wang
|
||||
*/
|
||||
public class RandomValidateCode {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(RandomValidateCode.class);
|
||||
private Random random = new Random();
|
||||
private String randString = "23456789ABCDEFGHIJKLMNPQRSTUVWXYZ";// 随机产生的字符串
|
||||
|
||||
private int width = 140;// 图片宽
|
||||
private int height = 30;// 图片高
|
||||
private int lineSize = 40;// 干扰线数量
|
||||
private int stringNum = 4;// 随机产生字符数量
|
||||
|
||||
/**
|
||||
* 获得字体.
|
||||
*
|
||||
* @return a {@link Font} object.
|
||||
*/
|
||||
private Font getFont() {
|
||||
return new Font("Fixedsys", Font.CENTER_BASELINE, 18);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>获得颜色.</p>
|
||||
*
|
||||
* @param fc a {@link Integer} object.
|
||||
* @param bc a {@link Integer} object.
|
||||
* @return a {@link Color} object.
|
||||
*/
|
||||
private Color getRandColor(int fc, int bc) {
|
||||
if (fc > 255)
|
||||
fc = 255;
|
||||
if (bc > 255)
|
||||
bc = 255;
|
||||
int r = fc + random.nextInt(bc - fc - 16);
|
||||
int g = fc + random.nextInt(bc - fc - 14);
|
||||
int b = fc + random.nextInt(bc - fc - 18);
|
||||
return new Color(r, g, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成随机图片.
|
||||
*
|
||||
* @param request a {@link javax.servlet.http.HttpServletRequest} object.
|
||||
* @param response a {@link javax.servlet.http.HttpServletResponse} object.
|
||||
*/
|
||||
public void genRandcode(HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
HttpSession session = request.getSession(true);
|
||||
// BufferedImage类是具有缓冲区的Image类,Image类是用于描述图像信息的类
|
||||
BufferedImage image = new BufferedImage(width, height,
|
||||
BufferedImage.TYPE_INT_BGR);
|
||||
Graphics g = image.getGraphics();// 产生Image对象的Graphics对象,改对象可以在图像上进行各种绘制操作
|
||||
g.fillRect(0, 0, width, height);
|
||||
g.setFont(new Font("Times New Roman", Font.ROMAN_BASELINE, 18));
|
||||
g.setColor(getRandColor(110, 133));
|
||||
// 绘制干扰线
|
||||
for (int i = 0; i <= lineSize; i++) {
|
||||
drowLine(g);
|
||||
}
|
||||
// 绘制随机字符
|
||||
String randomString = "";
|
||||
for (int i = 1; i <= stringNum; i++) {
|
||||
randomString = drowString(g, randomString, i);
|
||||
}
|
||||
session.removeAttribute("captcha");
|
||||
session.setAttribute("captcha", randomString);
|
||||
g.dispose();
|
||||
logger.info("curr captcha:{}", randomString);
|
||||
try {
|
||||
ImageIO.write(image, "JPEG", response.getOutputStream());// 将内存中的图片通过流动形式输出到客户端
|
||||
} catch (Exception e) {
|
||||
logger.error("create register rand code error" , e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制字符串.
|
||||
*
|
||||
* @param g a {@link Integer} object.
|
||||
* @param randomString a {@link Integer} object.
|
||||
* @return a {@link Color} object.
|
||||
*/
|
||||
private String drowString(Graphics g, String randomString, int i) {
|
||||
g.setFont(getFont());
|
||||
g.setColor(new Color(random.nextInt(101), random.nextInt(111), random
|
||||
.nextInt(121)));
|
||||
String rand = String.valueOf(getRandomString(random.nextInt(randString
|
||||
.length())));
|
||||
randomString += rand;
|
||||
g.translate(random.nextInt(25), random.nextInt(5));
|
||||
g.drawString(rand, 13 * i, 16);
|
||||
return randomString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制干扰线.
|
||||
*
|
||||
* @param g a {@link Graphics} object.
|
||||
*/
|
||||
private void drowLine(Graphics g) {
|
||||
int x = random.nextInt(width);
|
||||
int y = random.nextInt(height);
|
||||
int xl = random.nextInt(13);
|
||||
int yl = random.nextInt(15);
|
||||
g.drawLine(x, y, x + xl, y + yl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取随机的字符.
|
||||
*
|
||||
* @param num a {@link Integer} object.
|
||||
* @return a {@link String} object.
|
||||
*/
|
||||
public String getRandomString(int num) {
|
||||
return String.valueOf(randString.charAt(num));
|
||||
}
|
||||
|
||||
}
|
||||
69
radar-admin/src/main/resources/application.yml
Normal file
69
radar-admin/src/main/resources/application.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/radar?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false
|
||||
username: root
|
||||
password: 456132
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
druid:
|
||||
initial-size: 8
|
||||
min-idle: 1
|
||||
max-active: 20
|
||||
max-wait: 60000
|
||||
time-between-eviction-runsMillis: 60000
|
||||
min-evictable-idle-timeMillis: 300000
|
||||
validation-query: select 1 FROM DUAL
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
pool-prepared-statements: true
|
||||
max-open-prepared-statements: 20
|
||||
max-pool-prepared-statement-per-connection-size: 20
|
||||
filters: stat,wall
|
||||
connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
|
||||
use-global-data-source-stat: true
|
||||
thymeleaf:
|
||||
mode: HTML
|
||||
encoding: UTF-8
|
||||
#开发配置为false,避免修改模板还要重启服务器
|
||||
cache: false
|
||||
prefix: classpath:/templates
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
#password:
|
||||
timeout: 2000ms
|
||||
database: 0 #默认有16个db(集群模式用hash槽代替),这里配置具体使用的db,默认是0
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 30 #最大连接数(使用负值表示没有限制) 默认 8
|
||||
max-wait: -1ms #最大阻塞等待时间(使用负值表示没有限制) 默认 -1
|
||||
max-idle: 10 #最大空闲连接 默认 8
|
||||
min-idle: 0
|
||||
|
||||
mybatis:
|
||||
mapper-locations: classpath*:mapping/*.xml
|
||||
mapper:
|
||||
mappers:
|
||||
- tk.mybatis.mapper.common.Mapper
|
||||
not-empty: false
|
||||
mongodb:
|
||||
url: mongodb://localhost:27017/radar
|
||||
mobile:
|
||||
info:
|
||||
path: D:/soft/moble_info.csv
|
||||
ip2region:
|
||||
db:
|
||||
path: D:/soft/ip2region.db
|
||||
elksearch:
|
||||
server: localhost
|
||||
url: http://localhost:9200
|
||||
logging:
|
||||
level:
|
||||
root: info
|
||||
com.pgmmers.radar: info
|
||||
com.pgmmers.radar.mapper: debug
|
||||
sys:
|
||||
conf:
|
||||
app: admin
|
||||
entity-duplicate-insert: false
|
||||
mongo-restore-days: 93
|
||||
BIN
radar-admin/src/main/resources/static/images/anquan.png
Normal file
BIN
radar-admin/src/main/resources/static/images/anquan.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
21
radar-admin/src/main/resources/static/index.html
Normal file
21
radar-admin/src/main/resources/static/index.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>风控引擎管理平台</title>
|
||||
<link rel="shortcut icon" href="/images/anquan.png">
|
||||
<link rel="stylesheet" href="/js/dist/style.css">
|
||||
<!-- Polyfills -->
|
||||
<!--[if lt IE 10]>
|
||||
<script src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,es5-shim/4.5.7/es5-shim.min.js,es5-shim/4.5.7/es5-sham.min.js,html5shiv/3.7.2/html5shiv.min.js,media-match/2.0.2/media.match.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<div id="react-content"></div>
|
||||
|
||||
<script src="js/dist/common.js"></script>
|
||||
<script src="js/dist/main.bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
1
radar-admin/src/main/resources/static/js/dist/common.js
vendored
Normal file
1
radar-admin/src/main/resources/static/js/dist/common.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(e){function n(t){if(r[t])return r[t].exports;var a=r[t]={exports:{},id:t,loaded:!1};return e[t].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}var t=window.webpackJsonp;window.webpackJsonp=function(o,l){for(var p,c,i=0,s=[];i<o.length;i++)c=o[i],a[c]&&s.push.apply(s,a[c]),a[c]=0;for(p in l)e[p]=l[p];for(t&&t(o,l);s.length;)s.shift().call(null,n);if(l[0])return r[0]=0,n(0)};var r={},a={1:0};n.e=function(e,t){if(0===a[e])return t.call(null,n);if(void 0!==a[e])a[e].push(t);else{a[e]=[t];var r=document.getElementsByTagName("head")[0],o=document.createElement("script");o.type="text/javascript",o.charset="utf-8",o.async=!0,o.src=n.p+""+e+"."+({0:"main"}[e]||e)+".bundle.js",r.appendChild(o)}},n.m=e,n.c=r,n.p=""}([]);
|
||||
89
radar-admin/src/main/resources/static/js/dist/main.bundle.js
vendored
Normal file
89
radar-admin/src/main/resources/static/js/dist/main.bundle.js
vendored
Normal file
File diff suppressed because one or more lines are too long
13
radar-admin/src/main/resources/static/js/dist/style.css
vendored
Normal file
13
radar-admin/src/main/resources/static/js/dist/style.css
vendored
Normal file
File diff suppressed because one or more lines are too long
79
radar-commons/pom.xml
Normal file
79
radar-commons/pom.xml
Normal file
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<parent>
|
||||
<artifactId>radar</artifactId>
|
||||
<groupId>com.pgmmers</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>radar-commons</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>radar-commons</name>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.generator</groupId>
|
||||
<artifactId>mybatis-generator-core</artifactId>
|
||||
<version>1.3.7</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<version>2.4.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
13
radar-commons/src/main/java/com/pgmmers/App.java
Normal file
13
radar-commons/src/main/java/com/pgmmers/App.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.pgmmers;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
System.out.println( "Hello World!" );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.pgmmers.radar.mybatis.plugins;
|
||||
|
||||
import org.mybatis.generator.api.IntrospectedTable;
|
||||
import org.mybatis.generator.api.PluginAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ModelRenamePlugin extends PluginAdapter {
|
||||
|
||||
private String postFix;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean validate(List<String> list) {
|
||||
postFix = properties.getProperty("postFix");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialized(IntrospectedTable introspectedTable) {
|
||||
introspectedTable.setBaseRecordType(introspectedTable.getBaseRecordType() + this.getPostFix());
|
||||
}
|
||||
|
||||
public String getPostFix() {
|
||||
return postFix;
|
||||
}
|
||||
|
||||
public void setPostFix(String postFix) {
|
||||
this.postFix = postFix;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.pgmmers.radar.util;
|
||||
|
||||
public class BaseUtils {
|
||||
|
||||
public static String buildLike(String text) {
|
||||
return "%" + text + "%";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.pgmmers.radar.util;
|
||||
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.DESKeySpec;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
public class CryptUtils {
|
||||
|
||||
private final static String DES = "DES";
|
||||
//private final static String MD5 = "MD5";
|
||||
private final static String SHA = "SHA1";
|
||||
|
||||
public static void main(String args[]){
|
||||
// System.out.println( md5("123") );
|
||||
System.out.println( sha("222222") );
|
||||
}
|
||||
//
|
||||
// public static String md5(String source) {
|
||||
// return encryption(source, MD5);
|
||||
// }
|
||||
|
||||
public static String sha(String source) {
|
||||
return encryption(source, SHA);
|
||||
}
|
||||
|
||||
|
||||
public static String sha(String source, String salt) {
|
||||
return encryption(source + salt, SHA);
|
||||
}
|
||||
/**
|
||||
* 加密内容
|
||||
* @param plainText 加密的内容
|
||||
* @param type 加密的方式
|
||||
* @return
|
||||
*/
|
||||
private static String encryption(String plainText,String type) {
|
||||
String re_md5 = new String();
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance(type);
|
||||
md.update(plainText.getBytes());
|
||||
byte b[] = md.digest();
|
||||
int i;
|
||||
StringBuffer buf = new StringBuffer("");
|
||||
for (int offset = 0; offset < b.length; offset++) {
|
||||
i = b[offset];
|
||||
if (i < 0)
|
||||
i += 256;
|
||||
if (i < 16)
|
||||
buf.append("0");
|
||||
buf.append(Integer.toHexString(i));
|
||||
}
|
||||
re_md5 = buf.toString();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return re_md5;
|
||||
}
|
||||
|
||||
private static byte[] encrypt(byte[] src, byte[] key) throws RuntimeException {
|
||||
try {
|
||||
SecureRandom sr = new SecureRandom();
|
||||
DESKeySpec dks = new DESKeySpec(key);
|
||||
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
|
||||
SecretKey securekey = keyFactory.generateSecret(dks);
|
||||
Cipher cipher = Cipher.getInstance(DES);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
|
||||
|
||||
return cipher.doFinal(src);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] decrypt(byte[] src, byte[] key) throws RuntimeException {
|
||||
try {
|
||||
SecureRandom sr = new SecureRandom();
|
||||
DESKeySpec dks = new DESKeySpec(key);
|
||||
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
|
||||
SecretKey securekey = keyFactory.generateSecret(dks);
|
||||
Cipher cipher = Cipher.getInstance(DES);
|
||||
cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
|
||||
|
||||
return cipher.doFinal(src);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public final static String decrypt(String data, String key) {
|
||||
return new String(decrypt(hex2byte(data.getBytes()), key.getBytes()));
|
||||
}
|
||||
|
||||
public final static String encrypt(String data, String key) {
|
||||
if (data != null)
|
||||
try {
|
||||
return byte2hex(encrypt(data.getBytes(), key.getBytes()));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String byte2hex(byte[] b) {
|
||||
StringBuilder hs = new StringBuilder();
|
||||
String stmp;
|
||||
for (int n = 0; b != null && n < b.length; n++) {
|
||||
stmp = Integer.toHexString(b[n] & 0XFF);
|
||||
if (stmp.length() == 1)
|
||||
hs.append('0');
|
||||
hs.append(stmp);
|
||||
}
|
||||
return hs.toString().toUpperCase();
|
||||
}
|
||||
|
||||
private static byte[] hex2byte(byte[] b) {
|
||||
if ((b.length % 2) != 0)
|
||||
throw new IllegalArgumentException();
|
||||
byte[] b2 = new byte[b.length / 2];
|
||||
for (int n = 0; n < b.length; n += 2) {
|
||||
String item = new String(b, n, 2);
|
||||
b2[n / 2] = (byte) Integer.parseInt(item, 16);
|
||||
}
|
||||
return b2;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
package com.pgmmers.radar.util;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.SimpleTimeZone;
|
||||
|
||||
|
||||
/**
|
||||
* <p>DateUtils class.</p>
|
||||
*
|
||||
* @author feihu.wang
|
||||
*/
|
||||
public class DateUtils {
|
||||
|
||||
/** Constant <code>dateFormat</code> */
|
||||
public static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
/** Constant <code>dateTimeFormat</code> */
|
||||
public static final SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
/**
|
||||
* <p>parseDate.</p>
|
||||
*
|
||||
* @param str a {@link String} object.
|
||||
* @return a {@link Date} object.
|
||||
* @throws ParseException if any.
|
||||
*/
|
||||
public static Date parseDate(String str) throws ParseException {
|
||||
if (str == null || str.trim().equals("")) {
|
||||
return null;
|
||||
}
|
||||
return dateFormat.parse(str);
|
||||
}
|
||||
|
||||
public static Date parseDateTime(String str) throws ParseException {
|
||||
if (str == null || str.trim().equals("")) {
|
||||
return null;
|
||||
}
|
||||
return dateTimeFormat.parse(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getStartCurrentDate.</p>
|
||||
*
|
||||
* @return a {@link Date} object.
|
||||
*/
|
||||
public static Date getStartCurrentDate() {
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
// cal.set(Calendar.MINUTE, 0);
|
||||
// cal.set(Calendar.SECOND, 0);
|
||||
// try {
|
||||
// return dateTimeFormat.parse(dateTimeFormat.format(cal.getTime()));
|
||||
// } catch (ParseException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
return getCurrentDate();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getEndCurrentDate.</p>
|
||||
*
|
||||
* @return a {@link Date} object.
|
||||
*/
|
||||
public static Date getEndCurrentDate() {
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.set(Calendar.HOUR_OF_DAY, 23);
|
||||
// cal.set(Calendar.MINUTE, 59);
|
||||
// cal.set(Calendar.SECOND, 59);
|
||||
//
|
||||
// try {
|
||||
// return dateTimeFormat.parse(dateTimeFormat.format(cal.getTime()));
|
||||
// } catch (ParseException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
return addDate(1,getCurrentDate());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getDateTime.</p>
|
||||
*
|
||||
* @return a long.
|
||||
*/
|
||||
public static long getDateTime() {
|
||||
return new Date().getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getCurrentDate.</p>
|
||||
*
|
||||
* @return a {@link Date} object.
|
||||
*/
|
||||
public static Date getCurrentDate() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getCurrentGMTDate.</p>
|
||||
*
|
||||
* @return a {@link Date} object.
|
||||
*/
|
||||
public static Date getCurrentGMTDate() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
dateFormat.setTimeZone(new SimpleTimeZone(0, "GMT"));
|
||||
try {
|
||||
return dateTimeFormat.parse(dateFormat.format(new Date()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>formatDate.</p>
|
||||
*
|
||||
* @param date a {@link Date} object.
|
||||
* @return a {@link String} object.
|
||||
*/
|
||||
public static String formatDate(Date date) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>formatDate.</p>
|
||||
*
|
||||
* @param date a {@link Date} object.
|
||||
* @param format a {@link String} object.
|
||||
* @return a {@link String} object.
|
||||
*/
|
||||
public static String formatDate(Date date, String format) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 两个日期相减 得到秒
|
||||
*
|
||||
* @param startDate a {@link Date} object.
|
||||
* @param endDate a {@link Date} object.
|
||||
* @return a long.
|
||||
*/
|
||||
public static long dateSubtract(Date startDate,Date endDate) {
|
||||
Calendar startCal = Calendar.getInstance();
|
||||
startCal.setTime(startDate);
|
||||
Calendar endCal = Calendar.getInstance();
|
||||
endCal.setTime(endDate);
|
||||
System.out.println(startCal.getTimeInMillis());
|
||||
System.out.println(endCal.getTimeInMillis());
|
||||
return (startCal.getTimeInMillis() - endCal.getTimeInMillis()) / (1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期加指定天数
|
||||
*
|
||||
* @param day a int.
|
||||
* @param date a {@link Date} object.
|
||||
* @return a {@link Date} object.
|
||||
*/
|
||||
public static Date addDate(int day,Date date) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
cal.add(Calendar.DATE, day);
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>parse.</p>
|
||||
*
|
||||
* @param source a {@link String} object.
|
||||
* @param format a {@link String} object.
|
||||
* @return a {@link Calendar} object.
|
||||
*/
|
||||
public static Calendar parse(String source, String format) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
|
||||
Calendar c = Calendar.getInstance();
|
||||
try {
|
||||
Date date = dateFormat.parse(source);
|
||||
c.setTime(date);
|
||||
} catch (ParseException e) {
|
||||
c = null;
|
||||
}
|
||||
return c;
|
||||
|
||||
}
|
||||
|
||||
public static Calendar addDate(Date d, int field, int value) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(d);
|
||||
c.add(field, value);
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>main.</p>
|
||||
*
|
||||
* @param args an array of {@link String} objects.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getStartCurrentDate());
|
||||
System.out.println(getEndCurrentDate());
|
||||
|
||||
System.out.println(formatDate(new Date(), "yyyy-MM-ww-dd"));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.pgmmers.radar.util;
|
||||
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>ExcelUtils class.</p>
|
||||
*
|
||||
*/
|
||||
public class ExcelUtils {
|
||||
|
||||
/**
|
||||
* 创建excel文档.
|
||||
*
|
||||
* @param list a {@link List} object.
|
||||
* @param keys a {@link String[]} object.
|
||||
* @param columnNames a {@link String[]} object.
|
||||
* @return a {@link org.apache.poi.ss.usermodel.Workbook} object.
|
||||
*/
|
||||
public static Workbook createWorkBook(List<Map<String, Object>> list,String []keys,String columnNames[]) {
|
||||
// 创建excel工作簿
|
||||
// Workbook wb = new XSSFWorkbook();
|
||||
Workbook wb = new SXSSFWorkbook(1000);// keep 1k rows in memory, exceeding rows will be flushed to disk
|
||||
|
||||
//for(int pageCount=0;pageCount<count/50000;pageCount++){
|
||||
// 创建第一个sheet(页),并命名
|
||||
Sheet sheet = wb.createSheet(list.get(0).get("sheetName").toString());
|
||||
// 手动设置列宽。第一个参数表示要为第几列设;,第二个参数表示列的宽度,n为列高的像素数。
|
||||
for(int i=0;i<keys.length;i++){
|
||||
sheet.setColumnWidth((short) i, (short) (35.7 * 150));
|
||||
}
|
||||
|
||||
// 创建第一行
|
||||
Row row = sheet.createRow((short) 0);
|
||||
|
||||
// 创建两种单元格格式
|
||||
CellStyle cs = wb.createCellStyle();
|
||||
CellStyle cs2 = wb.createCellStyle();
|
||||
|
||||
// 创建两种字体
|
||||
Font f = wb.createFont();
|
||||
Font f2 = wb.createFont();
|
||||
|
||||
// 创建第一种字体样式(用于列名)
|
||||
f.setFontHeightInPoints((short) 10);
|
||||
f.setColor(IndexedColors.BLACK.getIndex());
|
||||
f.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
||||
|
||||
// 创建第二种字体样式(用于值)
|
||||
f2.setFontHeightInPoints((short) 10);
|
||||
f2.setColor(IndexedColors.BLACK.getIndex());
|
||||
|
||||
// Font f3=wb.createFont();
|
||||
// f3.setFontHeightInPoints((short) 10);
|
||||
// f3.setColor(IndexedColors.RED.getIndex());
|
||||
|
||||
// 设置第一种单元格的样式(用于列名)
|
||||
cs.setFont(f);
|
||||
cs.setBorderLeft(CellStyle.BORDER_THIN);
|
||||
cs.setBorderRight(CellStyle.BORDER_THIN);
|
||||
cs.setBorderTop(CellStyle.BORDER_THIN);
|
||||
cs.setBorderBottom(CellStyle.BORDER_THIN);
|
||||
cs.setAlignment(CellStyle.ALIGN_CENTER);
|
||||
|
||||
// 设置第二种单元格的样式(用于值)
|
||||
cs2.setFont(f2);
|
||||
cs2.setBorderLeft(CellStyle.BORDER_THIN);
|
||||
cs2.setBorderRight(CellStyle.BORDER_THIN);
|
||||
cs2.setBorderTop(CellStyle.BORDER_THIN);
|
||||
cs2.setBorderBottom(CellStyle.BORDER_THIN);
|
||||
cs2.setAlignment(CellStyle.ALIGN_CENTER);
|
||||
//设置列名
|
||||
for(int i=0;i<columnNames.length;i++){
|
||||
Cell cell = row.createCell(i);
|
||||
cell.setCellValue(columnNames[i]);
|
||||
cell.setCellStyle(cs);
|
||||
}
|
||||
//设置每行每列的值
|
||||
for (int i = 1; i < list.size(); i++) {
|
||||
// Row 行,Cell 方格 , Row 和 Cell 都是从0开始计数的
|
||||
// 创建一行,在页sheet上
|
||||
Row row1 = sheet.createRow(i);
|
||||
// 在row行上创建一个方格
|
||||
for(int j=0;j<keys.length;j++){
|
||||
Cell cell = row1.createCell(j);
|
||||
cell.setCellValue(list.get(i).get(keys[j]) == null?" ": list.get(i).get(keys[j]).toString());
|
||||
cell.setCellStyle(cs2);
|
||||
}
|
||||
}
|
||||
//}
|
||||
return wb;
|
||||
}
|
||||
|
||||
|
||||
public static void readExcel(String filePath) throws Exception {
|
||||
InputStream is = new FileInputStream(new File(filePath));
|
||||
XSSFWorkbook wb = new XSSFWorkbook(is);
|
||||
XSSFSheet sheet = wb.getSheetAt(0);
|
||||
XSSFRow row = null;
|
||||
int rowNum = 0;
|
||||
while ((row = sheet.getRow(++rowNum)) != null && row.getCell(0) != null) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.pgmmers.radar.util;
|
||||
|
||||
import groovy.lang.GroovyClassLoader;
|
||||
import groovy.lang.GroovyObject;
|
||||
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class GroovyScriptUtil {
|
||||
|
||||
public static Map<String, GroovyObject> passedClassMap = new HashMap<String, GroovyObject>();
|
||||
|
||||
public static GroovyClassLoader groovyClassLoader;
|
||||
|
||||
// 初始化GroovyClassLoader
|
||||
static {
|
||||
// TODO: 检查是否有更加合适的办法获取classLoader。目前这个方法绑定在Spring上。
|
||||
ClassLoader parent = AutowiredAnnotationBeanPostProcessor.class.getClassLoader();
|
||||
groovyClassLoader = new GroovyClassLoader(parent);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 加载 groovy script.
|
||||
*
|
||||
* @param script string of groovy script
|
||||
* @return {@link GroovyObject}
|
||||
* @author feihu.wang
|
||||
* 2016年8月2日
|
||||
*/
|
||||
public static GroovyObject loadScript(String script) {
|
||||
GroovyObject groovyObject = passedClassMap.get(script.hashCode() + "");
|
||||
if (groovyObject == null) {
|
||||
Class groovyClass = groovyClassLoader.parseClass(script);
|
||||
try {
|
||||
groovyObject = (GroovyObject) groovyClass.newInstance();
|
||||
passedClassMap.put(script.hashCode() + "", groovyObject);
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return groovyObject;
|
||||
}
|
||||
|
||||
public static Object invokeMethod(GroovyObject object, String method, Object[] args) {
|
||||
return object.invokeMethod(method, args);
|
||||
}
|
||||
|
||||
public static Object invokeMethod(String script, String method, Object[] args) {
|
||||
GroovyObject groovy = loadScript(script);
|
||||
if (groovy != null) {
|
||||
return invokeMethod(groovy, method, args);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.pgmmers.radar.util;
|
||||
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* <p>MD5Utils class.</p>
|
||||
*
|
||||
* @author linguibao
|
||||
* @version $Id: $Id
|
||||
*/
|
||||
public class MD5Utils {
|
||||
|
||||
private static final String[] SALEARR = { "q", "a", "z", "w", "s", "x",
|
||||
"e", "d", "c", "r", "f", "v", "t", "g", "b", "y", "h", "n", "u",
|
||||
"j", "m", "i", "k", "o", "l", "p", "_" };
|
||||
|
||||
static char[] chars = { '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a',
|
||||
'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'h', 'i', 'o', 't',
|
||||
'y', 'E', 'D', 'O', 'T', 'Y', 'j', 'p', 'u', 'z', 'F', 'J', 'P',
|
||||
'U', 'Z', 'k', 'q', 'v', 'A', 'G', 'K', 'Q', 'V', 'l', 'r', 'w',
|
||||
'B', 'H', 'L', 'R', 'W', 'm', 's', 'x', 'C', 'I', 'M', 'S', 'X' };
|
||||
|
||||
/**
|
||||
* 生成盐值
|
||||
*
|
||||
* @return a {@link String} object.
|
||||
*/
|
||||
public static String getSalt() {
|
||||
Random random = new Random();
|
||||
StringBuilder sb = new StringBuilder("");
|
||||
for (int i = 0; i < 6; i++) {
|
||||
sb.append(SALEARR[random.nextInt(26)]);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getTempPwd.</p>
|
||||
*
|
||||
* @return a {@link String} object.
|
||||
*/
|
||||
public static String getTempPwd() {
|
||||
return RandomStringUtils.random(10, chars);
|
||||
}
|
||||
|
||||
/**
|
||||
* MD5加密
|
||||
*
|
||||
* @param str a {@link String} object.
|
||||
* @param salt a {@link String} object.
|
||||
* @return a {@link String} object.
|
||||
*/
|
||||
public static String encrypt(String str, String salt) {
|
||||
MessageDigest messageDigest = null;
|
||||
str += salt;
|
||||
try {
|
||||
messageDigest = MessageDigest.getInstance("MD5");
|
||||
|
||||
messageDigest.reset();
|
||||
|
||||
messageDigest.update(str.getBytes("UTF-8"));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
return null;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
byte[] byteArray = messageDigest.digest();
|
||||
|
||||
StringBuilder md5StrBuff = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < byteArray.length; i++) {
|
||||
String hexString = Integer.toHexString(0xFF & byteArray[i]);
|
||||
if (hexString.length() == 1)
|
||||
md5StrBuff.append("0").append(hexString);
|
||||
else
|
||||
md5StrBuff.append(hexString);
|
||||
}
|
||||
return md5StrBuff.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>main.</p>
|
||||
*
|
||||
* @param args an array of {@link String} objects.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
System.out.println(encrypt("222222","admin"));
|
||||
System.out.println(encrypt("123456","test"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.pgmmers.radar.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
public class MobileLocationUtil {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String httpUrl = "http://apis.baidu.com/apistore/mobilenumber/mobilenumber";
|
||||
String httpArg = "phone=17710200001";
|
||||
String jsonResult = get(httpUrl, httpArg);
|
||||
System.out.println(jsonResult);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static String getLocation(String mobile) {
|
||||
String httpUrl = "http://apis.baidu.com/apistore/mobilenumber/mobilenumber";
|
||||
String httpArg = "phone=" + mobile;
|
||||
String jsonResult = get(httpUrl, httpArg);
|
||||
return jsonResult;
|
||||
}
|
||||
public static String get(String httpUrl, String httpArg) {
|
||||
BufferedReader reader = null;
|
||||
String result = null;
|
||||
StringBuffer sbf = new StringBuffer();
|
||||
httpUrl = httpUrl + "?" + httpArg;
|
||||
|
||||
try {
|
||||
URL url = new URL(httpUrl);
|
||||
HttpURLConnection connection = (HttpURLConnection) url
|
||||
.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
// 填入apikey到HTTP header
|
||||
connection.setRequestProperty("apikey",
|
||||
"4d740bcb5d482693f3a4d6c4de6274dd");
|
||||
connection.connect();
|
||||
InputStream is = connection.getInputStream();
|
||||
reader = new BufferedReader(new InputStreamReader(is));
|
||||
String strRead = null;
|
||||
while ((strRead = reader.readLine()) != null) {
|
||||
sbf.append(strRead);
|
||||
sbf.append("\r\n");
|
||||
}
|
||||
reader.close();
|
||||
result = sbf.toString();
|
||||
result = unicodeToUtf8(result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String unicodeToUtf8(String theString) {
|
||||
char aChar;
|
||||
int len = theString.length();
|
||||
StringBuffer outBuffer = new StringBuffer(len);
|
||||
for (int x = 0; x < len;) {
|
||||
aChar = theString.charAt(x++);
|
||||
if (aChar == '\\') {
|
||||
aChar = theString.charAt(x++);
|
||||
if (aChar == 'u') {
|
||||
// Read the xxxx
|
||||
int value = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
aChar = theString.charAt(x++);
|
||||
switch (aChar) {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
value = (value << 4) + aChar - '0';
|
||||
break;
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 'e':
|
||||
case 'f':
|
||||
value = (value << 4) + 10 + aChar - 'a';
|
||||
break;
|
||||
case 'A':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'E':
|
||||
case 'F':
|
||||
value = (value << 4) + 10 + aChar - 'A';
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
"Malformed \\uxxxx encoding.");
|
||||
}
|
||||
}
|
||||
outBuffer.append((char) value);
|
||||
} else {
|
||||
if (aChar == 't')
|
||||
aChar = '\t';
|
||||
else if (aChar == 'r')
|
||||
aChar = '\r';
|
||||
else if (aChar == 'n')
|
||||
aChar = '\n';
|
||||
else if (aChar == 'f')
|
||||
aChar = '\f';
|
||||
outBuffer.append(aChar);
|
||||
}
|
||||
} else
|
||||
outBuffer.append(aChar);
|
||||
}
|
||||
return outBuffer.toString();
|
||||
}
|
||||
}
|
||||
64
radar-dal/pom.xml
Normal file
64
radar-dal/pom.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>radar</artifactId>
|
||||
<groupId>com.pgmmers</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>radar-dal</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.pgmmers</groupId>
|
||||
<artifactId>radar-dao</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>3.4.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
<artifactId>mapper</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
|
||||
public class AbstractionQuery extends PageQuery {
|
||||
|
||||
private Long modelId;
|
||||
private Integer aggregateType;
|
||||
private String name;
|
||||
private Integer status;
|
||||
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public Integer getAggregateType() {
|
||||
return aggregateType;
|
||||
}
|
||||
|
||||
public void setAggregateType(Integer aggregateType) {
|
||||
this.aggregateType = aggregateType;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
|
||||
public class ActivationQuery extends PageQuery {
|
||||
|
||||
private Long modelId;
|
||||
private String name;
|
||||
private Integer status;
|
||||
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
|
||||
public class DataListQuery extends PageQuery {
|
||||
|
||||
private Long modelId;
|
||||
private String name;
|
||||
private String listType;
|
||||
private Integer status;
|
||||
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getListType() {
|
||||
return listType;
|
||||
}
|
||||
|
||||
public void setListType(String listType) {
|
||||
this.listType = listType;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
public class DataListRecordQuery extends PageQuery {
|
||||
|
||||
private Long dataListId;
|
||||
|
||||
public Long getDataListId() {
|
||||
return dataListId;
|
||||
}
|
||||
|
||||
public void setDataListId(Long dataListId) {
|
||||
this.dataListId = dataListId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
public class EventExportQuery extends PageQuery {
|
||||
|
||||
private String[] fields;
|
||||
|
||||
private String[] preItems;
|
||||
|
||||
private String[] rules;
|
||||
|
||||
private String[] activations;
|
||||
|
||||
public String[] getFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public void setFields(String[] fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
public String[] getPreItems() {
|
||||
return preItems;
|
||||
}
|
||||
|
||||
public void setPreItems(String[] preItems) {
|
||||
this.preItems = preItems;
|
||||
}
|
||||
|
||||
public String[] getRules() {
|
||||
return rules;
|
||||
}
|
||||
|
||||
public void setRules(String[] rules) {
|
||||
this.rules = rules;
|
||||
}
|
||||
|
||||
public String[] getActivations() {
|
||||
return activations;
|
||||
}
|
||||
|
||||
public void setActivations(String[] activations) {
|
||||
this.activations = activations;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
public class EventQuery extends PageQuery {
|
||||
|
||||
private Long modelId;
|
||||
|
||||
private String entityId;
|
||||
|
||||
private String beginTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public String getBeginTime() {
|
||||
return beginTime;
|
||||
}
|
||||
|
||||
public void setBeginTime(String beginTime) {
|
||||
this.beginTime = beginTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
public void setEntityId(String entityId) {
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
public class FieldQuery extends PageQuery {
|
||||
|
||||
private Long modelId;
|
||||
private String fieldName;
|
||||
private String fieldType;
|
||||
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public String getFieldName() {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
public void setFieldName(String fieldName) {
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
public String getFieldType() {
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
public void setFieldType(String fieldType) {
|
||||
this.fieldType = fieldType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
public class MerchantAccountQuery extends PageQuery {
|
||||
|
||||
private String loginName;
|
||||
|
||||
private String passwd;
|
||||
|
||||
public String getLoginName() {
|
||||
return loginName;
|
||||
}
|
||||
|
||||
public void setLoginName(String loginName) {
|
||||
this.loginName = loginName;
|
||||
}
|
||||
|
||||
public String getPasswd() {
|
||||
return passwd;
|
||||
}
|
||||
|
||||
public void setPasswd(String passwd) {
|
||||
this.passwd = passwd;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
public class ModelQuery extends PageQuery {
|
||||
|
||||
private String modelName;
|
||||
private Integer status;
|
||||
private String merchantCode;
|
||||
private String label;
|
||||
|
||||
public String getModelName() {
|
||||
return modelName;
|
||||
}
|
||||
|
||||
public void setModelName(String modelName) {
|
||||
this.modelName = modelName;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getMerchantCode() {
|
||||
return merchantCode;
|
||||
}
|
||||
|
||||
public void setMerchantCode(String merchantCode) {
|
||||
this.merchantCode = merchantCode;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
public class PageQuery {
|
||||
|
||||
private Integer pageNo = 1;
|
||||
private Integer pageSize = 10;
|
||||
|
||||
public Integer getPageNo() {
|
||||
return pageNo;
|
||||
}
|
||||
|
||||
public void setPageNo(Integer pageNo) {
|
||||
this.pageNo = pageNo;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
|
||||
public class PageResult<T> {
|
||||
|
||||
private int rowCount = 0; // 记录总数
|
||||
private int pageCount = 1; // 分页总数
|
||||
private int pageSize = 10; // 每页记录数
|
||||
private int pageNum = 1; // 当前页数
|
||||
private int startIndex = 1; // 起始记录数
|
||||
private int endIndex = 1; // 结束记录数
|
||||
private List<T> list;// 记录列表
|
||||
|
||||
public PageResult(int pageNum, int pageSize, int rowCount) {
|
||||
preProcessParams(pageNum, pageSize);
|
||||
this.rowCount = rowCount;
|
||||
countPage();
|
||||
}
|
||||
|
||||
public PageResult(int pageNum, int pageSize, int rowCount, List<T> list) {
|
||||
this(pageNum, pageSize, rowCount);
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public PageResult(Page<T> page) {
|
||||
this(page.getPageNum(), page.getPageSize(), (int) page.getTotal(), page.getResult());
|
||||
}
|
||||
|
||||
private void preProcessParams(int pageNum, int pageSize) {
|
||||
if (pageNum > 0) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
if (pageSize > 0) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
if (pageSize > 1000) {
|
||||
this.pageSize = 1000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void countPage() {
|
||||
// 计算分页总数
|
||||
if ((rowCount % pageSize) == 0) {
|
||||
pageCount = rowCount / pageSize;
|
||||
} else {
|
||||
pageCount = rowCount / pageSize + 1;
|
||||
}
|
||||
if (pageCount == 0) {
|
||||
pageCount = 1;
|
||||
}
|
||||
// 判断pageNum是否过界
|
||||
if (pageNum > pageCount && rowCount != 0) {
|
||||
pageNum = pageCount;
|
||||
}
|
||||
// 计算起止记录
|
||||
startIndex = (pageNum - 1) * pageSize + 1;
|
||||
endIndex = (pageNum) * pageSize;
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
public void setRowCount(int rowCount) {
|
||||
this.rowCount = rowCount;
|
||||
}
|
||||
|
||||
public int getPageCount() {
|
||||
return pageCount;
|
||||
}
|
||||
|
||||
public void setPageCount(int pageCount) {
|
||||
this.pageCount = pageCount;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum(int pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public int getStartIndex() {
|
||||
return startIndex;
|
||||
}
|
||||
|
||||
public void setStartIndex(int startIndex) {
|
||||
this.startIndex = startIndex;
|
||||
}
|
||||
|
||||
public int getEndIndex() {
|
||||
return endIndex;
|
||||
}
|
||||
|
||||
public void setEndIndex(int endIndex) {
|
||||
this.endIndex = endIndex;
|
||||
}
|
||||
|
||||
public List<T> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<T> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
public class PreItemQuery extends PageQuery {
|
||||
|
||||
private Long modelId;
|
||||
private String plugin;
|
||||
private Integer status;
|
||||
private String destField;
|
||||
private String label;
|
||||
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public String getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public void setPlugin(String plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDestField() {
|
||||
return destField;
|
||||
}
|
||||
|
||||
public void setDestField(String destField) {
|
||||
this.destField = destField;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.PageQuery;
|
||||
|
||||
public class RuleHistoryQuery extends PageQuery {
|
||||
|
||||
private Long ruleId;
|
||||
|
||||
public Long getRuleId() {
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
public void setRuleId(Long ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.PageQuery;
|
||||
|
||||
public class RuleQuery extends PageQuery {
|
||||
|
||||
private Long activationId;
|
||||
private String name;
|
||||
private Integer status;
|
||||
|
||||
public Long getActivationId() {
|
||||
return activationId;
|
||||
}
|
||||
|
||||
public void setActivationId(Long activationId) {
|
||||
this.activationId = activationId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.PageQuery;
|
||||
|
||||
public class TermQuery extends PageQuery {
|
||||
|
||||
private Long modelId;
|
||||
|
||||
private String fieldName;
|
||||
|
||||
private String fieldValue;
|
||||
|
||||
private String beginTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public String getBeginTime() {
|
||||
return beginTime;
|
||||
}
|
||||
|
||||
public void setBeginTime(String beginTime) {
|
||||
this.beginTime = beginTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getFieldName() {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
public void setFieldName(String fieldName) {
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
public String getFieldValue() {
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
public void setFieldValue(String fieldValue) {
|
||||
this.fieldValue = fieldValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.pgmmers.radar.dal.bean;
|
||||
|
||||
public class UserQuery extends PageQuery {
|
||||
private String userName;
|
||||
|
||||
private String passwd;
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getPasswd() {
|
||||
return passwd;
|
||||
}
|
||||
|
||||
public void setPasswd(String passwd) {
|
||||
this.passwd = passwd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.pgmmers.radar.dal.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.pgmmers.radar.vo.data.MobileInfoVO;
|
||||
|
||||
public interface MobileInfoDal {
|
||||
List<MobileInfoVO> listMobileInfo(int pageNum, int pageSize);
|
||||
|
||||
int countQty(MobileInfoVO vo);
|
||||
|
||||
MobileInfoVO getMobileInfoByMobileNo(String mobile);
|
||||
|
||||
List<MobileInfoVO> listMobileInfo(String province, String city, int pageNum, int pageSize);
|
||||
|
||||
int save(MobileInfoVO info);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.pgmmers.radar.dal.data.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.pgmmers.radar.dal.data.MobileInfoDal;
|
||||
import com.pgmmers.radar.dal.util.POVOUtils;
|
||||
import com.pgmmers.radar.mapper.MobileInfoMapper;
|
||||
import com.pgmmers.radar.model.MobileInfoPO;
|
||||
import com.pgmmers.radar.vo.data.MobileInfoVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
@Service
|
||||
public class MobileInfoDalImpl implements MobileInfoDal {
|
||||
|
||||
@Autowired
|
||||
private MobileInfoMapper mobileMapper;
|
||||
|
||||
@Override
|
||||
public List<MobileInfoVO> listMobileInfo(int pageNum, int pageSize) {
|
||||
Example example = new Example(MobileInfoPO.class);
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<MobileInfoPO> poList = mobileMapper.selectByExample(example);
|
||||
List<MobileInfoVO> voList = new ArrayList<MobileInfoVO>();
|
||||
MobileInfoVO vo;
|
||||
for (MobileInfoPO po : poList) {
|
||||
vo = POVOUtils.copyFromMobileInfPO(po);
|
||||
voList.add(vo);
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countQty(MobileInfoVO vo) {
|
||||
Example example = new Example(MobileInfoPO.class);
|
||||
int count = mobileMapper.selectCountByExample(example);
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobileInfoVO getMobileInfoByMobileNo(String mobile) {
|
||||
Example example = new Example(MobileInfoPO.class);
|
||||
example.createCriteria().andEqualTo("mobile", mobile);
|
||||
List<MobileInfoPO> list = mobileMapper.selectByExample(example);
|
||||
if (list != null && list.size() > 0) {
|
||||
return POVOUtils.copyFromMobileInfPO(list.get(0));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MobileInfoVO> listMobileInfo(String province, String city, int pageNum, int pageSize) {
|
||||
Example example = new Example(MobileInfoPO.class);
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
if (!StringUtils.isEmpty(province)) {
|
||||
criteria.andEqualTo("province", province);
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(city)) {
|
||||
criteria.andEqualTo("city", city);
|
||||
}
|
||||
|
||||
List<MobileInfoPO> poList = mobileMapper.selectByExample(example);
|
||||
List<MobileInfoVO> voList = new ArrayList<MobileInfoVO>();
|
||||
MobileInfoVO vo;
|
||||
for (MobileInfoPO po : poList) {
|
||||
vo = POVOUtils.copyFromMobileInfPO(po);
|
||||
voList.add(vo);
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(MobileInfoVO info) {
|
||||
MobileInfoPO po = POVOUtils.copyFromMobileInfoVO(info);
|
||||
return mobileMapper.insertSelective(po);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.pgmmers.radar.dal.logs;
|
||||
|
||||
|
||||
import com.pgmmers.radar.vo.logs.RiskAnalysisResultVO;
|
||||
|
||||
public interface RiskAnalysisResultDal {
|
||||
|
||||
int save(RiskAnalysisResultVO vo);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.pgmmers.radar.dal.logs.impl;
|
||||
|
||||
import com.pgmmers.radar.dal.logs.RiskAnalysisResultDal;
|
||||
import com.pgmmers.radar.vo.logs.RiskAnalysisResultVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service
|
||||
public class RiskAnalysisResultDalImpl implements RiskAnalysisResultDal {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int save(RiskAnalysisResultVO vo) {
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.pgmmers.radar.dal.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import com.pgmmers.radar.dal.bean.AbstractionQuery;
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.vo.model.AbstractionVO;
|
||||
|
||||
public interface AbstractionDal {
|
||||
|
||||
public AbstractionVO get(Long id);
|
||||
|
||||
public List<AbstractionVO> list(Long modelId);
|
||||
|
||||
public PageResult<AbstractionVO> query(AbstractionQuery query);
|
||||
|
||||
public int save(AbstractionVO abstraction);
|
||||
|
||||
public int delete(Long[] id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.pgmmers.radar.dal.model;
|
||||
|
||||
|
||||
import com.pgmmers.radar.dal.bean.ActivationQuery;
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.vo.model.ActivationVO;
|
||||
|
||||
public interface ActivationDal {
|
||||
|
||||
ActivationVO get(Long id);
|
||||
|
||||
PageResult<ActivationVO> query(ActivationQuery query);
|
||||
|
||||
int save(ActivationVO model);
|
||||
|
||||
int delete(Long[] id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.pgmmers.radar.dal.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import com.pgmmers.radar.dal.bean.DataListQuery;
|
||||
import com.pgmmers.radar.dal.bean.DataListRecordQuery;
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.vo.model.DataListMetaVO;
|
||||
import com.pgmmers.radar.vo.model.DataListRecordVO;
|
||||
import com.pgmmers.radar.vo.model.DataListsVO;
|
||||
|
||||
public interface DataListDal {
|
||||
|
||||
List<DataListMetaVO> listDataMeta(Long dataListId);
|
||||
|
||||
List<DataListRecordVO> listDataRecord(Long dataListId);
|
||||
|
||||
DataListMetaVO getListMetaById(Long metaId);
|
||||
|
||||
List<DataListsVO> listDataLists(Long modelId, Integer status);
|
||||
|
||||
//
|
||||
DataListsVO get(Long id);
|
||||
|
||||
List<DataListsVO> list(Long modelId);
|
||||
|
||||
PageResult<DataListsVO> query(DataListQuery query);
|
||||
|
||||
int save(DataListsVO dataList);
|
||||
|
||||
int delete(Long[] id);
|
||||
|
||||
//
|
||||
DataListMetaVO getMeta(Long id);
|
||||
|
||||
int saveMeta(DataListMetaVO dataListMeta);
|
||||
|
||||
int deleteMeta(List<Long> listId);
|
||||
|
||||
//
|
||||
DataListRecordVO getRecord(Long id);
|
||||
|
||||
PageResult<DataListRecordVO> queryRecord(DataListRecordQuery query);
|
||||
|
||||
int saveRecord(DataListRecordVO dataListRecord);
|
||||
|
||||
int deleteRecord(Long[] id);
|
||||
|
||||
int deleteRecord(Long dataListId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.pgmmers.radar.dal.model;
|
||||
|
||||
|
||||
import com.pgmmers.radar.dal.bean.FieldQuery;
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.vo.model.FieldVO;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
public interface FieldDal {
|
||||
|
||||
FieldVO get(Long id);
|
||||
|
||||
PageResult<FieldVO> query(FieldQuery query);
|
||||
|
||||
int save(FieldVO field);
|
||||
|
||||
int delete(Long[] id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.pgmmers.radar.dal.model;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.ModelQuery;
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.vo.model.*;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
public interface ModelDal {
|
||||
|
||||
ModelVO getModelByGuid(String guid);
|
||||
|
||||
ModelVO getModelById(Long modelId);
|
||||
|
||||
List<ModelVO> listModel(String merchantCode,Integer status);
|
||||
|
||||
List<ModelVO> listModel(String merchantCode,Integer status, Boolean isTemplate);
|
||||
|
||||
List<ModelVO> listModel(Integer status);
|
||||
|
||||
List<FieldVO> listField(Long modelId);
|
||||
|
||||
List<AbstractionVO> listAbstraction(Long modelId);
|
||||
|
||||
List<AbstractionVO> listAbstraction(Long modelId, Integer status);
|
||||
|
||||
List<ActivationVO> listActivation(Long modelId);
|
||||
|
||||
List<ActivationVO> listActivation(Long modelId, Integer status);
|
||||
|
||||
|
||||
List<RuleVO> listRules(Long modelId, Long activationId, Integer status);
|
||||
|
||||
List<PreItemVO> listPreItem(Long modelId, Integer status);
|
||||
|
||||
PageResult<ModelVO> query(ModelQuery query);
|
||||
|
||||
int save(ModelVO model);
|
||||
|
||||
int delete(Long[] id);
|
||||
|
||||
int copy(ModelVO model);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.pgmmers.radar.dal.model;
|
||||
|
||||
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.dal.bean.PreItemQuery;
|
||||
import com.pgmmers.radar.vo.model.PreItemVO;
|
||||
|
||||
public interface PreItemDal {
|
||||
|
||||
PreItemVO get(Long id);
|
||||
|
||||
PageResult<PreItemVO> query(PreItemQuery query);
|
||||
|
||||
int save(PreItemVO preItem);
|
||||
|
||||
int delete(Long[] id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.pgmmers.radar.dal.model;
|
||||
|
||||
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.dal.bean.RuleHistoryQuery;
|
||||
import com.pgmmers.radar.dal.bean.RuleQuery;
|
||||
import com.pgmmers.radar.vo.model.RuleHistoryVO;
|
||||
import com.pgmmers.radar.vo.model.RuleVO;
|
||||
|
||||
|
||||
public interface RuleDal {
|
||||
|
||||
RuleVO get(Long id);
|
||||
|
||||
PageResult<RuleVO> query(RuleQuery query);
|
||||
|
||||
int save(RuleVO model);
|
||||
|
||||
int delete(Long[] id);
|
||||
|
||||
PageResult<RuleHistoryVO> queryHistory(RuleHistoryQuery query);
|
||||
|
||||
int saveHistory(RuleHistoryVO model);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.pgmmers.radar.dal.model;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.dal.bean.UserQuery;
|
||||
import com.pgmmers.radar.model.UserPO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserDal {
|
||||
PageResult<UserPO> query(UserQuery query);
|
||||
|
||||
List<UserPO> list(String name, String pass);
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.pgmmers.radar.dal.model.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.AbstractionQuery;
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.dal.model.AbstractionDal;
|
||||
import com.pgmmers.radar.dal.util.POVOUtils;
|
||||
import com.pgmmers.radar.mapper.AbstractionMapper;
|
||||
import com.pgmmers.radar.model.AbstractionPO;
|
||||
import com.pgmmers.radar.util.BaseUtils;
|
||||
import com.pgmmers.radar.vo.model.AbstractionVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
|
||||
@Service
|
||||
public class AbstractionDalImpl implements AbstractionDal {
|
||||
|
||||
public static Logger logger = LoggerFactory.getLogger(AbstractionDalImpl.class);
|
||||
|
||||
@Autowired
|
||||
private AbstractionMapper abstractionMapper;
|
||||
|
||||
@Override
|
||||
public AbstractionVO get(Long id) {
|
||||
AbstractionPO abstraction = abstractionMapper.selectByPrimaryKey(id);
|
||||
if (abstraction != null) {
|
||||
AbstractionVO abstractionVO = new AbstractionVO();
|
||||
BeanUtils.copyProperties(abstraction, abstractionVO);
|
||||
return abstractionVO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractionVO> list(Long modelId) {
|
||||
Example example = new Example(AbstractionPO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
criteria.andEqualTo("modelId", modelId);
|
||||
List<AbstractionPO> list = abstractionMapper.selectByExample(example);
|
||||
|
||||
List<AbstractionVO> listVO = new ArrayList<AbstractionVO>();
|
||||
for (AbstractionPO abstractionPO : list) {
|
||||
AbstractionVO abstractionVO = new AbstractionVO();
|
||||
BeanUtils.copyProperties(abstractionPO, abstractionVO);
|
||||
listVO.add(abstractionVO);
|
||||
}
|
||||
return listVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AbstractionVO> query(AbstractionQuery query) {
|
||||
PageHelper.startPage(query.getPageNo(), query.getPageSize());
|
||||
|
||||
Example example = new Example(AbstractionPO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
criteria.andEqualTo("modelId", query.getModelId());
|
||||
|
||||
if (query.getAggregateType() != null) {
|
||||
criteria.andEqualTo("aggregateType", query.getAggregateType());
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getName())) {
|
||||
criteria.andLike("name", BaseUtils.buildLike(query.getName()));
|
||||
}
|
||||
if (query.getStatus() != null) {
|
||||
criteria.andEqualTo("status", query.getStatus());
|
||||
}
|
||||
|
||||
List<AbstractionPO> list = abstractionMapper.selectByExample(example);
|
||||
Page<AbstractionPO> page = (Page<AbstractionPO>) list;
|
||||
|
||||
List<AbstractionVO> listVO = new ArrayList<AbstractionVO>();
|
||||
for (AbstractionPO abstractionPO : page.getResult()) {
|
||||
AbstractionVO abstractionVO = new AbstractionVO();
|
||||
abstractionVO = POVOUtils.copyFromAbstractPO(abstractionPO);
|
||||
listVO.add(abstractionVO);
|
||||
}
|
||||
|
||||
// for (AbstractionPO abstractionPO : page.getResult()) {
|
||||
// AbstractionVO abstractionVO = new AbstractionVO();
|
||||
// BeanUtils.copyProperties(abstractionPO, abstractionVO);
|
||||
// listVO.add(abstractionVO);
|
||||
// }
|
||||
|
||||
PageResult<AbstractionVO> pageResult = new PageResult<AbstractionVO>(page.getPageNum(), page.getPageSize(),
|
||||
(int) page.getTotal(), listVO);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(AbstractionVO abstraction) {
|
||||
AbstractionPO abstractionPO = POVOUtils.copyFromAbstractVO(abstraction);
|
||||
Date sysDate = new Date();
|
||||
int count = 0;
|
||||
if (abstraction.getId() == null) {
|
||||
abstractionPO.setCreateTime(sysDate);
|
||||
abstractionPO.setUpdateTime(sysDate);
|
||||
count = abstractionMapper.insertSelective(abstractionPO);
|
||||
abstraction.setId(abstractionPO.getId());// 返回id
|
||||
} else {
|
||||
abstractionPO.setUpdateTime(sysDate);
|
||||
count = abstractionMapper.updateByPrimaryKeySelective(abstractionPO);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long[] id) {
|
||||
Example example = new Example(AbstractionPO.class);
|
||||
example.createCriteria().andIn("id", Arrays.asList(id));
|
||||
int count = abstractionMapper.deleteByExample(example);
|
||||
// TODO 删除关联子表
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.pgmmers.radar.dal.model.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.ActivationQuery;
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.dal.model.ActivationDal;
|
||||
import com.pgmmers.radar.mapper.ActivationMapper;
|
||||
import com.pgmmers.radar.model.ActivationPO;
|
||||
import com.pgmmers.radar.util.BaseUtils;
|
||||
import com.pgmmers.radar.vo.model.ActivationVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
|
||||
@Service
|
||||
public class ActivationDalImpl implements ActivationDal {
|
||||
|
||||
public static Logger logger = LoggerFactory.getLogger(ActivationDalImpl.class);
|
||||
|
||||
@Autowired
|
||||
private ActivationMapper activationMapper;
|
||||
|
||||
@Override
|
||||
public ActivationVO get(Long id) {
|
||||
ActivationPO activation = activationMapper.selectByPrimaryKey(id);
|
||||
if (activation != null) {
|
||||
ActivationVO activationVO = new ActivationVO();
|
||||
BeanUtils.copyProperties(activation, activationVO);
|
||||
return activationVO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ActivationVO> query(ActivationQuery query) {
|
||||
PageHelper.startPage(query.getPageNo(), query.getPageSize());
|
||||
|
||||
Example example = new Example(ActivationPO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
criteria.andEqualTo("modelId", query.getModelId());
|
||||
if (!StringUtils.isEmpty(query.getName())) {
|
||||
criteria.andLike("activationName", BaseUtils.buildLike(query.getName()));
|
||||
}
|
||||
if (query.getStatus() != null) {
|
||||
criteria.andEqualTo("status", query.getStatus());
|
||||
}
|
||||
List<ActivationPO> list = activationMapper.selectByExample(example);
|
||||
Page<ActivationPO> page = (Page<ActivationPO>) list;
|
||||
|
||||
List<ActivationVO> listVO = new ArrayList<>();
|
||||
for (ActivationPO activationPO : page.getResult()) {
|
||||
ActivationVO activationVO = new ActivationVO();
|
||||
BeanUtils.copyProperties(activationPO, activationVO);
|
||||
listVO.add(activationVO);
|
||||
}
|
||||
|
||||
PageResult<ActivationVO> pageResult = new PageResult<ActivationVO>(page.getPageNum(), page.getPageSize(),
|
||||
(int) page.getTotal(), listVO);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(ActivationVO activation) {
|
||||
ActivationPO activationPO = new ActivationPO();
|
||||
BeanUtils.copyProperties(activation, activationPO);
|
||||
Date sysDate = new Date();
|
||||
int count = 0;
|
||||
if (activation.getId() == null) {
|
||||
activationPO.setCreateTime(sysDate);
|
||||
activationPO.setUpdateTime(sysDate);
|
||||
count = activationMapper.insertSelective(activationPO);
|
||||
activation.setId(activationPO.getId());// 返回id
|
||||
} else {
|
||||
activationPO.setUpdateTime(sysDate);
|
||||
count = activationMapper.updateByPrimaryKeySelective(activationPO);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long[] id) {
|
||||
Example example = new Example(ActivationPO.class);
|
||||
example.createCriteria().andIn("id", Arrays.asList(id));
|
||||
int count = activationMapper.deleteByExample(example);
|
||||
// TODO 删除关联子表
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
package com.pgmmers.radar.dal.model.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.DataListQuery;
|
||||
import com.pgmmers.radar.dal.bean.DataListRecordQuery;
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.dal.model.DataListDal;
|
||||
import com.pgmmers.radar.mapper.DataListMetaMapper;
|
||||
import com.pgmmers.radar.mapper.DataListRecordMapper;
|
||||
import com.pgmmers.radar.mapper.DataListsMapper;
|
||||
import com.pgmmers.radar.model.DataListMetaPO;
|
||||
import com.pgmmers.radar.model.DataListRecordPO;
|
||||
import com.pgmmers.radar.model.DataListsPO;
|
||||
import com.pgmmers.radar.util.BaseUtils;
|
||||
import com.pgmmers.radar.vo.model.DataListMetaVO;
|
||||
import com.pgmmers.radar.vo.model.DataListRecordVO;
|
||||
import com.pgmmers.radar.vo.model.DataListsVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
|
||||
@Service
|
||||
public class DataListDalImpl implements DataListDal {
|
||||
|
||||
public static Logger logger = LoggerFactory.getLogger(DataListDalImpl.class);
|
||||
|
||||
@Autowired
|
||||
private DataListsMapper dataListMapper;
|
||||
|
||||
@Autowired
|
||||
private DataListRecordMapper dataListRecordMapper;
|
||||
|
||||
@Autowired
|
||||
private DataListMetaMapper dataListMetaMapper;
|
||||
|
||||
@Override
|
||||
public List<DataListMetaVO> listDataMeta(Long dataListId) {
|
||||
logger.info("listDataRecord,{}", dataListId);
|
||||
List<DataListMetaVO> volist = new ArrayList<>();
|
||||
Example example = new Example(DataListMetaPO.class);
|
||||
example.createCriteria().andEqualTo("dataListId", dataListId);
|
||||
DataListMetaVO vo;
|
||||
List<DataListMetaPO> list = dataListMetaMapper.selectByExample(example);
|
||||
for (DataListMetaPO po : list) {
|
||||
vo = new DataListMetaVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
volist.add(vo);
|
||||
}
|
||||
return volist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataListRecordVO> listDataRecord(Long dataListId) {
|
||||
logger.info("listDataRecord,{}", dataListId);
|
||||
List<DataListRecordVO> voList = new ArrayList<>();
|
||||
Example example = new Example(DataListRecordPO.class);
|
||||
example.createCriteria().andEqualTo("dataListId", dataListId);
|
||||
List<DataListRecordPO> list = dataListRecordMapper.selectByExample(example);
|
||||
DataListRecordVO vo;
|
||||
for (DataListRecordPO po : list) {
|
||||
vo = new DataListRecordVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
voList.add(vo);
|
||||
}
|
||||
|
||||
return voList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataListMetaVO getListMetaById(Long metaId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataListsVO> listDataLists(Long modelId, Integer status) {
|
||||
logger.info("listDataLists,{},{}", modelId, status);
|
||||
List<DataListsVO> dataLists = new ArrayList<>();
|
||||
Example example = new Example(DataListsPO.class);
|
||||
Example.Criteria cri = example.createCriteria();
|
||||
if (status != null) {
|
||||
cri.andEqualTo("status", status);
|
||||
}
|
||||
List<DataListsPO> list = dataListMapper.selectByExample(example);
|
||||
DataListsVO vo;
|
||||
if (list == null || list.size() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
for (DataListsPO po : list) {
|
||||
vo = new DataListsVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
dataLists.add(vo);
|
||||
}
|
||||
}
|
||||
return dataLists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataListsVO get(Long id) {
|
||||
DataListsPO dataListsPO = dataListMapper.selectByPrimaryKey(id);
|
||||
if (dataListsPO != null) {
|
||||
DataListsVO dataListsVO = new DataListsVO();
|
||||
BeanUtils.copyProperties(dataListsPO, dataListsVO);
|
||||
return dataListsVO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataListsVO> list(Long modelId) {
|
||||
Example example = new Example(DataListsPO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
criteria.andIn("modelId", Arrays.asList(modelId, 0L));
|
||||
List<DataListsPO> list = dataListMapper.selectByExample(example);
|
||||
|
||||
List<DataListsVO> listVO = new ArrayList<>();
|
||||
for (DataListsPO dataListsPO : list) {
|
||||
DataListsVO dataListsVO = new DataListsVO();
|
||||
BeanUtils.copyProperties(dataListsPO, dataListsVO);
|
||||
listVO.add(dataListsVO);
|
||||
}
|
||||
return listVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<DataListsVO> query(DataListQuery query) {
|
||||
PageHelper.startPage(query.getPageNo(), query.getPageSize());
|
||||
|
||||
Example example = new Example(DataListsPO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
criteria.andEqualTo("modelId", query.getModelId());
|
||||
if (!StringUtils.isEmpty(query.getName())) {
|
||||
criteria.andLike("name", BaseUtils.buildLike(query.getName()));
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getListType())) {
|
||||
criteria.andEqualTo("listType", query.getListType());
|
||||
}
|
||||
if (query.getStatus() != null) {
|
||||
criteria.andEqualTo("status", query.getStatus());
|
||||
}
|
||||
List<DataListsPO> list = dataListMapper.selectByExample(example);
|
||||
Page<DataListsPO> page = (Page<DataListsPO>) list;
|
||||
|
||||
List<DataListsVO> listVO = new ArrayList<>();
|
||||
for (DataListsPO dataListsPO : page.getResult()) {
|
||||
DataListsVO dataListsVO = new DataListsVO();
|
||||
BeanUtils.copyProperties(dataListsPO, dataListsVO);
|
||||
listVO.add(dataListsVO);
|
||||
}
|
||||
|
||||
PageResult<DataListsVO> pageResult = new PageResult<>(page.getPageNum(), page.getPageSize(),
|
||||
(int) page.getTotal(), listVO);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(DataListsVO datalist) {
|
||||
DataListsPO dataListsPO = new DataListsPO();
|
||||
BeanUtils.copyProperties(datalist, dataListsPO);
|
||||
Date sysDate = new Date();
|
||||
int count = 0;
|
||||
if (datalist.getId() == null) {
|
||||
dataListsPO.setCreateTime(sysDate);
|
||||
dataListsPO.setUpdateTime(sysDate);
|
||||
count = dataListMapper.insertSelective(dataListsPO);
|
||||
datalist.setId(dataListsPO.getId());// 返回id
|
||||
} else {
|
||||
dataListsPO.setUpdateTime(sysDate);
|
||||
count = dataListMapper.updateByPrimaryKeySelective(dataListsPO);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long[] id) {
|
||||
Example example = new Example(DataListsPO.class);
|
||||
example.createCriteria().andIn("id", Arrays.asList(id));
|
||||
int count = dataListMapper.deleteByExample(example);
|
||||
// TODO 删除关联子表
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataListMetaVO getMeta(Long id) {
|
||||
DataListMetaPO dataListMetaPO = dataListMetaMapper.selectByPrimaryKey(id);
|
||||
if (dataListMetaPO != null) {
|
||||
DataListMetaVO dataListMetaVO = new DataListMetaVO();
|
||||
BeanUtils.copyProperties(dataListMetaPO, dataListMetaVO);
|
||||
return dataListMetaVO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveMeta(DataListMetaVO dataListMeta) {
|
||||
DataListMetaPO dataListMetaPO = new DataListMetaPO();
|
||||
BeanUtils.copyProperties(dataListMeta, dataListMetaPO);
|
||||
Date sysDate = new Date();
|
||||
int count = 0;
|
||||
if (dataListMetaPO.getId() == null) {
|
||||
dataListMetaPO.setCreateTime(sysDate);
|
||||
dataListMetaPO.setUpdateTime(sysDate);
|
||||
count = dataListMetaMapper.insertSelective(dataListMetaPO);
|
||||
dataListMeta.setId(dataListMetaPO.getId());// 返回id
|
||||
} else {
|
||||
dataListMetaPO.setUpdateTime(sysDate);
|
||||
count = dataListMetaMapper.updateByPrimaryKeySelective(dataListMetaPO);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteMeta(List<Long> listId) {
|
||||
Example example = new Example(DataListMetaPO.class);
|
||||
example.createCriteria().andIn("id", listId);
|
||||
int count = dataListMetaMapper.deleteByExample(example);
|
||||
// TODO 删除关联子表
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataListRecordVO getRecord(Long id) {
|
||||
DataListRecordPO dataListRecordPO = dataListRecordMapper.selectByPrimaryKey(id);
|
||||
if (dataListRecordPO != null) {
|
||||
DataListRecordVO dataListRecordVO = new DataListRecordVO();
|
||||
BeanUtils.copyProperties(dataListRecordPO, dataListRecordVO);
|
||||
return dataListRecordVO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<DataListRecordVO> queryRecord(DataListRecordQuery query) {
|
||||
PageHelper.startPage(query.getPageNo(), query.getPageSize());
|
||||
|
||||
Example example = new Example(DataListRecordPO.class);
|
||||
example.createCriteria().andEqualTo("dataListId", query.getDataListId());
|
||||
List<DataListRecordPO> list = dataListRecordMapper.selectByExample(example);
|
||||
Page<DataListRecordPO> page = (Page<DataListRecordPO>) list;
|
||||
|
||||
List<DataListRecordVO> listVO = new ArrayList<>();
|
||||
for (DataListRecordPO dataListRecordPO : page.getResult()) {
|
||||
DataListRecordVO dataListRecordVO = new DataListRecordVO();
|
||||
BeanUtils.copyProperties(dataListRecordPO, dataListRecordVO);
|
||||
listVO.add(dataListRecordVO);
|
||||
}
|
||||
|
||||
PageResult<DataListRecordVO> pageResult = new PageResult<>(page.getPageNum(),
|
||||
page.getPageSize(), (int) page.getTotal(), listVO);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveRecord(DataListRecordVO dataListRecord) {
|
||||
DataListRecordPO dataListRecordPO = new DataListRecordPO();
|
||||
BeanUtils.copyProperties(dataListRecord, dataListRecordPO);
|
||||
Date sysDate = new Date();
|
||||
int count = 0;
|
||||
if (dataListRecordPO.getId() == null) {
|
||||
dataListRecordPO.setCreateTime(sysDate);
|
||||
dataListRecordPO.setUpdateTime(sysDate);
|
||||
count = dataListRecordMapper.insertSelective(dataListRecordPO);
|
||||
dataListRecord.setId(dataListRecordPO.getId());// 返回id
|
||||
} else {
|
||||
dataListRecordPO.setUpdateTime(sysDate);
|
||||
count = dataListRecordMapper.updateByPrimaryKeySelective(dataListRecordPO);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteRecord(Long[] id) {
|
||||
Example example = new Example(DataListRecordPO.class);
|
||||
example.createCriteria().andIn("id", Arrays.asList(id));
|
||||
int count = dataListRecordMapper.deleteByExample(example);
|
||||
// TODO 删除关联子表
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteRecord(Long dataListId) {
|
||||
Example example = new Example(DataListRecordPO.class);
|
||||
example.createCriteria().andEqualTo("dataListId", dataListId);
|
||||
int count = dataListRecordMapper.deleteByExample(example);
|
||||
// TODO 删除关联子表
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.pgmmers.radar.dal.model.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.FieldQuery;
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.dal.model.FieldDal;
|
||||
import com.pgmmers.radar.mapper.FieldMapper;
|
||||
import com.pgmmers.radar.model.FieldPO;
|
||||
import com.pgmmers.radar.util.BaseUtils;
|
||||
import com.pgmmers.radar.vo.model.FieldVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
|
||||
@Service
|
||||
public class FieldDalImpl implements FieldDal {
|
||||
|
||||
public static Logger logger = LoggerFactory.getLogger(FieldDalImpl.class);
|
||||
|
||||
@Autowired
|
||||
private FieldMapper fieldMapper;
|
||||
|
||||
@Override
|
||||
public FieldVO get(Long id) {
|
||||
FieldPO field = fieldMapper.selectByPrimaryKey(id);
|
||||
if (field != null) {
|
||||
FieldVO fieldVO = new FieldVO();
|
||||
BeanUtils.copyProperties(field, fieldVO);
|
||||
return fieldVO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<FieldVO> query(FieldQuery query) {
|
||||
PageHelper.startPage(query.getPageNo(), query.getPageSize());
|
||||
|
||||
Example example = new Example(FieldPO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
criteria.andEqualTo("modelId", query.getModelId());
|
||||
if (!StringUtils.isEmpty(query.getFieldName())) {
|
||||
criteria.andLike("fieldName", BaseUtils.buildLike(query.getFieldName()));
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getFieldType())) {
|
||||
criteria.andEqualTo("fieldType", query.getFieldType());
|
||||
}
|
||||
List<FieldPO> list = fieldMapper.selectByExample(example);
|
||||
Page<FieldPO> page = (Page<FieldPO>) list;
|
||||
|
||||
List<FieldVO> listVO = new ArrayList<>();
|
||||
for (FieldPO fieldPO : page.getResult()) {
|
||||
FieldVO fieldVO = new FieldVO();
|
||||
BeanUtils.copyProperties(fieldPO, fieldVO);
|
||||
listVO.add(fieldVO);
|
||||
}
|
||||
|
||||
PageResult<FieldVO> pageResult = new PageResult<FieldVO>(page.getPageNum(), page.getPageSize(),
|
||||
(int) page.getTotal(), listVO);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(FieldVO field) {
|
||||
FieldPO fieldPO = new FieldPO();
|
||||
BeanUtils.copyProperties(field, fieldPO);
|
||||
Date sysDate = new Date();
|
||||
int count = 0;
|
||||
if (field.getId() == null) {
|
||||
fieldPO.setCreateTime(sysDate);
|
||||
fieldPO.setUpdateTime(sysDate);
|
||||
count = fieldMapper.insertSelective(fieldPO);
|
||||
field.setId(fieldPO.getId());// 返回id
|
||||
} else {
|
||||
fieldPO.setUpdateTime(sysDate);
|
||||
count = fieldMapper.updateByPrimaryKeySelective(fieldPO);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long[] id) {
|
||||
Example example = new Example(FieldPO.class);
|
||||
example.createCriteria().andIn("id", Arrays.asList(id));
|
||||
int count = fieldMapper.deleteByExample(example);
|
||||
// TODO 删除关联子表
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,445 @@
|
||||
package com.pgmmers.radar.dal.model.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.ModelQuery;
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.dal.model.ModelDal;
|
||||
import com.pgmmers.radar.dal.util.POVOUtils;
|
||||
import com.pgmmers.radar.enums.StatusType;
|
||||
import com.pgmmers.radar.mapper.*;
|
||||
import com.pgmmers.radar.model.*;
|
||||
import com.pgmmers.radar.util.BaseUtils;
|
||||
import com.pgmmers.radar.vo.model.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
|
||||
@Service
|
||||
public class ModelDalImpl implements ModelDal {
|
||||
|
||||
public static Logger logger = LoggerFactory.getLogger(ModelDalImpl.class);
|
||||
|
||||
@Autowired
|
||||
private ModelMapper modelMapper;
|
||||
|
||||
@Autowired
|
||||
private FieldMapper fieldMapper;
|
||||
|
||||
@Autowired
|
||||
private AbstractionMapper abstractionMapper;
|
||||
|
||||
@Autowired
|
||||
private ActivationMapper activationMapper;
|
||||
|
||||
@Autowired
|
||||
private DataListsMapper dataListMapper;
|
||||
|
||||
@Autowired
|
||||
private DataListMetaMapper dataListMetaMapper;
|
||||
|
||||
@Autowired
|
||||
private DataListRecordMapper dataListRecordMapper;
|
||||
|
||||
@Autowired
|
||||
private RuleMapper ruleMapper;
|
||||
|
||||
@Autowired
|
||||
private PreItemMapper preItemMapper;
|
||||
|
||||
@Cacheable(value = "models", key = "#guid")
|
||||
@Override
|
||||
public ModelVO getModelByGuid(String guid) {
|
||||
logger.info("getModelByGuid,{}", guid);
|
||||
ModelPO po = null;
|
||||
ModelVO vo = new ModelVO();
|
||||
Example example = new Example(ModelPO.class);
|
||||
example.createCriteria().andEqualTo("guid", guid);
|
||||
List<ModelPO> models = modelMapper.selectByExample(example);
|
||||
if (models == null || models.size() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
po = models.get(0);
|
||||
}
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
//@Cacheable(value = "models", key = "#modelId")
|
||||
@Override
|
||||
public ModelVO getModelById(Long modelId) {
|
||||
logger.info("getModelById,{}", modelId);
|
||||
ModelVO vo = new ModelVO();
|
||||
ModelPO model = modelMapper.selectByPrimaryKey(modelId);
|
||||
if (model != null) {
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
return vo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractionVO> listAbstraction(Long modelId) {
|
||||
logger.info("listAbstraction,{}", modelId);
|
||||
return listAbstraction(modelId, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ActivationVO> listActivation(Long modelId) {
|
||||
logger.info("listActivation,{}", modelId);
|
||||
return listActivation(modelId, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FieldVO> listField(Long modelId) {
|
||||
logger.info("listField,{}", modelId);
|
||||
List<FieldVO> fieldList = new ArrayList<>();
|
||||
Example example = new Example(FieldPO.class);
|
||||
example.createCriteria().andEqualTo("modelId", modelId);
|
||||
List<FieldPO> list = fieldMapper.selectByExample(example);
|
||||
FieldVO vo;
|
||||
if (list == null || list.size() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
for (FieldPO po : list) {
|
||||
vo = new FieldVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
fieldList.add(vo);
|
||||
}
|
||||
}
|
||||
return fieldList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ModelVO> listModel(String merchantCode, Integer status) {
|
||||
logger.info("listAbstraction,merchantCode:{},status:{}",merchantCode, status);
|
||||
return listModel(merchantCode, status, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ModelVO> listModel(Integer status) {
|
||||
logger.info("listAbstraction,status:{}", status);
|
||||
List<ModelVO> modelList = new ArrayList<>();
|
||||
Example example = new Example(ModelPO.class);
|
||||
if (status != null) {
|
||||
example.createCriteria().andEqualTo("status", status);
|
||||
}
|
||||
List<ModelPO> list = modelMapper.selectByExample(example);
|
||||
for (ModelPO po : list) {
|
||||
modelList.add(POVOUtils.copyFromModelPO(po));
|
||||
}
|
||||
return modelList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AbstractionVO> listAbstraction(Long modelId, Integer status) {
|
||||
logger.info("listAbstraction,{}", modelId);
|
||||
List<AbstractionVO> absList = new ArrayList<AbstractionVO>();
|
||||
Example example = new Example(AbstractionPO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
criteria.andEqualTo("modelId", modelId);
|
||||
if (status != null) {
|
||||
criteria.andEqualTo("status",status);
|
||||
}
|
||||
List<AbstractionPO> list = abstractionMapper.selectByExample(example);
|
||||
AbstractionVO vo;
|
||||
if (list == null || list.size() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
for (AbstractionPO po : list) {
|
||||
vo = new AbstractionVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
absList.add(vo);
|
||||
}
|
||||
}
|
||||
return absList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ActivationVO> listActivation(Long modelId, Integer status) {
|
||||
logger.info("listActivation,{}", modelId);
|
||||
List<ActivationVO> activationList = new ArrayList<ActivationVO>();
|
||||
Example example = new Example(ActivationPO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
criteria.andEqualTo("modelId", modelId);
|
||||
if (status != null) {
|
||||
criteria.andEqualTo("status", status);
|
||||
}
|
||||
List<ActivationPO> list = activationMapper.selectByExample(example);
|
||||
ActivationVO vo;
|
||||
if (list == null || list.size() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
for (ActivationPO po : list) {
|
||||
vo = new ActivationVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
activationList.add(vo);
|
||||
}
|
||||
}
|
||||
return activationList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<RuleVO> listRules(Long modelId, Long activationId, Integer status) {
|
||||
logger.info("listRules:{},{},{}", modelId, activationId, status);
|
||||
List<RuleVO> ruleList = new ArrayList<>();
|
||||
Example example = new Example(RulePO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
if (modelId != null) {
|
||||
criteria.andEqualTo("modelId", modelId);
|
||||
}
|
||||
if (activationId != null) {
|
||||
criteria.andEqualTo("activationId", activationId);
|
||||
}
|
||||
if (status != null) {
|
||||
criteria.andEqualTo("status", status);
|
||||
}
|
||||
RuleVO vo;
|
||||
List<RulePO> rulePoList = ruleMapper.selectByExample(example);
|
||||
for (RulePO po : rulePoList) {
|
||||
vo = new RuleVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
ruleList.add(vo);
|
||||
}
|
||||
return ruleList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PreItemVO> listPreItem(Long modelId, Integer status) {
|
||||
logger.info("listRules:{},{}", modelId, status);
|
||||
List<PreItemVO> itemList = new ArrayList<>();
|
||||
Example example = new Example(PreItemPO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
criteria.andEqualTo("modelId", modelId);
|
||||
if (status != null) {
|
||||
criteria.andEqualTo("status", status);
|
||||
}
|
||||
List<PreItemPO> itemPOList = preItemMapper.selectByExample(example);
|
||||
PreItemVO vo = null;
|
||||
for (PreItemPO po : itemPOList) {
|
||||
vo = new PreItemVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
itemList.add(vo);
|
||||
}
|
||||
return itemList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ModelVO> query(ModelQuery query) {
|
||||
PageHelper.startPage(query.getPageNo(), query.getPageSize());
|
||||
|
||||
Example example = new Example(ModelPO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
if (!StringUtils.isEmpty(query.getModelName())) {
|
||||
criteria.andLike("modelName", BaseUtils.buildLike(query.getModelName()));
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getLabel())) {
|
||||
criteria.andLike("label", BaseUtils.buildLike(query.getLabel()));
|
||||
}
|
||||
if (query.getStatus() != null) {
|
||||
criteria.andEqualTo("status", query.getStatus());
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getMerchantCode())) {
|
||||
criteria.andEqualTo("code", query.getMerchantCode());
|
||||
}
|
||||
List<ModelPO> list = modelMapper.selectByExample(example);
|
||||
Page<ModelPO> page = (Page<ModelPO>) list;
|
||||
|
||||
List<ModelVO> listVO = new ArrayList<>();
|
||||
for (ModelPO modelPO : page.getResult()) {
|
||||
ModelVO modelVO = new ModelVO();
|
||||
BeanUtils.copyProperties(modelPO, modelVO);
|
||||
listVO.add(modelVO);
|
||||
}
|
||||
|
||||
PageResult<ModelVO> pageResult = new PageResult<ModelVO>(page.getPageNum(), page.getPageSize(),
|
||||
(int) page.getTotal(), listVO);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
//@CachePut(value = "models", key = "#model.id")
|
||||
@Override
|
||||
public int save(ModelVO model) {
|
||||
ModelPO modelPO = new ModelPO();
|
||||
BeanUtils.copyProperties(model, modelPO);
|
||||
Date sysDate = new Date();
|
||||
int count = 0;
|
||||
if (model.getId() == null) {
|
||||
modelPO.setCreateTime(sysDate);
|
||||
modelPO.setUpdateTime(sysDate);
|
||||
count = modelMapper.insertSelective(modelPO);
|
||||
model.setId(modelPO.getId());//返回id
|
||||
} else {
|
||||
modelPO.setUpdateTime(sysDate);
|
||||
count = modelMapper.updateByPrimaryKeySelective(modelPO);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long[] id) {
|
||||
Example example = new Example(ModelPO.class);
|
||||
example.createCriteria().andIn("id", Arrays.asList(id));
|
||||
int count = modelMapper.deleteByExample(example);
|
||||
// TODO 删除关联子表
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int copy(ModelVO model){
|
||||
Long oldId=model.getId();
|
||||
model.setId(null);
|
||||
model.setStatus(StatusType.INIT.getKey());
|
||||
model.setGuid(UUID.randomUUID().toString().toUpperCase());
|
||||
model.setTemplate(false);
|
||||
int count=this.save(model);
|
||||
|
||||
Long newId=model.getId();
|
||||
Date sysDate = new Date();
|
||||
|
||||
//复制field
|
||||
Example fieldExample = new Example(FieldPO.class);
|
||||
fieldExample.createCriteria().andEqualTo("modelId", oldId);
|
||||
List<FieldPO> fieldList = fieldMapper.selectByExample(fieldExample);
|
||||
for(FieldPO po:fieldList){
|
||||
po.setModelId(newId);
|
||||
po.setId(null);
|
||||
po.setCreateTime(sysDate);
|
||||
po.setUpdateTime(sysDate);
|
||||
fieldMapper.insertSelective(po);
|
||||
}
|
||||
|
||||
//复制preItem
|
||||
Example preItemExample = new Example(PreItemPO.class);
|
||||
preItemExample.createCriteria().andEqualTo("modelId", oldId);
|
||||
List<PreItemPO> preItemList = preItemMapper.selectByExample(preItemExample);
|
||||
for(PreItemPO po:preItemList){
|
||||
po.setModelId(newId);
|
||||
po.setId(null);
|
||||
po.setCreateTime(sysDate);
|
||||
po.setUpdateTime(sysDate);
|
||||
preItemMapper.insertSelective(po);
|
||||
}
|
||||
|
||||
//复制dataList
|
||||
Example dataListsExample = new Example(DataListsPO.class);
|
||||
dataListsExample.createCriteria().andEqualTo("modelId", oldId);
|
||||
List<DataListsPO> dataListsList=dataListMapper.selectByExample(dataListsExample);
|
||||
for(DataListsPO po:dataListsList){
|
||||
Long oldDataListId=po.getId();
|
||||
|
||||
po.setModelId(newId);
|
||||
po.setId(null);
|
||||
po.setCreateTime(sysDate);
|
||||
po.setUpdateTime(sysDate);
|
||||
dataListMapper.insertSelective(po);
|
||||
|
||||
Long newDataListId=po.getId();
|
||||
|
||||
//复制dataListMeta
|
||||
Example dataListMetaExample = new Example(DataListMetaPO.class);
|
||||
dataListMetaExample.createCriteria().andEqualTo("dataListId", oldDataListId);
|
||||
List<DataListMetaPO> dataListMetaList=dataListMetaMapper.selectByExample(dataListMetaExample);
|
||||
for(DataListMetaPO metaPO:dataListMetaList){
|
||||
metaPO.setDataListId(newDataListId);
|
||||
metaPO.setId(null);
|
||||
metaPO.setCreateTime(sysDate);
|
||||
metaPO.setUpdateTime(sysDate);
|
||||
dataListMetaMapper.insertSelective(metaPO);
|
||||
}
|
||||
|
||||
//复制dataListRecord
|
||||
Example dataListRecordExample = new Example(DataListRecordPO.class);
|
||||
dataListRecordExample.createCriteria().andEqualTo("dataListId", oldDataListId);
|
||||
List<DataListRecordPO> dataListRecordList=dataListRecordMapper.selectByExample(dataListRecordExample);
|
||||
for(DataListRecordPO recordPO:dataListRecordList){
|
||||
recordPO.setDataListId(newDataListId);
|
||||
recordPO.setId(null);
|
||||
recordPO.setCreateTime(sysDate);
|
||||
recordPO.setUpdateTime(sysDate);
|
||||
dataListRecordMapper.insertSelective(recordPO);
|
||||
}
|
||||
}
|
||||
|
||||
//复制abstraction
|
||||
Example abstractionExample = new Example(AbstractionPO.class);
|
||||
abstractionExample.createCriteria().andEqualTo("modelId", oldId);
|
||||
List<AbstractionPO> abstractionList = abstractionMapper.selectByExample(abstractionExample);
|
||||
for(AbstractionPO po:abstractionList){
|
||||
po.setModelId(newId);
|
||||
po.setId(null);
|
||||
po.setCreateTime(sysDate);
|
||||
po.setUpdateTime(sysDate);
|
||||
abstractionMapper.insertSelective(po);
|
||||
}
|
||||
|
||||
//复制activation
|
||||
Example activationExample = new Example(ActivationPO.class);
|
||||
activationExample.createCriteria().andEqualTo("modelId", oldId);
|
||||
List<ActivationPO> activationList = activationMapper.selectByExample(activationExample);
|
||||
for(ActivationPO po:activationList){
|
||||
Long oldActivationID=po.getId();
|
||||
|
||||
po.setModelId(newId);
|
||||
po.setId(null);
|
||||
po.setCreateTime(sysDate);
|
||||
po.setUpdateTime(sysDate);
|
||||
activationMapper.insertSelective(po);
|
||||
|
||||
Long newActivationID=po.getId();
|
||||
|
||||
//复制rule
|
||||
Example ruleExample = new Example(RulePO.class);
|
||||
ruleExample.createCriteria().andEqualTo("activationId", oldActivationID);
|
||||
List<RulePO> ruleList = ruleMapper.selectByExample(ruleExample);
|
||||
for(RulePO rulePO:ruleList){
|
||||
rulePO.setModelId(newId);
|
||||
rulePO.setActivationId(newActivationID);
|
||||
rulePO.setId(null);
|
||||
rulePO.setCreateTime(sysDate);
|
||||
rulePO.setUpdateTime(sysDate);
|
||||
ruleMapper.insertSelective(rulePO);
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ModelVO> listModel(String merchantCode, Integer status,
|
||||
Boolean isTemplate) {
|
||||
List<ModelVO> modelList = new ArrayList<>();
|
||||
Example example = new Example(ModelPO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
if (!StringUtils.isEmpty(merchantCode)){
|
||||
criteria.andEqualTo("code", merchantCode);
|
||||
}
|
||||
if (status != null) {
|
||||
criteria.andEqualTo("status",status);
|
||||
}
|
||||
if (isTemplate != null) {
|
||||
criteria.andEqualTo("template", isTemplate);
|
||||
}
|
||||
List<ModelPO> list = modelMapper.selectByExample(example);
|
||||
for (ModelPO po : list) {
|
||||
modelList.add(POVOUtils.copyFromModelPO(po));
|
||||
}
|
||||
return modelList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.pgmmers.radar.dal.model.impl;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.dal.bean.PreItemQuery;
|
||||
import com.pgmmers.radar.dal.model.PreItemDal;
|
||||
import com.pgmmers.radar.mapper.PreItemMapper;
|
||||
import com.pgmmers.radar.model.PreItemPO;
|
||||
import com.pgmmers.radar.vo.model.PreItemVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class PreItemDalImpl implements PreItemDal {
|
||||
|
||||
public static Logger logger = LoggerFactory.getLogger(PreItemDalImpl.class);
|
||||
|
||||
@Autowired
|
||||
private PreItemMapper preItemMapper;
|
||||
|
||||
@Override
|
||||
public PreItemVO get(Long id) {
|
||||
PreItemPO preItem = preItemMapper.selectByPrimaryKey(id);
|
||||
if (preItem != null) {
|
||||
PreItemVO preItemVO = new PreItemVO();
|
||||
BeanUtils.copyProperties(preItem, preItemVO);
|
||||
return preItemVO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PreItemVO> query(PreItemQuery query) {
|
||||
PageHelper.startPage(query.getPageNo(), query.getPageSize());
|
||||
|
||||
Example example = new Example(PreItemPO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
criteria.andEqualTo("modelId", query.getModelId());
|
||||
if (!StringUtils.isEmpty(query.getPlugin())) {
|
||||
criteria.andEqualTo("plugin", query.getPlugin());
|
||||
}
|
||||
if (query.getStatus() != null) {
|
||||
criteria.andEqualTo("status", query.getStatus());
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getLabel())) {
|
||||
//criteria.andLabelLike(BaseUtils.buildLike(query.getLabel()));
|
||||
criteria.andEqualTo("label", query.getLabel());
|
||||
}
|
||||
|
||||
List<PreItemPO> list = preItemMapper.selectByExample(example);
|
||||
Page<PreItemPO> page = (Page<PreItemPO>) list;
|
||||
|
||||
List<PreItemVO> listVO = new ArrayList<PreItemVO>();
|
||||
for (PreItemPO preItemPO : page.getResult()) {
|
||||
PreItemVO preItemVO = new PreItemVO();
|
||||
BeanUtils.copyProperties(preItemPO, preItemVO);
|
||||
listVO.add(preItemVO);
|
||||
}
|
||||
|
||||
PageResult<PreItemVO> pageResult = new PageResult<>(page.getPageNum(), page.getPageSize(),
|
||||
(int) page.getTotal(), listVO);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(PreItemVO preItem) {
|
||||
PreItemPO preItemPO = new PreItemPO();
|
||||
BeanUtils.copyProperties(preItem, preItemPO);
|
||||
Date sysDate = new Date();
|
||||
int count = 0;
|
||||
if (preItemPO.getId() == null) {
|
||||
preItemPO.setCreateTime(sysDate);
|
||||
preItemPO.setUpdateTime(sysDate);
|
||||
count = preItemMapper.insertSelective(preItemPO);
|
||||
preItem.setId(preItemPO.getId());// 返回id
|
||||
} else {
|
||||
preItemPO.setUpdateTime(sysDate);
|
||||
count = preItemMapper.updateByPrimaryKeySelective(preItemPO);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long[] id) {
|
||||
Example example = new Example(PreItemPO.class);
|
||||
example.createCriteria().andIn("id", Arrays.asList(id));
|
||||
int count = preItemMapper.deleteByExample(example);
|
||||
// TODO 删除关联子表
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.pgmmers.radar.dal.model.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.dal.bean.RuleHistoryQuery;
|
||||
import com.pgmmers.radar.dal.bean.RuleQuery;
|
||||
import com.pgmmers.radar.dal.model.RuleDal;
|
||||
import com.pgmmers.radar.dal.util.POVOUtils;
|
||||
import com.pgmmers.radar.mapper.RuleHistoryMapper;
|
||||
import com.pgmmers.radar.mapper.RuleMapper;
|
||||
import com.pgmmers.radar.model.RuleHistoryPO;
|
||||
import com.pgmmers.radar.model.RulePO;
|
||||
import com.pgmmers.radar.util.BaseUtils;
|
||||
import com.pgmmers.radar.vo.model.RuleHistoryVO;
|
||||
import com.pgmmers.radar.vo.model.RuleVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
|
||||
@Service
|
||||
public class RuleDalImpl implements RuleDal {
|
||||
|
||||
public static Logger logger = LoggerFactory.getLogger(RuleDalImpl.class);
|
||||
|
||||
@Autowired
|
||||
private RuleMapper ruleMapper;
|
||||
|
||||
@Autowired
|
||||
private RuleHistoryMapper ruleHistoryMapper;
|
||||
|
||||
@Override
|
||||
public RuleVO get(Long id) {
|
||||
RulePO rule = ruleMapper.selectByPrimaryKey(id);
|
||||
if (rule != null) {
|
||||
RuleVO ruleVO = POVOUtils.copyFromRulePO(rule);
|
||||
return ruleVO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RuleVO> query(RuleQuery query) {
|
||||
PageHelper.startPage(query.getPageNo(), query.getPageSize());
|
||||
|
||||
Example example = new Example(RulePO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
RulePO rule = new RulePO();
|
||||
rule.setActivationId(query.getActivationId());
|
||||
rule.setStatus(query.getStatus());
|
||||
rule.setName(query.getName());
|
||||
|
||||
|
||||
|
||||
criteria.andEqualTo("activationId",query.getActivationId());
|
||||
if (!StringUtils.isEmpty(query.getName())) {
|
||||
criteria.andLike("name", BaseUtils.buildLike(query.getName()));
|
||||
}
|
||||
if (query.getStatus() != null) {
|
||||
criteria.andEqualTo("status", query.getStatus());
|
||||
}
|
||||
List<RulePO> list = ruleMapper.selectByExample(example);
|
||||
|
||||
|
||||
Page<RulePO> page = (Page<RulePO>) list;
|
||||
|
||||
List<RuleVO> listVO = new ArrayList<RuleVO>();
|
||||
for (RulePO rulePO : page.getResult()) {
|
||||
// RuleVO ruleVO = new RuleVO();
|
||||
// BeanUtils.copyProperties(rulePO, ruleVO);
|
||||
RuleVO ruleVO = POVOUtils.copyFromRulePO(rulePO);
|
||||
listVO.add(ruleVO);
|
||||
}
|
||||
|
||||
PageResult<RuleVO> pageResult = new PageResult<RuleVO>(page.getPageNum(), page.getPageSize(),
|
||||
(int) page.getTotal(), listVO);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(RuleVO rule) {
|
||||
RulePO rulePO = POVOUtils.copyFromRuleVO(rule);
|
||||
Date sysDate = new Date();
|
||||
int count = 0;
|
||||
if (rule.getId() == null) {
|
||||
rulePO.setCreateTime(sysDate);
|
||||
rulePO.setUpdateTime(sysDate);
|
||||
count = ruleMapper.insertSelective(rulePO);
|
||||
rule.setId(rulePO.getId());// 返回id
|
||||
} else {
|
||||
rulePO.setUpdateTime(sysDate);
|
||||
count = ruleMapper.updateByPrimaryKeySelective(rulePO);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long[] id) {
|
||||
Example example = new Example(RulePO.class);
|
||||
example.createCriteria().andIn("id", Arrays.asList(id));
|
||||
int count = ruleMapper.deleteByExample(example);
|
||||
// TODO 删除关联子表
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RuleHistoryVO> queryHistory(RuleHistoryQuery query) {
|
||||
PageHelper.startPage(query.getPageNo(), query.getPageSize());
|
||||
|
||||
Example example = new Example(RuleHistoryVO.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
criteria.andEqualTo("ruleId", query.getRuleId());
|
||||
List<RuleHistoryPO> list = ruleHistoryMapper.selectByExample(example);
|
||||
Page<RuleHistoryPO> page = (Page<RuleHistoryPO>) list;
|
||||
|
||||
List<RuleHistoryVO> listVO = new ArrayList<RuleHistoryVO>();
|
||||
for (RuleHistoryPO ruleHistoryPO : page.getResult()) {
|
||||
RuleHistoryVO ruleHistoryVO = new RuleHistoryVO();
|
||||
BeanUtils.copyProperties(ruleHistoryPO, ruleHistoryVO);
|
||||
listVO.add(ruleHistoryVO);
|
||||
}
|
||||
|
||||
PageResult<RuleHistoryVO> pageResult = new PageResult<RuleHistoryVO>(page.getPageNum(), page.getPageSize(),
|
||||
(int) page.getTotal(), listVO);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveHistory(RuleHistoryVO ruleHistory) {
|
||||
RuleHistoryPO ruleHistoryPO = new RuleHistoryPO();
|
||||
BeanUtils.copyProperties(ruleHistory, ruleHistoryPO);
|
||||
Date sysDate = new Date();
|
||||
int count = 0;
|
||||
ruleHistoryPO.setUpdateTime(sysDate);
|
||||
count = ruleHistoryMapper.insertSelective(ruleHistoryPO);
|
||||
ruleHistory.setId(ruleHistoryPO.getId());// 返回id
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.pgmmers.radar.dal.model.impl;
|
||||
|
||||
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
||||
import com.pgmmers.radar.dal.bean.PageResult;
|
||||
import com.pgmmers.radar.dal.bean.UserQuery;
|
||||
import com.pgmmers.radar.dal.model.UserDal;
|
||||
import com.pgmmers.radar.mapper.UserMapper;
|
||||
import com.pgmmers.radar.model.UserPO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class UserDalImpl implements UserDal {
|
||||
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public PageResult<UserPO> query(UserQuery query) {
|
||||
PageHelper.startPage(query.getPageNo(), query.getPageSize());
|
||||
|
||||
|
||||
UserPO userPO = new UserPO();
|
||||
userPO.setUserName(query.getUserName());
|
||||
userPO.setPasswd(query.getPasswd());
|
||||
Example userExample = new Example(UserPO.class);
|
||||
userExample.createCriteria().andEqualTo(userPO);
|
||||
|
||||
List<UserPO> users = userMapper.selectByExample(userExample);
|
||||
|
||||
if (users == null ) {
|
||||
users = new ArrayList<>();
|
||||
}
|
||||
|
||||
Page<UserPO> page = (Page<UserPO>) users;
|
||||
|
||||
PageResult<UserPO> pageResult = new PageResult<>(page.getPageNum(), page.getPageSize(),
|
||||
(int) page.getTotal(), users);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserPO> list(String name, String pass) {
|
||||
Example example = new Example(UserPO.class);
|
||||
example.createCriteria().andEqualTo("userName", name).andEqualTo("passwd",pass);
|
||||
List<UserPO> list = userMapper.selectByExample(example);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.pgmmers.radar.dal.util;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.util.JSONPObject;
|
||||
import com.pgmmers.radar.model.AbstractionPO;
|
||||
import com.pgmmers.radar.model.MobileInfoPO;
|
||||
import com.pgmmers.radar.model.ModelPO;
|
||||
import com.pgmmers.radar.model.RulePO;
|
||||
import com.pgmmers.radar.vo.data.MobileInfoVO;
|
||||
import com.pgmmers.radar.vo.model.AbstractionVO;
|
||||
import com.pgmmers.radar.vo.model.ModelVO;
|
||||
import com.pgmmers.radar.vo.model.RuleVO;
|
||||
import jdk.nashorn.internal.parser.JSONParser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class POVOUtils {
|
||||
|
||||
public static ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
public static MobileInfoVO copyFromMobileInfPO(MobileInfoPO po) {
|
||||
MobileInfoVO vo = new MobileInfoVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
public static ModelVO copyFromModelPO(ModelPO po) {
|
||||
ModelVO vo = new ModelVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
public static MobileInfoPO copyFromMobileInfoVO(MobileInfoVO vo) {
|
||||
MobileInfoPO po = new MobileInfoPO();
|
||||
BeanUtils.copyProperties(vo, po);
|
||||
return po;
|
||||
}
|
||||
|
||||
public static AbstractionVO copyFromAbstractPO(AbstractionPO po) {
|
||||
AbstractionVO vo = new AbstractionVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
JsonNode json = null;
|
||||
try {
|
||||
json = objectMapper.readTree(po.getRuleDefinition());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
vo.setRuleDefinition(json);
|
||||
return vo;
|
||||
}
|
||||
|
||||
public static AbstractionPO copyFromAbstractVO(AbstractionVO vo) {
|
||||
AbstractionPO po = new AbstractionPO();
|
||||
BeanUtils.copyProperties(vo, po);
|
||||
try {
|
||||
String str = objectMapper.writeValueAsString(vo.getRuleDefinition());
|
||||
po.setRuleDefinition(str);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return po;
|
||||
}
|
||||
|
||||
public static RuleVO copyFromRulePO(RulePO po) {
|
||||
RuleVO vo = new RuleVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
JsonNode json = null;
|
||||
try {
|
||||
json = objectMapper.readTree(po.getRuleDefinition());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
vo.setRuleDefinition(json);
|
||||
return vo;
|
||||
}
|
||||
|
||||
public static RulePO copyFromRuleVO(RuleVO vo) {
|
||||
RulePO po = new RulePO();
|
||||
BeanUtils.copyProperties(vo, po);
|
||||
try {
|
||||
String str = objectMapper.writeValueAsString(vo.getRuleDefinition());
|
||||
po.setRuleDefinition(str);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return po;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.pgmmers.radar.enums;
|
||||
|
||||
/**
|
||||
*
|
||||
* 统计类型.
|
||||
*
|
||||
* @author feihu.wang
|
||||
* @version Revision 1.0.0
|
||||
* @since:2016年8月19日
|
||||
*
|
||||
*/
|
||||
public class AggregateType {
|
||||
|
||||
public static final int COUNT = 1;
|
||||
|
||||
public static final int DISTINCT_COUNT = 2;
|
||||
|
||||
public static final int SUM = 3;
|
||||
|
||||
public static final int AVERAGE = 4;
|
||||
|
||||
public static final int MAX = 5;
|
||||
|
||||
public static final int MIN = 6;
|
||||
|
||||
/**
|
||||
* 标准差
|
||||
*/
|
||||
public static final int SD = 7;
|
||||
|
||||
/**
|
||||
* 方差
|
||||
*/
|
||||
public static final int VARIANCE = 8;
|
||||
|
||||
/**
|
||||
* 偏离率
|
||||
*/
|
||||
public static final int DEVIATION = 9;
|
||||
|
||||
/**
|
||||
* 中位数
|
||||
*/
|
||||
public static final int MEDIAN = 10;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.pgmmers.radar.enums;
|
||||
|
||||
public class CombineType {
|
||||
|
||||
/**
|
||||
* 字符串拼接
|
||||
*/
|
||||
public final static int CONCAT = 1;
|
||||
|
||||
/**
|
||||
* 实数累计
|
||||
*/
|
||||
public final static int ACCUMULATE = 2;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.pgmmers.radar.enums;
|
||||
|
||||
/**
|
||||
*
|
||||
* 名单类型.
|
||||
*
|
||||
* @author feihu.wang
|
||||
* @version Revision 1.0.0
|
||||
* @since:2016年8月19日
|
||||
*
|
||||
*/
|
||||
public enum DataListType {
|
||||
|
||||
BLACK(1, "黑名单"), WHITE(2, "白名单");
|
||||
private Integer key;
|
||||
private String desc;
|
||||
|
||||
DataListType(Integer key, String desc) {
|
||||
this.key = key;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(Integer key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.pgmmers.radar.enums;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
*
|
||||
* 时间字段类型.
|
||||
*
|
||||
* @author feihu.wang
|
||||
* @version Revision 1.0.0
|
||||
* @since:2016年8月19日
|
||||
*
|
||||
*/
|
||||
public class DateType {
|
||||
|
||||
public static int YEAR = Calendar.YEAR;
|
||||
|
||||
public static int MONTH = Calendar.MONTH;
|
||||
|
||||
public static int DAY = Calendar.DATE;
|
||||
|
||||
public static int HOUR = Calendar.HOUR_OF_DAY;
|
||||
|
||||
public static int MINUTE = Calendar.MINUTE;
|
||||
|
||||
public static int SECOND = Calendar.SECOND;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.pgmmers.radar.enums;
|
||||
|
||||
/**
|
||||
*
|
||||
* 字段类型.
|
||||
*
|
||||
* @author feihu.wang
|
||||
* @version Revision 1.0.0
|
||||
* @since:2016年8月19日
|
||||
*
|
||||
*/
|
||||
public enum FieldType {
|
||||
STRING(1, "字符串", String.class), INTEGER(2, "整数", Integer.class), LONG(3, "长整数", Long.class), DOUBLE(4, "浮点数", Double.class);
|
||||
|
||||
private int key;
|
||||
private String desc;
|
||||
|
||||
private Class<?> clazz;
|
||||
|
||||
FieldType(int key,String desc, Class<?> clazz) {
|
||||
this.key = key;
|
||||
this.desc = desc;
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
public int getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(int key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Class<?> getClazz() {
|
||||
return clazz;
|
||||
}
|
||||
|
||||
public void setClazz(Class<?> clazz) {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.pgmmers.radar.enums;
|
||||
|
||||
/**
|
||||
*
|
||||
* 运算符.
|
||||
*
|
||||
* @author feihu.wang
|
||||
* @since:2016年8月19日
|
||||
*
|
||||
*/
|
||||
public enum Operator {
|
||||
|
||||
ADD(1, "add"), SUB(2, "sub"), MUL(3, "mul"), DIV(4, "div"), NONE(5, "none");
|
||||
|
||||
private Integer key;
|
||||
|
||||
private String desc;
|
||||
|
||||
Operator(Integer key, String desc) {
|
||||
this.key = key;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(Integer key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
||||
100
radar-dal/src/main/java/com.pgmmers.radar/enums/PluginType.java
Normal file
100
radar-dal/src/main/java/com.pgmmers.radar/enums/PluginType.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package com.pgmmers.radar.enums;
|
||||
|
||||
/**
|
||||
*
|
||||
* 插件类型.
|
||||
*
|
||||
* @author feihu.wang
|
||||
* @version Revision 1.0.0
|
||||
* @since:2016年8月19日
|
||||
*
|
||||
*/
|
||||
public enum PluginType {
|
||||
|
||||
IP2LOCATION(
|
||||
1,
|
||||
"ip2location",
|
||||
"IP转换成地址",
|
||||
null,
|
||||
"[{\"column\":\"country\", \"title\":\"国家\", \"type\":\"STRING\"},{\"column\":\"provice\", \"title\":\"省份\", \"type\":\"STRING\"},{\"column\":\"city\", \"title\":\"城市\", \"type\":\"STRING\"}]"), //
|
||||
GPS2LOCATION(
|
||||
2,
|
||||
"gps2location",
|
||||
"GPS转换成地址",
|
||||
null,
|
||||
"[{\"column\":\"country\", \"title\":\"国家\", \"type\":\"STRING\"},{\"column\":\"provice\", \"title\":\"省份\", \"type\":\"STRING\"},{\"column\":\"city\", \"title\":\"城市\", \"type\":\"STRING\"}]"), //
|
||||
ALLINONE(3, "allInOne", "字段合并", "STRING", null), //
|
||||
SUBSTRING(4, "subString", "字符串截短", "STRING", null), //
|
||||
MOBILE2LOCATION(
|
||||
5,
|
||||
"mobile2location",
|
||||
"手机号码归属地",
|
||||
null,
|
||||
"[{\"column\":\"country\", \"title\":\"国家\", \"type\":\"STRING\"},{\"column\":\"provice\", \"title\":\"省份\", \"type\":\"STRING\"},{\"column\":\"city\", \"title\":\"城市\", \"type\":\"STRING\"}]"), //
|
||||
SENSITIVE_TIME(6, "getSensitiveTime", "敏感时间段(小时)", "STRING", null),
|
||||
//DATEFORMAT(7, "formatDate", "日期时间处理", "STRING", null),
|
||||
;
|
||||
|
||||
private Integer key;
|
||||
private String method;
|
||||
private String desc;
|
||||
private String type;
|
||||
private String meta;
|
||||
|
||||
PluginType(Integer key, String method, String desc, String type, String meta) {
|
||||
this.key = key;
|
||||
this.method = method;
|
||||
this.desc = desc;
|
||||
this.type = type;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(Integer key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void setMeta(String meta) {
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public static PluginType get(String plugin) {
|
||||
for (PluginType pluginType : PluginType.values()) {
|
||||
if (pluginType.name().equals(plugin))
|
||||
return pluginType;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.pgmmers.radar.enums;
|
||||
|
||||
public enum ResultCode {
|
||||
|
||||
OVER_TIME("600","登录超时");
|
||||
|
||||
private String code;
|
||||
private String desc;
|
||||
|
||||
ResultCode(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.pgmmers.radar.enums;
|
||||
|
||||
/**
|
||||
*
|
||||
* 状态.
|
||||
*
|
||||
* @author feihu.wang
|
||||
* @since:2016年8月19日
|
||||
*
|
||||
*/
|
||||
public enum StatusType {
|
||||
|
||||
INIT(0, "初始"), ACTIVE(1, "可用"), INACTIVE(2, "不可用");
|
||||
|
||||
private int key;
|
||||
private String value;
|
||||
|
||||
StatusType(int key, String value) {
|
||||
this.setKey(key);
|
||||
this.setValue(value);
|
||||
}
|
||||
|
||||
public int getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(int key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.pgmmers.radar.enums;
|
||||
|
||||
/**
|
||||
*
|
||||
* 校验类型.
|
||||
* @author feihu.wang
|
||||
* @version Revision 0.0.1
|
||||
*/
|
||||
public enum ValidateType {
|
||||
|
||||
INTEGER(1, "整型"), LONG(2, "整型"), DOUBLE(3, "浮点型"), STRING(4, "字符串"),
|
||||
|
||||
LENGTH(11, "字符串长度"), MAX_LENGTH(11, "最大长度"), MIN_LENGTH(11, "最小长度"),
|
||||
|
||||
EMAIL(21, "邮箱"), MOBILE(22, "手机"), IP(23, "IP"),
|
||||
|
||||
REGEX(99, "正则表达式");
|
||||
|
||||
ValidateType(int key, String desc) {
|
||||
this.key = key;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
private int key;
|
||||
private String desc;
|
||||
|
||||
public int getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(int key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.pgmmers.radar.vo.admin;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class UserVO implements Serializable{
|
||||
static final long serialVersionUID = 9039238878942L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String passwd;
|
||||
|
||||
private String code;
|
||||
|
||||
private String status;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getPasswd() {
|
||||
return passwd;
|
||||
}
|
||||
|
||||
public void setPasswd(String passwd) {
|
||||
this.passwd = passwd;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.pgmmers.radar.vo.common;
|
||||
|
||||
public class FieldValueVO {
|
||||
|
||||
private String key;
|
||||
|
||||
private String value;
|
||||
|
||||
private String field;
|
||||
|
||||
public FieldValueVO(String key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public FieldValueVO(String key, String field, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
public void setField(String field) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
}
|
||||
168
radar-dal/src/main/java/com.pgmmers.radar/vo/common/PageVO.java
Normal file
168
radar-dal/src/main/java/com.pgmmers.radar/vo/common/PageVO.java
Normal file
@@ -0,0 +1,168 @@
|
||||
package com.pgmmers.radar.vo.common;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* <p>PageVO class.</p>
|
||||
*
|
||||
* @author zhang
|
||||
* @version $Id: $Id
|
||||
*/
|
||||
public class PageVO<T> {
|
||||
|
||||
private int rowCount = 0; // 记录总数
|
||||
private int pageCount = 1; // 分页总数
|
||||
private int pageSize = 10; // 每页记录数
|
||||
private int pageNum = 1; // 当前页数
|
||||
private int startIndex = 1; // 起始记录数
|
||||
private int endIndex = 1; // 结束记录数
|
||||
private List<T> list;// 记录列表
|
||||
|
||||
/**
|
||||
* 初始化分页对象
|
||||
*
|
||||
* @param pageNum a int.
|
||||
* @param pageSize a int.
|
||||
* @param rowCount a int.
|
||||
*/
|
||||
public PageVO(int pageNum, int pageSize,int rowCount) {
|
||||
preProcessParams(pageNum, pageSize);
|
||||
this.rowCount = rowCount;
|
||||
countPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 预处理SQL语句和页面参数
|
||||
*/
|
||||
private void preProcessParams(int pageNum, int pageSize) {
|
||||
if (pageNum > 0) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
if (pageSize > 0) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
if (pageSize > 1000) {
|
||||
this.pageSize = 1000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算分页数及起止记录
|
||||
*/
|
||||
private void countPage() {
|
||||
// 计算分页总数
|
||||
if ((rowCount % pageSize) == 0) {
|
||||
pageCount = rowCount / pageSize;
|
||||
} else {
|
||||
pageCount = rowCount / pageSize + 1;
|
||||
}
|
||||
if (pageCount == 0) {
|
||||
pageCount = 1;
|
||||
}
|
||||
// 判断pageNum是否过界
|
||||
if (pageNum > pageCount && rowCount != 0) {
|
||||
pageNum = pageCount;
|
||||
}
|
||||
// 计算起止记录
|
||||
startIndex = (pageNum - 1) * pageSize + 1;
|
||||
endIndex = (pageNum) * pageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得对象列表
|
||||
*
|
||||
* @return a {@link java.util.List} object.
|
||||
*/
|
||||
public List<T> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
/* 获得起始记录数 */
|
||||
/**
|
||||
* <p>Getter for the field <code>startIndex</code>.</p>
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public int getStartIndex() {
|
||||
return startIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getStartIndexInteger.</p>
|
||||
*
|
||||
* @return a {@link java.lang.Integer} object.
|
||||
*/
|
||||
public Integer getStartIndexInteger() {
|
||||
return startIndex;
|
||||
}
|
||||
|
||||
/* 获得结束记录数 */
|
||||
/**
|
||||
* <p>Getter for the field <code>endIndex</code>.</p>
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public int getEndIndex() {
|
||||
return endIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getEndIndexInteger.</p>
|
||||
*
|
||||
* @return a {@link java.lang.Integer} object.
|
||||
*/
|
||||
public Integer getEndIndexInteger() {
|
||||
return endIndex;
|
||||
}
|
||||
|
||||
/* 获得分页其它信息 */
|
||||
/**
|
||||
* <p>Getter for the field <code>pageCount</code>.</p>
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public int getPageCount() {
|
||||
return pageCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Getter for the field <code>pageNum</code>.</p>
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public int getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Getter for the field <code>pageSize</code>.</p>
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Getter for the field <code>rowCount</code>.</p>
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public int getRowCount() {
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Setter for the field <code>list</code>.</p>
|
||||
*
|
||||
* @param list a {@link java.util.List} object.
|
||||
*/
|
||||
public void setList(List<T> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.pgmmers.radar.vo.common;
|
||||
|
||||
|
||||
import com.pgmmers.radar.enums.PluginType;
|
||||
|
||||
public class PluginVO {
|
||||
|
||||
private Integer key;
|
||||
private String method;
|
||||
private String desc;
|
||||
|
||||
// private JSONArray meta;
|
||||
|
||||
public PluginVO() {
|
||||
|
||||
}
|
||||
|
||||
public PluginVO(PluginType plugin) {
|
||||
this.key = plugin.getKey();
|
||||
this.method = plugin.name();
|
||||
this.desc = plugin.getDesc();
|
||||
// if (!StringUtils.isEmpty(plugin.getMeta())) {
|
||||
// this.meta = JSONArray.parseArray(plugin.getMeta());
|
||||
// }
|
||||
}
|
||||
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(Integer key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
package com.pgmmers.radar.vo.data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class MobileInfoVO {
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column DATA_MOBLE_INFO.ID
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column DATA_MOBLE_INFO.MOBILE
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column DATA_MOBLE_INFO.PROVINCE
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column DATA_MOBLE_INFO.CITY
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column DATA_MOBLE_INFO.SUPPLIER
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String supplier;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column DATA_MOBLE_INFO.REGION_CODE
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private String regionCode;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column DATA_MOBLE_INFO.CREATE_TIME
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column DATA_MOBLE_INFO.UPDATE_TIME
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column DATA_MOBLE_INFO.ID
|
||||
*
|
||||
* @return the value of DATA_MOBLE_INFO.ID
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column DATA_MOBLE_INFO.ID
|
||||
*
|
||||
* @param id the value for DATA_MOBLE_INFO.ID
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column DATA_MOBLE_INFO.MOBILE
|
||||
*
|
||||
* @return the value of DATA_MOBLE_INFO.MOBILE
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column DATA_MOBLE_INFO.MOBILE
|
||||
*
|
||||
* @param mobile the value for DATA_MOBLE_INFO.MOBILE
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile == null ? null : mobile.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column DATA_MOBLE_INFO.PROVINCE
|
||||
*
|
||||
* @return the value of DATA_MOBLE_INFO.PROVINCE
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column DATA_MOBLE_INFO.PROVINCE
|
||||
*
|
||||
* @param province the value for DATA_MOBLE_INFO.PROVINCE
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setProvince(String province) {
|
||||
this.province = province == null ? null : province.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column DATA_MOBLE_INFO.CITY
|
||||
*
|
||||
* @return the value of DATA_MOBLE_INFO.CITY
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column DATA_MOBLE_INFO.CITY
|
||||
*
|
||||
* @param city the value for DATA_MOBLE_INFO.CITY
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setCity(String city) {
|
||||
this.city = city == null ? null : city.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column DATA_MOBLE_INFO.SUPPLIER
|
||||
*
|
||||
* @return the value of DATA_MOBLE_INFO.SUPPLIER
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getSupplier() {
|
||||
return supplier;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column DATA_MOBLE_INFO.SUPPLIER
|
||||
*
|
||||
* @param supplier the value for DATA_MOBLE_INFO.SUPPLIER
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setSupplier(String supplier) {
|
||||
this.supplier = supplier == null ? null : supplier.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column DATA_MOBLE_INFO.REGION_CODE
|
||||
*
|
||||
* @return the value of DATA_MOBLE_INFO.REGION_CODE
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public String getRegionCode() {
|
||||
return regionCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column DATA_MOBLE_INFO.REGION_CODE
|
||||
*
|
||||
* @param regionCode the value for DATA_MOBLE_INFO.REGION_CODE
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setRegionCode(String regionCode) {
|
||||
this.regionCode = regionCode == null ? null : regionCode.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column DATA_MOBLE_INFO.CREATE_TIME
|
||||
*
|
||||
* @return the value of DATA_MOBLE_INFO.CREATE_TIME
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column DATA_MOBLE_INFO.CREATE_TIME
|
||||
*
|
||||
* @param createTime the value for DATA_MOBLE_INFO.CREATE_TIME
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column DATA_MOBLE_INFO.UPDATE_TIME
|
||||
*
|
||||
* @return the value of DATA_MOBLE_INFO.UPDATE_TIME
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column DATA_MOBLE_INFO.UPDATE_TIME
|
||||
*
|
||||
* @param updateTime the value for DATA_MOBLE_INFO.UPDATE_TIME
|
||||
*
|
||||
* @mbggenerated
|
||||
*/
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.pgmmers.radar.vo.logs;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class RiskAnalysisResultVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String guid;
|
||||
|
||||
private String reqId;
|
||||
|
||||
|
||||
private String result;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getGuid() {
|
||||
return guid;
|
||||
}
|
||||
|
||||
public void setGuid(String guid) {
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
public String getReqId() {
|
||||
return reqId;
|
||||
}
|
||||
|
||||
public void setReqId(String reqId) {
|
||||
this.reqId = reqId;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.pgmmers.radar.vo.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class AbstractionVO implements Serializable{
|
||||
static final long serialVersionUID = 234345456231L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String label;
|
||||
|
||||
private Long modelId;
|
||||
|
||||
private Integer aggregateType;
|
||||
|
||||
private String searchField;
|
||||
|
||||
private Integer searchIntervalType;
|
||||
|
||||
private Integer searchIntervalValue;
|
||||
|
||||
private String functionField;
|
||||
|
||||
private String ruleScript;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private String comment;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String dataCollectionNames;
|
||||
|
||||
@JsonProperty
|
||||
private JsonNode ruleDefinition;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public Integer getAggregateType() {
|
||||
return aggregateType;
|
||||
}
|
||||
|
||||
public void setAggregateType(Integer aggregateType) {
|
||||
this.aggregateType = aggregateType;
|
||||
}
|
||||
|
||||
public String getSearchField() {
|
||||
return searchField;
|
||||
}
|
||||
|
||||
public void setSearchField(String searchField) {
|
||||
this.searchField = searchField;
|
||||
}
|
||||
|
||||
public Integer getSearchIntervalType() {
|
||||
return searchIntervalType;
|
||||
}
|
||||
|
||||
public void setSearchIntervalType(Integer searchIntervalType) {
|
||||
this.searchIntervalType = searchIntervalType;
|
||||
}
|
||||
|
||||
public Integer getSearchIntervalValue() {
|
||||
return searchIntervalValue;
|
||||
}
|
||||
|
||||
public void setSearchIntervalValue(Integer searchIntervalValue) {
|
||||
this.searchIntervalValue = searchIntervalValue;
|
||||
}
|
||||
|
||||
public String getFunctionField() {
|
||||
return functionField;
|
||||
}
|
||||
|
||||
public void setFunctionField(String functionField) {
|
||||
this.functionField = functionField;
|
||||
}
|
||||
|
||||
public String getRuleScript() {
|
||||
return ruleScript;
|
||||
}
|
||||
|
||||
public void setRuleScript(String ruleScript) {
|
||||
this.ruleScript = ruleScript;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getDataCollectionNames() {
|
||||
return dataCollectionNames;
|
||||
}
|
||||
|
||||
public void setDataCollectionNames(String dataCollectionNames) {
|
||||
this.dataCollectionNames = dataCollectionNames;
|
||||
}
|
||||
|
||||
public JsonNode getRuleDefinition() {
|
||||
return ruleDefinition;
|
||||
}
|
||||
|
||||
public void setRuleDefinition(JsonNode ruleDefinition) {
|
||||
this.ruleDefinition = ruleDefinition;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.pgmmers.radar.vo.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class AbstractionVO2 implements Serializable{
|
||||
static final long serialVersionUID = 234345456231L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String label;
|
||||
|
||||
private Long modelId;
|
||||
|
||||
private Integer aggregateType;
|
||||
|
||||
private String searchField;
|
||||
|
||||
private Integer searchIntervalType;
|
||||
|
||||
private Integer searchIntervalValue;
|
||||
|
||||
private String functionField;
|
||||
|
||||
private String ruleScript;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private String comment;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String dataCollectionNames;
|
||||
|
||||
private String ruleDefinition;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public Integer getAggregateType() {
|
||||
return aggregateType;
|
||||
}
|
||||
|
||||
public void setAggregateType(Integer aggregateType) {
|
||||
this.aggregateType = aggregateType;
|
||||
}
|
||||
|
||||
public String getSearchField() {
|
||||
return searchField;
|
||||
}
|
||||
|
||||
public void setSearchField(String searchField) {
|
||||
this.searchField = searchField;
|
||||
}
|
||||
|
||||
public Integer getSearchIntervalType() {
|
||||
return searchIntervalType;
|
||||
}
|
||||
|
||||
public void setSearchIntervalType(Integer searchIntervalType) {
|
||||
this.searchIntervalType = searchIntervalType;
|
||||
}
|
||||
|
||||
public Integer getSearchIntervalValue() {
|
||||
return searchIntervalValue;
|
||||
}
|
||||
|
||||
public void setSearchIntervalValue(Integer searchIntervalValue) {
|
||||
this.searchIntervalValue = searchIntervalValue;
|
||||
}
|
||||
|
||||
public String getFunctionField() {
|
||||
return functionField;
|
||||
}
|
||||
|
||||
public void setFunctionField(String functionField) {
|
||||
this.functionField = functionField;
|
||||
}
|
||||
|
||||
public String getRuleScript() {
|
||||
return ruleScript;
|
||||
}
|
||||
|
||||
public void setRuleScript(String ruleScript) {
|
||||
this.ruleScript = ruleScript;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getDataCollectionNames() {
|
||||
return dataCollectionNames;
|
||||
}
|
||||
|
||||
public void setDataCollectionNames(String dataCollectionNames) {
|
||||
this.dataCollectionNames = dataCollectionNames;
|
||||
}
|
||||
|
||||
public String getRuleDefinition() {
|
||||
return ruleDefinition;
|
||||
}
|
||||
|
||||
public void setRuleDefinition(String ruleDefinition) {
|
||||
this.ruleDefinition = ruleDefinition;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
package com.pgmmers.radar.vo.model;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class ActivationVO implements Serializable{
|
||||
static final long serialVersionUID = 65434232L;
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
private String activationName;
|
||||
|
||||
|
||||
private Long modelId;
|
||||
|
||||
|
||||
private String label;
|
||||
|
||||
private String comment;
|
||||
|
||||
|
||||
private Integer status;
|
||||
|
||||
|
||||
private Date createTime;
|
||||
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private Integer bottom;
|
||||
|
||||
|
||||
private Integer median;
|
||||
|
||||
|
||||
private Integer high;
|
||||
|
||||
private String ruleOrder;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getActivationName() {
|
||||
return activationName;
|
||||
}
|
||||
|
||||
|
||||
public void setActivationName(String activationName) {
|
||||
this.activationName = activationName;
|
||||
}
|
||||
|
||||
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
|
||||
public Integer getBottom() {
|
||||
return bottom;
|
||||
}
|
||||
|
||||
|
||||
public void setBottom(Integer bottom) {
|
||||
this.bottom = bottom;
|
||||
}
|
||||
|
||||
|
||||
public Integer getMedian() {
|
||||
return median;
|
||||
}
|
||||
|
||||
|
||||
public void setMedian(Integer median) {
|
||||
this.median = median;
|
||||
}
|
||||
|
||||
|
||||
public Integer getHigh() {
|
||||
return high;
|
||||
}
|
||||
|
||||
|
||||
public void setHigh(Integer high) {
|
||||
this.high = high;
|
||||
}
|
||||
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getRuleOrder() {
|
||||
return ruleOrder;
|
||||
}
|
||||
|
||||
public void setRuleOrder(String ruleOrder) {
|
||||
this.ruleOrder = ruleOrder;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.pgmmers.radar.vo.model;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class DataListMetaVO implements Serializable{
|
||||
static final long serialVersionUID = 90392342L;
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
private Long dataListId;
|
||||
|
||||
|
||||
private String fieldName;
|
||||
|
||||
private String label;
|
||||
|
||||
private Integer seqNum;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public Long getDataListId() {
|
||||
return dataListId;
|
||||
}
|
||||
|
||||
|
||||
public void setDataListId(Long dataListId) {
|
||||
this.dataListId = dataListId;
|
||||
}
|
||||
|
||||
|
||||
public String getFieldName() {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
|
||||
public void setFieldName(String fieldName) {
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Integer getSeqNum() {
|
||||
return seqNum;
|
||||
}
|
||||
|
||||
|
||||
public void setSeqNum(Integer seqNum) {
|
||||
this.seqNum = seqNum;
|
||||
}
|
||||
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.pgmmers.radar.vo.model;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class DataListRecordVO implements Serializable{
|
||||
|
||||
static final long serialVersionUID = 455234234L;
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
private Long dataListId;
|
||||
|
||||
|
||||
private String dataRecord;
|
||||
|
||||
|
||||
private Date createTime;
|
||||
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private Long modelId;
|
||||
|
||||
/**
|
||||
* operate
|
||||
*/
|
||||
private String opt;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public Long getDataListId() {
|
||||
return dataListId;
|
||||
}
|
||||
|
||||
|
||||
public void setDataListId(Long dataListId) {
|
||||
this.dataListId = dataListId;
|
||||
}
|
||||
|
||||
|
||||
public String getDataRecord() {
|
||||
return dataRecord;
|
||||
}
|
||||
|
||||
|
||||
public void setDataRecord(String dataRecord) {
|
||||
this.dataRecord = dataRecord;
|
||||
}
|
||||
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
|
||||
public String getOpt() {
|
||||
return opt;
|
||||
}
|
||||
|
||||
|
||||
public void setOpt(String opt) {
|
||||
this.opt = opt;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.pgmmers.radar.vo.model;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class DataListsVO implements Serializable{
|
||||
|
||||
static final long serialVersionUID = 76543424L;
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
private String label;
|
||||
|
||||
|
||||
private Long modelId;
|
||||
|
||||
|
||||
private String comment;
|
||||
|
||||
|
||||
private String listType;
|
||||
|
||||
|
||||
private Integer status;
|
||||
|
||||
|
||||
private Date createTime;
|
||||
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
/**
|
||||
* operate
|
||||
*/
|
||||
private String opt;
|
||||
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
|
||||
public String getListType() {
|
||||
return listType;
|
||||
}
|
||||
|
||||
|
||||
public void setListType(String listType) {
|
||||
this.listType = listType;
|
||||
}
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
|
||||
public String getOpt() {
|
||||
return opt;
|
||||
}
|
||||
|
||||
|
||||
public void setOpt(String opt) {
|
||||
this.opt = opt;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.pgmmers.radar.vo.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class EntityVO implements Serializable{
|
||||
static final long serialVersionUID = 988234234L;
|
||||
|
||||
}
|
||||
109
radar-dal/src/main/java/com.pgmmers.radar/vo/model/FieldVO.java
Normal file
109
radar-dal/src/main/java/com.pgmmers.radar/vo/model/FieldVO.java
Normal file
@@ -0,0 +1,109 @@
|
||||
package com.pgmmers.radar.vo.model;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class FieldVO implements Serializable{
|
||||
static final long serialVersionUID = 7643552321L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long modelId;
|
||||
|
||||
private String fieldName;
|
||||
|
||||
private String label;
|
||||
|
||||
private String fieldType;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String validateType;
|
||||
|
||||
private String validateArgs;
|
||||
|
||||
private Boolean indexed;
|
||||
|
||||
|
||||
public String getValidateType() {
|
||||
return validateType;
|
||||
}
|
||||
|
||||
public void setValidateType(String validateType) {
|
||||
this.validateType = validateType;
|
||||
}
|
||||
|
||||
public String getValidateArgs() {
|
||||
return validateArgs;
|
||||
}
|
||||
|
||||
public void setValidateArgs(String validateArgs) {
|
||||
this.validateArgs = validateArgs;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
public void setModelId(Long modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public String getFieldName() {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
public void setFieldName(String fieldName) {
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
public String getFieldType() {
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
public void setFieldType(String fieldType) {
|
||||
this.fieldType = fieldType;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public Boolean getIndexed() {
|
||||
return indexed;
|
||||
}
|
||||
|
||||
public void setIndexed(Boolean indexed) {
|
||||
this.indexed = indexed;
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user