mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-26 08:16:41 +08:00
jeecg-boot 2.0 模块开发版本发布
This commit is contained in:
@ -0,0 +1,37 @@
|
||||
package org.jeecg;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
@Slf4j
|
||||
@EnableSwagger2
|
||||
@SpringBootApplication
|
||||
@EnableAutoConfiguration
|
||||
public class JeecgApplication {
|
||||
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
//System.setProperty("spring.devtools.restart.enabled", "true");
|
||||
|
||||
ConfigurableApplicationContext application = SpringApplication.run(JeecgApplication.class, args);
|
||||
Environment env = application.getEnvironment();
|
||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||
String port = env.getProperty("server.port");
|
||||
String path = env.getProperty("server.servlet.context-path");
|
||||
log.info("\n----------------------------------------------------------\n\t" +
|
||||
"Application Jeecg-Boot is running! Access URLs:\n\t" +
|
||||
"Local: \t\thttp://localhost:" + port + path + "/\n\t" +
|
||||
"External: \thttp://" + ip + ":" + port + path + "/\n\t" +
|
||||
"swagger-ui: \thttp://" + ip + ":" + port + path + "/swagger-ui.html\n\t" +
|
||||
"Doc: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" +
|
||||
"----------------------------------------------------------");
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package org.jeecg;
|
||||
|
||||
import org.jeecgframework.codegenerate.window.CodeWindow;
|
||||
|
||||
/**
|
||||
* @Title: 单表代码生成器入口
|
||||
* @Author 张代浩
|
||||
* @site www.jeecg.org
|
||||
* @Version:V1.0.1
|
||||
*/
|
||||
public class JeecgOneGUI {
|
||||
|
||||
/** 详细使用手册: http://jeecg-boot.mydoc.io/?t=338140 */
|
||||
public static void main(String[] args) {
|
||||
new CodeWindow().pack();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package org.jeecg;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecgframework.codegenerate.generate.impl.CodeGenerateOneToMany;
|
||||
import org.jeecgframework.codegenerate.generate.pojo.onetomany.MainTableVo;
|
||||
import org.jeecgframework.codegenerate.generate.pojo.onetomany.SubTableVo;
|
||||
|
||||
/**
|
||||
* 代码生成器入口【一对多】
|
||||
* @Author 张代浩
|
||||
* @site www.jeecg.org
|
||||
*
|
||||
*/
|
||||
public class JeecgOneToMainUtil {
|
||||
|
||||
/**
|
||||
* 一对多(父子表)数据模型,生成方法
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
//第一步:设置主表配置
|
||||
MainTableVo mainTable = new MainTableVo();
|
||||
mainTable.setTableName("jeecg_order_main");//表名
|
||||
mainTable.setEntityName("TestOrderMain"); //实体名
|
||||
mainTable.setEntityPackage("test2"); //包名
|
||||
mainTable.setFtlDescription("订单"); //描述
|
||||
|
||||
//第二步:设置子表集合配置
|
||||
List<SubTableVo> subTables = new ArrayList<SubTableVo>();
|
||||
//[1].子表一
|
||||
SubTableVo po = new SubTableVo();
|
||||
po.setTableName("jeecg_order_customer");//表名
|
||||
po.setEntityName("TestOrderCustom"); //实体名
|
||||
po.setEntityPackage("test2"); //包名
|
||||
po.setFtlDescription("客户明细"); //描述
|
||||
//子表外键参数配置
|
||||
/*说明:
|
||||
* a) 子表引用主表主键ID作为外键,外键字段必须以_ID结尾;
|
||||
* b) 主表和子表的外键字段名字,必须相同(除主键ID外);
|
||||
* c) 多个外键字段,采用逗号分隔;
|
||||
*/
|
||||
po.setForeignKeys(new String[]{"order_id"});
|
||||
subTables.add(po);
|
||||
//[2].子表二
|
||||
SubTableVo po2 = new SubTableVo();
|
||||
po2.setTableName("jeecg_order_ticket"); //表名
|
||||
po2.setEntityName("TestOrderTicket"); //实体名
|
||||
po2.setEntityPackage("test2"); //包名
|
||||
po2.setFtlDescription("产品明细"); //描述
|
||||
//子表外键参数配置
|
||||
/*说明:
|
||||
* a) 子表引用主表主键ID作为外键,外键字段必须以_ID结尾;
|
||||
* b) 主表和子表的外键字段名字,必须相同(除主键ID外);
|
||||
* c) 多个外键字段,采用逗号分隔;
|
||||
*/
|
||||
po2.setForeignKeys(new String[]{"order_id"});
|
||||
subTables.add(po2);
|
||||
mainTable.setSubTables(subTables);
|
||||
|
||||
//第三步:一对多(父子表)数据模型,代码生成
|
||||
new CodeGenerateOneToMany(mainTable,subTables).generateCodeFile();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Author: Scott
|
||||
* @Date: 2018/2/7
|
||||
* @description: autopoi 配置类
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
public class AutoPoiConfig {
|
||||
|
||||
/**
|
||||
* excel注解字典参数支持(导入导出字典值,自动翻译)
|
||||
* 举例: @Excel(name = "性别", width = 15, dicCode = "sex")
|
||||
* 1、导出的时候会根据字典配置,把值1,2翻译成:男、女;
|
||||
* 2、导入的时候,会把男、女翻译成1,2存进数据库;
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public ApplicationContextUtil applicationContextUtil() {
|
||||
return new org.jeecgframework.core.util.ApplicationContextUtil();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
|
||||
|
||||
/**
|
||||
* 单数据源配置(jeecg.datasource.open = false时生效)
|
||||
* @Author zhoujf
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(value={"org.jeecg.modules.**.mapper*"})
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
/**
|
||||
* 分页插件
|
||||
*/
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
return new PaginationInterceptor();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * mybatis-plus SQL执行效率插件【生产环境可以关闭】
|
||||
// */
|
||||
// @Bean
|
||||
// public PerformanceInterceptor performanceInterceptor() {
|
||||
// return new PerformanceInterceptor();
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.Duration;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
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.RedisCacheConfiguration;
|
||||
import org.springframework.data.redis.cache.RedisCacheManager;
|
||||
import org.springframework.data.redis.cache.RedisCacheWriter;
|
||||
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 com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
|
||||
|
||||
@Configuration
|
||||
@EnableCaching // 开启缓存支持
|
||||
public class RedisConfig extends CachingConfigurerSupport {
|
||||
|
||||
@Resource
|
||||
private LettuceConnectionFactory lettuceConnectionFactory;
|
||||
|
||||
/**
|
||||
* @description 自定义的缓存key的生成策略 若想使用这个key
|
||||
* 只需要讲注解上keyGenerator的值设置为keyGenerator即可</br>
|
||||
* @return 自定义策略生成的key
|
||||
*/
|
||||
@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();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, Visibility.ANY);
|
||||
om.enableDefaultTyping(DefaultTyping.NON_FINAL);
|
||||
jackson2JsonRedisSerializer.setObjectMapper(om);
|
||||
// 配置redisTemplate
|
||||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<String, Object>();
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存配置管理器
|
||||
*/
|
||||
@Bean
|
||||
public CacheManager cacheManager(LettuceConnectionFactory factory) {
|
||||
// 以锁写入的方式创建RedisCacheWriter对象
|
||||
RedisCacheWriter writer = RedisCacheWriter.lockingRedisCacheWriter(factory);
|
||||
/**
|
||||
* 设置CacheManager的Value序列化方式为JdkSerializationRedisSerializer,
|
||||
* 但其实RedisCacheConfiguration默认就是使用 StringRedisSerializer序列化key,
|
||||
* JdkSerializationRedisSerializer序列化value, 所以以下注释代码就是默认实现,没必要写,直接注释掉
|
||||
*/
|
||||
// RedisSerializationContext.SerializationPair pair =
|
||||
// RedisSerializationContext.SerializationPair.fromSerializer(new
|
||||
// JdkSerializationRedisSerializer(this.getClass().getClassLoader()));
|
||||
// RedisCacheConfiguration config =
|
||||
// RedisCacheConfiguration.defaultCacheConfig().serializeValuesWith(pair);
|
||||
// 创建默认缓存配置对象
|
||||
RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofHours(1)); // 设置缓存有效期一小时;
|
||||
RedisCacheManager cacheManager = new RedisCacheManager(writer, config);
|
||||
return cacheManager;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,130 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
|
||||
import org.apache.shiro.mgt.DefaultSessionStorageEvaluator;
|
||||
import org.apache.shiro.mgt.DefaultSubjectDAO;
|
||||
import org.apache.shiro.mgt.SecurityManager;
|
||||
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
|
||||
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
|
||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||
import org.jeecg.modules.shiro.authc.ShiroRealm;
|
||||
import org.jeecg.modules.shiro.authc.aop.JwtFilter;
|
||||
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
|
||||
/**
|
||||
* @author: Scott
|
||||
* @date: 2018/2/7
|
||||
* @description: shiro 配置类
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
public class ShiroConfig {
|
||||
|
||||
/**
|
||||
* Filter Chain定义说明
|
||||
*
|
||||
* 1、一个URL可以配置多个Filter,使用逗号分隔
|
||||
* 2、当设置多个过滤器时,全部验证通过,才视为通过
|
||||
* 3、部分过滤器可指定参数,如perms,roles
|
||||
*/
|
||||
@Bean("shiroFilter")
|
||||
public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
|
||||
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
|
||||
shiroFilterFactoryBean.setSecurityManager(securityManager);
|
||||
// 拦截器
|
||||
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
|
||||
// 配置不会被拦截的链接 顺序判断
|
||||
filterChainDefinitionMap.put("/sys/login", "anon"); //登录接口排除
|
||||
filterChainDefinitionMap.put("/auth/2step-code", "anon");//登录验证码
|
||||
filterChainDefinitionMap.put("/sys/common/view/**", "anon");//图片预览不限制token
|
||||
filterChainDefinitionMap.put("/sys/common/download/**", "anon");//文件下载不限制token
|
||||
filterChainDefinitionMap.put("/sys/common/pdf/**", "anon");//pdf预览
|
||||
filterChainDefinitionMap.put("/generic/**", "anon");//pdf预览需要文件
|
||||
filterChainDefinitionMap.put("/", "anon");
|
||||
filterChainDefinitionMap.put("/doc.html", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.js", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.css", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.html", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.svg", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.jpg", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.png", "anon");
|
||||
filterChainDefinitionMap.put("/**/*.ico", "anon");
|
||||
filterChainDefinitionMap.put("/druid/**", "anon");
|
||||
filterChainDefinitionMap.put("/swagger-ui.html", "anon");
|
||||
filterChainDefinitionMap.put("/swagger**/**", "anon");
|
||||
filterChainDefinitionMap.put("/webjars/**", "anon");
|
||||
filterChainDefinitionMap.put("/v2/**", "anon");
|
||||
|
||||
//性能监控
|
||||
filterChainDefinitionMap.put("/actuator/metrics/**", "anon");
|
||||
filterChainDefinitionMap.put("/actuator/httptrace/**", "anon");
|
||||
filterChainDefinitionMap.put("/actuator/redis/**", "anon");
|
||||
|
||||
|
||||
// 添加自己的过滤器并且取名为jwt
|
||||
Map<String, Filter> filterMap = new HashMap<String, Filter>(1);
|
||||
filterMap.put("jwt", new JwtFilter());
|
||||
shiroFilterFactoryBean.setFilters(filterMap);
|
||||
// <!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边
|
||||
filterChainDefinitionMap.put("/**", "jwt");
|
||||
|
||||
// 未授权界面返回JSON
|
||||
shiroFilterFactoryBean.setUnauthorizedUrl("/sys/common/403");
|
||||
shiroFilterFactoryBean.setLoginUrl("/sys/common/403");
|
||||
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
|
||||
return shiroFilterFactoryBean;
|
||||
}
|
||||
|
||||
@Bean("securityManager")
|
||||
public DefaultWebSecurityManager securityManager(ShiroRealm myRealm) {
|
||||
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
|
||||
securityManager.setRealm(myRealm);
|
||||
|
||||
/*
|
||||
* 关闭shiro自带的session,详情见文档
|
||||
* http://shiro.apache.org/session-management.html#SessionManagement-
|
||||
* StatelessApplications%28Sessionless%29
|
||||
*/
|
||||
DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
|
||||
DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
|
||||
defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
|
||||
subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
|
||||
securityManager.setSubjectDAO(subjectDAO);
|
||||
|
||||
return securityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下面的代码是添加注解支持
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
@DependsOn("lifecycleBeanPostProcessor")
|
||||
public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
|
||||
DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
|
||||
defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
|
||||
return defaultAdvisorAutoProxyCreator;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
|
||||
return new LifecycleBeanPostProcessor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
|
||||
AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
|
||||
advisor.setSecurityManager(securityManager);
|
||||
return advisor;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.shiro.vo.DefContants;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import springfox.documentation.service.Parameter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* @Author scott
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
@EnableSwaggerBootstrapUI
|
||||
public class Swagger2Config implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
*
|
||||
* 显示swagger-ui.html文档展示页,还必须注入swagger资源:
|
||||
*
|
||||
* @param registry
|
||||
*/
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
}
|
||||
|
||||
/**
|
||||
* swagger2的配置文件,这里可以配置swagger2的一些基本的内容,比如扫描的包等等
|
||||
*
|
||||
* @return Docket
|
||||
*/
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
//此包路径下的类,才生成接口文档
|
||||
.apis(RequestHandlerSelectors.basePackage("org.jeecg.modules"))
|
||||
//加了ApiOperation注解的类,才生成接口文档
|
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
.globalOperationParameters(setHeaderToken());
|
||||
}
|
||||
|
||||
/**
|
||||
* JWT token
|
||||
* @return
|
||||
*/
|
||||
private List<Parameter> setHeaderToken() {
|
||||
ParameterBuilder tokenPar = new ParameterBuilder();
|
||||
List<Parameter> pars = new ArrayList<>();
|
||||
tokenPar.name(DefContants.X_ACCESS_TOKEN).description("token").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
|
||||
pars.add(tokenPar.build());
|
||||
return pars;
|
||||
}
|
||||
|
||||
/**
|
||||
* api文档的详细信息函数,注意这里的注解引用的是哪个
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
// //大标题
|
||||
.title("Jeecg-Boot 后台服务API接口文档")
|
||||
// 版本号
|
||||
.version("1.0")
|
||||
// .termsOfServiceUrl("NO terms of service")
|
||||
// 描述
|
||||
.description("restful 风格接口")
|
||||
// 作者
|
||||
// .contact(new Contact("scott", "http://jeecg.org", "jeecgos@163.com"))
|
||||
// .license("The Apache License, Version 2.0")
|
||||
// .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* Spring Boot 2.0 解决跨域问题
|
||||
*
|
||||
* @Author qinfeng
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class WebMvcConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@Value("${jeecg.path.upload}")
|
||||
private String upLoadPath;
|
||||
@Value("${jeecg.path.webapp}")
|
||||
private String webAppPath;
|
||||
@Value("${spring.resource.static-locations}")
|
||||
private String staticLocations;
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
|
||||
final CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
/* 是否允许请求带有验证信息 */
|
||||
corsConfiguration.setAllowCredentials(true);
|
||||
/* 允许访问的客户端域名 */
|
||||
corsConfiguration.addAllowedOrigin("*");
|
||||
/* 允许服务端访问的客户端请求头 */
|
||||
corsConfiguration.addAllowedHeader("*");
|
||||
/* 允许访问的方法名,GET POST等 */
|
||||
corsConfiguration.addAllowedMethod("*");
|
||||
urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
|
||||
return new CorsFilter(urlBasedCorsConfigurationSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 静态资源的配置 - 使得可以从磁盘中读取 Html、图片、视频、音频等
|
||||
*/
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/**")
|
||||
.addResourceLocations("file:" + upLoadPath + "//", "file:" + webAppPath + "//")
|
||||
.addResourceLocations(staticLocations.split(","));
|
||||
}
|
||||
|
||||
/**
|
||||
* 访问根路径默认跳转 index.html页面 (简化部署方案: 可以把前端打包直接放到项目的 webapp,上面的配置)
|
||||
*/
|
||||
@Override
|
||||
public void addViewControllers(ViewControllerRegistry registry) {
|
||||
registry.addViewController("/").setViewName("index.html");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,164 @@
|
||||
package org.jeecg.config.mybatis;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.ibatis.binding.MapperMethod.ParamMap;
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.SqlCommandType;
|
||||
import org.apache.ibatis.plugin.Interceptor;
|
||||
import org.apache.ibatis.plugin.Intercepts;
|
||||
import org.apache.ibatis.plugin.Invocation;
|
||||
import org.apache.ibatis.plugin.Plugin;
|
||||
import org.apache.ibatis.plugin.Signature;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* mybatis拦截器,自动注入创建人、创建时间、修改人、修改时间
|
||||
* @Author scott
|
||||
* @Date 2019-01-19
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@Intercepts({ @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }) })
|
||||
public class MybatisInterceptor implements Interceptor {
|
||||
|
||||
@Override
|
||||
public Object intercept(Invocation invocation) throws Throwable {
|
||||
MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
|
||||
String sqlId = mappedStatement.getId();
|
||||
log.debug("------sqlId------" + sqlId);
|
||||
SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType();
|
||||
Object parameter = invocation.getArgs()[1];
|
||||
log.debug("------sqlCommandType------" + sqlCommandType);
|
||||
|
||||
if (parameter == null) {
|
||||
return invocation.proceed();
|
||||
}
|
||||
if (SqlCommandType.INSERT == sqlCommandType) {
|
||||
Field[] fields = oConvertUtils.getAllFields(parameter);
|
||||
for (Field field : fields) {
|
||||
log.debug("------field.name------" + field.getName());
|
||||
try {
|
||||
// 获取登录用户信息
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if ("createBy".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object local_createBy = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (local_createBy == null || local_createBy.equals("")) {
|
||||
String createBy = "jeecg";
|
||||
if (sysUser != null) {
|
||||
// 登录账号
|
||||
createBy = sysUser.getUsername();
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(createBy)) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, createBy);
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 注入创建时间
|
||||
if ("createTime".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object local_createDate = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (local_createDate == null || local_createDate.equals("")) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, new Date());
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
//注入部门编码
|
||||
if ("sysOrgCode".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object local_sysOrgCode = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (local_sysOrgCode == null || local_sysOrgCode.equals("")) {
|
||||
String sysOrgCode = "";
|
||||
// 获取登录用户信息
|
||||
if (sysUser != null) {
|
||||
// 登录账号
|
||||
sysOrgCode = sysUser.getOrgCode();
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(sysOrgCode)) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, sysOrgCode);
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SqlCommandType.UPDATE == sqlCommandType) {
|
||||
Field[] fields = null;
|
||||
if (parameter instanceof ParamMap) {
|
||||
ParamMap<?> p = (ParamMap<?>) parameter;
|
||||
parameter = p.get("param1");
|
||||
fields = oConvertUtils.getAllFields(parameter);
|
||||
} else {
|
||||
fields = oConvertUtils.getAllFields(parameter);
|
||||
}
|
||||
|
||||
for (Field field : fields) {
|
||||
log.debug("------field.name------" + field.getName());
|
||||
try {
|
||||
if ("updateBy".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object local_updateBy = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (local_updateBy == null || local_updateBy.equals("")) {
|
||||
String updateBy = "jeecg";
|
||||
// 获取登录用户信息
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (sysUser != null) {
|
||||
// 登录账号
|
||||
updateBy = sysUser.getUsername();
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(updateBy)) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, updateBy);
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("updateTime".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object local_updateDate = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (local_updateDate == null || local_updateDate.equals("")) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, new Date());
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object plugin(Object target) {
|
||||
return Plugin.wrap(target, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperties(Properties properties) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,204 @@
|
||||
package org.jeecg.modules.demo.mock;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.swing.filechooser.FileSystemView;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
@Slf4j
|
||||
public class MockController {
|
||||
|
||||
private final String JSON_PATH = "classpath:org/jeecg/modules/demo/mock/json";
|
||||
|
||||
/**
|
||||
* 通用json访问接口
|
||||
* 格式: http://localhost:8080/jeecg-boot/api/json/{filename}
|
||||
* @param filename
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/json/{filename}", method = RequestMethod.GET)
|
||||
public String getJsonData(@PathVariable String filename) {
|
||||
String jsonpath = "classpath:org/jeecg/modules/demo/mock/json/"+filename+".json";
|
||||
return readJson(jsonpath);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/asynTreeList")
|
||||
public String asynTreeList(String id) {
|
||||
return readJson(JSON_PATH + "/asyn_tree_list_" + id + ".json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/user")
|
||||
public String user() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/user.json");
|
||||
}
|
||||
|
||||
/**
|
||||
* 老的登录获取用户信息接口
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/user/info")
|
||||
public String userInfo() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/user_info.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/role")
|
||||
public String role() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/role.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/service")
|
||||
public String service() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/service.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/permission")
|
||||
public String permission() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/permission.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/permission/no-pager")
|
||||
public String permission_no_page() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/permission_no_page.json");
|
||||
}
|
||||
|
||||
/**
|
||||
* 省市县
|
||||
*/
|
||||
@GetMapping(value = "/area")
|
||||
public String area() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/area.json");
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试报表数据
|
||||
*/
|
||||
@GetMapping(value = "/report/getYearCountInfo")
|
||||
public String getYearCountInfo() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/getCntrNoCountInfo.json");
|
||||
}
|
||||
@GetMapping(value = "/report/getMonthCountInfo")
|
||||
public String getMonthCountInfo() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/getCntrNoCountInfo.json");
|
||||
}
|
||||
@GetMapping(value = "/report/getCntrNoCountInfo")
|
||||
public String getCntrNoCountInfo() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/getCntrNoCountInfo.json");
|
||||
}
|
||||
@GetMapping(value = "/report/getCabinetCountInfo")
|
||||
public String getCabinetCountInfo() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/getCntrNoCountInfo.json");
|
||||
}
|
||||
|
||||
/**
|
||||
* 实时磁盘监控
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryDiskInfo")
|
||||
public Result<List<Map<String,Object>>> queryDiskInfo(HttpServletRequest request, HttpServletResponse response){
|
||||
Result<List<Map<String,Object>>> res = new Result<>();
|
||||
try {
|
||||
// 当前文件系统类
|
||||
FileSystemView fsv = FileSystemView.getFileSystemView();
|
||||
// 列出所有windows 磁盘
|
||||
File[] fs = File.listRoots();
|
||||
log.info("查询磁盘信息:"+fs.length+"个");
|
||||
List<Map<String,Object>> list = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < fs.length; i++) {
|
||||
if(fs[i].getTotalSpace()==0) {
|
||||
continue;
|
||||
}
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("name", fsv.getSystemDisplayName(fs[i]));
|
||||
map.put("max", fs[i].getTotalSpace());
|
||||
map.put("rest", fs[i].getFreeSpace());
|
||||
map.put("restPPT", fs[i].getFreeSpace()*100/fs[i].getTotalSpace());
|
||||
list.add(map);
|
||||
log.info(map.toString());
|
||||
}
|
||||
res.setResult(list);
|
||||
res.success("查询成功");
|
||||
} catch (Exception e) {
|
||||
res.error500("查询失败"+e.getMessage());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* 工作台首页的数据
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list/search/projects")
|
||||
public String projects() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/workplace_projects.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/workplace/activity")
|
||||
public String activity() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/workplace_activity.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/workplace/teams")
|
||||
public String teams() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/workplace_teams.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/workplace/radar")
|
||||
public String radar() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/workplace_radar.json");
|
||||
}
|
||||
|
||||
@GetMapping(value = "/task/process")
|
||||
public String taskProcess() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/task_process.json");
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
|
||||
//author:lvdandan-----date:20190315---for:添加数据日志json----
|
||||
public String sysDataLogJson() {
|
||||
return readJson("classpath:org/jeecg/modules/demo/mock/json/sysdatalog.json");
|
||||
}
|
||||
//author:lvdandan-----date:20190315---for:添加数据日志json----
|
||||
|
||||
/**
|
||||
* 读取json格式文件
|
||||
* @param jsonSrc
|
||||
* @return
|
||||
*/
|
||||
private String readJson(String jsonSrc) {
|
||||
String json = "";
|
||||
try {
|
||||
//File jsonFile = ResourceUtils.getFile(jsonSrc);
|
||||
//json = FileUtils.re.readFileToString(jsonFile);
|
||||
//换个写法,解决springboot读取jar包中文件的问题
|
||||
InputStream stream = getClass().getClassLoader().getResourceAsStream(jsonSrc.replace("classpath:", ""));
|
||||
json = IOUtils.toString(stream);
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,29 @@
|
||||
{
|
||||
"status": 200,
|
||||
"success": true,
|
||||
"message": "ok",
|
||||
"result": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "首页",
|
||||
"component": "dashboard/Analysis",
|
||||
"orderNum": 1,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "常见案例",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 2,
|
||||
"hasChildren": true
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "系统监控",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 3,
|
||||
"hasChildren": true
|
||||
}
|
||||
],
|
||||
"timestamp": 1554950583837
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
{
|
||||
"status": 200,
|
||||
"success": true,
|
||||
"message": "ok",
|
||||
"result": [
|
||||
{
|
||||
"id": 11,
|
||||
"name": "首页",
|
||||
"component": "dashboard/Analysis",
|
||||
"orderNum": 1,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"name": "系统管理",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 2,
|
||||
"hasChildren": true
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"name": "常见案例",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 3,
|
||||
"hasChildren": true
|
||||
}
|
||||
],
|
||||
"timestamp": 1554950583837
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
{
|
||||
"status": 200,
|
||||
"success": true,
|
||||
"message": "ok",
|
||||
"result": [
|
||||
{
|
||||
"id": 21,
|
||||
"name": "弹框选择Demo",
|
||||
"component": "jeecg/SelectDemo",
|
||||
"orderNum": 1,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"name": "单表模型示例",
|
||||
"component": "jeecg/JeecgDemoList",
|
||||
"orderNum": 2,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"name": "一对多Tab示例",
|
||||
"component": "jeecg/tablist/JeecgOrderDMainList",
|
||||
"orderNum": 3,
|
||||
"hasChildren": false
|
||||
}
|
||||
],
|
||||
"timestamp": 1554950583837
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
{
|
||||
"status": 200,
|
||||
"success": true,
|
||||
"message": "ok",
|
||||
"result": [
|
||||
{
|
||||
"id": 31,
|
||||
"name": "性能监控",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 1,
|
||||
"hasChildren": true
|
||||
},
|
||||
{
|
||||
"id": 32,
|
||||
"name": "在线文档",
|
||||
"component": "layouts/IframePageView",
|
||||
"orderNum": 2,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 33,
|
||||
"name": "工作台",
|
||||
"component": "dashboard/Workplace",
|
||||
"orderNum": 3,
|
||||
"hasChildren": false
|
||||
}
|
||||
],
|
||||
"timestamp": 1554950583837
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
{
|
||||
"status": 200,
|
||||
"success": true,
|
||||
"message": "ok",
|
||||
"result": [
|
||||
{
|
||||
"id": 311,
|
||||
"name": "Redis监控",
|
||||
"component": "modules/monitor/RedisInfo",
|
||||
"orderNum": 1,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 312,
|
||||
"name": "JVM信息",
|
||||
"component": "modules/monitor/JvmInfo",
|
||||
"orderNum": 2,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 313,
|
||||
"name": "Tomcat信息",
|
||||
"component": "modules/monitor/TomcatInfo",
|
||||
"orderNum": 3,
|
||||
"hasChildren": false
|
||||
}
|
||||
],
|
||||
"timestamp": 1554950583837
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
{
|
||||
"success": true,
|
||||
"message": "查询成功",
|
||||
"code": null,
|
||||
"result": [
|
||||
{
|
||||
"resultIndex": 0,
|
||||
"yearcount": 623,
|
||||
"year": 2016,
|
||||
"month": "四月",
|
||||
"monthcount": 3255,
|
||||
"classifyname": "证明类",
|
||||
"cntrnocount": 24,
|
||||
"cabinetname": "一号柜",
|
||||
"cabinetcocunt": 12
|
||||
},
|
||||
{
|
||||
"resultIndex": 1,
|
||||
"yearcount": 243,
|
||||
"year": 2017,
|
||||
"month": "五月",
|
||||
"monthcount": 5673,
|
||||
"classifyname": "产权类",
|
||||
"cntrnocount": 52,
|
||||
"cabinetname": "二号柜",
|
||||
"cabinetcocunt": 52
|
||||
},
|
||||
{
|
||||
"resultIndex": 2,
|
||||
"yearcount": 345,
|
||||
"year": 2018,
|
||||
"month": "六月",
|
||||
"monthcount": 2673,
|
||||
"classifyname": "知识类",
|
||||
"cntrnocount": 85,
|
||||
"cabinetname": "三号柜",
|
||||
"cabinetcocunt": 24
|
||||
},
|
||||
{
|
||||
"resultIndex": 3,
|
||||
"yearcount": 452,
|
||||
"year": 2019,
|
||||
"month": "七月",
|
||||
"monthcount": 2341,
|
||||
"classifyname": "技术类",
|
||||
"cntrnocount": 67,
|
||||
"cabinetname": "四号柜",
|
||||
"cabinetcocunt": 45
|
||||
},
|
||||
{
|
||||
"resultIndex": 4,
|
||||
"yearcount": 645,
|
||||
"year": 2020,
|
||||
"month": "八月",
|
||||
"monthcount": 7473,
|
||||
"classifyname": "工具类",
|
||||
"cntrnocount": 93,
|
||||
"cabinetname": "五号柜",
|
||||
"cabinetcocunt": 94
|
||||
}
|
||||
],
|
||||
"timestamp": 1554285003594
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
{
|
||||
"status": 200,
|
||||
"success": true,
|
||||
"message": "ok",
|
||||
"result": {
|
||||
"data": [
|
||||
{
|
||||
"id": 0,
|
||||
"x": "1",
|
||||
"y": 889
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"x": "2",
|
||||
"y": 341
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"x": "3",
|
||||
"y": 1028
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"x": "4",
|
||||
"y": 1168
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"x": "5",
|
||||
"y": 653
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"x": "6",
|
||||
"y": 863
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"x": "7",
|
||||
"y": 421
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"x": "8",
|
||||
"y": 1320
|
||||
}
|
||||
]
|
||||
},
|
||||
"timestamp": 1554950583837
|
||||
}
|
||||
@ -0,0 +1,156 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": {
|
||||
"data": [
|
||||
{
|
||||
"id": "marketing",
|
||||
"name": "营销管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": null,
|
||||
"parents": null,
|
||||
"type": null,
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"query",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "member",
|
||||
"name": "会员管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"query",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "menu",
|
||||
"name": "菜单管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"import",
|
||||
"get",
|
||||
"update"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "order",
|
||||
"name": "订单管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"query",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "permission",
|
||||
"name": "权限管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "role",
|
||||
"name": "角色管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "test",
|
||||
"name": "测试权限",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "user",
|
||||
"name": "用户管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"describe\":\"新增\",\"defaultCheck\":false},{\"action\":\"get\",\"describe\":\"查询\",\"defaultCheck\":false}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get"
|
||||
]
|
||||
}
|
||||
],
|
||||
"pageSize": 10,
|
||||
"pageNo": 0,
|
||||
"totalPage": 1,
|
||||
"totalCount": 5
|
||||
},
|
||||
"status": 200,
|
||||
"timestamp": 1537082021471
|
||||
}
|
||||
@ -0,0 +1,150 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": [
|
||||
{
|
||||
"id": "marketing",
|
||||
"name": "营销管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": null,
|
||||
"parents": null,
|
||||
"type": null,
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"query",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "member",
|
||||
"name": "会员管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"query",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "menu",
|
||||
"name": "菜单管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"import",
|
||||
"get",
|
||||
"update"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "order",
|
||||
"name": "订单管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"query",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "permission",
|
||||
"name": "权限管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "role",
|
||||
"name": "角色管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get",
|
||||
"update",
|
||||
"delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "test",
|
||||
"name": "测试权限",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "user",
|
||||
"name": "用户管理",
|
||||
"describe": null,
|
||||
"status": 1,
|
||||
"actionData": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"export\",\"defaultCheck\":false,\"describe\":\"导出\"}]",
|
||||
"sptDaTypes": null,
|
||||
"optionalFields": "[]",
|
||||
"parents": null,
|
||||
"type": "default",
|
||||
"deleted": 0,
|
||||
"actions": [
|
||||
"add",
|
||||
"get"
|
||||
]
|
||||
}
|
||||
],
|
||||
"status": 200,
|
||||
"timestamp": 1537082021471
|
||||
}
|
||||
@ -0,0 +1,608 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": {
|
||||
"data": [
|
||||
{
|
||||
"id": "admin",
|
||||
"name": "管理员",
|
||||
"describe": "拥有所有权限",
|
||||
"status": 1,
|
||||
"creatorId": "system",
|
||||
"createTime": 1497160610259,
|
||||
"deleted": 0,
|
||||
"permissions": [
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "comment",
|
||||
"permissionName": "评论管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "member",
|
||||
"permissionName": "会员管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "menu",
|
||||
"permissionName": "菜单管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "import",
|
||||
"describe": "导入",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "order",
|
||||
"permissionName": "订单管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "permission",
|
||||
"permissionName": "权限管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "role",
|
||||
"permissionName": "角色管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "test",
|
||||
"permissionName": "测试权限",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "user",
|
||||
"permissionName": "用户管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"},{\"action\":\"export\",\"defaultCheck\":false,\"describe\":\"导出\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "import",
|
||||
"describe": "导入",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "export",
|
||||
"describe": "导出",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "svip",
|
||||
"name": "SVIP",
|
||||
"describe": "超级会员",
|
||||
"status": 1,
|
||||
"creatorId": "system",
|
||||
"createTime": 1532417744846,
|
||||
"deleted": 0,
|
||||
"permissions": [
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "comment",
|
||||
"permissionName": "评论管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "member",
|
||||
"permissionName": "会员管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "menu",
|
||||
"permissionName": "菜单管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "import",
|
||||
"describe": "导入",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "order",
|
||||
"permissionName": "订单管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "permission",
|
||||
"permissionName": "权限管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "role",
|
||||
"permissionName": "角色管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "test",
|
||||
"permissionName": "测试权限",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "user",
|
||||
"permissionName": "用户管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"},{\"action\":\"export\",\"defaultCheck\":false,\"describe\":\"导出\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "import",
|
||||
"describe": "导入",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "user",
|
||||
"name": "普通会员",
|
||||
"describe": "普通用户,只能查询",
|
||||
"status": 1,
|
||||
"creatorId": "system",
|
||||
"createTime": 1497160610259,
|
||||
"deleted": 0,
|
||||
"permissions": [
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "comment",
|
||||
"permissionName": "评论管理",
|
||||
"actions": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "marketing",
|
||||
"permissionName": "营销管理",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "member",
|
||||
"permissionName": "会员管理",
|
||||
"actions": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "menu",
|
||||
"permissionName": "菜单管理",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "order",
|
||||
"permissionName": "订单管理",
|
||||
"actions": "[{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "permission",
|
||||
"permissionName": "权限管理",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "role",
|
||||
"permissionName": "角色管理",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "test",
|
||||
"permissionName": "测试权限",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "user",
|
||||
"permissionId": "user",
|
||||
"permissionName": "用户管理",
|
||||
"actions": "[]",
|
||||
"actionEntitySet": [],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"pageSize": 10,
|
||||
"pageNo": 0,
|
||||
"totalPage": 1,
|
||||
"totalCount": 5
|
||||
},
|
||||
"status": 200,
|
||||
"timestamp": 1537079497645
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": {
|
||||
"pageSize": 10,
|
||||
"pageNo": 0,
|
||||
"totalCount": 57,
|
||||
"totalPage": 6,
|
||||
"data": [
|
||||
{
|
||||
"key": 1,
|
||||
"no": "No 1",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 127,
|
||||
"status": 2,
|
||||
"updatedAt": "1970-06-24 11:51:20",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 2,
|
||||
"no": "No 2",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 573,
|
||||
"status": 2,
|
||||
"updatedAt": "1994-12-11 00:37:35",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 3,
|
||||
"no": "No 3",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 869,
|
||||
"status": 2,
|
||||
"updatedAt": "2013-11-11 08:04:03",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 4,
|
||||
"no": "No 4",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 26,
|
||||
"status": 2,
|
||||
"updatedAt": "1990-11-04 15:41:42",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 5,
|
||||
"no": "No 5",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 20,
|
||||
"status": 2,
|
||||
"updatedAt": "1970-01-05 11:04:56",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 6,
|
||||
"no": "No 6",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 675,
|
||||
"status": 2,
|
||||
"updatedAt": "1983-06-06 04:09:04",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 7,
|
||||
"no": "No 7",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 512,
|
||||
"status": 3,
|
||||
"updatedAt": "1996-08-26 21:47:44",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 8,
|
||||
"no": "No 8",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 962,
|
||||
"status": 2,
|
||||
"updatedAt": "2004-08-15 23:15:22",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 9,
|
||||
"no": "No 9",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 318,
|
||||
"status": 3,
|
||||
"updatedAt": "1988-08-10 14:36:35",
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": 10,
|
||||
"no": "No 10",
|
||||
"description": "这是一段描述",
|
||||
"callNo": 789,
|
||||
"status": 0,
|
||||
"updatedAt": "1988-12-27 23:39:41",
|
||||
"editable": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": 200,
|
||||
"timestamp": 1534955098193
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
{
|
||||
"mobilePhone":"1872222222",
|
||||
"officePhone":"1222222",
|
||||
"email":"",
|
||||
"createDate":"Jun 23, 2016 12:00:00 PM",
|
||||
"sex":"1",
|
||||
"depId":"402880e447e99cf10147e9a03b320003",
|
||||
"userName":"9001",
|
||||
"status":"1",
|
||||
"content":"111",
|
||||
"id":"4028ef81550c1a7901550c1cd6e70001"
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
{
|
||||
"success": true,
|
||||
"message": "操作成功!",
|
||||
"code": 0,
|
||||
"result": {
|
||||
"records": [
|
||||
{
|
||||
"taskId": "48701",
|
||||
"name": "start",
|
||||
"taskBeginTime": "2019-03-07 09:33:04",
|
||||
"taskEndTime": "2019-03-08 04:03:01",
|
||||
"principal": "测试体验账号",
|
||||
"result": "已完成"
|
||||
},
|
||||
{
|
||||
"taskId": "48702",
|
||||
"name": "部门领导审批",
|
||||
"taskBeginTime": "2019-03-07 09:33:04",
|
||||
"taskEndTime": "2019-03-08 04:03:01",
|
||||
"principal": "测试体验账号",
|
||||
"result": "已完成"
|
||||
},
|
||||
{
|
||||
"taskId": "48703",
|
||||
"name": "调整申请",
|
||||
"taskBeginTime": "2019-03-07 09:33:04",
|
||||
"taskEndTime": "2019-03-08 04:03:01",
|
||||
"principal": "测试体验账号",
|
||||
"result": "已完成"
|
||||
},
|
||||
{
|
||||
"taskId": "48704",
|
||||
"name": "人事审批",
|
||||
"taskBeginTime": "2019-03-07 09:33:04",
|
||||
"taskEndTime": "2019-03-08 04:03:01",
|
||||
"principal": "测试体验账号",
|
||||
"result": "已完成"
|
||||
},
|
||||
{
|
||||
"taskId": "48705",
|
||||
"name": "end",
|
||||
"taskBeginTime": "2019-03-07 09:33:04",
|
||||
"taskEndTime": "2019-03-08 04:03:01",
|
||||
"principal": "测试体验账号",
|
||||
"result": "已完成"
|
||||
}
|
||||
],
|
||||
"total": 0,
|
||||
"size": 10,
|
||||
"current": 1,
|
||||
"searchCount": true,
|
||||
"pages": 0
|
||||
},
|
||||
"timestamp": 1551922394641
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,407 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": {
|
||||
"id": "4291d7da9005377ec9aec4a71ea837f",
|
||||
"name": "天野远子",
|
||||
"username": "admin",
|
||||
"password": "",
|
||||
"avatar": "/avatar2.jpg",
|
||||
"status": 1,
|
||||
"telephone": "",
|
||||
"lastLoginIp": "27.154.74.117",
|
||||
"lastLoginTime": 1534837621348,
|
||||
"creatorId": "admin",
|
||||
"createTime": 1497160610259,
|
||||
"merchantCode": "TLif2btpzg079h15bk",
|
||||
"deleted": 0,
|
||||
"roleId": "admin",
|
||||
"role": {
|
||||
"id": "admin",
|
||||
"name": "管理员",
|
||||
"describe": "拥有所有权限",
|
||||
"status": 1,
|
||||
"creatorId": "system",
|
||||
"createTime": 1497160610259,
|
||||
"deleted": 0,
|
||||
"permissions": [
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "dashboard",
|
||||
"permissionName": "仪表盘",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "exception",
|
||||
"permissionName": "异常页面权限",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "result",
|
||||
"permissionName": "结果权限",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "profile",
|
||||
"permissionName": "详细页权限",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "table",
|
||||
"permissionName": "表格权限",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "import",
|
||||
"describe": "导入",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "form",
|
||||
"permissionName": "表单权限",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "order",
|
||||
"permissionName": "订单管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "permission",
|
||||
"permissionName": "权限管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "role",
|
||||
"permissionName": "角色管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "table",
|
||||
"permissionName": "桌子管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "query",
|
||||
"describe": "查询",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
},
|
||||
{
|
||||
"roleId": "admin",
|
||||
"permissionId": "user",
|
||||
"permissionName": "用户管理",
|
||||
"actions": "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"import\",\"defaultCheck\":false,\"describe\":\"导入\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"},{\"action\":\"export\",\"defaultCheck\":false,\"describe\":\"导出\"}]",
|
||||
"actionEntitySet": [
|
||||
{
|
||||
"action": "add",
|
||||
"describe": "新增",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "import",
|
||||
"describe": "导入",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "get",
|
||||
"describe": "详情",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "update",
|
||||
"describe": "修改",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "delete",
|
||||
"describe": "删除",
|
||||
"defaultCheck": false
|
||||
},
|
||||
{
|
||||
"action": "export",
|
||||
"describe": "导出",
|
||||
"defaultCheck": false
|
||||
}
|
||||
],
|
||||
"actionList": null,
|
||||
"dataAccess": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"status": 200,
|
||||
"timestamp": 1534844188679
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": [
|
||||
{
|
||||
"id": 1,
|
||||
"user": {
|
||||
"nickname": "Barbara Lee",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png"
|
||||
},
|
||||
"project": {
|
||||
"name": "白鹭酱油开发组",
|
||||
"action": "更新",
|
||||
"event": "番组计划"
|
||||
},
|
||||
"time": "2018-08-23 14:47:00"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"user": {
|
||||
"nickname": "蓝莓酱",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png"
|
||||
},
|
||||
"project": {
|
||||
"name": "白鹭酱油开发组",
|
||||
"action": "更新",
|
||||
"event": "番组计划"
|
||||
},
|
||||
"time": "2018-08-23 09:35:37"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"user": {
|
||||
"nickname": "Brian Young",
|
||||
"avatar": "http://dummyimage.com/64x64"
|
||||
},
|
||||
"project": {
|
||||
"name": "白鹭酱油开发组",
|
||||
"action": "创建",
|
||||
"event": "番组计划"
|
||||
},
|
||||
"time": "2017-05-27 00:00:00"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"user": {
|
||||
"nickname": "曲丽丽",
|
||||
"avatar": "http://dummyimage.com/64x64"
|
||||
},
|
||||
"project": {
|
||||
"name": "高逼格设计天团",
|
||||
"action": "更新",
|
||||
"event": "六月迭代"
|
||||
},
|
||||
"time": "2018-08-23 14:47:00"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"user": {
|
||||
"nickname": "Dorothy Thompson",
|
||||
"avatar": "http://dummyimage.com/64x64"
|
||||
},
|
||||
"project": {
|
||||
"name": "高逼格设计天团",
|
||||
"action": "created",
|
||||
"event": "六月迭代"
|
||||
},
|
||||
"time": "2018-08-23 14:47:00"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"user": {
|
||||
"nickname": "曲丽丽",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png"
|
||||
},
|
||||
"project": {
|
||||
"name": "高逼格设计天团",
|
||||
"action": "created",
|
||||
"event": "六月迭代"
|
||||
},
|
||||
"time": "2018-08-23 14:47:00"
|
||||
}
|
||||
],
|
||||
"status": 200,
|
||||
"timestamp": 0
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": {
|
||||
"data": [
|
||||
{
|
||||
"id": 1,
|
||||
"cover": "https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png",
|
||||
"title": "Alipay",
|
||||
"description": "那是一种内在的东西, 他们到达不了,也无法触及的",
|
||||
"status": 1,
|
||||
"updatedAt": "2018-07-26 00:00:00"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"cover": "https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png",
|
||||
"title": "Angular",
|
||||
"description": "希望是一个好东西,也许是最好的,好东西是不会消亡的",
|
||||
"status": 1,
|
||||
"updatedAt": "2018-07-26 00:00:00"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"cover": "https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png",
|
||||
"title": "Ant Design",
|
||||
"description": "城镇中有那么多的酒馆,她却偏偏走进了我的酒馆",
|
||||
"status": 1,
|
||||
"updatedAt": "2018-07-26 00:00:00"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"cover": "https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png",
|
||||
"title": "Ant Design Pro",
|
||||
"description": "那时候我只会想自己想要什么,从不想自己拥有什么",
|
||||
"status": 1,
|
||||
"updatedAt": "2018-07-26 00:00:00"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"cover": "https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png",
|
||||
"title": "Bootstrap",
|
||||
"description": "凛冬将至",
|
||||
"status": 1,
|
||||
"updatedAt": "2018-07-26 00:00:00"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"cover": "https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png",
|
||||
"title": "Vue",
|
||||
"description": "生命就像一盒巧克力,结果往往出人意料",
|
||||
"status": 1,
|
||||
"updatedAt": "2018-07-26 00:00:00"
|
||||
}
|
||||
],
|
||||
"pageSize": 10,
|
||||
"pageNo": 1,
|
||||
"totalPage": 6,
|
||||
"totalCount": 57
|
||||
},
|
||||
"status": 200,
|
||||
"timestamp": 1534955098193
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": [
|
||||
{
|
||||
"item": "引用",
|
||||
"个人": 70,
|
||||
"团队": 30,
|
||||
"部门": 40
|
||||
},
|
||||
{
|
||||
"item": "口碑",
|
||||
"个人": 60,
|
||||
"团队": 70,
|
||||
"部门": 40
|
||||
},
|
||||
{
|
||||
"item": "产量",
|
||||
"个人": 50,
|
||||
"团队": 60,
|
||||
"部门": 40
|
||||
},
|
||||
{
|
||||
"item": "贡献",
|
||||
"个人": 40,
|
||||
"团队": 50,
|
||||
"部门": 40
|
||||
},
|
||||
{
|
||||
"item": "热度",
|
||||
"个人": 60,
|
||||
"团队": 70,
|
||||
"部门": 40
|
||||
},
|
||||
{
|
||||
"item": "引用",
|
||||
"个人": 70,
|
||||
"团队": 50,
|
||||
"部门": 40
|
||||
}
|
||||
],
|
||||
"status": 200,
|
||||
"timestamp": 1534955098193
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
{
|
||||
"message": "",
|
||||
"result": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "科学搬砖组",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "程序员日常",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/cnrhVkzwxjPwAaCfPbdc.png"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "设计天团",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/gaOngJwsRYRaVAuXXcmB.png"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "中二少女团",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/ubnKSIfAJTxIgXOKlciN.png"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "骗你学计算机",
|
||||
"avatar": "https://gw.alipayobjects.com/zos/rmsportal/WhxKECPNujWoWEFNdnJE.png"
|
||||
}
|
||||
],
|
||||
"status": 200,
|
||||
"timestamp": 0
|
||||
}
|
||||
@ -0,0 +1,328 @@
|
||||
package org.jeecg.modules.demo.test.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.aspect.annotation.PermissionData;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgDemo;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgDemoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Description: 测试demo
|
||||
* @Author: jeecg-boot
|
||||
* @Date:2018-12-29
|
||||
* @Version:V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags="单表DEMO")
|
||||
@RestController
|
||||
@RequestMapping("/test/jeecgDemo")
|
||||
public class JeecgDemoController extends JeecgController<JeecgDemo,IJeecgDemoService> {
|
||||
@Autowired
|
||||
private IJeecgDemoService jeecgDemoService;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param jeecgDemo
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取Demo数据列表", notes = "获取所有Demo数据列表")
|
||||
@GetMapping(value = "/list")
|
||||
@PermissionData(pageComponent="jeecg/JeecgDemoList")
|
||||
public Result<IPage<JeecgDemo>> list(JeecgDemo jeecgDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<JeecgDemo>> result = new Result<IPage<JeecgDemo>>();
|
||||
/*
|
||||
* QueryWrapper<JeecgDemo> queryWrapper = null;
|
||||
* //===========================================================================
|
||||
* ===== //高级组合查询 try { String superQueryParams =
|
||||
* req.getParameter("superQueryParams");
|
||||
* if(oConvertUtils.isNotEmpty(superQueryParams)) { // 解码 superQueryParams =
|
||||
* URLDecoder.decode(superQueryParams, "UTF-8"); List<QueryRuleVo> userList =
|
||||
* JSON.parseArray(superQueryParams, QueryRuleVo.class);
|
||||
* log.info(superQueryParams); queryWrapper = new QueryWrapper<JeecgDemo>(); for
|
||||
* (QueryRuleVo rule : userList) { if(oConvertUtils.isNotEmpty(rule.getField())
|
||||
* && oConvertUtils.isNotEmpty(rule.getRule()) &&
|
||||
* oConvertUtils.isNotEmpty(rule.getVal())){
|
||||
* ObjectParseUtil.addCriteria(queryWrapper, rule.getField(),
|
||||
* QueryRuleEnum.getByValue(rule.getRule()), rule.getVal()); } } } } catch
|
||||
* (UnsupportedEncodingException e) { e.printStackTrace(); }
|
||||
* //===========================================================================
|
||||
* =====
|
||||
*
|
||||
* // 手工转换实体驼峰字段为下划线分隔表字段 queryWrapper = queryWrapper==null?new
|
||||
* QueryWrapper<JeecgDemo>(jeecgDemo):queryWrapper; Page<JeecgDemo> page = new
|
||||
* Page<JeecgDemo>(pageNo, pageSize);
|
||||
*
|
||||
* // 排序逻辑 处理 String column = req.getParameter("column"); String order =
|
||||
* req.getParameter("order"); if (oConvertUtils.isNotEmpty(column) &&
|
||||
* oConvertUtils.isNotEmpty(order)) { if ("asc".equals(order)) {
|
||||
* queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column)); } else {
|
||||
* queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column)); } }
|
||||
*/
|
||||
|
||||
QueryWrapper<JeecgDemo> queryWrapper = QueryGenerator.initQueryWrapper(jeecgDemo, req.getParameterMap());
|
||||
Page<JeecgDemo> page = new Page<JeecgDemo>(pageNo, pageSize);
|
||||
|
||||
IPage<JeecgDemo> pageList = jeecgDemoService.page(page, queryWrapper);
|
||||
// log.info("查询当前页:" + pageList.getCurrent());
|
||||
// log.info("查询当前页数量:" + pageList.getSize());
|
||||
// log.info("查询结果数量:" + pageList.getRecords().size());
|
||||
// log.info("数据总数:" + pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param jeecgDemo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
@AutoLog(value = "添加测试DEMO")
|
||||
@ApiOperation(value = "添加DEMO", notes = "添加DEMO")
|
||||
public Result<JeecgDemo> add(@RequestBody JeecgDemo jeecgDemo) {
|
||||
Result<JeecgDemo> result = new Result<JeecgDemo>();
|
||||
try {
|
||||
jeecgDemoService.save(jeecgDemo);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param jeecgDemo
|
||||
* @return
|
||||
*/
|
||||
@PutMapping(value = "/edit")
|
||||
@ApiOperation(value = "编辑DEMO", notes = "编辑DEMO")
|
||||
public Result<JeecgDemo> eidt(@RequestBody JeecgDemo jeecgDemo) {
|
||||
Result<JeecgDemo> result = new Result<JeecgDemo>();
|
||||
JeecgDemo jeecgDemoEntity = jeecgDemoService.getById(jeecgDemo.getId());
|
||||
if (jeecgDemoEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = jeecgDemoService.updateById(jeecgDemo);
|
||||
// TODO 返回false说明什么?
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "删除测试DEMO")
|
||||
@DeleteMapping(value = "/delete")
|
||||
@ApiOperation(value = "通过ID删除DEMO", notes = "通过ID删除DEMO")
|
||||
public Result<JeecgDemo> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<JeecgDemo> result = new Result<JeecgDemo>();
|
||||
JeecgDemo jeecgDemo = jeecgDemoService.getById(id);
|
||||
if (jeecgDemo == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = jeecgDemoService.removeById(id);
|
||||
if (ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
@ApiOperation(value = "批量删除DEMO", notes = "批量删除DEMO")
|
||||
public Result<JeecgDemo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
Result<JeecgDemo> result = new Result<JeecgDemo>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
this.jeecgDemoService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
@ApiOperation(value = "通过ID查询DEMO", notes = "通过ID查询DEMO")
|
||||
public Result<JeecgDemo> queryById(@ApiParam(name = "id", value = "示例id", required = true) @RequestParam(name = "id", required = true) String id) {
|
||||
Result<JeecgDemo> result = new Result<JeecgDemo>();
|
||||
JeecgDemo jeecgDemo = jeecgDemoService.getById(id);
|
||||
if (jeecgDemo == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
result.setResult(jeecgDemo);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
@PermissionData(pageComponent="jeecg/JeecgDemoList")
|
||||
public ModelAndView exportXls(HttpServletRequest request, JeecgDemo jeecgDemo) {
|
||||
return super.exportXls(request, jeecgDemo, JeecgDemo.class, "单表模型");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, JeecgDemo.class);
|
||||
}
|
||||
|
||||
// ================================================================================================================
|
||||
/**
|
||||
* redis操作 -- set
|
||||
*/
|
||||
@GetMapping(value = "/redisSet")
|
||||
public void redisSet() {
|
||||
redisUtil.set("name", "张三" + DateUtils.now());
|
||||
}
|
||||
|
||||
/**
|
||||
* redis操作 -- get
|
||||
*/
|
||||
@GetMapping(value = "/redisGet")
|
||||
public String redisGet() {
|
||||
return (String) redisUtil.get("name");
|
||||
}
|
||||
|
||||
/**
|
||||
* redis操作 -- setObj
|
||||
*/
|
||||
@GetMapping(value = "/redisSetObj")
|
||||
public void redisSetObj() {
|
||||
JeecgDemo p = new JeecgDemo();
|
||||
p.setAge(10);
|
||||
p.setBirthday(new Date());
|
||||
p.setContent("hello");
|
||||
p.setName("张三");
|
||||
p.setSex("男");
|
||||
redisUtil.set("user-zdh", p);
|
||||
}
|
||||
|
||||
/**
|
||||
* redis操作 -- setObj
|
||||
*/
|
||||
@GetMapping(value = "/redisGetObj")
|
||||
public Object redisGetObj() {
|
||||
return redisUtil.get("user-zdh");
|
||||
}
|
||||
|
||||
/**
|
||||
* redis操作 -- get
|
||||
*/
|
||||
@GetMapping(value = "/redisDemo/{id}")
|
||||
public JeecgDemo redisGetJeecgDemo(@PathVariable("id") String id) {
|
||||
JeecgDemo t = jeecgDemoService.getByIdCacheable(id);
|
||||
System.out.println(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* freemaker方式 【页面路径: src/main/resources/templates】
|
||||
*
|
||||
* @param modelAndView
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/demo3")
|
||||
public ModelAndView demo3(ModelAndView modelAndView) {
|
||||
modelAndView.setViewName("demo3");
|
||||
List<String> userList = new ArrayList<String>();
|
||||
userList.add("admin");
|
||||
userList.add("user1");
|
||||
userList.add("user2");
|
||||
log.info("--------------test--------------");
|
||||
modelAndView.addObject("userList", userList);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
// ================================================================================================================
|
||||
|
||||
// ==========================================动态表单
|
||||
// JSON接收测试===========================================//
|
||||
@PostMapping(value = "/testOnlineAdd")
|
||||
public Result<JeecgDemo> testOnlineAdd(@RequestBody JSONObject json) {
|
||||
Result<JeecgDemo> result = new Result<JeecgDemo>();
|
||||
log.info(json.toJSONString());
|
||||
result.success("添加成功!");
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,425 @@
|
||||
package org.jeecg.modules.demo.test.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderMain;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderCustomerService;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderMainService;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderTicketService;
|
||||
import org.jeecg.modules.demo.test.vo.JeecgOrderMainPage;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 订单模拟
|
||||
* @Author: ZhiLin
|
||||
* @Date: 2019-02-20
|
||||
* @Version: v1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/test/order")
|
||||
public class JeecgOrderDMainController {
|
||||
@Autowired
|
||||
private IJeecgOrderMainService jeecgOrderMainService;
|
||||
@Autowired
|
||||
private IJeecgOrderCustomerService jeecgOrderCustomerService;
|
||||
@Autowired
|
||||
private IJeecgOrderTicketService jeecgOrderTicketService;
|
||||
@Autowired
|
||||
private IJeecgOrderCustomerService customerService;
|
||||
@Autowired
|
||||
private IJeecgOrderTicketService ticketService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param jeecgOrderMain
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/orderList")
|
||||
public Result<IPage<JeecgOrderMain>> respondePagedData(JeecgOrderMain jeecgOrderMain,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<JeecgOrderMain>> result = new Result<IPage<JeecgOrderMain>>();
|
||||
QueryWrapper<JeecgOrderMain> queryWrapper = QueryGenerator.initQueryWrapper(jeecgOrderMain, req.getParameterMap());
|
||||
Page<JeecgOrderMain> page = new Page<JeecgOrderMain>(pageNo, pageSize);
|
||||
IPage<JeecgOrderMain> pageList = jeecgOrderMainService.page(page, queryWrapper);
|
||||
//log.debug("查询当前页:"+pageList.getCurrent());
|
||||
//log.debug("查询当前页数量:"+pageList.getSize());
|
||||
//log.debug("查询结果数量:"+pageList.getRecords().size());
|
||||
//log.debug("数据总数:"+pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param jeecgOrderMainPage
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<JeecgOrderMain> add(@RequestBody JeecgOrderMainPage jeecgOrderMainPage) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
try {
|
||||
JeecgOrderMain jeecgOrderMain = new JeecgOrderMain();
|
||||
BeanUtils.copyProperties(jeecgOrderMainPage, jeecgOrderMain);
|
||||
jeecgOrderMainService.save(jeecgOrderMain);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param jeecgOrderMainPage
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/edit")
|
||||
public Result<JeecgOrderMain> edit(@RequestBody JeecgOrderMainPage jeecgOrderMainPage) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
JeecgOrderMain jeecgOrderMain = new JeecgOrderMain();
|
||||
BeanUtils.copyProperties(jeecgOrderMainPage, jeecgOrderMain);
|
||||
JeecgOrderMain jeecgOrderMainEntity = jeecgOrderMainService.getById(jeecgOrderMain.getId());
|
||||
if (jeecgOrderMainEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
jeecgOrderMainService.updateById(jeecgOrderMain);
|
||||
result.success("修改成功!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<JeecgOrderMain> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
JeecgOrderMain jeecgOrderMain = jeecgOrderMainService.getById(id);
|
||||
if (jeecgOrderMain == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
jeecgOrderMainService.delMain(id);
|
||||
result.success("删除成功!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<JeecgOrderMain> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
this.jeecgOrderMainService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<JeecgOrderMain> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
JeecgOrderMain jeecgOrderMain = jeecgOrderMainService.getById(id);
|
||||
if (jeecgOrderMain == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
result.setResult(jeecgOrderMain);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param mainId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/listOrderCustomerByMainId")
|
||||
public Result<List<JeecgOrderCustomer>> queryOrderCustomerListByMainId(@RequestParam(name = "mainId", required = false) String mainId) {
|
||||
Result<List<JeecgOrderCustomer>> result = new Result<List<JeecgOrderCustomer>>();
|
||||
List<JeecgOrderCustomer> jeecgOrderCustomerList = null;
|
||||
if (mainId != null) {
|
||||
jeecgOrderCustomerList = jeecgOrderCustomerService.selectCustomersByMainId(mainId);
|
||||
result.setResult(jeecgOrderCustomerList);
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param mainId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/listOrderTicketByMainId")
|
||||
public Result<List<JeecgOrderTicket>> queryOrderTicketListByMainId(@RequestParam(name = "mainId", required = false) String mainId) {
|
||||
Result<List<JeecgOrderTicket>> result = new Result<List<JeecgOrderTicket>>();
|
||||
List<JeecgOrderTicket> jeecgOrderTicketList = null;
|
||||
if (mainId != null) {
|
||||
jeecgOrderTicketList = jeecgOrderTicketService.selectTicketsByMainId(mainId);
|
||||
result.setResult(jeecgOrderTicketList);
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ================================以下是客户信息相关的API=================================
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param jeecgOrderCustomer
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/addCustomer")
|
||||
public Result<JeecgOrderCustomer> addCustomer(@RequestBody JeecgOrderCustomer jeecgOrderCustomer) {
|
||||
Result<JeecgOrderCustomer> result = new Result<>();
|
||||
try {
|
||||
boolean ok = customerService.save(jeecgOrderCustomer);
|
||||
if (ok) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("添加数据成功");
|
||||
} else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("添加数据失败");
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
e.fillInStackTrace();
|
||||
result.setSuccess(false);
|
||||
result.setMessage("遇到问题了!");
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param jeecgOrderCustomer
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/editCustomer")
|
||||
public Result<JeecgOrderCustomer> editCustomer(@RequestBody JeecgOrderCustomer jeecgOrderCustomer) {
|
||||
Result<JeecgOrderCustomer> result = new Result<>();
|
||||
try {
|
||||
boolean ok = customerService.updateById(jeecgOrderCustomer);
|
||||
if (ok) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("更新成功");
|
||||
} else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("更新失败");
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
e.fillInStackTrace();
|
||||
result.setSuccess(true);
|
||||
result.setMessage("更新中碰到异常了");
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteCustomer")
|
||||
public Result<JeecgOrderCustomer> deleteCustomer(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<JeecgOrderCustomer> result = new Result<>();
|
||||
try {
|
||||
boolean ok = customerService.removeById(id);
|
||||
if (ok) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("删除成功");
|
||||
} else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("删除失败");
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
e.fillInStackTrace();
|
||||
result.setSuccess(false);
|
||||
result.setMessage("删除过程中碰到异常了");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatchCustomer")
|
||||
public Result<JeecgOrderCustomer> deleteBatchCustomer(@RequestParam(name = "ids", required = true) String ids) {
|
||||
Result<JeecgOrderCustomer> result = new Result<JeecgOrderCustomer>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
this.customerService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//===========================以下是机票的相关API====================================
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param jeecgOrderTicket
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/addTicket")
|
||||
public Result<JeecgOrderTicket> addTicket(@RequestBody JeecgOrderTicket jeecgOrderTicket) {
|
||||
Result<JeecgOrderTicket> result = new Result<>();
|
||||
try {
|
||||
boolean ok = ticketService.save(jeecgOrderTicket);
|
||||
if (ok) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("添加机票信息成功.");
|
||||
} else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("添加机票信息失败!");
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
e.fillInStackTrace();
|
||||
result.setSuccess(false);
|
||||
result.setMessage("添加机票信息过程中出现了异常: " + e.getMessage());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param jeecgOrderTicket
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/editTicket")
|
||||
public Result<JeecgOrderTicket> editTicket(@RequestBody JeecgOrderTicket jeecgOrderTicket) {
|
||||
Result<JeecgOrderTicket> result = new Result<>();
|
||||
try {
|
||||
boolean ok = ticketService.updateById(jeecgOrderTicket);
|
||||
if (ok) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("更新数据成功.");
|
||||
} else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("更新机票 信息失败!");
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("更新数据过程中出现异常啦: " + e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteTicket")
|
||||
public Result<JeecgOrderTicket> deleteTicket(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<JeecgOrderTicket> result = new Result<>();
|
||||
try {
|
||||
boolean ok = ticketService.removeById(id);
|
||||
if (ok) {
|
||||
result.setSuccess(true);
|
||||
result.setMessage("删除机票信息成功.");
|
||||
} else {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("删除机票信息失败!");
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("删除机票信息过程中出现异常啦: " + e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatchTicket")
|
||||
public Result<JeecgOrderTicket> deleteBatchTicket(@RequestParam(name = "ids", required = true) String ids) {
|
||||
Result<JeecgOrderTicket> result = new Result<JeecgOrderTicket>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
this.ticketService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,299 @@
|
||||
package org.jeecg.modules.demo.test.controller;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderMain;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderCustomerService;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderMainService;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderTicketService;
|
||||
import org.jeecg.modules.demo.test.vo.JeecgOrderMainPage;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 订单
|
||||
* @Author: jeecg-boot
|
||||
* @Date:2019-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test/jeecgOrderMain")
|
||||
@Slf4j
|
||||
public class JeecgOrderMainController {
|
||||
@Autowired
|
||||
private IJeecgOrderMainService jeecgOrderMainService;
|
||||
@Autowired
|
||||
private IJeecgOrderCustomerService jeecgOrderCustomerService;
|
||||
@Autowired
|
||||
private IJeecgOrderTicketService jeecgOrderTicketService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param jeecgOrderMain
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<JeecgOrderMain>> queryPageList(JeecgOrderMain jeecgOrderMain, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
Result<IPage<JeecgOrderMain>> result = new Result<IPage<JeecgOrderMain>>();
|
||||
QueryWrapper<JeecgOrderMain> queryWrapper = QueryGenerator.initQueryWrapper(jeecgOrderMain, req.getParameterMap());
|
||||
Page<JeecgOrderMain> page = new Page<JeecgOrderMain>(pageNo, pageSize);
|
||||
IPage<JeecgOrderMain> pageList = jeecgOrderMainService.page(page, queryWrapper);
|
||||
// log.debug("查询当前页:"+pageList.getCurrent());
|
||||
// log.debug("查询当前页数量:"+pageList.getSize());
|
||||
// log.debug("查询结果数量:"+pageList.getRecords().size());
|
||||
// log.debug("数据总数:"+pageList.getTotal());
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param jeecgOrderMain
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<JeecgOrderMain> add(@RequestBody JeecgOrderMainPage jeecgOrderMainPage) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
try {
|
||||
JeecgOrderMain jeecgOrderMain = new JeecgOrderMain();
|
||||
BeanUtils.copyProperties(jeecgOrderMainPage, jeecgOrderMain);
|
||||
jeecgOrderMainService.saveMain(jeecgOrderMain, jeecgOrderMainPage.getJeecgOrderCustomerList(), jeecgOrderMainPage.getJeecgOrderTicketList());
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param jeecgOrderMain
|
||||
* @return
|
||||
*/
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<JeecgOrderMain> eidt(@RequestBody JeecgOrderMainPage jeecgOrderMainPage) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
JeecgOrderMain jeecgOrderMain = new JeecgOrderMain();
|
||||
BeanUtils.copyProperties(jeecgOrderMainPage, jeecgOrderMain);
|
||||
JeecgOrderMain jeecgOrderMainEntity = jeecgOrderMainService.getById(jeecgOrderMain.getId());
|
||||
if (jeecgOrderMainEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
jeecgOrderMainService.updateMain(jeecgOrderMain, jeecgOrderMainPage.getJeecgOrderCustomerList(), jeecgOrderMainPage.getJeecgOrderTicketList());
|
||||
result.success("修改成功!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<JeecgOrderMain> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
JeecgOrderMain jeecgOrderMain = jeecgOrderMainService.getById(id);
|
||||
if (jeecgOrderMain == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
jeecgOrderMainService.delMain(id);
|
||||
result.success("删除成功!");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<JeecgOrderMain> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
this.jeecgOrderMainService.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<JeecgOrderMain> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<JeecgOrderMain> result = new Result<JeecgOrderMain>();
|
||||
JeecgOrderMain jeecgOrderMain = jeecgOrderMainService.getById(id);
|
||||
if (jeecgOrderMain == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
result.setResult(jeecgOrderMain);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryOrderCustomerListByMainId")
|
||||
public Result<List<JeecgOrderCustomer>> queryOrderCustomerListByMainId(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<List<JeecgOrderCustomer>> result = new Result<List<JeecgOrderCustomer>>();
|
||||
List<JeecgOrderCustomer> jeecgOrderCustomerList = jeecgOrderCustomerService.selectCustomersByMainId(id);
|
||||
result.setResult(jeecgOrderCustomerList);
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryOrderTicketListByMainId")
|
||||
public Result<List<JeecgOrderTicket>> queryOrderTicketListByMainId(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<List<JeecgOrderTicket>> result = new Result<List<JeecgOrderTicket>>();
|
||||
List<JeecgOrderTicket> jeecgOrderTicketList = jeecgOrderTicketService.selectTicketsByMainId(id);
|
||||
result.setResult(jeecgOrderTicketList);
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, JeecgOrderMain jeecgOrderMain) {
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<JeecgOrderMain> queryWrapper = QueryGenerator.initQueryWrapper(jeecgOrderMain, request.getParameterMap());
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
List<JeecgOrderMainPage> pageList = new ArrayList<JeecgOrderMainPage>();
|
||||
|
||||
List<JeecgOrderMain> jeecgOrderMainList = jeecgOrderMainService.list(queryWrapper);
|
||||
for (JeecgOrderMain orderMain : jeecgOrderMainList) {
|
||||
JeecgOrderMainPage vo = new JeecgOrderMainPage();
|
||||
BeanUtils.copyProperties(orderMain, vo);
|
||||
// 查询机票
|
||||
List<JeecgOrderTicket> jeecgOrderTicketList = jeecgOrderTicketService.selectTicketsByMainId(orderMain.getId());
|
||||
vo.setJeecgOrderTicketList(jeecgOrderTicketList);
|
||||
// 查询客户
|
||||
List<JeecgOrderCustomer> jeecgOrderCustomerList = jeecgOrderCustomerService.selectCustomersByMainId(orderMain.getId());
|
||||
vo.setJeecgOrderCustomerList(jeecgOrderCustomerList);
|
||||
pageList.add(vo);
|
||||
}
|
||||
|
||||
// 导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "一对多导出文件名字");
|
||||
// 注解对象Class
|
||||
mv.addObject(NormalExcelConstants.CLASS, JeecgOrderMainPage.class);
|
||||
// 自定义表格参数
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("自定义导出Excel内容标题", "导出人:Jeecg", "自定义Sheet名字"));
|
||||
// 导出数据列表
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
MultipartFile file = entity.getValue();// 获取上传文件对象
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(2);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<JeecgOrderMainPage> list = ExcelImportUtil.importExcel(file.getInputStream(), JeecgOrderMainPage.class, params);
|
||||
for (JeecgOrderMainPage page : list) {
|
||||
JeecgOrderMain po = new JeecgOrderMain();
|
||||
BeanUtils.copyProperties(page, po);
|
||||
jeecgOrderMainService.saveMain(po, page.getJeecgOrderCustomerList(), page.getJeecgOrderTicketList());
|
||||
}
|
||||
return Result.ok("文件导入成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("文件导入失败:"+e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,244 @@
|
||||
package org.jeecg.modules.demo.test.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.demo.test.entity.JoaDemo;
|
||||
import org.jeecg.modules.demo.test.service.IJoaDemoService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Description: 流程测试
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-05-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test/joaDemo")
|
||||
@Slf4j
|
||||
public class JoaDemoController {
|
||||
@Autowired
|
||||
private IJoaDemoService joaDemoService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param joaDemo
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<JoaDemo>> queryPageList(JoaDemo joaDemo,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<JoaDemo>> result = new Result<IPage<JoaDemo>>();
|
||||
QueryWrapper<JoaDemo> queryWrapper = QueryGenerator.initQueryWrapper(joaDemo, req.getParameterMap());
|
||||
Page<JoaDemo> page = new Page<JoaDemo>(pageNo, pageSize);
|
||||
IPage<JoaDemo> pageList = joaDemoService.page(page, queryWrapper);
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param joaDemo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<JoaDemo> add(@RequestBody JoaDemo joaDemo) {
|
||||
Result<JoaDemo> result = new Result<JoaDemo>();
|
||||
try {
|
||||
joaDemoService.save(joaDemo);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param joaDemo
|
||||
* @return
|
||||
*/
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<JoaDemo> edit(@RequestBody JoaDemo joaDemo) {
|
||||
Result<JoaDemo> result = new Result<JoaDemo>();
|
||||
JoaDemo joaDemoEntity = joaDemoService.getById(joaDemo.getId());
|
||||
if(joaDemoEntity==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = joaDemoService.updateById(joaDemo);
|
||||
//TODO 返回false说明什么?
|
||||
if(ok) {
|
||||
result.success("修改成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<JoaDemo> delete(@RequestParam(name="id",required=true) String id) {
|
||||
Result<JoaDemo> result = new Result<JoaDemo>();
|
||||
JoaDemo joaDemo = joaDemoService.getById(id);
|
||||
if(joaDemo==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = joaDemoService.removeById(id);
|
||||
if(ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<JoaDemo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<JoaDemo> result = new Result<JoaDemo>();
|
||||
if(ids==null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
}else {
|
||||
this.joaDemoService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<JoaDemo> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Result<JoaDemo> result = new Result<JoaDemo>();
|
||||
JoaDemo joaDemo = joaDemoService.getById(id);
|
||||
if(joaDemo==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
result.setResult(joaDemo);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<JoaDemo> queryWrapper = null;
|
||||
try {
|
||||
String paramsStr = request.getParameter("paramsStr");
|
||||
if (oConvertUtils.isNotEmpty(paramsStr)) {
|
||||
String deString = URLDecoder.decode(paramsStr, "UTF-8");
|
||||
JoaDemo joaDemo = JSON.parseObject(deString, JoaDemo.class);
|
||||
queryWrapper = QueryGenerator.initQueryWrapper(joaDemo, request.getParameterMap());
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
List<JoaDemo> pageList = joaDemoService.list(queryWrapper);
|
||||
//导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "流程测试列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, JoaDemo.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("流程测试列表数据", "导出人:Jeecg", "导出信息"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
MultipartFile file = entity.getValue();// 获取上传文件对象
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<JoaDemo> listJoaDemos = ExcelImportUtil.importExcel(file.getInputStream(), JoaDemo.class, params);
|
||||
for (JoaDemo joaDemoExcel : listJoaDemos) {
|
||||
joaDemoService.save(joaDemoExcel);
|
||||
}
|
||||
return Result.ok("文件导入成功!数据行数:" + listJoaDemos.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("文件导入失败:"+e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.ok("文件导入失败!");
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package org.jeecg.modules.demo.test.entity;
|
||||
|
||||
import org.jeecg.common.system.base.entity.JeecgEntity;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: jeecg 测试demo
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2018-12-29
|
||||
* @Version:V1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="测试DEMO对象", description="测试DEMO")
|
||||
@TableName("demo")
|
||||
public class JeecgDemo extends JeecgEntity {
|
||||
|
||||
/** 部门编码 */
|
||||
@Excel(name="部门编码",width=25)
|
||||
@ApiModelProperty(value = "部门编码")
|
||||
private java.lang.String sysOrgCode;
|
||||
/** 姓名 */
|
||||
@Excel(name="姓名",width=25)
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private java.lang.String name;
|
||||
/** 关键词 */
|
||||
@ApiModelProperty(value = "关键词")
|
||||
@Excel(name="关键词",width=15)
|
||||
private java.lang.String keyWord;
|
||||
/** 打卡时间 */
|
||||
@ApiModelProperty(value = "打卡时间")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name="打卡时间",width=20,format="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date punchTime;
|
||||
/** 工资 */
|
||||
@ApiModelProperty(value = "工资",example = "0")
|
||||
@Excel(name="工资",width=15)
|
||||
private java.math.BigDecimal salaryMoney;
|
||||
/** 奖金 */
|
||||
@ApiModelProperty(value = "奖金",example = "0")
|
||||
@Excel(name="奖金",width=15)
|
||||
private java.lang.Double bonusMoney;
|
||||
/** 性别 {男:1,女:2} */
|
||||
@ApiModelProperty(value = "性别")
|
||||
@Excel(name = "性别", width = 15, dicCode = "sex")
|
||||
private java.lang.String sex;
|
||||
/** 年龄 */
|
||||
@ApiModelProperty(value = "年龄",example = "0")
|
||||
@Excel(name="年龄",width=15)
|
||||
private java.lang.Integer age;
|
||||
/** 生日 */
|
||||
@ApiModelProperty(value = "生日")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name="生日",format="yyyy-MM-dd")
|
||||
private java.util.Date birthday;
|
||||
/** 邮箱 */
|
||||
@ApiModelProperty(value = "邮箱")
|
||||
@Excel(name="邮箱",width=30)
|
||||
private java.lang.String email;
|
||||
/** 个人简介 */
|
||||
@ApiModelProperty(value = "个人简介")
|
||||
private java.lang.String content;
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package org.jeecg.modules.demo.test.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: 订单客户
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("jeecg_order_customer")
|
||||
public class JeecgOrderCustomer implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private java.lang.String id;
|
||||
/**客户名*/
|
||||
@Excel(name="客户名字",width=15)
|
||||
private java.lang.String name;
|
||||
/**性别*/
|
||||
private java.lang.String sex;
|
||||
/**身份证号码*/
|
||||
@Excel(name="身份证号码",width=15)
|
||||
private java.lang.String idcard;
|
||||
/**身份证扫描件*/
|
||||
private java.lang.String idcardPic;
|
||||
/**电话1*/
|
||||
@Excel(name="电话",width=15)
|
||||
private java.lang.String telphone;
|
||||
/**外键*/
|
||||
private java.lang.String orderId;
|
||||
/**创建人*/
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/**修改人*/
|
||||
private java.lang.String updateBy;
|
||||
/**修改时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package org.jeecg.modules.demo.test.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: 订单
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("jeecg_order_main")
|
||||
public class JeecgOrderMain implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private java.lang.String id;
|
||||
/**订单号*/
|
||||
private java.lang.String orderCode;
|
||||
/**订单类型*/
|
||||
private java.lang.String ctype;
|
||||
/**订单日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date orderDate;
|
||||
/**订单金额*/
|
||||
private java.lang.Double orderMoney;
|
||||
/**订单备注*/
|
||||
private java.lang.String content;
|
||||
/**创建人*/
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/**修改人*/
|
||||
private java.lang.String updateBy;
|
||||
/**修改时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package org.jeecg.modules.demo.test.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @Description: 订单机票
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("jeecg_order_ticket")
|
||||
public class JeecgOrderTicket implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private java.lang.String id;
|
||||
/**航班号*/
|
||||
@Excel(name="航班号",width=15)
|
||||
private java.lang.String ticketCode;
|
||||
/**航班时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name="航班时间",width=15,format = "yyyy-MM-dd")
|
||||
private java.util.Date tickectDate;
|
||||
/**外键*/
|
||||
private java.lang.String orderId;
|
||||
/**创建人*/
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/**修改人*/
|
||||
private java.lang.String updateBy;
|
||||
/**修改时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package org.jeecg.modules.demo.test.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: 流程测试
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-05-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("joa_demo")
|
||||
public class JoaDemo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**ID*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private java.lang.String id;
|
||||
/**请假人*/
|
||||
@Excel(name = "请假人", width = 15)
|
||||
private java.lang.String name;
|
||||
/**请假天数*/
|
||||
@Excel(name = "请假天数", width = 15)
|
||||
private java.lang.Integer days;
|
||||
/**开始时间*/
|
||||
@Excel(name = "开始时间", width = 20, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private java.util.Date beginDate;
|
||||
/**请假结束时间*/
|
||||
@Excel(name = "请假结束时间", width = 20, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private java.util.Date endDate;
|
||||
/**请假原因*/
|
||||
@Excel(name = "请假原因", width = 15)
|
||||
private java.lang.String reason;
|
||||
/**流程状态*/
|
||||
@Excel(name = "流程状态", width = 15)
|
||||
private java.lang.String bpmStatus;
|
||||
/**创建人id*/
|
||||
@Excel(name = "创建人id", width = 15)
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/**修改时间*/
|
||||
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
/**修改人id*/
|
||||
@Excel(name = "修改人id", width = 15)
|
||||
private java.lang.String updateBy;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package org.jeecg.modules.demo.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgDemo;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: jeecg 测试demo
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2018-12-29
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface JeecgDemoMapper extends BaseMapper<JeecgDemo> {
|
||||
|
||||
public List<JeecgDemo> getDemoByName(@Param("name") String name);
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package org.jeecg.modules.demo.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 订单客户
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface JeecgOrderCustomerMapper extends BaseMapper<JeecgOrderCustomer> {
|
||||
|
||||
/**
|
||||
* 通过主表外键批量删除客户
|
||||
* @param mainId
|
||||
* @return
|
||||
*/
|
||||
@Delete("DELETE FROM JEECG_ORDER_CUSTOMER WHERE ORDER_ID = #{mainId}")
|
||||
public boolean deleteCustomersByMainId(String mainId);
|
||||
|
||||
@Select("SELECT * FROM JEECG_ORDER_CUSTOMER WHERE ORDER_ID = #{mainId}")
|
||||
public List<JeecgOrderCustomer> selectCustomersByMainId(String mainId);
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.demo.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderMain;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 订单
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface JeecgOrderMainMapper extends BaseMapper<JeecgOrderMain> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package org.jeecg.modules.demo.test.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 订单机票
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface JeecgOrderTicketMapper extends BaseMapper<JeecgOrderTicket> {
|
||||
|
||||
/**
|
||||
* 通过主表外键批量删除客户
|
||||
* @param mainId
|
||||
* @return
|
||||
*/
|
||||
@Delete("DELETE FROM JEECG_ORDER_TICKET WHERE ORDER_ID = #{mainId}")
|
||||
public boolean deleteTicketsByMainId(String mainId);
|
||||
|
||||
|
||||
@Select("SELECT * FROM JEECG_ORDER_TICKET WHERE ORDER_ID = #{mainId}")
|
||||
public List<JeecgOrderTicket> selectTicketsByMainId(String mainId);
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.jeecg.modules.demo.test.mapper;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JoaDemo;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 流程测试
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-05-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface JoaDemoMapper extends BaseMapper<JoaDemo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.test.mapper.JeecgDemoMapper">
|
||||
|
||||
<!-- 根据用户名查询 -->
|
||||
<select id="getDemoByName" resultType="org.jeecg.modules.demo.test.entity.JeecgDemo">
|
||||
select * from demo where name = #{name}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.test.mapper.JeecgOrderCustomerMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.test.mapper.JeecgOrderMainMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.test.mapper.JeecgOrderTicketMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.test.mapper.JoaDemoMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.demo.test.service;
|
||||
|
||||
import org.jeecg.common.system.base.service.JeecgService;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgDemo;
|
||||
|
||||
/**
|
||||
* @Description: jeecg 测试demo
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2018-12-29
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IJeecgDemoService extends JeecgService<JeecgDemo> {
|
||||
|
||||
public void testTran();
|
||||
|
||||
public JeecgDemo getByIdCacheable(String id);
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package org.jeecg.modules.demo.test.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 订单客户
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IJeecgOrderCustomerService extends IService<JeecgOrderCustomer> {
|
||||
|
||||
public List<JeecgOrderCustomer> selectCustomersByMainId(String mainId);
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package org.jeecg.modules.demo.test.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderMain;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 订单
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IJeecgOrderMainService extends IService<JeecgOrderMain> {
|
||||
|
||||
/**
|
||||
* 添加一对多
|
||||
*
|
||||
*/
|
||||
public void saveMain(JeecgOrderMain jeecgOrderMain,List<JeecgOrderCustomer> jeecgOrderCustomerList,List<JeecgOrderTicket> jeecgOrderTicketList) ;
|
||||
|
||||
/**
|
||||
* 修改一对多
|
||||
*
|
||||
*/
|
||||
public void updateMain(JeecgOrderMain jeecgOrderMain,List<JeecgOrderCustomer> jeecgOrderCustomerList,List<JeecgOrderTicket> jeecgOrderTicketList);
|
||||
|
||||
/**
|
||||
* 删除一对多
|
||||
* @param jformOrderMain
|
||||
*/
|
||||
public void delMain (String id);
|
||||
|
||||
/**
|
||||
* 批量删除一对多
|
||||
* @param jformOrderMain
|
||||
*/
|
||||
public void delBatchMain (Collection<? extends Serializable> idList);
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package org.jeecg.modules.demo.test.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 订单机票
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IJeecgOrderTicketService extends IService<JeecgOrderTicket> {
|
||||
|
||||
public List<JeecgOrderTicket> selectTicketsByMainId(String mainId);
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.jeecg.modules.demo.test.service;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JoaDemo;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 流程测试
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-05-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IJoaDemoService extends IService<JoaDemo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package org.jeecg.modules.demo.test.service.impl;
|
||||
|
||||
import org.jeecg.common.system.base.service.impl.JeecgServiceImpl;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgDemo;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgDemoMapper;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgDemoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @Description: jeecg 测试demo
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2018-12-29
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JeecgDemoServiceImpl extends JeecgServiceImpl<JeecgDemoMapper, JeecgDemo> implements IJeecgDemoService {
|
||||
@Autowired
|
||||
JeecgDemoMapper jeecgDemoMapper;
|
||||
|
||||
/**
|
||||
* 事务控制在service层面
|
||||
* 加上注解:@Transactional,声明的方法就是一个独立的事务(有异常DB操作全部回滚)
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void testTran() {
|
||||
JeecgDemo pp = new JeecgDemo();
|
||||
pp.setAge(1111);
|
||||
pp.setName("测试事务 小白兔 1");
|
||||
jeecgDemoMapper.insert(pp);
|
||||
|
||||
JeecgDemo pp2 = new JeecgDemo();
|
||||
pp2.setAge(2222);
|
||||
pp2.setName("测试事务 小白兔 2");
|
||||
jeecgDemoMapper.insert(pp2);
|
||||
|
||||
Integer.parseInt("hello");//自定义异常
|
||||
|
||||
JeecgDemo pp3 = new JeecgDemo();
|
||||
pp3.setAge(3333);
|
||||
pp3.setName("测试事务 小白兔 3");
|
||||
jeecgDemoMapper.insert(pp3);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 缓存注解测试: redis
|
||||
*/
|
||||
@Override
|
||||
@Cacheable(cacheNames="jeecgDemo", key="#id")
|
||||
public JeecgDemo getByIdCacheable(String id) {
|
||||
JeecgDemo t = jeecgDemoMapper.selectById(id);
|
||||
System.err.println("---未读缓存,读取数据库---");
|
||||
System.err.println(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package org.jeecg.modules.demo.test.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgOrderCustomerMapper;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderCustomerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 订单客户
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JeecgOrderCustomerServiceImpl extends ServiceImpl<JeecgOrderCustomerMapper, JeecgOrderCustomer> implements IJeecgOrderCustomerService {
|
||||
|
||||
@Autowired
|
||||
private JeecgOrderCustomerMapper jeecgOrderCustomerMapper;
|
||||
|
||||
@Override
|
||||
public List<JeecgOrderCustomer> selectCustomersByMainId(String mainId) {
|
||||
return jeecgOrderCustomerMapper.selectCustomersByMainId(mainId);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package org.jeecg.modules.demo.test.service.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderMain;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgOrderCustomerMapper;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgOrderMainMapper;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgOrderTicketMapper;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 订单
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JeecgOrderMainServiceImpl extends ServiceImpl<JeecgOrderMainMapper, JeecgOrderMain> implements IJeecgOrderMainService {
|
||||
|
||||
@Autowired
|
||||
private JeecgOrderMainMapper jeecgOrderMainMapper;
|
||||
@Autowired
|
||||
private JeecgOrderCustomerMapper jeecgOrderCustomerMapper;
|
||||
@Autowired
|
||||
private JeecgOrderTicketMapper jeecgOrderTicketMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveMain(JeecgOrderMain jeecgOrderMain, List<JeecgOrderCustomer> jeecgOrderCustomerList, List<JeecgOrderTicket> jeecgOrderTicketList) {
|
||||
jeecgOrderMainMapper.insert(jeecgOrderMain);
|
||||
if (jeecgOrderCustomerList != null) {
|
||||
for (JeecgOrderCustomer entity : jeecgOrderCustomerList) {
|
||||
entity.setOrderId(jeecgOrderMain.getId());
|
||||
jeecgOrderCustomerMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
if (jeecgOrderTicketList != null) {
|
||||
for (JeecgOrderTicket entity : jeecgOrderTicketList) {
|
||||
entity.setOrderId(jeecgOrderMain.getId());
|
||||
jeecgOrderTicketMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateMain(JeecgOrderMain jeecgOrderMain, List<JeecgOrderCustomer> jeecgOrderCustomerList, List<JeecgOrderTicket> jeecgOrderTicketList) {
|
||||
jeecgOrderMainMapper.updateById(jeecgOrderMain);
|
||||
|
||||
//1.先删除子表数据
|
||||
jeecgOrderTicketMapper.deleteTicketsByMainId(jeecgOrderMain.getId());
|
||||
jeecgOrderCustomerMapper.deleteCustomersByMainId(jeecgOrderMain.getId());
|
||||
|
||||
//2.子表数据重新插入
|
||||
if (jeecgOrderCustomerList != null) {
|
||||
for (JeecgOrderCustomer entity : jeecgOrderCustomerList) {
|
||||
entity.setOrderId(jeecgOrderMain.getId());
|
||||
jeecgOrderCustomerMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
if (jeecgOrderTicketList != null) {
|
||||
for (JeecgOrderTicket entity : jeecgOrderTicketList) {
|
||||
entity.setOrderId(jeecgOrderMain.getId());
|
||||
jeecgOrderTicketMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void delMain(String id) {
|
||||
jeecgOrderMainMapper.deleteById(id);
|
||||
jeecgOrderTicketMapper.deleteTicketsByMainId(id);
|
||||
jeecgOrderCustomerMapper.deleteCustomersByMainId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void delBatchMain(Collection<? extends Serializable> idList) {
|
||||
for(Serializable id:idList) {
|
||||
jeecgOrderMainMapper.deleteById(id);
|
||||
jeecgOrderTicketMapper.deleteTicketsByMainId(id.toString());
|
||||
jeecgOrderCustomerMapper.deleteCustomersByMainId(id.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package org.jeecg.modules.demo.test.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
import org.jeecg.modules.demo.test.mapper.JeecgOrderTicketMapper;
|
||||
import org.jeecg.modules.demo.test.service.IJeecgOrderTicketService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 订单机票
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JeecgOrderTicketServiceImpl extends ServiceImpl<JeecgOrderTicketMapper, JeecgOrderTicket> implements IJeecgOrderTicketService {
|
||||
@Autowired
|
||||
private JeecgOrderTicketMapper jeecgOrderTicketMapper;
|
||||
|
||||
@Override
|
||||
public List<JeecgOrderTicket> selectTicketsByMainId(String mainId) {
|
||||
return jeecgOrderTicketMapper.selectTicketsByMainId(mainId);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.demo.test.service.impl;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JoaDemo;
|
||||
import org.jeecg.modules.demo.test.mapper.JoaDemoMapper;
|
||||
import org.jeecg.modules.demo.test.service.IJoaDemoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 流程测试
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-05-14
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class JoaDemoServiceImpl extends ServiceImpl<JoaDemoMapper, JoaDemo> implements IJoaDemoService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package org.jeecg.modules.demo.test.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderCustomer;
|
||||
import org.jeecg.modules.demo.test.entity.JeecgOrderTicket;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class JeecgOrderMainPage {
|
||||
|
||||
/**主键*/
|
||||
private java.lang.String id;
|
||||
/**订单号*/
|
||||
@Excel(name="订单号",width=15)
|
||||
private java.lang.String orderCode;
|
||||
/**订单类型*/
|
||||
private java.lang.String ctype;
|
||||
/**订单日期*/
|
||||
@Excel(name="订单日期",width=15,format = "yyyy-MM-dd")
|
||||
private java.util.Date orderDate;
|
||||
/**订单金额*/
|
||||
@Excel(name="订单金额",width=15)
|
||||
private java.lang.Double orderMoney;
|
||||
/**订单备注*/
|
||||
private java.lang.String content;
|
||||
/**创建人*/
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
private java.util.Date createTime;
|
||||
/**修改人*/
|
||||
private java.lang.String updateBy;
|
||||
/**修改时间*/
|
||||
private java.util.Date updateTime;
|
||||
|
||||
@ExcelCollection(name="客户")
|
||||
private List<JeecgOrderCustomer> jeecgOrderCustomerList;
|
||||
@ExcelCollection(name="机票")
|
||||
private List<JeecgOrderTicket> jeecgOrderTicketList;
|
||||
|
||||
}
|
||||
@ -0,0 +1,188 @@
|
||||
package org.jeecg.modules.message.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.message.entity.SysMessage;
|
||||
import org.jeecg.modules.message.service.ISysMessageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Description: 消息
|
||||
* @author: jeecg-boot
|
||||
* @date: 2019-04-09
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/message/sysMessage")
|
||||
public class SysMessageController extends JeecgController<SysMessage, ISysMessageService> {
|
||||
@Autowired
|
||||
private ISysMessageService sysMessageService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysMessage
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<SysMessage>> queryPageList(SysMessage sysMessage, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
Result<IPage<SysMessage>> result = new Result<IPage<SysMessage>>();
|
||||
QueryWrapper<SysMessage> queryWrapper = QueryGenerator.initQueryWrapper(sysMessage, req.getParameterMap());
|
||||
Page<SysMessage> page = new Page<SysMessage>(pageNo, pageSize);
|
||||
IPage<SysMessage> pageList = sysMessageService.page(page, queryWrapper);
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysMessage
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@RequestBody SysMessage sysMessage) {
|
||||
Result<T> result = new Result<T>();
|
||||
try {
|
||||
sysMessageService.save(sysMessage);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage(), e);
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysMessage
|
||||
* @return
|
||||
*/
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<T> edit(@RequestBody SysMessage sysMessage) {
|
||||
Result<T> result = new Result<T>();
|
||||
SysMessage sysMessageEntity = sysMessageService.getById(sysMessage.getId());
|
||||
if (sysMessageEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = sysMessageService.updateById(sysMessage);
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
} else {
|
||||
result.error500("修改失败!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<T> result = new Result<T>();
|
||||
SysMessage sysMessage = sysMessageService.getById(id);
|
||||
if (sysMessage == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = sysMessageService.removeById(id);
|
||||
if (ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
Result<T> result = new Result<T>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("ids参数不允许为空!");
|
||||
} else {
|
||||
this.sysMessageService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysMessage> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<SysMessage> result = new Result<SysMessage>();
|
||||
SysMessage sysMessage = sysMessageService.getById(id);
|
||||
if (sysMessage == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
result.setResult(sysMessage);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@GetMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysMessage sysMessage) {
|
||||
return super.exportXls(request,sysMessage,SysMessage.class, "推送消息模板");
|
||||
}
|
||||
|
||||
/**
|
||||
* excel导入
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/importExcel")
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysMessage.class);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,216 @@
|
||||
package org.jeecg.modules.message.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.message.entity.MsgParams;
|
||||
import org.jeecg.modules.message.entity.SysMessageTemplate;
|
||||
import org.jeecg.modules.message.service.ISysMessageTemplateService;
|
||||
import org.jeecg.modules.message.util.PushMsgUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Description: 消息模板
|
||||
* @Author: jeecg-boot
|
||||
* @Sate: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/message/sysMessageTemplate")
|
||||
public class SysMessageTemplateController extends JeecgController<SysMessageTemplate, ISysMessageTemplateService> {
|
||||
@Autowired
|
||||
private ISysMessageTemplateService sysMessageTemplateService;
|
||||
@Autowired
|
||||
private PushMsgUtil pushMsgUtil;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysMessageTemplate
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<SysMessageTemplate>> queryPageList(SysMessageTemplate sysMessageTemplate, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
Result<IPage<SysMessageTemplate>> result = new Result<IPage<SysMessageTemplate>>();
|
||||
QueryWrapper<SysMessageTemplate> queryWrapper = QueryGenerator.initQueryWrapper(sysMessageTemplate, req.getParameterMap());
|
||||
Page<SysMessageTemplate> page = new Page<SysMessageTemplate>(pageNo, pageSize);
|
||||
IPage<SysMessageTemplate> pageList = sysMessageTemplateService.page(page, queryWrapper);
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysMessageTemplate
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@RequestBody SysMessageTemplate sysMessageTemplate) {
|
||||
Result<T> result = new Result<T>();
|
||||
try {
|
||||
sysMessageTemplateService.save(sysMessageTemplate);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage(), e);
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysMessageTemplate
|
||||
* @return
|
||||
*/
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<T> edit(@RequestBody SysMessageTemplate sysMessageTemplate) {
|
||||
Result<T> result = new Result<T>();
|
||||
SysMessageTemplate sysMessageTemplateEntity = sysMessageTemplateService.getById(sysMessageTemplate.getId());
|
||||
if (sysMessageTemplateEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = sysMessageTemplateService.updateById(sysMessageTemplate);
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
} else {
|
||||
result.error500("修改失败!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<T> result = new Result<T>();
|
||||
SysMessageTemplate sysMessageTemplate = sysMessageTemplateService.getById(id);
|
||||
if (sysMessageTemplate == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = sysMessageTemplateService.removeById(id);
|
||||
if (ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
Result<T> result = new Result<T>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("ids参数不允许为空!");
|
||||
} else {
|
||||
this.sysMessageTemplateService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysMessageTemplate> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<SysMessageTemplate> result = new Result<SysMessageTemplate>();
|
||||
SysMessageTemplate sysMessageTemplate = sysMessageTemplateService.getById(id);
|
||||
if (sysMessageTemplate == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
result.setResult(sysMessageTemplate);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@GetMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request,SysMessageTemplate sysMessageTemplate) {
|
||||
return super.exportXls(request, sysMessageTemplate, SysMessageTemplate.class,"推送消息模板");
|
||||
}
|
||||
|
||||
/**
|
||||
* excel导入
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/importExcel")
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysMessageTemplate.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*/
|
||||
@PostMapping(value = "/sendMsg")
|
||||
public Result<SysMessageTemplate> sendMessage(@RequestBody MsgParams msgParams) {
|
||||
Result<SysMessageTemplate> result = new Result<SysMessageTemplate>();
|
||||
Map<String, String> map = null;
|
||||
try {
|
||||
map = (Map<String, String>) JSON.parse(msgParams.getTestData());
|
||||
} catch (Exception e) {
|
||||
result.error500("解析Json出错!");
|
||||
return result;
|
||||
}
|
||||
boolean is_sendSuccess = pushMsgUtil.sendMessage(msgParams.getMsgType(), msgParams.getTemplateCode(), map, msgParams.getReceiver());
|
||||
if (is_sendSuccess)
|
||||
result.success("发送消息任务添加成功!");
|
||||
else
|
||||
result.error500("发送消息任务添加失败!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package org.jeecg.modules.message.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 发送消息实体
|
||||
*/
|
||||
@Data
|
||||
public class MsgParams implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/*消息类型*/
|
||||
private String msgType;
|
||||
/*消息接收方*/
|
||||
private String receiver;
|
||||
/*消息模板码*/
|
||||
private String templateCode;
|
||||
/*测试数据*/
|
||||
private String testData;
|
||||
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package org.jeecg.modules.message.entity;
|
||||
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecg.common.system.base.entity.JeecgEntity;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 消息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("sys_sms")
|
||||
public class SysMessage extends JeecgEntity {
|
||||
/**推送内容*/
|
||||
@Excel(name = "推送内容", width = 15)
|
||||
private java.lang.Object esContent;
|
||||
/**推送所需参数Json格式*/
|
||||
@Excel(name = "推送所需参数Json格式", width = 15)
|
||||
private java.lang.String esParam;
|
||||
/**接收人*/
|
||||
@Excel(name = "接收人", width = 15)
|
||||
private java.lang.String esReceiver;
|
||||
/**推送失败原因*/
|
||||
@Excel(name = "推送失败原因", width = 15)
|
||||
private java.lang.String esResult;
|
||||
/**发送次数*/
|
||||
@Excel(name = "发送次数", width = 15)
|
||||
private java.lang.Integer esSendNum;
|
||||
/**推送状态 0未推送 1推送成功 2推送失败*/
|
||||
@Excel(name = "推送状态 0未推送 1推送成功 2推送失败", width = 15)
|
||||
@Dict(dicCode = "msgSendStatus")
|
||||
private java.lang.String esSendStatus;
|
||||
/**推送时间*/
|
||||
@Excel(name = "推送时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date esSendTime;
|
||||
/**消息标题*/
|
||||
@Excel(name = "消息标题", width = 15)
|
||||
private java.lang.String esTitle;
|
||||
/**推送方式:1短信 2邮件 3微信*/
|
||||
@Excel(name = "推送方式:1短信 2邮件 3微信", width = 15)
|
||||
@Dict(dicCode = "msgType")
|
||||
private java.lang.String esType;
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
private java.lang.String remark;
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package org.jeecg.modules.message.entity;
|
||||
|
||||
import org.jeecg.common.system.base.entity.JeecgEntity;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 消息模板
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("sys_sms_template")
|
||||
public class SysMessageTemplate extends JeecgEntity{
|
||||
/**模板CODE*/
|
||||
@Excel(name = "模板CODE", width = 15)
|
||||
private java.lang.String templateCode;
|
||||
/**模板标题*/
|
||||
@Excel(name = "模板标题", width = 30)
|
||||
private java.lang.String templateName;
|
||||
/**模板内容*/
|
||||
@Excel(name = "模板内容", width = 50)
|
||||
private java.lang.String templateContent;
|
||||
/**模板测试json*/
|
||||
@Excel(name = "模板测试json", width = 15)
|
||||
private java.lang.String templateTestJson;
|
||||
/**模板类型*/
|
||||
@Excel(name = "模板类型", width = 15)
|
||||
private java.lang.String templateType;
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package org.jeecg.modules.message.handle;
|
||||
|
||||
public interface ISendMsgHandle {
|
||||
|
||||
void SendMsg(String es_receiver, String es_title, String es_content);
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package org.jeecg.modules.message.handle.enums;
|
||||
|
||||
/**
|
||||
* 推送状态枚举
|
||||
*/
|
||||
public enum SendMsgStatusEnum {
|
||||
|
||||
//推送状态 0未推送 1推送成功 2推送失败
|
||||
WAIT("0"), SUCCESS("1"), FAIL("2");
|
||||
|
||||
private String code;
|
||||
|
||||
private SendMsgStatusEnum(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setStatusCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package org.jeecg.modules.message.handle.enums;
|
||||
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
|
||||
/**
|
||||
* 发送消息类型枚举
|
||||
*/
|
||||
public enum SendMsgTypeEnum {
|
||||
|
||||
//推送方式:1短信 2邮件 3微信
|
||||
SMS("1", "org.jeecg.modules.message.handle.impl.SmsSendMsgHandle"),
|
||||
EMAIL("2", "org.jeecg.modules.message.handle.impl.EmailSendMsgHandle"),
|
||||
WX("3","org.jeecg.modules.message.handle.impl.WxSendMsgHandle");
|
||||
|
||||
private String type;
|
||||
|
||||
private String implClass;
|
||||
|
||||
private SendMsgTypeEnum(String type, String implClass) {
|
||||
this.type = type;
|
||||
this.implClass = implClass;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getImplClass() {
|
||||
return implClass;
|
||||
}
|
||||
|
||||
public void setImplClass(String implClass) {
|
||||
this.implClass = implClass;
|
||||
}
|
||||
|
||||
public static SendMsgTypeEnum getByType(String type) {
|
||||
if (oConvertUtils.isEmpty(type)) {
|
||||
return null;
|
||||
}
|
||||
for (SendMsgTypeEnum val : values()) {
|
||||
if (val.getType().equals(type)) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package org.jeecg.modules.message.handle.impl;
|
||||
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.modules.message.handle.ISendMsgHandle;
|
||||
import org.springframework.mail.SimpleMailMessage;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
|
||||
public class EmailSendMsgHandle implements ISendMsgHandle {
|
||||
|
||||
@Override
|
||||
public void SendMsg(String es_receiver, String es_title, String es_content) {
|
||||
JavaMailSender mailSender = (JavaMailSender) SpringContextUtils.getBean("mailSender");
|
||||
SimpleMailMessage message = new SimpleMailMessage();
|
||||
// 设置发送方邮箱地址
|
||||
message.setFrom("2897976540@qq.com");
|
||||
message.setTo(es_receiver);
|
||||
message.setSubject(es_title);
|
||||
message.setText(es_content);
|
||||
mailSender.send(message);
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package org.jeecg.modules.message.handle.impl;
|
||||
|
||||
import org.jeecg.modules.message.handle.ISendMsgHandle;
|
||||
|
||||
public class SmsSendMsgHandle implements ISendMsgHandle {
|
||||
|
||||
@Override
|
||||
public void SendMsg(String es_receiver, String es_title, String es_content) {
|
||||
// TODO Auto-generated method stub
|
||||
System.out.println("发短信");
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package org.jeecg.modules.message.handle.impl;
|
||||
|
||||
import org.jeecg.modules.message.handle.ISendMsgHandle;
|
||||
|
||||
public class WxSendMsgHandle implements ISendMsgHandle {
|
||||
|
||||
@Override
|
||||
public void SendMsg(String es_receiver, String es_title, String es_content) {
|
||||
// TODO Auto-generated method stub
|
||||
System.out.println("发微信消息模板");
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package org.jeecg.modules.message.job;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.message.entity.SysMessage;
|
||||
import org.jeecg.modules.message.handle.ISendMsgHandle;
|
||||
import org.jeecg.modules.message.handle.enums.SendMsgStatusEnum;
|
||||
import org.jeecg.modules.message.handle.enums.SendMsgTypeEnum;
|
||||
import org.jeecg.modules.message.service.ISysMessageService;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 发送消息任务
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
public class SendMsgJob implements Job {
|
||||
|
||||
@Autowired
|
||||
private ISysMessageService sysMessageService;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
log.info(String.format(" Jeecg-Boot 发送消息任务 SendMsgJob ! 时间:" + DateUtils.getTimestamp()));
|
||||
|
||||
// 1.读取消息中心数据,只查询未发送的和发送失败不超过次数的
|
||||
QueryWrapper<SysMessage> queryWrapper = new QueryWrapper<SysMessage>();
|
||||
queryWrapper.eq("es_send_status", SendMsgStatusEnum.WAIT.getCode())
|
||||
.or(i -> i.eq("es_send_status", SendMsgStatusEnum.FAIL.getCode()).lt("es_send_num", 6));
|
||||
List<SysMessage> sysMessages = sysMessageService.list(queryWrapper);
|
||||
System.out.println(sysMessages);
|
||||
// 2.根据不同的类型走不通的发送实现类
|
||||
for (SysMessage sysMessage : sysMessages) {
|
||||
ISendMsgHandle sendMsgHandle = null;
|
||||
try {
|
||||
if (sysMessage.getEsType().equals(SendMsgTypeEnum.EMAIL.getType())) {
|
||||
sendMsgHandle = (ISendMsgHandle) Class.forName(SendMsgTypeEnum.EMAIL.getImplClass()).newInstance();
|
||||
} else if (sysMessage.getEsType().equals(SendMsgTypeEnum.SMS.getType())) {
|
||||
sendMsgHandle = (ISendMsgHandle) Class.forName(SendMsgTypeEnum.SMS.getImplClass()).newInstance();
|
||||
} else if (sysMessage.getEsType().equals(SendMsgTypeEnum.WX.getType())) {
|
||||
sendMsgHandle = (ISendMsgHandle) Class.forName(SendMsgTypeEnum.WX.getImplClass()).newInstance();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
Integer sendNum = sysMessage.getEsSendNum();
|
||||
try {
|
||||
sendMsgHandle.SendMsg(sysMessage.getEsReceiver(), sysMessage.getEsTitle(),
|
||||
sysMessage.getEsContent().toString());
|
||||
// 发送消息成功
|
||||
sysMessage.setEsSendStatus(SendMsgStatusEnum.SUCCESS.getCode());
|
||||
} catch (Exception e) {
|
||||
// 发送消息出现异常
|
||||
sysMessage.setEsSendStatus(SendMsgStatusEnum.FAIL.getCode());
|
||||
}
|
||||
sysMessage.setEsSendNum(++sendNum);
|
||||
// 发送结果回写到数据库
|
||||
sysMessageService.updateById(sysMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.message.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.message.entity.SysMessage;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 消息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysMessageMapper extends BaseMapper<SysMessage> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package org.jeecg.modules.message.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.jeecg.modules.message.entity.SysMessageTemplate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 消息模板
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysMessageTemplateMapper extends BaseMapper<SysMessageTemplate> {
|
||||
@Select("SELECT * FROM SYS_SMS_TEMPLATE WHERE TEMPLATE_CODE = #{code}")
|
||||
List<SysMessageTemplate> selectByCode(String code);
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.message.mapper.SysMessageMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.message.mapper.SysMessageTemplateMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.message.service;
|
||||
|
||||
import org.jeecg.common.system.base.service.JeecgService;
|
||||
import org.jeecg.modules.message.entity.SysMessage;
|
||||
|
||||
/**
|
||||
* @Description: 消息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysMessageService extends JeecgService<SysMessage> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package org.jeecg.modules.message.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.common.system.base.service.JeecgService;
|
||||
import org.jeecg.modules.message.entity.SysMessageTemplate;
|
||||
|
||||
/**
|
||||
* @Description: 消息模板
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysMessageTemplateService extends JeecgService<SysMessageTemplate> {
|
||||
List<SysMessageTemplate> selectByCode(String code);
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package org.jeecg.modules.message.service.impl;
|
||||
|
||||
import org.jeecg.common.system.base.service.impl.JeecgServiceImpl;
|
||||
import org.jeecg.modules.message.entity.SysMessage;
|
||||
import org.jeecg.modules.message.mapper.SysMessageMapper;
|
||||
import org.jeecg.modules.message.service.ISysMessageService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description: 消息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SysMessageServiceImpl extends JeecgServiceImpl<SysMessageMapper, SysMessage> implements ISysMessageService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package org.jeecg.modules.message.service.impl;
|
||||
|
||||
import org.jeecg.common.system.base.service.impl.JeecgServiceImpl;
|
||||
import org.jeecg.modules.message.entity.SysMessageTemplate;
|
||||
import org.jeecg.modules.message.mapper.SysMessageTemplateMapper;
|
||||
import org.jeecg.modules.message.service.ISysMessageTemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 消息模板
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SysMessageTemplateServiceImpl extends JeecgServiceImpl<SysMessageTemplateMapper, SysMessageTemplate> implements ISysMessageTemplateService {
|
||||
|
||||
@Autowired
|
||||
private SysMessageTemplateMapper sysMessageTemplateMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<SysMessageTemplate> selectByCode(String code) {
|
||||
return sysMessageTemplateMapper.selectByCode(code);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package org.jeecg.modules.message.util;
|
||||
|
||||
import org.jeecg.modules.message.entity.SysMessage;
|
||||
import org.jeecg.modules.message.entity.SysMessageTemplate;
|
||||
import org.jeecg.modules.message.handle.enums.SendMsgStatusEnum;
|
||||
import org.jeecg.modules.message.service.ISysMessageService;
|
||||
import org.jeecg.modules.message.service.ISysMessageTemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 消息生成工具
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class PushMsgUtil {
|
||||
|
||||
@Autowired
|
||||
private ISysMessageService sysMessageService;
|
||||
|
||||
@Autowired
|
||||
private ISysMessageTemplateService sysMessageTemplateService;
|
||||
|
||||
/**
|
||||
* @param msgType 消息类型 1短信 2邮件 3微信
|
||||
* @param templateCode 消息模板码
|
||||
* @param map 消息参数
|
||||
* @param sentTo 接收消息方
|
||||
*/
|
||||
public boolean sendMessage(String msgType, String templateCode, Map<String, String> map, String sentTo) {
|
||||
List<SysMessageTemplate> sysSmsTemplates = sysMessageTemplateService.selectByCode(templateCode);
|
||||
SysMessage sysMessage = new SysMessage();
|
||||
if (sysSmsTemplates.size() > 0) {
|
||||
SysMessageTemplate sysSmsTemplate = sysSmsTemplates.get(0);
|
||||
sysMessage.setEsType(msgType);
|
||||
sysMessage.setEsReceiver(sentTo);
|
||||
//模板标题
|
||||
String title = sysSmsTemplate.getTemplateName();
|
||||
//模板内容
|
||||
String content = sysSmsTemplate.getTemplateContent();
|
||||
if(map!=null) {
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
String str = "${" + entry.getKey() + "}";
|
||||
title = title.replace(str, entry.getValue());
|
||||
content = content.replace(str, entry.getValue());
|
||||
}
|
||||
}
|
||||
sysMessage.setEsTitle(title);
|
||||
sysMessage.setEsContent(content);
|
||||
sysMessage.setEsParam(JSONObject.toJSONString(map));
|
||||
sysMessage.setEsSendTime(new Date());
|
||||
sysMessage.setEsSendStatus(SendMsgStatusEnum.WAIT.getCode());
|
||||
sysMessage.setEsSendNum(0);
|
||||
if(sysMessageService.save(sysMessage)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package org.jeecg.modules.monitor.controller;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.swing.filechooser.FileSystemView;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.monitor.domain.RedisInfo;
|
||||
import org.jeecg.modules.monitor.service.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/actuator/redis")
|
||||
public class ActuatorRedisController {
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* Redis详细信息
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping("/info")
|
||||
public Result<?> getRedisInfo() throws Exception {
|
||||
List<RedisInfo> infoList = this.redisService.getRedisInfo();
|
||||
log.info(infoList.toString());
|
||||
return Result.ok(infoList);
|
||||
}
|
||||
|
||||
@GetMapping("/keysSize")
|
||||
public Map<String, Object> getKeysSize() throws Exception {
|
||||
return redisService.getKeysSize();
|
||||
}
|
||||
|
||||
@GetMapping("/memoryInfo")
|
||||
public Map<String, Object> getMemoryInfo() throws Exception {
|
||||
return redisService.getMemoryInfo();
|
||||
}
|
||||
|
||||
//update-begin--Author:zhangweijian Date:20190425 for:获取磁盘信息
|
||||
/**
|
||||
* @功能:获取磁盘信息
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryDiskInfo")
|
||||
public Result<List<Map<String,Object>>> queryDiskInfo(HttpServletRequest request, HttpServletResponse response){
|
||||
Result<List<Map<String,Object>>> res = new Result<>();
|
||||
try {
|
||||
// 当前文件系统类
|
||||
FileSystemView fsv = FileSystemView.getFileSystemView();
|
||||
// 列出所有windows 磁盘
|
||||
File[] fs = File.listRoots();
|
||||
log.info("查询磁盘信息:"+fs.length+"个");
|
||||
List<Map<String,Object>> list = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < fs.length; i++) {
|
||||
if(fs[i].getTotalSpace()==0) {
|
||||
continue;
|
||||
}
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("name", fsv.getSystemDisplayName(fs[i]));
|
||||
map.put("max", fs[i].getTotalSpace());
|
||||
map.put("rest", fs[i].getFreeSpace());
|
||||
map.put("restPPT", (fs[i].getTotalSpace()-fs[i].getFreeSpace())*100/fs[i].getTotalSpace());
|
||||
list.add(map);
|
||||
log.info(map.toString());
|
||||
}
|
||||
res.setResult(list);
|
||||
res.success("查询成功");
|
||||
} catch (Exception e) {
|
||||
res.error500("查询失败"+e.getMessage());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//update-end--Author:zhangweijian Date:20190425 for:获取磁盘信息
|
||||
}
|
||||
@ -0,0 +1,137 @@
|
||||
package org.jeecg.modules.monitor.domain;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class RedisInfo {
|
||||
|
||||
private static Map<String, String> map = new HashMap<>();
|
||||
|
||||
static {
|
||||
map.put("redis_version", "Redis 服务器版本");
|
||||
map.put("redis_git_sha1", "Git SHA1");
|
||||
map.put("redis_git_dirty", "Git dirty flag");
|
||||
map.put("os", "Redis 服务器的宿主操作系统");
|
||||
map.put("arch_bits", " 架构(32 或 64 位)");
|
||||
map.put("multiplexing_api", "Redis 所使用的事件处理机制");
|
||||
map.put("gcc_version", "编译 Redis 时所使用的 GCC 版本");
|
||||
map.put("process_id", "服务器进程的 PID");
|
||||
map.put("run_id", "Redis 服务器的随机标识符(用于 Sentinel 和集群)");
|
||||
map.put("tcp_port", "TCP/IP 监听端口");
|
||||
map.put("uptime_in_seconds", "自 Redis 服务器启动以来,经过的秒数");
|
||||
map.put("uptime_in_days", "自 Redis 服务器启动以来,经过的天数");
|
||||
map.put("lru_clock", " 以分钟为单位进行自增的时钟,用于 LRU 管理");
|
||||
map.put("connected_clients", "已连接客户端的数量(不包括通过从属服务器连接的客户端)");
|
||||
map.put("client_longest_output_list", "当前连接的客户端当中,最长的输出列表");
|
||||
map.put("client_longest_input_buf", "当前连接的客户端当中,最大输入缓存");
|
||||
map.put("blocked_clients", "正在等待阻塞命令(BLPOP、BRPOP、BRPOPLPUSH)的客户端的数量");
|
||||
map.put("used_memory", "由 Redis 分配器分配的内存总量,以字节(byte)为单位");
|
||||
map.put("used_memory_human", "以人类可读的格式返回 Redis 分配的内存总量");
|
||||
map.put("used_memory_rss", "从操作系统的角度,返回 Redis 已分配的内存总量(俗称常驻集大小)。这个值和 top 、 ps 等命令的输出一致");
|
||||
map.put("used_memory_peak", " Redis 的内存消耗峰值(以字节为单位)");
|
||||
map.put("used_memory_peak_human", "以人类可读的格式返回 Redis 的内存消耗峰值");
|
||||
map.put("used_memory_lua", "Lua 引擎所使用的内存大小(以字节为单位)");
|
||||
map.put("mem_fragmentation_ratio", "sed_memory_rss 和 used_memory 之间的比率");
|
||||
map.put("mem_allocator", "在编译时指定的, Redis 所使用的内存分配器。可以是 libc 、 jemalloc 或者 tcmalloc");
|
||||
|
||||
map.put("redis_build_id", "redis_build_id");
|
||||
map.put("redis_mode", "运行模式,单机(standalone)或者集群(cluster)");
|
||||
map.put("atomicvar_api", "atomicvar_api");
|
||||
map.put("hz", "redis内部调度(进行关闭timeout的客户端,删除过期key等等)频率,程序规定serverCron每秒运行10次。");
|
||||
map.put("executable", "server脚本目录");
|
||||
map.put("config_file", "配置文件目录");
|
||||
map.put("client_biggest_input_buf", "当前连接的客户端当中,最大输入缓存,用client list命令观察qbuf和qbuf-free两个字段最大值");
|
||||
map.put("used_memory_rss_human", "以人类可读的方式返回 Redis 已分配的内存总量");
|
||||
map.put("used_memory_peak_perc", "内存使用率峰值");
|
||||
map.put("total_system_memory", "系统总内存");
|
||||
map.put("total_system_memory_human", "以人类可读的方式返回系统总内存");
|
||||
map.put("used_memory_lua_human", "以人类可读的方式返回Lua 引擎所使用的内存大小");
|
||||
map.put("maxmemory", "最大内存限制,0表示无限制");
|
||||
map.put("maxmemory_human", "以人类可读的方式返回最大限制内存");
|
||||
map.put("maxmemory_policy", "超过内存限制后的处理策略");
|
||||
map.put("loading", "服务器是否正在载入持久化文件");
|
||||
map.put("rdb_changes_since_last_save", "离最近一次成功生成rdb文件,写入命令的个数,即有多少个写入命令没有持久化");
|
||||
map.put("rdb_bgsave_in_progress", "服务器是否正在创建rdb文件");
|
||||
map.put("rdb_last_save_time", "离最近一次成功创建rdb文件的时间戳。当前时间戳 - rdb_last_save_time=多少秒未成功生成rdb文件");
|
||||
map.put("rdb_last_bgsave_status", "最近一次rdb持久化是否成功");
|
||||
map.put("rdb_last_bgsave_time_sec", "最近一次成功生成rdb文件耗时秒数");
|
||||
map.put("rdb_current_bgsave_time_sec", "如果服务器正在创建rdb文件,那么这个域记录的就是当前的创建操作已经耗费的秒数");
|
||||
map.put("aof_enabled", "是否开启了aof");
|
||||
map.put("aof_rewrite_in_progress", "标识aof的rewrite操作是否在进行中");
|
||||
map.put("aof_rewrite_scheduled", "rewrite任务计划,当客户端发送bgrewriteaof指令,如果当前rewrite子进程正在执行,那么将客户端请求的bgrewriteaof变为计划任务,待aof子进程结束后执行rewrite ");
|
||||
|
||||
map.put("aof_last_rewrite_time_sec", "最近一次aof rewrite耗费的时长");
|
||||
map.put("aof_current_rewrite_time_sec", "如果rewrite操作正在进行,则记录所使用的时间,单位秒");
|
||||
map.put("aof_last_bgrewrite_status", "上次bgrewrite aof操作的状态");
|
||||
map.put("aof_last_write_status", "上次aof写入状态");
|
||||
|
||||
map.put("total_commands_processed", "redis处理的命令数");
|
||||
map.put("total_connections_received", "新创建连接个数,如果新创建连接过多,过度地创建和销毁连接对性能有影响,说明短连接严重或连接池使用有问题,需调研代码的连接设置");
|
||||
map.put("instantaneous_ops_per_sec", "redis当前的qps,redis内部较实时的每秒执行的命令数");
|
||||
map.put("total_net_input_bytes", "redis网络入口流量字节数");
|
||||
map.put("total_net_output_bytes", "redis网络出口流量字节数");
|
||||
|
||||
map.put("instantaneous_input_kbps", "redis网络入口kps");
|
||||
map.put("instantaneous_output_kbps", "redis网络出口kps");
|
||||
map.put("rejected_connections", "拒绝的连接个数,redis连接个数达到maxclients限制,拒绝新连接的个数");
|
||||
map.put("sync_full", "主从完全同步成功次数");
|
||||
|
||||
map.put("sync_partial_ok", "主从部分同步成功次数");
|
||||
map.put("sync_partial_err", "主从部分同步失败次数");
|
||||
map.put("expired_keys", "运行以来过期的key的数量");
|
||||
map.put("evicted_keys", "运行以来剔除(超过了maxmemory后)的key的数量");
|
||||
map.put("keyspace_hits", "命中次数");
|
||||
map.put("keyspace_misses", "没命中次数");
|
||||
map.put("pubsub_channels", "当前使用中的频道数量");
|
||||
map.put("pubsub_patterns", "当前使用的模式的数量");
|
||||
map.put("latest_fork_usec", "最近一次fork操作阻塞redis进程的耗时数,单位微秒");
|
||||
map.put("role", "实例的角色,是master or slave");
|
||||
map.put("connected_slaves", "连接的slave实例个数");
|
||||
map.put("master_repl_offset", "主从同步偏移量,此值如果和上面的offset相同说明主从一致没延迟");
|
||||
map.put("repl_backlog_active", "复制积压缓冲区是否开启");
|
||||
map.put("repl_backlog_size", "复制积压缓冲大小");
|
||||
map.put("repl_backlog_first_byte_offset", "复制缓冲区里偏移量的大小");
|
||||
map.put("repl_backlog_histlen", "此值等于 master_repl_offset - repl_backlog_first_byte_offset,该值不会超过repl_backlog_size的大小");
|
||||
map.put("used_cpu_sys", "将所有redis主进程在核心态所占用的CPU时求和累计起来");
|
||||
map.put("used_cpu_user", "将所有redis主进程在用户态所占用的CPU时求和累计起来");
|
||||
map.put("used_cpu_sys_children", "将后台进程在核心态所占用的CPU时求和累计起来");
|
||||
map.put("used_cpu_user_children", "将后台进程在用户态所占用的CPU时求和累计起来");
|
||||
map.put("cluster_enabled", "实例是否启用集群模式");
|
||||
map.put("db0", "db0的key的数量,以及带有生存期的key的数,平均存活时间");
|
||||
|
||||
}
|
||||
|
||||
private String key;
|
||||
private String value;
|
||||
private String description;
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
this.description = map.get(this.key);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RedisInfo{" + "key='" + key + '\'' + ", value='" + value + '\'' + ", desctiption='" + description + '\'' + '}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package org.jeecg.modules.monitor.exception;
|
||||
|
||||
/**
|
||||
* Redis 连接异常
|
||||
*/
|
||||
public class RedisConnectException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1639374111871115063L;
|
||||
|
||||
public RedisConnectException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package org.jeecg.modules.monitor.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jeecg.modules.monitor.domain.RedisInfo;
|
||||
import org.jeecg.modules.monitor.exception.RedisConnectException;
|
||||
|
||||
public interface RedisService {
|
||||
|
||||
/**
|
||||
* 获取 redis 的详细信息
|
||||
*
|
||||
* @return List
|
||||
*/
|
||||
List<RedisInfo> getRedisInfo() throws RedisConnectException;
|
||||
|
||||
/**
|
||||
* 获取 redis key 数量
|
||||
*
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> getKeysSize() throws RedisConnectException;
|
||||
|
||||
/**
|
||||
* 获取 redis 内存信息
|
||||
*
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> getMemoryInfo() throws RedisConnectException;
|
||||
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package org.jeecg.modules.monitor.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.monitor.domain.RedisInfo;
|
||||
import org.jeecg.modules.monitor.exception.RedisConnectException;
|
||||
import org.jeecg.modules.monitor.service.RedisService;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Redis 监控信息获取
|
||||
*
|
||||
* @Author MrBird
|
||||
*/
|
||||
@Service("redisService")
|
||||
@Slf4j
|
||||
public class RedisServiceImpl implements RedisService {
|
||||
|
||||
@Resource
|
||||
private RedisConnectionFactory redisConnectionFactory;
|
||||
|
||||
/**
|
||||
* Redis详细信息
|
||||
*/
|
||||
@Override
|
||||
public List<RedisInfo> getRedisInfo() throws RedisConnectException {
|
||||
Properties info = redisConnectionFactory.getConnection().info();
|
||||
List<RedisInfo> infoList = new ArrayList<>();
|
||||
RedisInfo redisInfo = null;
|
||||
for (Map.Entry<Object, Object> entry : info.entrySet()) {
|
||||
redisInfo = new RedisInfo();
|
||||
redisInfo.setKey(oConvertUtils.getString(entry.getKey()));
|
||||
redisInfo.setValue(oConvertUtils.getString(entry.getValue()));
|
||||
infoList.add(redisInfo);
|
||||
}
|
||||
return infoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getKeysSize() throws RedisConnectException {
|
||||
Long dbSize = redisConnectionFactory.getConnection().dbSize();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("create_time", System.currentTimeMillis());
|
||||
map.put("dbSize", dbSize);
|
||||
|
||||
log.info("--getKeysSize--: " + map.toString());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMemoryInfo() throws RedisConnectException {
|
||||
Map<String, Object> map = null;
|
||||
Properties info = redisConnectionFactory.getConnection().info();
|
||||
for (Map.Entry<Object, Object> entry : info.entrySet()) {
|
||||
String key = oConvertUtils.getString(entry.getKey());
|
||||
if ("used_memory".equals(key)) {
|
||||
map = new HashMap<>();
|
||||
map.put("used_memory", entry.getValue());
|
||||
map.put("create_time", System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
log.info("--getMemoryInfo--: " + map.toString());
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package org.jeecg.modules.ngalain.aop;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;;
|
||||
|
||||
|
||||
// 暂时注释掉,提高系统性能
|
||||
//@Aspect //定义一个切面
|
||||
//@Configuration
|
||||
public class LogRecordAspect {
|
||||
private static final Logger logger = LoggerFactory.getLogger(LogRecordAspect.class);
|
||||
|
||||
// 定义切点Pointcut
|
||||
@Pointcut("execution(public * org.jeecg.modules.*.*.*Controller.*(..))")
|
||||
public void excudeService() {
|
||||
}
|
||||
|
||||
@Around("excudeService()")
|
||||
public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
|
||||
RequestAttributes ra = RequestContextHolder.getRequestAttributes();
|
||||
ServletRequestAttributes sra = (ServletRequestAttributes) ra;
|
||||
HttpServletRequest request = sra.getRequest();
|
||||
|
||||
String url = request.getRequestURL().toString();
|
||||
String method = request.getMethod();
|
||||
String uri = request.getRequestURI();
|
||||
String queryString = request.getQueryString();
|
||||
logger.info("请求开始, 各个参数, url: {}, method: {}, uri: {}, params: {}", url, method, uri, queryString);
|
||||
|
||||
// result的值就是被拦截方法的返回值
|
||||
Object result = pjp.proceed();
|
||||
|
||||
logger.info("请求结束,controller的返回值是 " + result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
package org.jeecg.modules.ngalain.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.ngalain.service.NgAlainService;
|
||||
import org.jeecg.modules.system.service.ISysDictService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/ng-alain")
|
||||
public class NgAlainController {
|
||||
@Autowired
|
||||
private NgAlainService ngAlainService;
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
@RequestMapping(value = "/getAppData")
|
||||
@ResponseBody
|
||||
public JSONObject getAppData(HttpServletRequest request) throws Exception {
|
||||
String token=request.getHeader("X-Access-Token");
|
||||
JSONObject j = new JSONObject();
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
JSONObject userObjcet = new JSONObject();
|
||||
userObjcet.put("name", user.getUsername());
|
||||
userObjcet.put("avatar", user.getAvatar());
|
||||
userObjcet.put("email", user.getEmail());
|
||||
userObjcet.put("token", token);
|
||||
j.put("user", userObjcet);
|
||||
j.put("menu",ngAlainService.getMenu(user.getUsername()));
|
||||
JSONObject app = new JSONObject();
|
||||
app.put("name", "jeecg-boot-angular");
|
||||
app.put("description", "jeecg+ng-alain整合版本");
|
||||
j.put("app", app);
|
||||
return j;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getDictItems/{dictCode}", method = RequestMethod.GET)
|
||||
public Object getDictItems(@PathVariable String dictCode) {
|
||||
log.info(" dictCode : "+ dictCode);
|
||||
Result<List<DictModel>> result = new Result<List<DictModel>>();
|
||||
List<DictModel> ls = null;
|
||||
try {
|
||||
ls = sysDictService.queryDictItemsByCode(dictCode);
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
return result;
|
||||
}
|
||||
List<JSONObject> dictlist=new ArrayList<>();
|
||||
for (DictModel l : ls) {
|
||||
JSONObject dict=new JSONObject();
|
||||
try {
|
||||
dict.put("value",Integer.parseInt(l.getValue()));
|
||||
} catch (NumberFormatException e) {
|
||||
dict.put("value",l.getValue());
|
||||
}
|
||||
dict.put("label",l.getText());
|
||||
dictlist.add(dict);
|
||||
}
|
||||
return dictlist;
|
||||
}
|
||||
@RequestMapping(value = "/getDictItemsByTable/{table}/{key}/{value}", method = RequestMethod.GET)
|
||||
public Object getDictItemsByTable(@PathVariable String table,@PathVariable String key,@PathVariable String value) {
|
||||
return this.ngAlainService.getDictByTable(table,key,value);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package org.jeecg.modules.ngalain.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface NgAlainMapper extends BaseMapper {
|
||||
public List<Map<String,String>> getDictByTable(@Param("table") String table, @Param("key") String key, @Param("value") String value);
|
||||
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.ngalain.mapper.NgAlainMapper">
|
||||
<select id="getDictByTable" parameterType="String" resultType="java.util.HashMap">
|
||||
select ${key} as 'label',${value} as 'value' from ${table}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,12 @@
|
||||
package org.jeecg.modules.ngalain.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface NgAlainService {
|
||||
public JSONArray getMenu(String id) throws Exception;
|
||||
public JSONArray getJeecgMenu(String id) throws Exception;
|
||||
public List<Map<String, String>> getDictByTable(String table, String key, String value);
|
||||
}
|
||||
@ -0,0 +1,182 @@
|
||||
package org.jeecg.modules.ngalain.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.jeecg.common.util.MD5Util;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.ngalain.mapper.NgAlainMapper;
|
||||
import org.jeecg.modules.ngalain.service.NgAlainService;
|
||||
import org.jeecg.modules.system.entity.SysPermission;
|
||||
import org.jeecg.modules.system.service.ISysPermissionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("ngAlainService")
|
||||
@Transactional
|
||||
public class NgAlainServiceImpl implements NgAlainService {
|
||||
@Autowired
|
||||
private ISysPermissionService sysPermissionService;
|
||||
@Autowired
|
||||
private NgAlainMapper mapper;
|
||||
@Override
|
||||
public JSONArray getMenu(String id) throws Exception {
|
||||
return getJeecgMenu(id);
|
||||
}
|
||||
@Override
|
||||
public JSONArray getJeecgMenu(String id) throws Exception {
|
||||
List<SysPermission> metaList = sysPermissionService.queryByUser(id);
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
getPermissionJsonArray(jsonArray, metaList, null);
|
||||
JSONArray menulist= parseNgAlain(jsonArray);
|
||||
JSONObject jeecgMenu = new JSONObject();
|
||||
jeecgMenu.put("text", "jeecg菜单");
|
||||
jeecgMenu.put("group",true);
|
||||
jeecgMenu.put("children", menulist);
|
||||
JSONArray jeecgMenuList=new JSONArray();
|
||||
jeecgMenuList.add(jeecgMenu);
|
||||
return jeecgMenuList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> getDictByTable(String table, String key, String value) {
|
||||
return this.mapper.getDictByTable(table,key,value);
|
||||
}
|
||||
|
||||
private JSONArray parseNgAlain(JSONArray jsonArray) {
|
||||
JSONArray menulist=new JSONArray();
|
||||
for (Object object : jsonArray) {
|
||||
JSONObject jsonObject= (JSONObject) object;
|
||||
String path= (String) jsonObject.get("path");
|
||||
JSONObject meta= (JSONObject) jsonObject.get("meta");
|
||||
JSONObject menu=new JSONObject();
|
||||
menu.put("text",meta.get("title"));
|
||||
menu.put("reuse",true);
|
||||
if (jsonObject.get("children")!=null){
|
||||
JSONArray child= parseNgAlain((JSONArray) jsonObject.get("children"));
|
||||
menu.put("children",child);
|
||||
JSONObject icon=new JSONObject();
|
||||
icon.put("type", "icon");
|
||||
icon.put("value", "appstore");
|
||||
menu.put("icon",icon);
|
||||
}else {
|
||||
menu.put("link",path);
|
||||
}
|
||||
menulist.add(menu);
|
||||
}
|
||||
return menulist;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单JSON数组
|
||||
* @param jsonArray
|
||||
* @param metaList
|
||||
* @param parentJson
|
||||
*/
|
||||
private void getPermissionJsonArray(JSONArray jsonArray,List<SysPermission> metaList,JSONObject parentJson) {
|
||||
for (SysPermission permission : metaList) {
|
||||
if(permission.getMenuType()==null) {
|
||||
continue;
|
||||
}
|
||||
String tempPid = permission.getParentId();
|
||||
JSONObject json = getPermissionJsonObject(permission);
|
||||
if(parentJson==null && oConvertUtils.isEmpty(tempPid)) {
|
||||
jsonArray.add(json);
|
||||
if(!permission.isLeaf()) {
|
||||
getPermissionJsonArray(jsonArray, metaList, json);
|
||||
}
|
||||
}else if(parentJson!=null && oConvertUtils.isNotEmpty(tempPid) && tempPid.equals(parentJson.getString("id"))){
|
||||
if(permission.getMenuType()==0) {
|
||||
JSONObject metaJson = parentJson.getJSONObject("meta");
|
||||
if(metaJson.containsKey("permissionList")) {
|
||||
metaJson.getJSONArray("permissionList").add(json);
|
||||
}else {
|
||||
JSONArray permissionList = new JSONArray();
|
||||
permissionList.add(json);
|
||||
metaJson.put("permissionList", permissionList);
|
||||
}
|
||||
|
||||
}else if(permission.getMenuType()==1) {
|
||||
if(parentJson.containsKey("children")) {
|
||||
parentJson.getJSONArray("children").add(json);
|
||||
}else {
|
||||
JSONArray children = new JSONArray();
|
||||
children.add(json);
|
||||
parentJson.put("children", children);
|
||||
}
|
||||
|
||||
if(!permission.isLeaf()) {
|
||||
getPermissionJsonArray(jsonArray, metaList, json);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
private JSONObject getPermissionJsonObject(SysPermission permission) {
|
||||
JSONObject json = new JSONObject();
|
||||
//类型(0:一级菜单 1:子菜单 2:按钮)
|
||||
if(permission.getMenuType()==2) {
|
||||
json.put("action", permission.getPerms());
|
||||
json.put("describe", permission.getName());
|
||||
}else if(permission.getMenuType()==0||permission.getMenuType()==1) {
|
||||
json.put("id", permission.getId());
|
||||
if(permission.getUrl()!=null&&(permission.getUrl().startsWith("http://")||permission.getUrl().startsWith("https://"))) {
|
||||
String url= new String(Base64.getUrlEncoder().encode(permission.getUrl().getBytes()));
|
||||
json.put("path", "/sys/link/" +url.replaceAll("=",""));
|
||||
}else {
|
||||
json.put("path", permission.getUrl());
|
||||
}
|
||||
|
||||
//重要规则:路由name (通过URL生成路由name,路由name供前端开发,页面跳转使用)
|
||||
json.put("name", urlToRouteName(permission.getUrl()));
|
||||
|
||||
//是否隐藏路由,默认都是显示的
|
||||
if(permission.isHidden()) {
|
||||
json.put("hidden",true);
|
||||
}
|
||||
//聚合路由
|
||||
if(permission.isAlwaysShow()) {
|
||||
json.put("alwaysShow",true);
|
||||
}
|
||||
json.put("component", permission.getComponent());
|
||||
JSONObject meta = new JSONObject();
|
||||
meta.put("title", permission.getName());
|
||||
if(oConvertUtils.isEmpty(permission.getParentId())) {
|
||||
//一级菜单跳转地址
|
||||
json.put("redirect",permission.getRedirect());
|
||||
meta.put("icon", oConvertUtils.getString(permission.getIcon(), ""));
|
||||
}else {
|
||||
meta.put("icon", oConvertUtils.getString(permission.getIcon(), ""));
|
||||
}
|
||||
if(permission.getUrl()!=null&&(permission.getUrl().startsWith("http://")||permission.getUrl().startsWith("https://"))) {
|
||||
meta.put("url", permission.getUrl());
|
||||
}
|
||||
json.put("meta", meta);
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
/**
|
||||
* 通过URL生成路由name(去掉URL前缀斜杠,替换内容中的斜杠‘/’为-)
|
||||
* 举例: URL = /isystem/role
|
||||
* RouteName = isystem-role
|
||||
* @return
|
||||
*/
|
||||
private String urlToRouteName(String url) {
|
||||
if(oConvertUtils.isNotEmpty(url)) {
|
||||
if(url.startsWith("/")) {
|
||||
url = url.substring(1);
|
||||
}
|
||||
url = url.replace("/", "-");
|
||||
return url;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,300 @@
|
||||
package org.jeecg.modules.quartz.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.quartz.entity.QuartzJob;
|
||||
import org.jeecg.modules.quartz.service.IQuartzJobService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.quartz.JobKey;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Description: 定时任务在线管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-01-02
|
||||
* @Version:V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/quartzJob")
|
||||
@Slf4j
|
||||
@Api(tags = "定时任务接口")
|
||||
public class QuartzJobController {
|
||||
@Autowired
|
||||
private IQuartzJobService quartzJobService;
|
||||
@Autowired
|
||||
private Scheduler scheduler;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param quartzJob
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<IPage<QuartzJob>> queryPageList(QuartzJob quartzJob, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
Result<IPage<QuartzJob>> result = new Result<IPage<QuartzJob>>();
|
||||
QueryWrapper<QuartzJob> queryWrapper = QueryGenerator.initQueryWrapper(quartzJob, req.getParameterMap());
|
||||
Page<QuartzJob> page = new Page<QuartzJob>(pageNo, pageSize);
|
||||
IPage<QuartzJob> pageList = quartzJobService.page(page, queryWrapper);
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加定时任务
|
||||
*
|
||||
* @param quartzJob
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<?> add(@RequestBody QuartzJob quartzJob) {
|
||||
Result<QuartzJob> result = new Result<QuartzJob>();
|
||||
|
||||
List<QuartzJob> list = quartzJobService.findByJobClassName(quartzJob.getJobClassName());
|
||||
if (list != null && list.size() > 0) {
|
||||
return Result.error("该定时任务类名已存在");
|
||||
}
|
||||
try {
|
||||
boolean ok = quartzJobService.saveAndScheduleJob(quartzJob);
|
||||
if (ok) {
|
||||
result.success("创建定时任务成功");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("创建定时任务失败," + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新定时任务
|
||||
*
|
||||
* @param quartzJob
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public Result<?> eidt(@RequestBody QuartzJob quartzJob) {
|
||||
Result<QuartzJob> result = new Result<QuartzJob>();
|
||||
QuartzJob quartzJobEntity = quartzJobService.getById(quartzJob.getId());
|
||||
if (quartzJobEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = true;
|
||||
try {
|
||||
ok = quartzJobService.editAndScheduleJob(quartzJob);
|
||||
} catch (SchedulerException e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("更新定时任务失败!");
|
||||
}
|
||||
if (ok) {
|
||||
result.success("更新定时任务成功!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<QuartzJob> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<QuartzJob> result = new Result<QuartzJob>();
|
||||
QuartzJob quartzJob = quartzJobService.getById(id);
|
||||
if (quartzJob == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = quartzJobService.deleteAndStopJob(quartzJob);
|
||||
if (ok) {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<QuartzJob> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
Result<QuartzJob> result = new Result<QuartzJob>();
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
for (String id : Arrays.asList(ids.split(","))) {
|
||||
QuartzJob job = quartzJobService.getById(id);
|
||||
quartzJobService.deleteAndStopJob(job);
|
||||
}
|
||||
result.success("删除定时任务成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停定时任务
|
||||
*
|
||||
* @param job
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/pause")
|
||||
@ApiOperation(value = "暂停定时任务")
|
||||
public Result<Object> pauseJob(@RequestParam(name = "jobClassName", required = true) String jobClassName) {
|
||||
QuartzJob job = null;
|
||||
try {
|
||||
job = quartzJobService.getOne(new LambdaQueryWrapper<QuartzJob>().eq(QuartzJob::getJobClassName, jobClassName));
|
||||
if (job == null) {
|
||||
return Result.error("定时任务不存在!");
|
||||
}
|
||||
scheduler.pauseJob(JobKey.jobKey(jobClassName.trim()));
|
||||
} catch (SchedulerException e) {
|
||||
throw new JeecgBootException("暂停定时任务失败");
|
||||
}
|
||||
job.setStatus(CommonConstant.STATUS_DISABLE);
|
||||
quartzJobService.updateById(job);
|
||||
return Result.ok("暂停定时任务成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动定时任务
|
||||
*
|
||||
* @param job
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/resume")
|
||||
@ApiOperation(value = "恢复定时任务")
|
||||
public Result<Object> resumeJob(@RequestParam(name = "jobClassName", required = true) String jobClassName) {
|
||||
QuartzJob job = quartzJobService.getOne(new LambdaQueryWrapper<QuartzJob>().eq(QuartzJob::getJobClassName, jobClassName));
|
||||
if (job == null) {
|
||||
return Result.error("定时任务不存在!");
|
||||
}
|
||||
quartzJobService.resumeJob(job);
|
||||
//scheduler.resumeJob(JobKey.jobKey(job.getJobClassName().trim()));
|
||||
return Result.ok("恢复定时任务成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
||||
public Result<QuartzJob> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<QuartzJob> result = new Result<QuartzJob>();
|
||||
QuartzJob quartzJob = quartzJobService.getById(id);
|
||||
if (quartzJob == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
result.setResult(quartzJob);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, QuartzJob quartzJob) {
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<QuartzJob> queryWrapper = QueryGenerator.initQueryWrapper(quartzJob, request.getParameterMap());
|
||||
// Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
List<QuartzJob> pageList = quartzJobService.list(queryWrapper);
|
||||
// 导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "定时任务列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, QuartzJob.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("定时任务列表数据", "导出人:Jeecg", "导出信息"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
MultipartFile file = entity.getValue();// 获取上传文件对象
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<QuartzJob> listQuartzJobs = ExcelImportUtil.importExcel(file.getInputStream(), QuartzJob.class, params);
|
||||
for (QuartzJob quartzJobExcel : listQuartzJobs) {
|
||||
quartzJobService.save(quartzJobExcel);
|
||||
}
|
||||
return Result.ok("文件导入成功!数据行数:" + listQuartzJobs.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("文件导入失败!");
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package org.jeecg.modules.quartz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: 定时任务在线管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-01-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_quartz_job")
|
||||
public class QuartzJob implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.UUID)
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/**删除状态*/
|
||||
private java.lang.Integer delFlag;
|
||||
/**修改人*/
|
||||
private java.lang.String updateBy;
|
||||
/**修改时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
/**任务类名*/
|
||||
@Excel(name="任务类名",width=40)
|
||||
private java.lang.String jobClassName;
|
||||
/**cron表达式*/
|
||||
@Excel(name="cron表达式",width=30)
|
||||
private java.lang.String cronExpression;
|
||||
/**参数*/
|
||||
@Excel(name="参数",width=15)
|
||||
private java.lang.String parameter;
|
||||
/**描述*/
|
||||
@Excel(name="描述",width=40)
|
||||
private java.lang.String description;
|
||||
/**状态 0正常 -1停止*/
|
||||
@Excel(name="状态",width=15)
|
||||
private java.lang.Integer status;
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package org.jeecg.modules.quartz.job;
|
||||
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 示例不带参定时任务
|
||||
*
|
||||
* @Author Scott
|
||||
*/
|
||||
@Slf4j
|
||||
public class SampleJob implements Job {
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
log.info(String.format(" Jeecg-Boot 普通定时任务 SampleJob ! 时间:" + DateUtils.getTimestamp()));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package org.jeecg.modules.quartz.job;
|
||||
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 示例带参定时任务
|
||||
*
|
||||
* @Author Scott
|
||||
*/
|
||||
@Slf4j
|
||||
public class SampleParamJob implements Job {
|
||||
|
||||
/**
|
||||
* 若参数变量名修改 QuartzJobController中也需对应修改
|
||||
*/
|
||||
private String parameter;
|
||||
|
||||
public void setParameter(String parameter) {
|
||||
this.parameter = parameter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
log.info(String.format("welcome %s! Jeecg-Boot 带参数定时任务 SampleParamJob ! 时间:" + DateUtils.now(), this.parameter));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package org.jeecg.modules.quartz.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.quartz.entity.QuartzJob;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 定时任务在线管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-01-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface QuartzJobMapper extends BaseMapper<QuartzJob> {
|
||||
|
||||
public List<QuartzJob> findByJobClassName(@Param("jobClassName") String jobClassName);
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.quartz.mapper.QuartzJobMapper">
|
||||
|
||||
<!-- 根据jobClassName查询 -->
|
||||
<select id="findByJobClassName" resultType="org.jeecg.modules.quartz.entity.QuartzJob">
|
||||
select * from sys_quartz_job where job_class_name = #{jobClassName}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,27 @@
|
||||
package org.jeecg.modules.quartz.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.quartz.entity.QuartzJob;
|
||||
import org.quartz.SchedulerException;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 定时任务在线管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-04-28
|
||||
* @Version: V1.1
|
||||
*/
|
||||
public interface IQuartzJobService extends IService<QuartzJob> {
|
||||
|
||||
List<QuartzJob> findByJobClassName(String jobClassName);
|
||||
|
||||
boolean saveAndScheduleJob(QuartzJob quartzJob);
|
||||
|
||||
boolean editAndScheduleJob(QuartzJob quartzJob) throws SchedulerException;
|
||||
|
||||
boolean deleteAndStopJob(QuartzJob quartzJob);
|
||||
|
||||
boolean resumeJob(QuartzJob quartzJob);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user