Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-09-29 17:52:06 +08:00
commit 98f5b5519f
708 changed files with 25534 additions and 23812 deletions

View File

@ -2,7 +2,8 @@
### 关于数据库或orm ### 关于数据库或orm
- 数据库版本管理工具使用flyway请将文件resource目录下对应位置文件名称使用 R__XXX 或 Vn.n__XXX R开头文件表明该文件为可重复执行sql当文件内容更改时该sql文件会在启动时再次执行一次即该文件无版本执行限制常用于数据初始化或数据迁移V开头的文件为版本约束文件常用于数据库表DDL操作使用场景一般为创表、加字段、加索引等ddl操作文件一旦被执行过不会再次重复执行 - 数据库版本管理工具使用flyway请将文件resource目录下对应位置文件名称使用 R__XXX 或 Vn.n__XXX
R开头文件表明该文件为可重复执行sql当文件内容更改时该sql文件会在启动时再次执行一次即该文件无版本执行限制常用于数据初始化或数据迁移V开头的文件为版本约束文件常用于数据库表DDL操作使用场景一般为创表、加字段、加索引等ddl操作文件一旦被执行过不会再次重复执行
- 使用flyway管理的ddl语句对表的操作语句不要指定SchemaDatabase防止在不同地区部署的数据库名称不一致导致执行异常 - 使用flyway管理的ddl语句对表的操作语句不要指定SchemaDatabase防止在不同地区部署的数据库名称不一致导致执行异常
- 使用flyway管理的ddl语句增加表的字段时不要指定新增字段位于已有字段后;防止表内不存在指定表字段导致ddl失败 - 使用flyway管理的ddl语句增加表的字段时不要指定新增字段位于已有字段后;防止表内不存在指定表字段导致ddl失败

View File

@ -11,12 +11,8 @@
7. 更新底部栏;支持通过读取配置文件,更改底部栏信息。 7. 更新底部栏;支持通过读取配置文件,更改底部栏信息。
8. 更新单点登录配置;支持通过配置关闭单点登录功能。 8. 更新单点登录配置;支持通过配置关闭单点登录功能。
------------------ ------------------
- v0.8.0.1 - v0.8.0.1
更新内容: 更新内容:
@ -24,14 +20,8 @@
1. 修复登录白屏问题 1. 修复登录白屏问题
2. 修复平台弱口令问题 2. 修复平台弱口令问题
--------------- ---------------
- v0.8.1.dev - v0.8.1.dev
更新内容: 更新内容:
@ -46,12 +36,8 @@
8. 更新赋能案例,新增后台赋能案例增删改查,门户读取后台管理中的相关模块数据。 8. 更新赋能案例,新增后台赋能案例增删改查,门户读取后台管理中的相关模块数据。
9. 更新申购车模块 9. 更新申购车模块
----------------- -----------------
- v0.8.1.1.release(本地测试环境测试) - v0.8.1.1.release(本地测试环境测试)
更新内容: 更新内容:
@ -68,21 +54,13 @@
-------------------- --------------------
- v0.8.1.2.release西海岸部署修复 - v0.8.1.2.release西海岸部署修复
1. 修复本地测试P1、P2问题 1. 修复本地测试P1、P2问题
2. 修复云图调用市局接口的问题 2. 修复云图调用市局接口的问题
--------------- ---------------
- v0.8.1.3.release市局部署修复 - v0.8.1.3.release市局部署修复
1. 修复市局接口报错问题 1. 修复市局接口报错问题
@ -90,20 +68,10 @@
3. 修复审核流程字段验证bug 3. 修复审核流程字段验证bug
4. 其他旧数据格式导致的展示类问题 4. 其他旧数据格式导致的展示类问题
------------ ------------
## 后续内容 ## 后续内容
- v0.8.1.4 - v0.8.1.4
1. 新增数据资源对接 1. 新增数据资源对接
@ -116,12 +84,8 @@
8. 更新赋能案例,新增后台赋能案例增删改查,门户读取后台管理中的相关模块数据。 8. 更新赋能案例,新增后台赋能案例增删改查,门户读取后台管理中的相关模块数据。
9. 更新申购车模块 9. 更新申购车模块
------------------- -------------------
- v0.8.2.dev - v0.8.2.dev
更新内容: 更新内容:
@ -130,20 +94,4 @@
2. 新增后台能力统计 2. 新增后台能力统计
|| 新增、修改、删除、解决的重点bug
|| 新增、修改、删除、解决的重点bug

12
pom.xml
View File

@ -8,15 +8,15 @@
<name>security-enterprise</name> <name>security-enterprise</name>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.7.RELEASE</version> <version>2.3.7.RELEASE</version>
</parent> </parent>
<modules> <modules>
<module>renren-common</module> <module>renren-common</module>
<module>renren-dynamic-datasource</module> <module>renren-dynamic-datasource</module>
<module>renren-admin</module> <module>renren-admin</module>
<module>renren-api</module> <module>renren-api</module>
</modules> </modules>

View File

@ -10,11 +10,10 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
/** /**
* renren-admin * renren-admin
*
*/ */
@SpringBootApplication(exclude = { @SpringBootApplication(exclude = {
org.activiti.spring.boot.SecurityAutoConfiguration.class, org.activiti.spring.boot.SecurityAutoConfiguration.class,
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
}) })
@EnableSwagger2 @EnableSwagger2
//@MapperScan("io.renren.modules.monitor.mapper") //@MapperScan("io.renren.modules.monitor.mapper")
@ -22,12 +21,12 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableScheduling @EnableScheduling
public class AdminApplication extends SpringBootServletInitializer { public class AdminApplication extends SpringBootServletInitializer {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(AdminApplication.class, args); SpringApplication.run(AdminApplication.class, args);
} }
@Override @Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(AdminApplication.class); return application.sources(AdminApplication.class);
} }
} }

View File

@ -4,7 +4,6 @@ import java.lang.annotation.*;
/** /**
* 数据过滤注解 * 数据过滤注解
*
*/ */
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)

View File

@ -1,27 +1,22 @@
package io.renren.common.annotation; package io.renren.common.annotation;
import java.lang.annotation.Documented; import java.lang.annotation.*;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/** /**
* 操作日志注解 * 操作日志注解
*
*/ */
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
public @interface LogOperation { public @interface LogOperation {
/** /**
* 操作名称 * 操作名称
*/ */
String value() default ""; String value() default "";
/** /**
* 操作数据库表 * 操作数据库表
*/ */
String operationTable() default ""; String operationTable() default "";
} }

View File

@ -22,7 +22,6 @@ import java.util.Map;
/** /**
* 数据过滤切面处理类 * 数据过滤切面处理类
*
*/ */
@Aspect @Aspect
@Component @Component
@ -36,24 +35,24 @@ public class DataFilterAspect {
@Before("dataFilterCut()") @Before("dataFilterCut()")
public void dataFilter(JoinPoint point) { public void dataFilter(JoinPoint point) {
Object params = point.getArgs()[0]; Object params = point.getArgs()[0];
if(params instanceof Map){ if (params instanceof Map) {
UserDetail user = SecurityUser.getUser(); UserDetail user = SecurityUser.getUser();
//如果是超级管理员则不进行数据过滤 //如果是超级管理员则不进行数据过滤
if(user.getSuperAdmin() == SuperAdminEnum.YES.value()) { if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) {
return ; return;
} }
try { try {
//否则进行数据过滤 //否则进行数据过滤
Map map = (Map)params; Map map = (Map) params;
String sqlFilter = getSqlFilter(user, point); String sqlFilter = getSqlFilter(user, point);
map.put(Constant.SQL_FILTER, new DataScope(sqlFilter)); map.put(Constant.SQL_FILTER, new DataScope(sqlFilter));
}catch (Exception e){ } catch (Exception e) {
} }
return ; return;
} }
throw new io.renren.common.exception.RenException(ErrorCode.DATA_SCOPE_PARAMS_ERROR); throw new io.renren.common.exception.RenException(ErrorCode.DATA_SCOPE_PARAMS_ERROR);
@ -69,8 +68,8 @@ public class DataFilterAspect {
//获取表的别名 //获取表的别名
String tableAlias = dataFilter.tableAlias(); String tableAlias = dataFilter.tableAlias();
if(StringUtils.isNotBlank(tableAlias)){ if (StringUtils.isNotBlank(tableAlias)) {
tableAlias += "."; tableAlias += ".";
} }
StringBuilder sqlFilter = new StringBuilder(); StringBuilder sqlFilter = new StringBuilder();
@ -78,14 +77,14 @@ public class DataFilterAspect {
//部门ID列表 //部门ID列表
List<Long> deptIdList = user.getDeptIdList(); List<Long> deptIdList = user.getDeptIdList();
if(CollUtil.isNotEmpty(deptIdList)){ if (CollUtil.isNotEmpty(deptIdList)) {
sqlFilter.append(tableAlias).append(dataFilter.deptId()); sqlFilter.append(tableAlias).append(dataFilter.deptId());
sqlFilter.append(" in(").append(StringUtils.join(deptIdList, ",")).append(")"); sqlFilter.append(" in(").append(StringUtils.join(deptIdList, ",")).append(")");
} }
//查询本人数据 //查询本人数据
if(CollUtil.isNotEmpty(deptIdList)){ if (CollUtil.isNotEmpty(deptIdList)) {
sqlFilter.append(" or "); sqlFilter.append(" or ");
} }
sqlFilter.append(tableAlias).append(dataFilter.userId()).append("=").append(user.getId()); sqlFilter.append(tableAlias).append(dataFilter.userId()).append("=").append(user.getId());

View File

@ -23,7 +23,6 @@ import java.lang.reflect.Method;
/** /**
* 操作日志切面处理类 * 操作日志切面处理类
*
*/ */
@Aspect @Aspect
@Component @Component
@ -47,7 +46,7 @@ public class LogOperationAspect {
saveLog(point, time, OperationStatusEnum.SUCCESS.value(), result); saveLog(point, time, OperationStatusEnum.SUCCESS.value(), result);
return result; return result;
}catch(Exception e) { } catch (Exception e) {
//执行时长(毫秒) //执行时长(毫秒)
long time = System.currentTimeMillis() - beginTime; long time = System.currentTimeMillis() - beginTime;
//保存日志 //保存日志
@ -63,7 +62,7 @@ public class LogOperationAspect {
LogOperation annotation = method.getAnnotation(LogOperation.class); LogOperation annotation = method.getAnnotation(LogOperation.class);
SysLogOperationEntity log = new SysLogOperationEntity(); SysLogOperationEntity log = new SysLogOperationEntity();
if(annotation != null){ if (annotation != null) {
//注解上的描述 //注解上的描述
log.setOperation(annotation.value()); log.setOperation(annotation.value());
//操作数据库表 //操作数据库表
@ -72,12 +71,12 @@ public class LogOperationAspect {
//登录用户信息 //登录用户信息
UserDetail user = SecurityUser.getUser(); UserDetail user = SecurityUser.getUser();
if(user != null){ if (user != null) {
log.setCreatorName(user.getUsername()); log.setCreatorName(user.getUsername());
} }
log.setStatus(status); log.setStatus(status);
log.setRequestTime((int)time); log.setRequestTime((int) time);
log.setResultData(JSON.toJSONString(result)); log.setResultData(JSON.toJSONString(result));
//请求相关信息 //请求相关信息
@ -89,10 +88,10 @@ public class LogOperationAspect {
//请求参数 //请求参数
Object[] args = joinPoint.getArgs(); Object[] args = joinPoint.getArgs();
try{ try {
String params = JSON.toJSONString(args[0]); String params = JSON.toJSONString(args[0]);
log.setRequestParams(params); log.setRequestParams(params);
}catch (Exception e){ } catch (Exception e) {
} }

View File

@ -2,18 +2,12 @@ package io.renren.common.config;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders; import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.HttpRequest; import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.client.*;
import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.SocketAddress;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.Collections;
@Configuration @Configuration
public class RestTemplateConfig { public class RestTemplateConfig {

View File

@ -19,39 +19,38 @@ import static com.google.common.collect.Lists.newArrayList;
/** /**
* Swagger配置 * Swagger配置
*
*/ */
@Configuration @Configuration
@EnableSwagger2 @EnableSwagger2
public class SwaggerConfig{ public class SwaggerConfig {
@Bean @Bean
public Docket createRestApi() { public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo()) .apiInfo(apiInfo())
.select() .select()
//加了ApiOperation注解的类生成接口文档 //加了ApiOperation注解的类生成接口文档
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
//包下的类生成接口文档 //包下的类生成接口文档
//.apis(RequestHandlerSelectors.basePackage("io.renren.modules.job.controller")) //.apis(RequestHandlerSelectors.basePackage("io.renren.modules.job.controller"))
.paths(PathSelectors.any()) .paths(PathSelectors.any())
.build() .build()
.directModelSubstitute(java.util.Date.class, String.class) .directModelSubstitute(java.util.Date.class, String.class)
.securitySchemes(security()); .securitySchemes(security());
} }
private ApiInfo apiInfo() { private ApiInfo apiInfo() {
return new ApiInfoBuilder() return new ApiInfoBuilder()
.title("能力平台") .title("能力平台")
.description("能力平台文档") .description("能力平台文档")
.termsOfServiceUrl("https://www.renren.io") .termsOfServiceUrl("https://www.renren.io")
.version("1.0.0") .version("1.0.0")
.build(); .build();
} }
private List<ApiKey> security() { private List<ApiKey> security() {
return newArrayList( return newArrayList(
new ApiKey(Constant.TOKEN_HEADER, Constant.TOKEN_HEADER, "header") new ApiKey(Constant.TOKEN_HEADER, Constant.TOKEN_HEADER, "header")
); );
} }
} }

View File

@ -7,7 +7,6 @@ import org.springframework.context.annotation.Configuration;
/** /**
* Swagger配置 * Swagger配置
*
*/ */
@Configuration @Configuration
public class TomcatConfig { public class TomcatConfig {

View File

@ -28,7 +28,10 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.*; import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;

View File

@ -211,7 +211,7 @@ public class AbilityCenterControllerV2 {
.filter(Objects::nonNull) .filter(Objects::nonNull)
.filter(index -> StringUtils.isNotEmpty(index.getResourceId())) .filter(index -> StringUtils.isNotEmpty(index.getResourceId()))
.collect(Collectors.groupingBy(t -> { .collect(Collectors.groupingBy(t -> {
if(t.getResourceOwnerDept() != null){ if (t.getResourceOwnerDept() != null) {
return t.getResourceOwnerDept().getId(); return t.getResourceOwnerDept().getId();
} }
ResourceDTO resourceDTO = resourceService.get(Long.valueOf(t.getResourceId())); ResourceDTO resourceDTO = resourceService.get(Long.valueOf(t.getResourceId()));

View File

@ -58,7 +58,6 @@ public class CensusController {
private String[] censusApplyTypes; // 需要进行申请统计的资源类型 private String[] censusApplyTypes; // 需要进行申请统计的资源类型
/** /**
* 获取各类资源数目 * 获取各类资源数目
* *
@ -382,7 +381,7 @@ public class CensusController {
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"), @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
}) })
public Result selectCensusResourceTable(@RequestParam Map<String, Object> params){ public Result selectCensusResourceTable(@RequestParam Map<String, Object> params) {
return new Result().ok(resourceService.selectCensusResourceTable(params)); return new Result().ok(resourceService.selectCensusResourceTable(params));
} }
@ -396,7 +395,7 @@ public class CensusController {
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"), @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
}) })
public Result selectCensusApplyTable(@RequestParam Map<String, Object> params){ public Result selectCensusApplyTable(@RequestParam Map<String, Object> params) {
return new Result().ok(resourceService.selectCensusApplyTable(params)); return new Result().ok(resourceService.selectCensusApplyTable(params));
} }

View File

@ -23,7 +23,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -182,7 +181,7 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String") @ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
}) })
public Result<List<Map<String, Object>>> assemblerCaredTopInfo(@ApiIgnore @RequestParam Map<String, Object> params) { public Result<List<Map<String, Object>>> assemblerCaredTopInfo(@ApiIgnore @RequestParam Map<String, Object> params) {
Object[] args = { params.get("resourceType"),params.get("id")}; Object[] args = {params.get("resourceType"), params.get("id")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT a.resource_id,b.name,COUNT(a.id) AS resourceCarNum FROM tb_resource_car a \n" + List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT a.resource_id,b.name,COUNT(a.id) AS resourceCarNum FROM tb_resource_car a \n" +
" INNER JOIN tb_data_resource b ON a.resource_id = b.id\n" + " INNER JOIN tb_data_resource b ON a.resource_id = b.id\n" +
@ -202,7 +201,7 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String") @ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
}) })
public Result<List<Map<String, Object>>> assemblerUsedInfo(@ApiIgnore @RequestParam Map<String, Object> params) { public Result<List<Map<String, Object>>> assemblerUsedInfo(@ApiIgnore @RequestParam Map<String, Object> params) {
Object[] ps = {params.get("resourceType"),params.get("id") }; Object[] ps = {params.get("resourceType"), params.get("id")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT count(b.attr_value) as nums,b.attr_value FROM tb_data_resource a INNER JOIN tb_data_attr b ON a.id = b.data_resource_id\n" + List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT count(b.attr_value) as nums,b.attr_value FROM tb_data_resource a INNER JOIN tb_data_attr b ON a.id = b.data_resource_id\n" +
" WHERE a.type = ? and a.del_flag = 0 AND a.dept_id = ? and b.attr_type = '组件类型' AND b.del_flag = 0\n" + " WHERE a.type = ? and a.del_flag = 0 AND a.dept_id = ? and b.attr_type = '组件类型' AND b.del_flag = 0\n" +
" GROUP BY b.attr_value", ps); " GROUP BY b.attr_value", ps);
@ -247,7 +246,7 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String") @ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
}) })
public Result<List<Map<String, Object>>> assemblerUseInfo(@ApiIgnore @RequestParam Map<String, Object> params) { public Result<List<Map<String, Object>>> assemblerUseInfo(@ApiIgnore @RequestParam Map<String, Object> params) {
Object[] ps = {params.get("id"),params.get("resourceType")}; Object[] ps = {params.get("id"), params.get("resourceType")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT COUNT(n.id) AS num,n.attr_value FROM\n" + List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT COUNT(n.id) AS num,n.attr_value FROM\n" +
" (\n" + " (\n" +
" SELECT DISTINCT(c.id) AS id,c.name FROM \n" + " SELECT DISTINCT(c.id) AS id,c.name FROM \n" +

View File

@ -26,69 +26,69 @@ import java.util.Map;
*/ */
@RestControllerAdvice @RestControllerAdvice
public class RenExceptionHandler { public class RenExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(RenExceptionHandler.class); private static final Logger logger = LoggerFactory.getLogger(RenExceptionHandler.class);
@Autowired @Autowired
private SysLogErrorService sysLogErrorService; private SysLogErrorService sysLogErrorService;
/** /**
* 处理自定义异常 * 处理自定义异常
*/ */
@ExceptionHandler(RenException.class) @ExceptionHandler(RenException.class)
public Result handleRenException(RenException ex){ public Result handleRenException(RenException ex) {
Result result = new Result(); Result result = new Result();
result.error(ex.getCode(), ex.getMsg()); result.error(ex.getCode(), ex.getMsg());
return result; return result;
} }
@ExceptionHandler(DuplicateKeyException.class) @ExceptionHandler(DuplicateKeyException.class)
public Result handleDuplicateKeyException(DuplicateKeyException ex){ public Result handleDuplicateKeyException(DuplicateKeyException ex) {
Result result = new Result(); Result result = new Result();
result.error(ErrorCode.DB_RECORD_EXISTS); result.error(ErrorCode.DB_RECORD_EXISTS);
return result; return result;
} }
@ExceptionHandler(UnauthorizedException.class) @ExceptionHandler(UnauthorizedException.class)
public Result handleUnauthorizedException(UnauthorizedException ex){ public Result handleUnauthorizedException(UnauthorizedException ex) {
Result result = new Result(); Result result = new Result();
result.error(ErrorCode.FORBIDDEN); result.error(ErrorCode.FORBIDDEN);
return result; return result;
} }
@ExceptionHandler(Exception.class) @ExceptionHandler(Exception.class)
public Result handleException(Exception ex){ public Result handleException(Exception ex) {
logger.error(ex.getMessage(), ex); logger.error(ex.getMessage(), ex);
saveLog(ex); saveLog(ex);
return new Result().error(); return new Result().error();
} }
/** /**
* 保存异常日志 * 保存异常日志
*/ */
private void saveLog(Exception ex){ private void saveLog(Exception ex) {
SysLogErrorEntity log = new SysLogErrorEntity(); SysLogErrorEntity log = new SysLogErrorEntity();
//请求相关信息 //请求相关信息
HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
log.setIp(IpUtils.getIpAddr(request)); log.setIp(IpUtils.getIpAddr(request));
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT)); log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
log.setRequestUri(request.getRequestURI()); log.setRequestUri(request.getRequestURI());
log.setRequestMethod(request.getMethod()); log.setRequestMethod(request.getMethod());
Map<String, String> params = HttpContextUtils.getParameterMap(request); Map<String, String> params = HttpContextUtils.getParameterMap(request);
if(MapUtil.isNotEmpty(params)){ if (MapUtil.isNotEmpty(params)) {
log.setRequestParams(JSON.toJSONString(params)); log.setRequestParams(JSON.toJSONString(params));
} }
//异常信息 //异常信息
log.setErrorInfo(ExceptionUtils.getErrorStackTrace(ex)); log.setErrorInfo(ExceptionUtils.getErrorStackTrace(ex));
//保存 //保存
sysLogErrorService.save(log); sysLogErrorService.save(log);
} }
} }

View File

@ -10,7 +10,6 @@ import java.util.Date;
/** /**
* 公共字段自动填充值 * 公共字段自动填充值
*
*/ */
@Component @Component
public class FieldMetaObjectHandler implements MetaObjectHandler { public class FieldMetaObjectHandler implements MetaObjectHandler {

View File

@ -62,7 +62,7 @@ public class DataFilterInterceptor extends AbstractSqlParserHandler implements I
} }
// 不用数据过滤 // 不用数据过滤
if(scope == null){ if (scope == null) {
return invocation.proceed(); return invocation.proceed();
} }
@ -74,21 +74,21 @@ public class DataFilterInterceptor extends AbstractSqlParserHandler implements I
return invocation.proceed(); return invocation.proceed();
} }
private String getSelect(String originalSql, DataScope scope){ private String getSelect(String originalSql, DataScope scope) {
try { try {
Select select = (Select) CCJSqlParserUtil.parse(originalSql); Select select = (Select) CCJSqlParserUtil.parse(originalSql);
PlainSelect plainSelect = (PlainSelect) select.getSelectBody(); PlainSelect plainSelect = (PlainSelect) select.getSelectBody();
Expression expression = plainSelect.getWhere(); Expression expression = plainSelect.getWhere();
if(expression == null){ if (expression == null) {
plainSelect.setWhere(new StringValue(scope.getSqlFilter())); plainSelect.setWhere(new StringValue(scope.getSqlFilter()));
}else{ } else {
AndExpression andExpression = new AndExpression(expression, new StringValue(scope.getSqlFilter())); AndExpression andExpression = new AndExpression(expression, new StringValue(scope.getSqlFilter()));
plainSelect.setWhere(andExpression); plainSelect.setWhere(andExpression);
} }
return select.toString().replaceAll("'", ""); return select.toString().replaceAll("'", "");
}catch (JSQLParserException e){ } catch (JSQLParserException e) {
return originalSql; return originalSql;
} }
} }

View File

@ -12,7 +12,6 @@ import java.util.List;
/** /**
* Excel模板读取类 * Excel模板读取类
*
*/ */
public class ExcelDataListener<E, T> extends AnalysisEventListener<T> { public class ExcelDataListener<E, T> extends AnalysisEventListener<T> {
private static final Logger LOGGER = LoggerFactory.getLogger(ExcelDataListener.class); private static final Logger LOGGER = LoggerFactory.getLogger(ExcelDataListener.class);
@ -53,6 +52,7 @@ public class ExcelDataListener<E, T> extends AnalysisEventListener<T> {
list.clear(); list.clear();
} }
} }
/** /**
* 所有数据解析完成了 都会来调用 * 所有数据解析完成了 都会来调用
*/ */

View File

@ -13,22 +13,21 @@ import java.util.List;
/** /**
* excel工具类 * excel工具类
*
*/ */
public class ExcelUtils { public class ExcelUtils {
/** /**
* Excel导出 * Excel导出
* *
* @param response response * @param response response
* @param fileName 文件名 * @param fileName 文件名
* @param sheetName sheetName * @param sheetName sheetName
* @param list 数据List * @param list 数据List
* @param pojoClass 对象Class * @param pojoClass 对象Class
*/ */
public static void exportExcel(HttpServletResponse response, String fileName, String sheetName, List<?> list, public static void exportExcel(HttpServletResponse response, String fileName, String sheetName, List<?> list,
Class<?> pojoClass) throws IOException { Class<?> pojoClass) throws IOException {
if(StringUtils.isBlank(fileName)){ if (StringUtils.isBlank(fileName)) {
//当前日期 //当前日期
fileName = DateUtils.format(new Date()); fileName = DateUtils.format(new Date());
} }
@ -36,23 +35,23 @@ public class ExcelUtils {
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
fileName = URLEncoder.encode(fileName, "UTF-8"); fileName = URLEncoder.encode(fileName, "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
EasyExcel.write(response.getOutputStream(), pojoClass).sheet(sheetName).doWrite(list); EasyExcel.write(response.getOutputStream(), pojoClass).sheet(sheetName).doWrite(list);
} }
/** /**
* Excel导出先sourceList转换成List<targetClass>再导出 * Excel导出先sourceList转换成List<targetClass>再导出
* *
* @param response response * @param response response
* @param fileName 文件名 * @param fileName 文件名
* @param sheetName sheetName * @param sheetName sheetName
* @param sourceList 原数据List * @param sourceList 原数据List
* @param targetClass 目标对象Class * @param targetClass 目标对象Class
*/ */
public static void exportExcelToTarget(HttpServletResponse response, String fileName, String sheetName, List<?> sourceList, public static void exportExcelToTarget(HttpServletResponse response, String fileName, String sheetName, List<?> sourceList,
Class<?> targetClass) throws Exception { Class<?> targetClass) throws Exception {
List targetList = new ArrayList<>(sourceList.size()); List targetList = new ArrayList<>(sourceList.size());
for(Object source : sourceList){ for (Object source : sourceList) {
Object target = targetClass.newInstance(); Object target = targetClass.newInstance();
BeanUtils.copyProperties(source, target); BeanUtils.copyProperties(source, target);
targetList.add(target); targetList.add(target);

View File

@ -9,38 +9,39 @@ import java.util.List;
public class PageUtil { public class PageUtil {
/** /**
* 手动分页类 * 手动分页类
*
* @param datas * @param datas
* @param pageSize * @param pageSize
* @param pageNo * @param pageNo
* @param <T> * @param <T>
* @return * @return
*/ */
public static <T> List<T> getPageSizeDataForRelations(List<T> datas,int pageSize,int pageNo){ public static <T> List<T> getPageSizeDataForRelations(List<T> datas, int pageSize, int pageNo) {
int startNum = (pageNo-1)* pageSize+1 ; //起始截取数据位置 int startNum = (pageNo - 1) * pageSize + 1; //起始截取数据位置
if(startNum > datas.size()){ if (startNum > datas.size()) {
return null; return null;
} }
List<T> res = new ArrayList<>(); List<T> res = new ArrayList<>();
int rum = datas.size() - startNum; int rum = datas.size() - startNum;
if(rum < 0){ if (rum < 0) {
return null; return null;
} }
if(rum == 0){ //说明正好是最后一个了 if (rum == 0) { //说明正好是最后一个了
int index = datas.size() -1; int index = datas.size() - 1;
res.add(datas.get(index)); res.add(datas.get(index));
return res; return res;
} }
if(rum / pageSize >= 1){ //剩下的数据还够1页返回整页的数据 if (rum / pageSize >= 1) { //剩下的数据还够1页返回整页的数据
for(int i=startNum;i<startNum + pageSize;i++){ //截取从startNum开始的数据 for (int i = startNum; i < startNum + pageSize; i++) { //截取从startNum开始的数据
res.add(datas.get(i-1)); res.add(datas.get(i - 1));
} }
return res; return res;
}else if((rum / pageSize == 0) && rum > 0){ //不够一页直接返回剩下数据 } else if ((rum / pageSize == 0) && rum > 0) { //不够一页直接返回剩下数据
for(int j = startNum ;j<=datas.size();j++){ for (int j = startNum; j <= datas.size(); j++) {
res.add(datas.get(j-1)); res.add(datas.get(j - 1));
} }
return res; return res;
}else{ } else {
return null; return null;
} }
} }

View File

@ -2,7 +2,6 @@ package io.renren.common.validator.group;
/** /**
* 阿里云 * 阿里云
*
*/ */
public interface AliyunGroup { public interface AliyunGroup {
} }

View File

@ -2,7 +2,6 @@ package io.renren.common.validator.group;
/** /**
* FastDFS * FastDFS
*
*/ */
public interface FastDFSGroup { public interface FastDFSGroup {
} }

View File

@ -2,7 +2,6 @@ package io.renren.common.validator.group;
/** /**
* 本地上传 * 本地上传
*
*/ */
public interface LocalGroup { public interface LocalGroup {
} }

View File

@ -2,7 +2,6 @@ package io.renren.common.validator.group;
/** /**
* MinIO * MinIO
*
*/ */
public interface MinioGroup { public interface MinioGroup {
} }

View File

@ -2,7 +2,6 @@ package io.renren.common.validator.group;
/** /**
* 腾讯云 * 腾讯云
*
*/ */
public interface QcloudGroup { public interface QcloudGroup {
} }

View File

@ -2,7 +2,6 @@ package io.renren.common.validator.group;
/** /**
* 七牛 * 七牛
*
*/ */
public interface QiniuGroup { public interface QiniuGroup {
} }

View File

@ -6,7 +6,6 @@ import org.springframework.context.annotation.Configuration;
/** /**
* 流程配置信息 * 流程配置信息
*
*/ */
@Configuration @Configuration
public class ProcessEngineConfig implements ProcessEngineConfigurationConfigurer { public class ProcessEngineConfig implements ProcessEngineConfigurationConfigurer {

View File

@ -22,11 +22,10 @@ import java.util.Map;
/** /**
* 模型管理 * 模型管理
*
*/ */
@RestController @RestController
@RequestMapping("/act/model") @RequestMapping("/act/model")
@Api(tags="模型管理") @Api(tags = "模型管理")
public class ActModelController { public class ActModelController {
@Autowired @Autowired
private ActModelService actModelService; private ActModelService actModelService;
@ -35,13 +34,13 @@ public class ActModelController {
@ApiOperation("模型管理-分页查询") @ApiOperation("模型管理-分页查询")
@LogOperation("模型管理-分页查询") @LogOperation("模型管理-分页查询")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = "key", value = "key", paramType = "query", dataType="String"), @ApiImplicitParam(name = "key", value = "key", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "name", value = "name", paramType = "query", dataType="String") @ApiImplicitParam(name = "name", value = "name", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:model:all") // @RequiresPermissions("sys:model:all")
public Result<PageData<Model>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<Model>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<Model> page = actModelService.page(params); PageData<Model> page = actModelService.page(params);
return new Result<PageData<Model>>().ok(page); return new Result<PageData<Model>>().ok(page);
@ -51,7 +50,7 @@ public class ActModelController {
@ApiOperation("模型管理-新增模型") @ApiOperation("模型管理-新增模型")
@LogOperation("模型管理-新增模型") @LogOperation("模型管理-新增模型")
// @RequiresPermissions("sys:model:all") // @RequiresPermissions("sys:model:all")
public Result save(@RequestBody ModelDTO dto) throws Exception{ public Result save(@RequestBody ModelDTO dto) throws Exception {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto); ValidatorUtils.validateEntity(dto);
@ -82,17 +81,17 @@ public class ActModelController {
@LogOperation("模型管理-删除") @LogOperation("模型管理-删除")
// @RequiresPermissions("sys:model:all") // @RequiresPermissions("sys:model:all")
public Result delete(@RequestBody String[] ids) { public Result delete(@RequestBody String[] ids) {
for(String id : ids) { for (String id : ids) {
actModelService.delete(id); actModelService.delete(id);
} }
return new Result(); return new Result();
} }
// @GetMapping("image/{deploymentId}") // @GetMapping("image/{deploymentId}")
@ApiOperation(value = "查看流程图", produces="application/octet-stream") @ApiOperation(value = "查看流程图", produces = "application/octet-stream")
@LogOperation("模型管理-查看流程图") @LogOperation("模型管理-查看流程图")
@RequiresPermissions("sys:model:all") @RequiresPermissions("sys:model:all")
public void viewDeployImage(@PathVariable("deploymentId") String deploymentId, @ApiIgnore HttpServletResponse response){ public void viewDeployImage(@PathVariable("deploymentId") String deploymentId, @ApiIgnore HttpServletResponse response) {
actModelService.deployImage(deploymentId, response); actModelService.deployImage(deploymentId, response);
} }
} }

View File

@ -30,11 +30,10 @@ import java.util.Map;
/** /**
* 流程管理 * 流程管理
*
*/ */
@RestController @RestController
@RequestMapping("/act/process") @RequestMapping("/act/process")
@Api(tags="流程管理") @Api(tags = "流程管理")
public class ActProcessController { public class ActProcessController {
@Autowired @Autowired
private ActProcessService actProcessService; private ActProcessService actProcessService;
@ -49,13 +48,13 @@ public class ActProcessController {
@ApiOperation("流程管理-分页") @ApiOperation("流程管理-分页")
@LogOperation("流程管理-分页") @LogOperation("流程管理-分页")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = "key", value = "key", paramType = "query", dataType="String"), @ApiImplicitParam(name = "key", value = "key", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "processName", value = "processName", paramType = "query", dataType="String") @ApiImplicitParam(name = "processName", value = "processName", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:process:all") // @RequiresPermissions("sys:process:all")
public Result<PageData<Map<String, Object>>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<Map<String, Object>>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<Map<String, Object>> page = actProcessService.page(params); PageData<Map<String, Object>> page = actProcessService.page(params);
return new Result<PageData<Map<String, Object>>>().ok(page); return new Result<PageData<Map<String, Object>>>().ok(page);
} }
@ -64,13 +63,13 @@ public class ActProcessController {
@ApiOperation("发起流程-分页") @ApiOperation("发起流程-分页")
@LogOperation("发起流程-分页") @LogOperation("发起流程-分页")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = "key", value = "key", paramType = "query", dataType="String"), @ApiImplicitParam(name = "key", value = "key", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "processName", value = "processName", paramType = "query", dataType="String") @ApiImplicitParam(name = "processName", value = "processName", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:process:all") // @RequiresPermissions("sys:process:all")
public Result<PageData<Map<String, Object>>> lastestPage(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<Map<String, Object>>> lastestPage(@ApiIgnore @RequestParam Map<String, Object> params) {
params.put("isLatestVersion", true); params.put("isLatestVersion", true);
PageData<Map<String, Object>> page = actProcessService.page(params); PageData<Map<String, Object>> page = actProcessService.page(params);
return new Result<PageData<Map<String, Object>>>().ok(page); return new Result<PageData<Map<String, Object>>>().ok(page);
@ -79,7 +78,7 @@ public class ActProcessController {
@PostMapping("deploy") @PostMapping("deploy")
@ApiOperation("部署流程文件") @ApiOperation("部署流程文件")
@LogOperation("部署流程文件") @LogOperation("部署流程文件")
@ApiImplicitParam(name = "processFile", value = "流程文件", paramType = "query", dataType= "file") @ApiImplicitParam(name = "processFile", value = "流程文件", paramType = "query", dataType = "file")
// @RequiresPermissions("sys:process:all") // @RequiresPermissions("sys:process:all")
public Result deploy(@RequestParam("processFile") MultipartFile file) throws IOException { public Result deploy(@RequestParam("processFile") MultipartFile file) throws IOException {
if (file.isEmpty()) { if (file.isEmpty()) {
@ -126,27 +125,27 @@ public class ActProcessController {
@LogOperation("删除流程") @LogOperation("删除流程")
// @RequiresPermissions("sys:process:all") // @RequiresPermissions("sys:process:all")
public Result delete(@RequestBody String[] deploymentIds) { public Result delete(@RequestBody String[] deploymentIds) {
for(String deploymentId : deploymentIds) { for (String deploymentId : deploymentIds) {
actProcessService.deleteDeployment(deploymentId); actProcessService.deleteDeployment(deploymentId);
} }
return new Result(); return new Result();
} }
@GetMapping(value = "resource") @GetMapping(value = "resource")
@ApiOperation(value="获取资源文件", produces="application/octet-stream") @ApiOperation(value = "获取资源文件", produces = "application/octet-stream")
@LogOperation("获取资源文件") @LogOperation("获取资源文件")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "deploymentId", value = "部署ID", paramType = "query", dataType="String"), @ApiImplicitParam(name = "deploymentId", value = "部署ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "resourceName", value = "资源名称", paramType = "query", dataType="String") @ApiImplicitParam(name = "resourceName", value = "资源名称", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("sys:process:all") // @RequiresPermissions("sys:process:all")
public void resource(String deploymentId, String resourceName, @ApiIgnore HttpServletResponse response) throws Exception { public void resource(String deploymentId, String resourceName, @ApiIgnore HttpServletResponse response) throws Exception {
InputStream resourceAsStream = actProcessService.getResourceAsStream(deploymentId, resourceName); InputStream resourceAsStream = actProcessService.getResourceAsStream(deploymentId, resourceName);
String[] fileNames = resourceName.split("\\."); String[] fileNames = resourceName.split("\\.");
if(fileNames.length>1){ if (fileNames.length > 1) {
if(fileNames[fileNames.length-1].equalsIgnoreCase("png")){ if (fileNames[fileNames.length - 1].equalsIgnoreCase("png")) {
response.setHeader("Content-Type","image/png"); response.setHeader("Content-Type", "image/png");
} else if(fileNames[fileNames.length-1].equalsIgnoreCase("xml")){ } else if (fileNames[fileNames.length - 1].equalsIgnoreCase("xml")) {
response.setHeader("Content-Type", "text/xml"); response.setHeader("Content-Type", "text/xml");
response.setHeader("Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode(resourceName, "UTF-8")); response.setHeader("Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode(resourceName, "UTF-8"));
} }
@ -159,7 +158,7 @@ public class ActProcessController {
@GetMapping(value = "getProcDefBizRoute/{id}") @GetMapping(value = "getProcDefBizRoute/{id}")
@ApiOperation("根据流程ID获取业务路由配置") @ApiOperation("根据流程ID获取业务路由配置")
@LogOperation("根据流程ID获取业务路由配置") @LogOperation("根据流程ID获取业务路由配置")
public Result getProcDefBizRoute(@PathVariable("id") String id){ public Result getProcDefBizRoute(@PathVariable("id") String id) {
ProcessBizRouteDTO processBizRouteDTO = processBizRouteService.getProcDefBizRoute(id); ProcessBizRouteDTO processBizRouteDTO = processBizRouteService.getProcDefBizRoute(id);
return new Result().ok(processBizRouteDTO); return new Result().ok(processBizRouteDTO);
} }
@ -167,8 +166,8 @@ public class ActProcessController {
@GetMapping(value = "getLatestProcDefBizRoute") @GetMapping(value = "getLatestProcDefBizRoute")
@ApiOperation("根据流程定义KEY获取最新的流程配置信息") @ApiOperation("根据流程定义KEY获取最新的流程配置信息")
@LogOperation("根据流程定义KEY获取最新的流程配置信息") @LogOperation("根据流程定义KEY获取最新的流程配置信息")
@ApiImplicitParam(name = "procDefKey", value = "流程定义KEY", paramType = "query", dataType="String") @ApiImplicitParam(name = "procDefKey", value = "流程定义KEY", paramType = "query", dataType = "String")
public Result getLatestProcDefBizRoute(String procDefKey){ public Result getLatestProcDefBizRoute(String procDefKey) {
ProcessBizRouteDTO processBizRouteDTO = processBizRouteService.getLatestProcDefBizRoute(procDefKey); ProcessBizRouteDTO processBizRouteDTO = processBizRouteService.getLatestProcDefBizRoute(procDefKey);
return new Result().ok(processBizRouteDTO); return new Result().ok(processBizRouteDTO);
} }
@ -177,23 +176,23 @@ public class ActProcessController {
@ApiOperation("根据业务ID获取流程业务路由配置和实例信息") @ApiOperation("根据业务ID获取流程业务路由配置和实例信息")
@LogOperation("根据业务ID获取流程业务路由配置和实例信息") @LogOperation("根据业务ID获取流程业务路由配置和实例信息")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "procDefKey", value = "流程定义KEY", required = true, paramType = "query", dataType="String"), @ApiImplicitParam(name = "procDefKey", value = "流程定义KEY", required = true, paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "businessKey", value = "业务KEY", required = true, paramType = "query", dataType="String") @ApiImplicitParam(name = "businessKey", value = "业务KEY", required = true, paramType = "query", dataType = "String")
}) })
public Result getProcDefBizRouteAndProcessInstance(String procDefKey, String businessKey) { public Result getProcDefBizRouteAndProcessInstance(String procDefKey, String businessKey) {
if(StringUtils.isEmpty(businessKey)){ if (StringUtils.isEmpty(businessKey)) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR); return new Result().error(ErrorCode.PARAMS_GET_ERROR);
} }
if(StringUtils.isEmpty(procDefKey)){ if (StringUtils.isEmpty(procDefKey)) {
return new Result().error(ErrorCode.PARAMS_GET_ERROR); return new Result().error(ErrorCode.PARAMS_GET_ERROR);
} }
ProcessInstanceDTO processInstanceDTO = historyService.getHistoryProcessInstanceByBusinessKey(procDefKey, businessKey); ProcessInstanceDTO processInstanceDTO = historyService.getHistoryProcessInstanceByBusinessKey(procDefKey, businessKey);
if(null == processInstanceDTO){ if (null == processInstanceDTO) {
return new Result(); return new Result();
} }
ProcessBizRouteDTO processBizRouteDTO = processBizRouteService.getProcDefBizRoute(processInstanceDTO.getProcessDefinitionId()); ProcessBizRouteDTO processBizRouteDTO = processBizRouteService.getProcDefBizRoute(processInstanceDTO.getProcessDefinitionId());
ProcessBizRouteAndProcessInstanceDTO dto = ConvertUtils.sourceToTarget(processBizRouteDTO, ProcessBizRouteAndProcessInstanceDTO.class); ProcessBizRouteAndProcessInstanceDTO dto = ConvertUtils.sourceToTarget(processBizRouteDTO, ProcessBizRouteAndProcessInstanceDTO.class);
if(null != dto) { if (null != dto) {
dto.setProcessDefinitionId(processInstanceDTO.getProcessDefinitionId()); dto.setProcessDefinitionId(processInstanceDTO.getProcessDefinitionId());
dto.setProcessDefinitionKey(procDefKey); dto.setProcessDefinitionKey(procDefKey);
dto.setProcessDefinitionName(processInstanceDTO.getProcessDefinitionName()); dto.setProcessDefinitionName(processInstanceDTO.getProcessDefinitionName());
@ -205,7 +204,7 @@ public class ActProcessController {
@PostMapping("saveProcBizRoute") @PostMapping("saveProcBizRoute")
@ApiOperation("保存业务路由配置") @ApiOperation("保存业务路由配置")
@LogOperation("保存业务路由配置") @LogOperation("保存业务路由配置")
public Result saveProcBizRoute(@RequestBody ProcessBizRouteDTO processBizRouteDTO){ public Result saveProcBizRoute(@RequestBody ProcessBizRouteDTO processBizRouteDTO) {
processBizRouteService.save(processBizRouteDTO); processBizRouteService.save(processBizRouteDTO);
return new Result(); return new Result();
} }
@ -213,7 +212,7 @@ public class ActProcessController {
@PutMapping("saveProcBizRoute") @PutMapping("saveProcBizRoute")
@ApiOperation("更新业务路由配置") @ApiOperation("更新业务路由配置")
@LogOperation("更新业务路由配置") @LogOperation("更新业务路由配置")
public Result updateProcBizRoute(@RequestBody ProcessBizRouteDTO processBizRouteDTO){ public Result updateProcBizRoute(@RequestBody ProcessBizRouteDTO processBizRouteDTO) {
processBizRouteService.updateProcBizRoute(processBizRouteDTO); processBizRouteService.updateProcBizRoute(processBizRouteDTO);
return new Result(); return new Result();
} }

View File

@ -26,11 +26,10 @@ import java.util.Map;
/** /**
* 转正申请 * 转正申请
*
*/ */
@RestController @RestController
@RequestMapping("act/demo/correction") @RequestMapping("act/demo/correction")
@Api(tags="转正申请") @Api(tags = "转正申请")
public class CorrectionController { public class CorrectionController {
@Autowired @Autowired
private CorrectionService correctionService; private CorrectionService correctionService;
@ -38,13 +37,13 @@ public class CorrectionController {
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页") @ApiOperation("分页")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")
}) })
@RequiresPermissions("sys:correction:all") @RequiresPermissions("sys:correction:all")
public Result<PageData<CorrectionDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<CorrectionDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<CorrectionDTO> page = correctionService.page(params); PageData<CorrectionDTO> page = correctionService.page(params);
return new Result<PageData<CorrectionDTO>>().ok(page); return new Result<PageData<CorrectionDTO>>().ok(page);
@ -53,7 +52,7 @@ public class CorrectionController {
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation("信息") @ApiOperation("信息")
@RequiresPermissions("sys:correction:all") @RequiresPermissions("sys:correction:all")
public Result<CorrectionDTO> get(@PathVariable("id") Long id){ public Result<CorrectionDTO> get(@PathVariable("id") Long id) {
CorrectionDTO data = correctionService.get(id); CorrectionDTO data = correctionService.get(id);
return new Result<CorrectionDTO>().ok(data); return new Result<CorrectionDTO>().ok(data);
@ -63,7 +62,7 @@ public class CorrectionController {
@ApiOperation("保存") @ApiOperation("保存")
@LogOperation("保存") @LogOperation("保存")
@RequiresPermissions("sys:correction:all") @RequiresPermissions("sys:correction:all")
public Result save(@RequestBody CorrectionDTO dto){ public Result save(@RequestBody CorrectionDTO dto) {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -77,7 +76,7 @@ public class CorrectionController {
@ApiOperation("修改") @ApiOperation("修改")
@LogOperation("修改") @LogOperation("修改")
@RequiresPermissions("sys:correction:all") @RequiresPermissions("sys:correction:all")
public Result update(@RequestBody CorrectionDTO dto){ public Result update(@RequestBody CorrectionDTO dto) {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -90,7 +89,7 @@ public class CorrectionController {
@ApiOperation("删除") @ApiOperation("删除")
@LogOperation("删除") @LogOperation("删除")
@RequiresPermissions("sys:correction:all") @RequiresPermissions("sys:correction:all")
public Result delete(@RequestBody Long[] ids){ public Result delete(@RequestBody Long[] ids) {
//效验数据 //效验数据
AssertUtils.isArrayEmpty(ids, "id"); AssertUtils.isArrayEmpty(ids, "id");
@ -104,10 +103,10 @@ public class CorrectionController {
@LogOperation("更新实例ID") @LogOperation("更新实例ID")
@RequiresPermissions("sys:correction:all") @RequiresPermissions("sys:correction:all")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "businessKey", value = "业务KEY", paramType = "query", required = true, dataType="String"), @ApiImplicitParam(name = "businessKey", value = "业务KEY", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "processInstanceId", value = "实例ID", paramType = "query",required = true, dataType="String") @ApiImplicitParam(name = "processInstanceId", value = "实例ID", paramType = "query", required = true, dataType = "String")
}) })
public Result updateInstanceId(String businessKey, String processInstanceId){ public Result updateInstanceId(String businessKey, String processInstanceId) {
Long id = Long.valueOf(businessKey); Long id = Long.valueOf(businessKey);
correctionService.updateInstanceId(processInstanceId, id); correctionService.updateInstanceId(processInstanceId, id);
return new Result(); return new Result();

View File

@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Mapper;
/** /**
* 转正申请 * 转正申请
*
*/ */
@Mapper @Mapper
public interface CorrectionDao extends BaseDao<CorrectionEntity> { public interface CorrectionDao extends BaseDao<CorrectionEntity> {

View File

@ -11,40 +11,39 @@ import java.util.Date;
/** /**
* 转正申请 * 转正申请
*
*/ */
@Data @Data
@ApiModel(value = "转正申请") @ApiModel(value = "转正申请")
public class CorrectionDTO implements Serializable { public class CorrectionDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private Long id; private Long id;
@ApiModelProperty(value = "申请岗位") @ApiModelProperty(value = "申请岗位")
private String applyPost; private String applyPost;
@ApiModelProperty(value = "入职日期") @ApiModelProperty(value = "入职日期")
@JsonFormat(pattern="yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date entryDate; private Date entryDate;
@ApiModelProperty(value = "转正日期") @ApiModelProperty(value = "转正日期")
@JsonFormat(pattern="yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date correctionDate; private Date correctionDate;
@ApiModelProperty(value = "工作内容") @ApiModelProperty(value = "工作内容")
private String workContent; private String workContent;
@ApiModelProperty(value = "工作成绩") @ApiModelProperty(value = "工作成绩")
private String achievement; private String achievement;
@ApiModelProperty(value = "创建者") @ApiModelProperty(value = "创建者")
private Long creator; private Long creator;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date createDate; private Date createDate;
@ApiModelProperty(value = "实例ID") @ApiModelProperty(value = "实例ID")
private String instanceId; private String instanceId;
} }

View File

@ -9,34 +9,33 @@ import java.util.Date;
/** /**
* 转正申请 * 转正申请
*
*/ */
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
@TableName("tb_correction") @TableName("tb_correction")
public class CorrectionEntity extends BaseEntity { public class CorrectionEntity extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 申请岗位 * 申请岗位
*/ */
private String applyPost; private String applyPost;
/** /**
* 入职日期 * 入职日期
*/ */
private Date entryDate; private Date entryDate;
/** /**
* 转正日期 * 转正日期
*/ */
private Date correctionDate; private Date correctionDate;
/** /**
* 工作内容 * 工作内容
*/ */
private String workContent; private String workContent;
/** /**
* 工作成绩 * 工作成绩
*/ */
private String achievement; private String achievement;
private String instanceId; private String instanceId;
} }

View File

@ -7,7 +7,6 @@ import io.renren.modules.activiti.demo.entity.CorrectionEntity;
/** /**
* 转正申请 * 转正申请
*
*/ */
public interface CorrectionService extends CrudService<CorrectionEntity, CorrectionDTO> { public interface CorrectionService extends CrudService<CorrectionEntity, CorrectionDTO> {

View File

@ -13,14 +13,13 @@ import java.util.Map;
/** /**
* 转正申请 * 转正申请
*
*/ */
@Service @Service
public class CorrectionServiceImpl extends CrudServiceImpl<CorrectionDao, CorrectionEntity, CorrectionDTO> implements CorrectionService { public class CorrectionServiceImpl extends CrudServiceImpl<CorrectionDao, CorrectionEntity, CorrectionDTO> implements CorrectionService {
@Override @Override
public QueryWrapper<CorrectionEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<CorrectionEntity> getWrapper(Map<String, Object> params) {
String id = (String)params.get("id"); String id = (String) params.get("id");
QueryWrapper<CorrectionEntity> wrapper = new QueryWrapper<>(); QueryWrapper<CorrectionEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id); wrapper.eq(StringUtils.isNotBlank(id), "id", id);

View File

@ -12,7 +12,7 @@ import java.util.Date;
* @author Jone * @author Jone
*/ */
@Data @Data
@Api(tags="历史细节") @Api(tags = "历史细节")
public class HistoryDetailDTO { public class HistoryDetailDTO {
@ApiModelProperty(value = "ID") @ApiModelProperty(value = "ID")

View File

@ -9,19 +9,18 @@ import java.io.Serializable;
/** /**
* 模型 * 模型
*
*/ */
@Data @Data
@Api(tags="模型") @Api(tags = "模型")
public class ModelDTO implements Serializable { public class ModelDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "模型名称") @ApiModelProperty(value = "模型名称")
@NotBlank(message="{model.name.require}") @NotBlank(message = "{model.name.require}")
private String name; private String name;
@ApiModelProperty(value = "模型标识") @ApiModelProperty(value = "模型标识")
@NotBlank(message="{model.key.require}") @NotBlank(message = "{model.key.require}")
private String key; private String key;
@ApiModelProperty(value = "模型描述") @ApiModelProperty(value = "模型描述")

View File

@ -10,7 +10,7 @@ import java.util.Date;
* @author Jone * @author Jone
*/ */
@Data @Data
@Api(tags="流程活动") @Api(tags = "流程活动")
public class ProcessActivityDTO { public class ProcessActivityDTO {

View File

@ -9,8 +9,8 @@ import lombok.EqualsAndHashCode;
* @Author:Jone * @Author:Jone
*/ */
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
@Api(tags="流程业务配置和实例信息") @Api(tags = "流程业务配置和实例信息")
public class ProcessBizRouteAndProcessInstanceDTO extends ProcessBizRouteDTO { public class ProcessBizRouteAndProcessInstanceDTO extends ProcessBizRouteDTO {
@ApiModelProperty(value = "实例ID") @ApiModelProperty(value = "实例ID")

View File

@ -11,7 +11,7 @@ import javax.validation.constraints.NotNull;
* @Author:Jone * @Author:Jone
*/ */
@Data @Data
@Api(tags="流程业务配置") @Api(tags = "流程业务配置")
public class ProcessBizRouteDTO { public class ProcessBizRouteDTO {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -20,18 +20,18 @@ public class ProcessBizRouteDTO {
private Long id; private Long id;
@ApiModelProperty(value = "流程定义ID") @ApiModelProperty(value = "流程定义ID")
@NotBlank(message="{processBizRoute.procDefId.require}") @NotBlank(message = "{processBizRoute.procDefId.require}")
private String procDefId; private String procDefId;
@ApiModelProperty(value = "业务路由") @ApiModelProperty(value = "业务路由")
@NotBlank(message="{processBizRoute.bizRoute.require}") @NotBlank(message = "{processBizRoute.bizRoute.require}")
private String bizRoute; private String bizRoute;
@ApiModelProperty(value = "流程定义KEY") @ApiModelProperty(value = "流程定义KEY")
@NotBlank(message="{processBizRoute.procDefKey.require}") @NotBlank(message = "{processBizRoute.procDefKey.require}")
private String procDefKey; private String procDefKey;
@ApiModelProperty(value = "版本号") @ApiModelProperty(value = "版本号")
@NotNull(message="{processBizRoute.version.require}") @NotNull(message = "{processBizRoute.version.require}")
private Integer version; private Integer version;
} }

View File

@ -11,15 +11,15 @@ import java.util.Map;
* @Author:Jone * @Author:Jone
*/ */
@Data @Data
@Api(tags="流程启动参数") @Api(tags = "流程启动参数")
public class ProcessStartDTO { public class ProcessStartDTO {
@ApiModelProperty(value = "流程KEY") @ApiModelProperty(value = "流程KEY")
@NotBlank(message="{ProcessStart.processDefinitionKey.require}") @NotBlank(message = "{ProcessStart.processDefinitionKey.require}")
private String processDefinitionKey; private String processDefinitionKey;
@ApiModelProperty(value = "业务KEY") @ApiModelProperty(value = "业务KEY")
@NotBlank(message="{ProcessStart.businessKey.require}") @NotBlank(message = "{ProcessStart.businessKey.require}")
private String businessKey; private String businessKey;
@ApiModelProperty(value = "流程参数") @ApiModelProperty(value = "流程参数")

View File

@ -10,7 +10,7 @@ import java.util.Date;
* @author Jone * @author Jone
*/ */
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
public class ProcessActivityEntity extends BaseEntity { public class ProcessActivityEntity extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -11,19 +11,18 @@ import java.io.InputStream;
/** /**
* Stencilset * Stencilset
*
*/ */
@RestController @RestController
@RequestMapping("service") @RequestMapping("service")
public class StencilsetRestResource { public class StencilsetRestResource {
@RequestMapping(value="/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8") @RequestMapping(value = "/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
public @ResponseBody String getStencilset() { public @ResponseBody String getStencilset() {
InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json"); InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
try { try {
return IOUtils.toString(stencilsetStream, "utf-8"); return IOUtils.toString(stencilsetStream, "utf-8");
} catch (Exception e) { } catch (Exception e) {
throw new ActivitiException("Error while loading stencil set", e); throw new ActivitiException("Error while loading stencil set", e);
}
} }
}
} }

View File

@ -17,44 +17,43 @@ import org.springframework.web.bind.annotation.RestController;
/** /**
* Model Editor * Model Editor
*
*/ */
@RestController @RestController
@RequestMapping("service") @RequestMapping("service")
public class ModelEditorJsonRestResource implements ModelDataJsonConstants { public class ModelEditorJsonRestResource implements ModelDataJsonConstants {
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelEditorJsonRestResource.class); protected static final Logger LOGGER = LoggerFactory.getLogger(ModelEditorJsonRestResource.class);
@Autowired @Autowired
private RepositoryService repositoryService; private RepositoryService repositoryService;
@Autowired @Autowired
private ObjectMapper objectMapper; private ObjectMapper objectMapper;
@RequestMapping(value="/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json") @RequestMapping(value = "/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
public ObjectNode getEditorJson(@PathVariable String modelId) { public ObjectNode getEditorJson(@PathVariable String modelId) {
ObjectNode modelNode = null; ObjectNode modelNode = null;
Model model = repositoryService.getModel(modelId); Model model = repositoryService.getModel(modelId);
if (model != null) { if (model != null) {
try { try {
if (StringUtils.isNotEmpty(model.getMetaInfo())) { if (StringUtils.isNotEmpty(model.getMetaInfo())) {
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo()); modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
} else { } else {
modelNode = objectMapper.createObjectNode(); modelNode = objectMapper.createObjectNode();
modelNode.put(MODEL_NAME, model.getName()); modelNode.put(MODEL_NAME, model.getName());
}
modelNode.put(MODEL_ID, model.getId());
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(
new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
modelNode.set("model", editorJsonNode);
} catch (Exception e) {
LOGGER.error("Error creating model JSON", e);
throw new ActivitiException("Error creating model JSON", e);
}
} }
modelNode.put(MODEL_ID, model.getId()); return modelNode;
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(
new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
modelNode.set("model", editorJsonNode);
} catch (Exception e) {
LOGGER.error("Error creating model JSON", e);
throw new ActivitiException("Error creating model JSON", e);
}
} }
return modelNode;
}
} }

View File

@ -24,7 +24,6 @@ import java.nio.charset.StandardCharsets;
/** /**
* Model Rest * Model Rest
*
*/ */
@RestController @RestController
@RequestMapping("service") @RequestMapping("service")
@ -36,7 +35,7 @@ public class ModelSaveRestResource implements ModelDataJsonConstants {
@Autowired @Autowired
private ObjectMapper objectMapper; private ObjectMapper objectMapper;
@RequestMapping(value="/model/{modelId}/save", method = RequestMethod.PUT) @RequestMapping(value = "/model/{modelId}/save", method = RequestMethod.PUT)
@ResponseStatus(value = HttpStatus.OK) @ResponseStatus(value = HttpStatus.OK)
public void saveModel(@PathVariable String modelId, HttpServletRequest request) { public void saveModel(@PathVariable String modelId, HttpServletRequest request) {
try { try {

View File

@ -38,7 +38,6 @@ import java.util.zip.ZipInputStream;
/** /**
* 流程管理 * 流程管理
*
*/ */
@Service @Service
public class ActProcessService { public class ActProcessService {
@ -55,29 +54,29 @@ public class ActProcessService {
* 流程列表 * 流程列表
*/ */
public PageData<Map<String, Object>> page(Map<String, Object> params) { public PageData<Map<String, Object>> page(Map<String, Object> params) {
String key = (String)params.get("key"); String key = (String) params.get("key");
String processName = (String)params.get("processName"); String processName = (String) params.get("processName");
boolean isLatestVersion = params.get("isLatestVersion") != null && (boolean) params.get("isLatestVersion"); boolean isLatestVersion = params.get("isLatestVersion") != null && (boolean) params.get("isLatestVersion");
//分页参数 //分页参数
int curPage = 1; int curPage = 1;
int limit = 10; int limit = 10;
if(params.get(Constant.PAGE) != null){ if (params.get(Constant.PAGE) != null) {
curPage = Integer.parseInt((String)params.get(Constant.PAGE)); curPage = Integer.parseInt((String) params.get(Constant.PAGE));
} }
if(params.get(Constant.LIMIT) != null){ if (params.get(Constant.LIMIT) != null) {
limit = Integer.parseInt((String)params.get(Constant.LIMIT)); limit = Integer.parseInt((String) params.get(Constant.LIMIT));
} }
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery() ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
.orderByProcessDefinitionId().desc().orderByProcessDefinitionKey().desc(); .orderByProcessDefinitionId().desc().orderByProcessDefinitionKey().desc();
if(isLatestVersion){ if (isLatestVersion) {
processDefinitionQuery.latestVersion(); processDefinitionQuery.latestVersion();
} }
if(StringUtils.isNotEmpty(key)){ if (StringUtils.isNotEmpty(key)) {
processDefinitionQuery.processDefinitionKeyLike(key); processDefinitionQuery.processDefinitionKeyLike(key);
} }
if(StringUtils.isNotEmpty(processName)){ if (StringUtils.isNotEmpty(processName)) {
processDefinitionQuery.processDefinitionNameLike(processName); processDefinitionQuery.processDefinitionNameLike(processName);
} }
@ -88,7 +87,7 @@ public class ActProcessService {
objectList.add(processDefinitionConvert(processDefinition)); objectList.add(processDefinitionConvert(processDefinition));
} }
return new PageData<>(objectList, (int)processDefinitionQuery.count()); return new PageData<>(objectList, (int) processDefinitionQuery.count());
} }
@ -115,41 +114,45 @@ public class ActProcessService {
/** /**
* 部署 * 部署
*
* @param file 文件 * @param file 文件
*/ */
public void deploy(MultipartFile file) throws IOException { public void deploy(MultipartFile file) throws IOException {
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
String extension = FilenameUtils.getExtension(fileName); String extension = FilenameUtils.getExtension(fileName);
if("zip".equalsIgnoreCase(extension) || "bar".equalsIgnoreCase(extension)) { if ("zip".equalsIgnoreCase(extension) || "bar".equalsIgnoreCase(extension)) {
ZipInputStream zip = new ZipInputStream(file.getInputStream()); ZipInputStream zip = new ZipInputStream(file.getInputStream());
repositoryService.createDeployment().addZipInputStream(zip).deploy(); repositoryService.createDeployment().addZipInputStream(zip).deploy();
}else if(fileName.contains("bpmn20.xml")){ } else if (fileName.contains("bpmn20.xml")) {
repositoryService.createDeployment().addInputStream(fileName, file.getInputStream()).deploy(); repositoryService.createDeployment().addInputStream(fileName, file.getInputStream()).deploy();
}else if("bpmn".equalsIgnoreCase(extension)){ } else if ("bpmn".equalsIgnoreCase(extension)) {
repositoryService.createDeployment().addInputStream(fileName, file.getInputStream()).deploy(); repositoryService.createDeployment().addInputStream(fileName, file.getInputStream()).deploy();
}else{ } else {
throw new RenException(ErrorCode.ACT_DEPLOY_FORMAT_ERROR); throw new RenException(ErrorCode.ACT_DEPLOY_FORMAT_ERROR);
} }
} }
/** /**
* 激活流程 * 激活流程
*
* @param id 流程ID * @param id 流程ID
*/ */
public void active(String id){ public void active(String id) {
repositoryService.activateProcessDefinitionById(id, true, null); repositoryService.activateProcessDefinitionById(id, true, null);
} }
/** /**
* 挂起流程 * 挂起流程
*
* @param id 流程ID * @param id 流程ID
*/ */
public void suspend(String id){ public void suspend(String id) {
repositoryService.suspendProcessDefinitionById(id, true, null); repositoryService.suspendProcessDefinitionById(id, true, null);
} }
/** /**
* 将部署的流程转换为模型 * 将部署的流程转换为模型
*
* @param id 流程ID * @param id 流程ID
*/ */
public Model convertToModel(String id) throws UnsupportedEncodingException, XMLStreamException { public Model convertToModel(String id) throws UnsupportedEncodingException, XMLStreamException {
@ -168,7 +171,7 @@ public class ActProcessService {
modelData.setName(processDefinition.getResourceName()); modelData.setName(processDefinition.getResourceName());
modelData.setCategory(processDefinition.getCategory()); modelData.setCategory(processDefinition.getCategory());
modelData.setDeploymentId(processDefinition.getDeploymentId()); modelData.setDeploymentId(processDefinition.getDeploymentId());
modelData.setVersion(Integer.parseInt(String.valueOf(repositoryService.createModelQuery().modelKey(modelData.getKey()).count()+1))); modelData.setVersion(Integer.parseInt(String.valueOf(repositoryService.createModelQuery().modelKey(modelData.getKey()).count() + 1)));
ObjectNode modelObjectNode = new ObjectMapper().createObjectNode(); ObjectNode modelObjectNode = new ObjectMapper().createObjectNode();
modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, processDefinition.getName()); modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, processDefinition.getName());
@ -185,15 +188,17 @@ public class ActProcessService {
/** /**
* 删除部署 * 删除部署
* @param deploymentId 部署ID *
* @param deploymentId 部署ID
*/ */
public void deleteDeployment(String deploymentId){ public void deleteDeployment(String deploymentId) {
repositoryService.deleteDeployment(deploymentId, true); repositoryService.deleteDeployment(deploymentId, true);
} }
/** /**
* 获取资源文件 * 获取资源文件
* @param deploymentId 部署ID *
* @param deploymentId 部署ID
* @param resourceName 资源名称 * @param resourceName 资源名称
*/ */
public InputStream getResourceAsStream(String deploymentId, String resourceName) { public InputStream getResourceAsStream(String deploymentId, String resourceName) {

View File

@ -15,7 +15,7 @@ import java.util.Map;
* *
* @author Jone * @author Jone
*/ */
public interface ActivitiService extends BaseService<ProcessActivityEntity> { public interface ActivitiService extends BaseService<ProcessActivityEntity> {
PageData<ProcessActivityDTO> getMyProcessInstancePage(Map<String, Object> params); PageData<ProcessActivityDTO> getMyProcessInstancePage(Map<String, Object> params);

View File

@ -7,7 +7,7 @@ import io.renren.modules.activiti.entity.ProcessBizRouteEntity;
/** /**
* @Author:Jone * @Author:Jone
*/ */
public interface ProcessBizRouteService extends BaseService<ProcessBizRouteEntity> { public interface ProcessBizRouteService extends BaseService<ProcessBizRouteEntity> {
ProcessBizRouteDTO getProcDefBizRoute(String id); ProcessBizRouteDTO getProcDefBizRoute(String id);

View File

@ -14,7 +14,7 @@ import java.util.List;
* @Author:Jone * @Author:Jone
*/ */
@Service @Service
public class ProcessBizRouteServiceImpl extends BaseServiceImpl<ProcessBizRouteDao, ProcessBizRouteEntity> implements ProcessBizRouteService { public class ProcessBizRouteServiceImpl extends BaseServiceImpl<ProcessBizRouteDao, ProcessBizRouteEntity> implements ProcessBizRouteService {
@Override @Override
public ProcessBizRouteDTO getProcDefBizRoute(String id) { public ProcessBizRouteDTO getProcDefBizRoute(String id) {
@ -37,7 +37,7 @@ public class ProcessBizRouteServiceImpl extends BaseServiceImpl<ProcessBizRoute
@Override @Override
public ProcessBizRouteDTO getLatestProcDefBizRoute(String procDefKey) { public ProcessBizRouteDTO getLatestProcDefBizRoute(String procDefKey) {
List<ProcessBizRouteEntity> list = baseDao.getLatestProcDefBizRoute(procDefKey); List<ProcessBizRouteEntity> list = baseDao.getLatestProcDefBizRoute(procDefKey);
if(list.isEmpty()){ if (list.isEmpty()) {
return null; return null;
} }
ProcessBizRouteEntity entity = list.get(0); ProcessBizRouteEntity entity = list.get(0);

View File

@ -26,7 +26,7 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/category") @RequestMapping("/category")
@Api(tags="编目管理") @Api(tags = "编目管理")
public class CategoryController { public class CategoryController {
@Value("${resource.devModelFilePath}") @Value("${resource.devModelFilePath}")
@ -73,7 +73,7 @@ public class CategoryController {
if (ObjectUtils.isEmpty(categoryDTO.getPid())) { if (ObjectUtils.isEmpty(categoryDTO.getPid())) {
File file = new File(devModelFilePath + File.pathSeparator + CommonUtils.getPinYinHeadChar(categoryDTO.getName())); File file = new File(devModelFilePath + File.pathSeparator + CommonUtils.getPinYinHeadChar(categoryDTO.getName()));
//文件路径不存在创建各种能力的子文件夹 //文件路径不存在创建各种能力的子文件夹
if (! file.exists()) { if (!file.exists()) {
try { try {
file.createNewFile(); file.createNewFile();
} catch (IOException e) { } catch (IOException e) {

View File

@ -1,7 +1,6 @@
package io.renren.modules.category.dao; package io.renren.modules.category.dao;
import io.renren.common.dao.BaseDao; import io.renren.common.dao.BaseDao;
import io.renren.modules.category.dto.CategoryDTO;
import io.renren.modules.category.entity.Category; import io.renren.modules.category.entity.Category;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;

View File

@ -9,11 +9,11 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* 资源分类表 * 资源分类表
* *
* @author dg * @author dg
* @since 1.0 2022-04-12 * @since 1.0 2022-04-12
*/ */
@Data @Data
@ApiModel(value = "资源分类表") @ApiModel(value = "资源分类表")
public class CategoryDTO implements Serializable { public class CategoryDTO implements Serializable {

View File

@ -1,7 +1,10 @@
package io.renren.modules.category.entity; package io.renren.modules.category.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.baomidou.mybatisplus.annotation.*;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
@ -15,7 +18,7 @@ import java.util.Date;
* @since 1.0 2022-04-12 * @since 1.0 2022-04-12
*/ */
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
@ToString @ToString
@TableName("tb_data_category") @TableName("tb_data_category")
public class Category implements Serializable { public class Category implements Serializable {

View File

@ -6,6 +6,7 @@ public class CommonUtils {
/** /**
* 得到中文首字母 * 得到中文首字母
*
* @param value * @param value
* @return * @return
*/ */

View File

@ -12,78 +12,78 @@ import lombok.EqualsAndHashCode;
* @since 1.0 2022-04-25 * @since 1.0 2022-04-25
*/ */
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
@TableName("t_demand_data") @TableName("t_demand_data")
public class TDemandDataEntity extends BaseEntity { public class TDemandDataEntity extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 申请人用户id * 申请人用户id
*/ */
private String applyUserId; private String applyUserId;
/** /**
* 申请人姓名 * 申请人姓名
*/ */
private String applyUserName; private String applyUserName;
/** /**
* 申请人部门id * 申请人部门id
*/ */
private String applyUserDeptId; private String applyUserDeptId;
/** /**
* 申请人部门名称 * 申请人部门名称
*/ */
private String applyUserDeptName; private String applyUserDeptName;
/** /**
* 申请人联系电话 * 申请人联系电话
*/ */
private String applyUserPhone; private String applyUserPhone;
/** /**
* 需求主题 * 需求主题
*/ */
private String demandSubject; private String demandSubject;
/** /**
* 需求描述 * 需求描述
*/ */
private String demandDetails; private String demandDetails;
/** /**
* 需求类型基础设施数据资源组件服务应用资源知识库 * 需求类型基础设施数据资源组件服务应用资源知识库
*/ */
private String detailsType; private String detailsType;
/** /**
* 需求领域 * 需求领域
*/ */
private String detailsField; private String detailsField;
/** /**
* 附件 * 附件
*/ */
private String enclosure; private String enclosure;
/** /**
* 业务标志0:初始化 1:审批中 2:审批拒绝 3:审批通过 * 业务标志0:初始化 1:审批中 2:审批拒绝 3:审批通过
*/ */
private Integer flag; private Integer flag;
/** /**
* 审批意见 * 审批意见
*/ */
private String approvalOpinions; private String approvalOpinions;
/** /**
* 审批人姓名 * 审批人姓名
*/ */
private String approvalUserName; private String approvalUserName;
/** /**
* 审批人部门名称 * 审批人部门名称
*/ */
private String approvalUserDeptName; private String approvalUserDeptName;
/** /**
* 访问量 * 访问量
*/ */
private Long visits; private Long visits;
/** /**
* 实例ID * 实例ID
*/ */
private String instanceId; private String instanceId;
/** /**
* 申请单号 * 申请单号
*/ */
private String applyNumber; private String applyNumber;
} }

View File

@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight; import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight; import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
/** /**

View File

@ -1,7 +1,6 @@
package io.renren.modules.demanData.listener; package io.renren.modules.demanData.listener;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer; import com.google.gson.JsonDeserializer;

View File

@ -74,8 +74,8 @@ public class TDemandDataServiceImpl extends CrudServiceImpl<TDemandDataDao, TDem
public Object selectFlagCountByDepts() { public Object selectFlagCountByDepts() {
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
Long deptId = SecurityUser.getUser().getDeptId(); Long deptId = SecurityUser.getUser().getDeptId();
List<Long> deptList=null; List<Long> deptList = null;
if(deptId != null){ if (deptId != null) {
deptList = deptService.getSubDeptIdList(deptId); deptList = deptService.getSubDeptIdList(deptId);
} }
List<Map> list = baseDao.selectFlagCountByDepts(deptList); List<Map> list = baseDao.selectFlagCountByDepts(deptList);

View File

@ -5,11 +5,11 @@ import io.renren.modules.demandComment.entity.TDemandCommentEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
* 需求评论 * 需求评论
* *
* @author wangliwen wangliwen2@hisense.com * @author wangliwen wangliwen2@hisense.com
* @since 1.0 2022-04-26 * @since 1.0 2022-04-26
*/ */
@Mapper @Mapper
public interface TDemandCommentDao extends BaseDao<TDemandCommentEntity> { public interface TDemandCommentDao extends BaseDao<TDemandCommentEntity> {

View File

@ -5,6 +5,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight; import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight; import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
/** /**

View File

@ -29,13 +29,13 @@ import java.util.Map;
/** /**
* Excel导入演示 * Excel导入演示
* *
* @author Mark sunlightcs@gmail.com * @author Mark sunlightcs@gmail.com
*/ */
@RestController @RestController
@RequestMapping("demo/excel") @RequestMapping("demo/excel")
@Api(tags="Excel导入演示") @Api(tags = "Excel导入演示")
public class ExcelDataController { public class ExcelDataController {
@Autowired @Autowired
private ExcelDataService excelDataService; private ExcelDataService excelDataService;
@ -43,13 +43,13 @@ public class ExcelDataController {
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页") @ApiOperation("分页")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("demo:excel:all") // @RequiresPermissions("demo:excel:all")
public Result<PageData<ExcelDataDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<ExcelDataDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<ExcelDataDTO> page = excelDataService.page(params); PageData<ExcelDataDTO> page = excelDataService.page(params);
return new Result<PageData<ExcelDataDTO>>().ok(page); return new Result<PageData<ExcelDataDTO>>().ok(page);
@ -58,7 +58,7 @@ public class ExcelDataController {
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation("信息") @ApiOperation("信息")
// @RequiresPermissions("demo:excel:all") // @RequiresPermissions("demo:excel:all")
public Result<ExcelDataDTO> get(@PathVariable("id") Long id){ public Result<ExcelDataDTO> get(@PathVariable("id") Long id) {
ExcelDataDTO data = excelDataService.get(id); ExcelDataDTO data = excelDataService.get(id);
return new Result<ExcelDataDTO>().ok(data); return new Result<ExcelDataDTO>().ok(data);
@ -67,7 +67,7 @@ public class ExcelDataController {
@PostMapping @PostMapping
@ApiOperation("保存") @ApiOperation("保存")
// @RequiresPermissions("demo:excel:all") // @RequiresPermissions("demo:excel:all")
public Result save(@RequestBody ExcelDataDTO dto){ public Result save(@RequestBody ExcelDataDTO dto) {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -79,7 +79,7 @@ public class ExcelDataController {
@PutMapping @PutMapping
@ApiOperation("修改") @ApiOperation("修改")
// @RequiresPermissions("demo:excel:all") // @RequiresPermissions("demo:excel:all")
public Result update(@RequestBody ExcelDataDTO dto){ public Result update(@RequestBody ExcelDataDTO dto) {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -91,7 +91,7 @@ public class ExcelDataController {
@DeleteMapping @DeleteMapping
@ApiOperation("删除") @ApiOperation("删除")
// @RequiresPermissions("demo:excel:all") // @RequiresPermissions("demo:excel:all")
public Result delete(@RequestBody Long[] ids){ public Result delete(@RequestBody Long[] ids) {
//效验数据 //效验数据
AssertUtils.isArrayEmpty(ids, "id"); AssertUtils.isArrayEmpty(ids, "id");
@ -103,7 +103,7 @@ public class ExcelDataController {
@PostMapping("import") @PostMapping("import")
@ApiOperation("导入") @ApiOperation("导入")
// @RequiresPermissions("demo:excel:all") // @RequiresPermissions("demo:excel:all")
@ApiImplicitParam(name = "config", value = "文件", paramType = "query", dataType= "config") @ApiImplicitParam(name = "config", value = "文件", paramType = "query", dataType = "config")
public Result importExcel(@RequestParam("config") MultipartFile file) throws Exception { public Result importExcel(@RequestParam("config") MultipartFile file) throws Exception {
//解析并保存到数据库 //解析并保存到数据库
EasyExcel.read(file.getInputStream(), ExcelDataExcel.class, new ExcelDataListener<>(excelDataService)).sheet().doRead(); EasyExcel.read(file.getInputStream(), ExcelDataExcel.class, new ExcelDataListener<>(excelDataService)).sheet().doRead();

View File

@ -15,7 +15,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
@ -25,11 +24,10 @@ import java.util.Map;
/** /**
* 新闻 * 新闻
*
*/ */
@RestController @RestController
@RequestMapping("demo/news") @RequestMapping("demo/news")
@Api(tags="新闻管理") @Api(tags = "新闻管理")
public class NewsController { public class NewsController {
@Autowired @Autowired
private NewsService newsService; private NewsService newsService;
@ -37,16 +35,16 @@ public class NewsController {
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页") @ApiOperation("分页")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "title", value = "标题", paramType = "query", dataType="String"), @ApiImplicitParam(name = "title", value = "标题", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType="String"), @ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType="String") @ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("demo:news:all") // @RequiresPermissions("demo:news:all")
public Result<PageData<NewsDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<NewsDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<NewsDTO> page = newsService.page(params); PageData<NewsDTO> page = newsService.page(params);
return new Result<PageData<NewsDTO>>().ok(page); return new Result<PageData<NewsDTO>>().ok(page);
@ -55,7 +53,7 @@ public class NewsController {
@ApiOperation("信息") @ApiOperation("信息")
@GetMapping("{id}") @GetMapping("{id}")
// @RequiresPermissions("demo:news:all") // @RequiresPermissions("demo:news:all")
public Result<NewsDTO> info(@PathVariable("id") Long id){ public Result<NewsDTO> info(@PathVariable("id") Long id) {
NewsDTO news = newsService.get(id); NewsDTO news = newsService.get(id);
return new Result<NewsDTO>().ok(news); return new Result<NewsDTO>().ok(news);
@ -65,7 +63,7 @@ public class NewsController {
@ApiOperation("保存") @ApiOperation("保存")
@LogOperation("保存") @LogOperation("保存")
// @RequiresPermissions("demo:news:all") // @RequiresPermissions("demo:news:all")
public Result save(NewsDTO dto){ public Result save(NewsDTO dto) {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -78,7 +76,7 @@ public class NewsController {
@ApiOperation("修改") @ApiOperation("修改")
@LogOperation("修改") @LogOperation("修改")
// @RequiresPermissions("demo:news:all") // @RequiresPermissions("demo:news:all")
public Result update(NewsDTO dto){ public Result update(NewsDTO dto) {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -91,7 +89,7 @@ public class NewsController {
@ApiOperation("删除") @ApiOperation("删除")
@LogOperation("删除") @LogOperation("删除")
// @RequiresPermissions("demo:news:all") // @RequiresPermissions("demo:news:all")
public Result delete(@RequestBody Long[] ids){ public Result delete(@RequestBody Long[] ids) {
//效验数据 //效验数据
AssertUtils.isArrayEmpty(ids, "id"); AssertUtils.isArrayEmpty(ids, "id");

View File

@ -15,7 +15,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
@ -25,11 +24,10 @@ import java.util.Map;
/** /**
* 产品管理 * 产品管理
*
*/ */
@RestController @RestController
@RequestMapping("demo/product") @RequestMapping("demo/product")
@Api(tags="产品管理") @Api(tags = "产品管理")
public class ProductController { public class ProductController {
@Autowired @Autowired
private ProductService productService; private ProductService productService;
@ -37,13 +35,13 @@ public class ProductController {
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页") @ApiOperation("分页")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")
}) })
// @RequiresPermissions("demo:product:page") // @RequiresPermissions("demo:product:page")
public Result<PageData<ProductDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<ProductDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<ProductDTO> page = productService.page(params); PageData<ProductDTO> page = productService.page(params);
return new Result<PageData<ProductDTO>>().ok(page); return new Result<PageData<ProductDTO>>().ok(page);
@ -52,7 +50,7 @@ public class ProductController {
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation("信息") @ApiOperation("信息")
// @RequiresPermissions("demo:product:info") // @RequiresPermissions("demo:product:info")
public Result<ProductDTO> get(@PathVariable("id") Long id){ public Result<ProductDTO> get(@PathVariable("id") Long id) {
ProductDTO data = productService.get(id); ProductDTO data = productService.get(id);
return new Result<ProductDTO>().ok(data); return new Result<ProductDTO>().ok(data);
@ -62,7 +60,7 @@ public class ProductController {
@ApiOperation("保存") @ApiOperation("保存")
@LogOperation("保存") @LogOperation("保存")
// @RequiresPermissions("demo:product:save") // @RequiresPermissions("demo:product:save")
public Result save(@RequestBody ProductDTO dto){ public Result save(@RequestBody ProductDTO dto) {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -75,7 +73,7 @@ public class ProductController {
@ApiOperation("修改") @ApiOperation("修改")
@LogOperation("修改") @LogOperation("修改")
// @RequiresPermissions("demo:product:update") // @RequiresPermissions("demo:product:update")
public Result update(@RequestBody ProductDTO dto){ public Result update(@RequestBody ProductDTO dto) {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -88,7 +86,7 @@ public class ProductController {
@ApiOperation("删除") @ApiOperation("删除")
@LogOperation("删除") @LogOperation("删除")
// @RequiresPermissions("demo:product:delete") // @RequiresPermissions("demo:product:delete")
public Result delete(@RequestBody Long[] ids){ public Result delete(@RequestBody Long[] ids) {
//效验数据 //效验数据
AssertUtils.isArrayEmpty(ids, "id"); AssertUtils.isArrayEmpty(ids, "id");

View File

@ -5,10 +5,10 @@ import io.renren.modules.demo.entity.ExcelDataEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
* Excel导入演示 * Excel导入演示
* *
* @author Mark sunlightcs@gmail.com * @author Mark sunlightcs@gmail.com
*/ */
@Mapper @Mapper
public interface ExcelDataDao extends BaseDao<ExcelDataEntity> { public interface ExcelDataDao extends BaseDao<ExcelDataEntity> {

View File

@ -9,7 +9,6 @@ import java.util.Map;
/** /**
* 新闻 * 新闻
*
*/ */
@Mapper @Mapper
public interface NewsDao extends BaseDao<NewsEntity> { public interface NewsDao extends BaseDao<NewsEntity> {

View File

@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Mapper;
/** /**
* 产品管理 * 产品管理
*
*/ */
@Mapper @Mapper
public interface ProductDao extends BaseDao<ProductEntity> { public interface ProductDao extends BaseDao<ProductEntity> {

View File

@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Mapper;
/** /**
* 产品参数管理 * 产品参数管理
*
*/ */
@Mapper @Mapper
public interface ProductParamsDao extends BaseDao<ProductParamsEntity> { public interface ProductParamsDao extends BaseDao<ProductParamsEntity> {

View File

@ -9,10 +9,10 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* Excel导入演示 * Excel导入演示
* *
* @author Mark sunlightcs@gmail.com * @author Mark sunlightcs@gmail.com
*/ */
@Data @Data
@ApiModel(value = "Excel导入演示") @ApiModel(value = "Excel导入演示")
public class ExcelDataDTO implements Serializable { public class ExcelDataDTO implements Serializable {
@ -27,7 +27,7 @@ public class ExcelDataDTO implements Serializable {
@ApiModelProperty(value = "家庭地址") @ApiModelProperty(value = "家庭地址")
private String address; private String address;
@ApiModelProperty(value = "入学日期") @ApiModelProperty(value = "入学日期")
@JsonFormat(pattern="yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date joinDate; private Date joinDate;
@ApiModelProperty(value = "班级名称") @ApiModelProperty(value = "班级名称")
private String className; private String className;

View File

@ -16,23 +16,22 @@ import java.util.Date;
/** /**
* 新闻管理 * 新闻管理
*
*/ */
@Data @Data
@ApiModel(value = "新闻管理") @ApiModel(value = "新闻管理")
public class NewsDTO implements Serializable { public class NewsDTO implements Serializable {
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
@Null(message="{id.null}", groups = AddGroup.class) @Null(message = "{id.null}", groups = AddGroup.class)
@NotNull(message="{id.require}", groups = UpdateGroup.class) @NotNull(message = "{id.require}", groups = UpdateGroup.class)
private Long id; private Long id;
@ApiModelProperty(value = "标题") @ApiModelProperty(value = "标题")
@NotBlank(message="{news.title.require}", groups = DefaultGroup.class) @NotBlank(message = "{news.title.require}", groups = DefaultGroup.class)
private String title; private String title;
@ApiModelProperty(value = "内容") @ApiModelProperty(value = "内容")
@NotBlank(message="{news.content.require}", groups = DefaultGroup.class) @NotBlank(message = "{news.content.require}", groups = DefaultGroup.class)
private String content; private String content;
@ApiModelProperty(value = "发布时间") @ApiModelProperty(value = "发布时间")

View File

@ -11,26 +11,25 @@ import java.util.List;
/** /**
* 产品管理 * 产品管理
*
*/ */
@Data @Data
@ApiModel(value = "产品管理") @ApiModel(value = "产品管理")
public class ProductDTO implements Serializable { public class ProductDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private Long id; private Long id;
@ApiModelProperty(value = "产品名称") @ApiModelProperty(value = "产品名称")
private String name; private String name;
@ApiModelProperty(value = "产品介绍") @ApiModelProperty(value = "产品介绍")
private String content; private String content;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date createDate; private Date createDate;
@ApiModelProperty(value = "产品参数列表") @ApiModelProperty(value = "产品参数列表")
private List<ProductParamsDTO> subList; private List<ProductParamsDTO> subList;
} }

View File

@ -9,16 +9,15 @@ import java.io.Serializable;
/** /**
* 产品参数管理 * 产品参数管理
*
*/ */
@Data @Data
@ApiModel(value = "产品参数管理") @ApiModel(value = "产品参数管理")
public class ProductParamsDTO implements Serializable { public class ProductParamsDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "参数名") @ApiModelProperty(value = "参数名")
private String paramName; private String paramName;
@ApiModelProperty(value = "参数值") @ApiModelProperty(value = "参数值")
private String paramValue; private String paramValue;
} }

View File

@ -11,47 +11,46 @@ import java.util.Date;
/** /**
* Excel导入演示 * Excel导入演示
*
*/ */
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
@TableName("tb_excel_data") @TableName("tb_excel_data")
public class ExcelDataEntity { public class ExcelDataEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* id * id
*/ */
@TableId @TableId
private Long id; private Long id;
/** /**
* 学生姓名 * 学生姓名
*/ */
private String realName; private String realName;
/** /**
* 身份证 * 身份证
*/ */
private String identity; private String identity;
/** /**
* 家庭地址 * 家庭地址
*/ */
private String address; private String address;
/** /**
* 入学日期 * 入学日期
*/ */
private Date joinDate; private Date joinDate;
/** /**
* 班级名称 * 班级名称
*/ */
private String className; private String className;
/** /**
* 创建者 * 创建者
*/ */
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
private Long creator; private Long creator;
/** /**
* 创建时间 * 创建时间
*/ */
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
private Date createDate; private Date createDate;
} }

View File

@ -11,39 +11,38 @@ import java.util.Date;
/** /**
* 新闻 * 新闻
*
*/ */
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
@TableName("tb_news") @TableName("tb_news")
public class NewsEntity extends BaseEntity { public class NewsEntity extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 标题 * 标题
*/ */
private String title; private String title;
/** /**
* 内容 * 内容
*/ */
private String content; private String content;
/** /**
* 发布时间 * 发布时间
*/ */
private Date pubDate; private Date pubDate;
/** /**
* 创建者dept_id * 创建者dept_id
*/ */
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
private Long deptId; private Long deptId;
/** /**
* 更新者 * 更新者
*/ */
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater; private Long updater;
/** /**
* 更新时间 * 更新时间
*/ */
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate; private Date updateDate;
} }

View File

@ -11,30 +11,29 @@ import java.util.Date;
/** /**
* 产品管理 * 产品管理
*
*/ */
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
@TableName("tb_product") @TableName("tb_product")
public class ProductEntity extends BaseEntity { public class ProductEntity extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 产品名称 * 产品名称
*/ */
private String name; private String name;
/** /**
* 产品介绍 * 产品介绍
*/ */
private String content; private String content;
/** /**
* 更新者 * 更新者
*/ */
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater; private Long updater;
/** /**
* 更新时间 * 更新时间
*/ */
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate; private Date updateDate;
} }

View File

@ -11,34 +11,33 @@ import java.util.Date;
/** /**
* 产品参数管理 * 产品参数管理
*
*/ */
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
@TableName("tb_product_params") @TableName("tb_product_params")
public class ProductParamsEntity extends BaseEntity { public class ProductParamsEntity extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 参数名 * 参数名
*/ */
private String paramName; private String paramName;
/** /**
* 参数值 * 参数值
*/ */
private String paramValue; private String paramValue;
/** /**
* 产品ID * 产品ID
*/ */
private Long productId; private Long productId;
/** /**
* 更新者 * 更新者
*/ */
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater; private Long updater;
/** /**
* 更新时间 * 更新时间
*/ */
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate; private Date updateDate;
} }

View File

@ -11,7 +11,6 @@ import java.util.Date;
/** /**
* Excel导入演示 * Excel导入演示
*
*/ */
@Data @Data
@ContentRowHeight(20) @ContentRowHeight(20)

View File

@ -6,7 +6,6 @@ import io.renren.modules.demo.entity.ExcelDataEntity;
/** /**
* Excel导入演示 * Excel导入演示
*
*/ */
public interface ExcelDataService extends CrudService<ExcelDataEntity, ExcelDataDTO> { public interface ExcelDataService extends CrudService<ExcelDataEntity, ExcelDataDTO> {

View File

@ -9,7 +9,6 @@ import java.util.Map;
/** /**
* 新闻 * 新闻
*
*/ */
public interface NewsService extends BaseService<NewsEntity> { public interface NewsService extends BaseService<NewsEntity> {

View File

@ -8,7 +8,6 @@ import java.util.List;
/** /**
* 产品参数管理 * 产品参数管理
*
*/ */
public interface ProductParamsService extends BaseService<ProductParamsEntity> { public interface ProductParamsService extends BaseService<ProductParamsEntity> {

View File

@ -6,7 +6,6 @@ import io.renren.modules.demo.entity.ProductEntity;
/** /**
* 产品管理 * 产品管理
*
*/ */
public interface ProductService extends CrudService<ProductEntity, ProductDTO> { public interface ProductService extends CrudService<ProductEntity, ProductDTO> {

View File

@ -13,19 +13,18 @@ import java.util.Map;
/** /**
* Excel导入演示 * Excel导入演示
*
*/ */
@Service @Service
public class ExcelDataServiceImpl extends CrudServiceImpl<ExcelDataDao, ExcelDataEntity, ExcelDataDTO> implements ExcelDataService { public class ExcelDataServiceImpl extends CrudServiceImpl<ExcelDataDao, ExcelDataEntity, ExcelDataDTO> implements ExcelDataService {
@Override @Override
public QueryWrapper<ExcelDataEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<ExcelDataEntity> getWrapper(Map<String, Object> params) {
QueryWrapper<ExcelDataEntity> wrapper = new QueryWrapper<>(); QueryWrapper<ExcelDataEntity> wrapper = new QueryWrapper<>();
String realName = (String)params.get("realName"); String realName = (String) params.get("realName");
wrapper.like(StringUtils.isNotBlank(realName), "real_name", realName); wrapper.like(StringUtils.isNotBlank(realName), "real_name", realName);
String identity = (String)params.get("identity"); String identity = (String) params.get("identity");
wrapper.like(StringUtils.isNotBlank(identity), "identity", identity); wrapper.like(StringUtils.isNotBlank(identity), "identity", identity);
return wrapper; return wrapper;

View File

@ -14,7 +14,6 @@ import java.util.List;
/** /**
* 产品参数管理 * 产品参数管理
*
*/ */
@Service @Service
public class ProductParamsServiceImpl extends BaseServiceImpl<ProductParamsDao, ProductParamsEntity> implements ProductParamsService { public class ProductParamsServiceImpl extends BaseServiceImpl<ProductParamsDao, ProductParamsEntity> implements ProductParamsService {
@ -24,12 +23,12 @@ public class ProductParamsServiceImpl extends BaseServiceImpl<ProductParamsDao,
//先删除子表数据 //先删除子表数据
deleteByProductIds(new Long[]{productId}); deleteByProductIds(new Long[]{productId});
if(CollUtil.isEmpty(list)){ if (CollUtil.isEmpty(list)) {
return ; return;
} }
//保存子表数据 //保存子表数据
for(ProductParamsDTO dto : list){ for (ProductParamsDTO dto : list) {
ProductParamsEntity entity = new ProductParamsEntity(); ProductParamsEntity entity = new ProductParamsEntity();
entity.setProductId(productId); entity.setProductId(productId);
entity.setParamName(dto.getParamName()); entity.setParamName(dto.getParamName());

View File

@ -18,7 +18,6 @@ import java.util.Map;
/** /**
* 产品管理 * 产品管理
*
*/ */
@Service @Service
public class ProductServiceImpl extends CrudServiceImpl<ProductDao, ProductEntity, ProductDTO> implements ProductService { public class ProductServiceImpl extends CrudServiceImpl<ProductDao, ProductEntity, ProductDTO> implements ProductService {
@ -26,8 +25,8 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductDao, ProductEntit
private ProductParamsService productParamsService; private ProductParamsService productParamsService;
@Override @Override
public QueryWrapper<ProductEntity> getWrapper(Map<String, Object> params){ public QueryWrapper<ProductEntity> getWrapper(Map<String, Object> params) {
String id = (String)params.get("id"); String id = (String) params.get("id");
QueryWrapper<ProductEntity> wrapper = new QueryWrapper<>(); QueryWrapper<ProductEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id); wrapper.eq(StringUtils.isNotBlank(id), "id", id);

View File

@ -49,7 +49,7 @@ public class DevelopmentGuideController {
try { try {
String s = developmentGuideService.uploadDevelopmentFile(uploadFile, request); String s = developmentGuideService.uploadDevelopmentFile(uploadFile, request);
return new Result<String>().ok(s); return new Result<String>().ok(s);
}catch (Exception e) { } catch (Exception e) {
return new Result<String>().error(e.getMessage()); return new Result<String>().error(e.getMessage());
} }
} }

View File

@ -30,7 +30,7 @@ public class DevelopmentGuideServiceImpl implements DevelopmentGuideService {
logger.info("----------------------------------获取开发指南--------------------------------------------------"); logger.info("----------------------------------获取开发指南--------------------------------------------------");
String type = request.getParameter("type"); String type = request.getParameter("type");
String resourceId = request.getParameter("resourceId"); String resourceId = request.getParameter("resourceId");
logger.info("读取文件类型及能力ID{};{}", type , resourceId); logger.info("读取文件类型及能力ID{};{}", type, resourceId);
String url = devModelFilePath + File.separator + type + File.separator + resourceId + ".md"; String url = devModelFilePath + File.separator + type + File.separator + resourceId + ".md";
String filePath = devModelFilePath + File.separator + type; String filePath = devModelFilePath + File.separator + type;
File file = new File(url); File file = new File(url);
@ -39,7 +39,7 @@ public class DevelopmentGuideServiceImpl implements DevelopmentGuideService {
logger.info("文件--->{}", url); logger.info("文件--->{}", url);
if (new File(filePath).exists()) { if (new File(filePath).exists()) {
if (! file.exists()) { if (!file.exists()) {
file = new File(devModelFilePath + File.separator + type + File.separator + type + ".md"); file = new File(devModelFilePath + File.separator + type + File.separator + type + ".md");
} }
} else { } else {
@ -65,11 +65,11 @@ public class DevelopmentGuideServiceImpl implements DevelopmentGuideService {
} }
@Override @Override
public String uploadDevelopmentFile(MultipartFile uploadFile, HttpServletRequest request) throws Exception{ public String uploadDevelopmentFile(MultipartFile uploadFile, HttpServletRequest request) throws Exception {
logger.info("----------------------------------开始上传开发指南--------------------------------------------------"); logger.info("----------------------------------开始上传开发指南--------------------------------------------------");
String type = request.getParameter("type"); String type = request.getParameter("type");
String fileName = request.getParameter("fileName"); String fileName = request.getParameter("fileName");
logger.info("读取文件类型及文件名:{};{}", type , fileName); logger.info("读取文件类型及文件名:{};{}", type, fileName);
File folder = new File(devModelFilePath + File.separator + type + File.separator + fileName); File folder = new File(devModelFilePath + File.separator + type + File.separator + fileName);
File path = new File(devModelFilePath + File.separator + type + File.separator); File path = new File(devModelFilePath + File.separator + type + File.separator);
//文件保存过删除后重新保存 //文件保存过删除后重新保存

View File

@ -77,7 +77,7 @@ public class TbDeviceApplyController {
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation("查看申请信息") @ApiOperation("查看申请信息")
public Result<TbDeviceApplyDTO> get(@PathVariable("id") Long id){ public Result<TbDeviceApplyDTO> get(@PathVariable("id") Long id) {
TbDeviceApplyDTO data = tbDeviceApplyService.get(id); TbDeviceApplyDTO data = tbDeviceApplyService.get(id);
return new Result<TbDeviceApplyDTO>().ok(data); return new Result<TbDeviceApplyDTO>().ok(data);
} }
@ -85,12 +85,12 @@ public class TbDeviceApplyController {
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页查询申请记录(我的申请)") @ApiOperation("分页查询申请记录(我的申请)")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = "roomName", value = "设备名称", paramType = "query", dataType="String") , @ApiImplicitParam(name = "roomName", value = "设备名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "state", value = "申请状态", paramType = "query", dataType="String") @ApiImplicitParam(name = "state", value = "申请状态", paramType = "query", dataType = "String")
}) })
public Result<PageData<TbDeviceApplyDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<TbDeviceApplyDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<TbDeviceApplyDTO> page = tbDeviceApplyService.queryList(params); PageData<TbDeviceApplyDTO> page = tbDeviceApplyService.queryList(params);
return new Result<PageData<TbDeviceApplyDTO>>().ok(page); return new Result<PageData<TbDeviceApplyDTO>>().ok(page);
} }
@ -98,13 +98,13 @@ public class TbDeviceApplyController {
@GetMapping("auditPage") @GetMapping("auditPage")
@ApiOperation("分页查询申请记录(我的待办)") @ApiOperation("分页查询申请记录(我的待办)")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = "deviceName", value = "设备名称", paramType = "query", dataType="String"), @ApiImplicitParam(name = "deviceName", value = "设备名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "state", value = "申请状态", paramType = "query", dataType="int") @ApiImplicitParam(name = "state", value = "申请状态", paramType = "query", dataType = "int")
}) })
public Result<PageData<TbDeviceApplyDTO>> auditPage(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<TbDeviceApplyDTO>> auditPage(@ApiIgnore @RequestParam Map<String, Object> params) {
if(params.get("state") != null){ if (params.get("state") != null) {
params.put("states", ImmutableList.of(params.get("state"))); params.put("states", ImmutableList.of(params.get("state")));
} }
PageData<TbDeviceApplyDTO> page = tbDeviceApplyService.queryAuditList(params); PageData<TbDeviceApplyDTO> page = tbDeviceApplyService.queryAuditList(params);
@ -114,15 +114,15 @@ public class TbDeviceApplyController {
@GetMapping("myDonePage") @GetMapping("myDonePage")
@ApiOperation("分页查询申请记录(我的已办)") @ApiOperation("分页查询申请记录(我的已办)")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = "deviceName", value = "设备名称", paramType = "query", dataType="String"), @ApiImplicitParam(name = "deviceName", value = "设备名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "state", value = "申请状态", paramType = "query", dataType="int") @ApiImplicitParam(name = "state", value = "申请状态", paramType = "query", dataType = "int")
}) })
public Result<PageData<TbDeviceApplyDTO>> myDonePage(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<TbDeviceApplyDTO>> myDonePage(@ApiIgnore @RequestParam Map<String, Object> params) {
if(params.get("state") == null || "".equals(params.get("state"))){ if (params.get("state") == null || "".equals(params.get("state"))) {
params.put("states", ImmutableList.of(2,3)); params.put("states", ImmutableList.of(2, 3));
}else{ } else {
params.put("states", ImmutableList.of(params.get("state"))); params.put("states", ImmutableList.of(params.get("state")));
} }
PageData<TbDeviceApplyDTO> page = tbDeviceApplyService.queryAuditList(params); PageData<TbDeviceApplyDTO> page = tbDeviceApplyService.queryAuditList(params);
@ -137,20 +137,20 @@ public class TbDeviceApplyController {
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
dto.setCreator(SecurityUser.getUserId()); dto.setCreator(SecurityUser.getUserId());
dto.setCreateDate(new Date()); dto.setCreateDate(new Date());
if(dto.getDeviceName()==null){ if (dto.getDeviceName() == null) {
dto.setDeviceName(tbDeviceService.get(dto.getDeviceId()).getName()); dto.setDeviceName(tbDeviceService.get(dto.getDeviceId()).getName());
} }
QueryWrapper wrapper=new QueryWrapper<TbDeviceDTO>(); QueryWrapper wrapper = new QueryWrapper<TbDeviceDTO>();
wrapper.eq( "creator", dto.getCreator()); wrapper.eq("creator", dto.getCreator());
wrapper.eq("device_id", dto.getDeviceId()); wrapper.eq("device_id", dto.getDeviceId());
if(!tbDeviceApplyDao.selectList(wrapper).isEmpty()){ if (!tbDeviceApplyDao.selectList(wrapper).isEmpty()) {
return new Result().error("请勿重复申请!"); return new Result().error("请勿重复申请!");
} }
// 发起预约后推送消息 // 发起预约后推送消息
SysRoleDTO roleDTO = sysRoleService.getByName(roleName); SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(sysDeptService.getByName(bigDateDeptName).getId(), roleDTO.getId()); SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(sysDeptService.getByName(bigDateDeptName).getId(), roleDTO.getId());
dto.setAuditor(userDTO==null ? Long.parseLong(defaultAssigneeRoleId) : userDTO.getId()); dto.setAuditor(userDTO == null ? Long.parseLong(defaultAssigneeRoleId) : userDTO.getId());
tbDeviceApplyService.save(dto); tbDeviceApplyService.save(dto);
codeGenerationUtils.setApplyNumber("SBSQ", Collections.singletonList(dto.getId()), jdbcTemplate); codeGenerationUtils.setApplyNumber("SBSQ", Collections.singletonList(dto.getId()), jdbcTemplate);
@ -161,7 +161,7 @@ public class TbDeviceApplyController {
sysNoticeDTO.setTitle("设备申请审核通知"); sysNoticeDTO.setTitle("设备申请审核通知");
sysNoticeDTO.setContent(content); // 通知内容 sysNoticeDTO.setContent(content); // 通知内容
sysNoticeDTO.setReceiverType(1); sysNoticeDTO.setReceiverType(1);
sysNoticeDTO.setReceiverTypeIds(userDTO==null ? defaultAssigneeRoleId : userDTO.getId().toString()); sysNoticeDTO.setReceiverTypeIds(userDTO == null ? defaultAssigneeRoleId : userDTO.getId().toString());
sysNoticeDTO.setStatus(NoticeStatusEnum.SEND.value()); sysNoticeDTO.setStatus(NoticeStatusEnum.SEND.value());
sysNoticeDTO.setSenderName("流程系统"); sysNoticeDTO.setSenderName("流程系统");
sysNoticeDTO.setSenderDate(new Date()); sysNoticeDTO.setSenderDate(new Date());
@ -172,7 +172,7 @@ public class TbDeviceApplyController {
// 还要发送自己能看到的的谁给我审核的消息 // 还要发送自己能看到的的谁给我审核的消息
String ownedContent = "【通知】您发起的" + dto.getDeviceName() + String ownedContent = "【通知】您发起的" + dto.getDeviceName() +
"设备申请,当前审核部门为:" + bigDateDeptName + ",审核负责人:" + "设备申请,当前审核部门为:" + bigDateDeptName + ",审核负责人:" +
(userDTO==null ? sysUserService.get(Long.parseLong(defaultAssigneeRoleId)).getRealName() : userDTO.getRealName()); (userDTO == null ? sysUserService.get(Long.parseLong(defaultAssigneeRoleId)).getRealName() : userDTO.getRealName());
SysNoticeDTO ownedSysNoticeDTO = new SysNoticeDTO(); SysNoticeDTO ownedSysNoticeDTO = new SysNoticeDTO();
ownedSysNoticeDTO.setType(2); ownedSysNoticeDTO.setType(2);
ownedSysNoticeDTO.setTitle("设备申请发起通知"); ownedSysNoticeDTO.setTitle("设备申请发起通知");
@ -198,14 +198,14 @@ public class TbDeviceApplyController {
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
dto.setAuditTime(new Date()); dto.setAuditTime(new Date());
tbDeviceApplyService.update(dto); tbDeviceApplyService.update(dto);
if(dto.getDeviceName()==null){ if (dto.getDeviceName() == null) {
dto.setDeviceName(tbDeviceService.get(dto.getDeviceId()).getName()); dto.setDeviceName(tbDeviceService.get(dto.getDeviceId()).getName());
} }
// 修改之后推送存通知sysNotice // 修改之后推送存通知sysNotice
String state = dto.getState() == 2 ? "通过" : "不通过"; String state = dto.getState() == 2 ? "通过" : "不通过";
SysUserDTO userDTO=sysUserService.get(dto.getAuditor()); SysUserDTO userDTO = sysUserService.get(dto.getAuditor());
String content = "【通知】" + dto.getName() + ",您发起的" + dto.getDeviceName() + String content = "【通知】" + dto.getName() + ",您发起的" + dto.getDeviceName() +
"设备申请,审核结果为:" + state + ",请联系技术人员:"+userDTO.getRealName()+",手机号:"+userDTO.getMobile()+"获取设备"; "设备申请,审核结果为:" + state + ",请联系技术人员:" + userDTO.getRealName() + ",手机号:" + userDTO.getMobile() + "获取设备";
SysNoticeDTO sysNoticeDTO = new SysNoticeDTO(); SysNoticeDTO sysNoticeDTO = new SysNoticeDTO();
sysNoticeDTO.setType(2); sysNoticeDTO.setType(2);
sysNoticeDTO.setTitle("设备申请审核结果通知"); sysNoticeDTO.setTitle("设备申请审核结果通知");

View File

@ -26,7 +26,7 @@ import java.util.Map;
* @date:2022/9/20 * @date:2022/9/20
* @des * @des
*/ */
@Api(tags="设备") @Api(tags = "设备")
@RestController @RestController
@RequestMapping("device") @RequestMapping("device")
public class TbDeviceController { public class TbDeviceController {
@ -39,11 +39,11 @@ public class TbDeviceController {
@GetMapping("page") @GetMapping("page")
@ApiOperation("分页") @ApiOperation("分页")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = "type", value = "设备类型", paramType = "query",dataType="String") , @ApiImplicitParam(name = "type", value = "设备类型", paramType = "query", dataType = "String"),
}) })
public Result<PageData<TbDeviceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<TbDeviceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<TbDeviceDTO> page = tbDeviceService.page(params); PageData<TbDeviceDTO> page = tbDeviceService.page(params);
return new Result<PageData<TbDeviceDTO>>().ok(page); return new Result<PageData<TbDeviceDTO>>().ok(page);
} }
@ -58,11 +58,11 @@ public class TbDeviceController {
@PostMapping @PostMapping
@ApiOperation("新增") @ApiOperation("新增")
@LogOperation("新增") @LogOperation("新增")
public Result save(@RequestBody TbDeviceDTO dto){ public Result save(@RequestBody TbDeviceDTO dto) {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tbDeviceService.save(dto); tbDeviceService.save(dto);
dto.getDeviceAttrDTOList().stream().forEach(attr->{ dto.getDeviceAttrDTOList().stream().forEach(attr -> {
attr.setDeviceId(dto.getId()); attr.setDeviceId(dto.getId());
tbDeviceAttrService.save(attr); tbDeviceAttrService.save(attr);
}); });
@ -79,5 +79,4 @@ public class TbDeviceController {
} }
} }

View File

@ -15,7 +15,7 @@ import java.util.Date;
* @des * @des
*/ */
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
@TableName("tb_device") @TableName("tb_device")
public class TbDeviceEntity extends BaseEntity { public class TbDeviceEntity extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -44,22 +44,22 @@ public class TbDeviceApplyServiceImpl extends CrudServiceImpl<TbDeviceApplyDao,
//分页参数 //分页参数
int curPage = 1; int curPage = 1;
int limit = 10; int limit = 10;
if(params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())){ if (params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())) {
limit = Integer.parseInt(params.get("limit").toString()); limit = Integer.parseInt(params.get("limit").toString());
} }
if(params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())){ if (params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())) {
curPage = Integer.parseInt(params.get("page").toString()); curPage = Integer.parseInt(params.get("page").toString());
} }
params.put("userId", SecurityUser.getUserId()); params.put("userId", SecurityUser.getUserId());
List<TbDeviceApplyDTO> dtoList = tbDeviceApplyDao.queryListForAudit(params); List<TbDeviceApplyDTO> dtoList = tbDeviceApplyDao.queryListForAudit(params);
List<TbDeviceApplyDTO> resultList; List<TbDeviceApplyDTO> resultList;
if(params.get("deviceName") != null && !"".equals(params.get("deviceName"))){ if (params.get("deviceName") != null && !"".equals(params.get("deviceName"))) {
resultList = dtoList.stream().filter(it->tbDeviceService.get(it.getDeviceId()).getName().contains(params.get("deviceName").toString())).collect(Collectors.toList()); resultList = dtoList.stream().filter(it -> tbDeviceService.get(it.getDeviceId()).getName().contains(params.get("deviceName").toString())).collect(Collectors.toList());
}else{ } else {
resultList=dtoList; resultList = dtoList;
} }
List<TbDeviceApplyDTO> result = resultList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); List<TbDeviceApplyDTO> result = resultList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList());
result.stream().forEach(it->{ result.stream().forEach(it -> {
it.setTbDeviceDTO(tbDeviceService.get(it.getDeviceId())); it.setTbDeviceDTO(tbDeviceService.get(it.getDeviceId()));
it.setAuditorName(sysUserService.get(it.getAuditor()).getRealName()); it.setAuditorName(sysUserService.get(it.getAuditor()).getRealName());
}); });
@ -71,24 +71,24 @@ public class TbDeviceApplyServiceImpl extends CrudServiceImpl<TbDeviceApplyDao,
//分页参数 //分页参数
int curPage = 1; int curPage = 1;
int limit = 10; int limit = 10;
if(params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())){ if (params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())) {
limit = Integer.parseInt(params.get("limit").toString()); limit = Integer.parseInt(params.get("limit").toString());
} }
if(params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())){ if (params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())) {
curPage = Integer.parseInt(params.get("page").toString()); curPage = Integer.parseInt(params.get("page").toString());
} }
params.put("userId", SecurityUser.getUserId()); params.put("userId", SecurityUser.getUserId());
List<Integer> stateList=new ArrayList<>(); List<Integer> stateList = new ArrayList<>();
if(params.containsKey("state") && StringUtils.isNotBlank(params.get("state").toString())){ if (params.containsKey("state") && StringUtils.isNotBlank(params.get("state").toString())) {
String state=params.get("state").toString(); String state = params.get("state").toString();
if("审核中".equals(state)){ if ("审核中".equals(state)) {
stateList.add(0); stateList.add(0);
}else if("审核完成".equals(state)){ } else if ("审核完成".equals(state)) {
stateList.add(2); stateList.add(2);
stateList.add(3); stateList.add(3);
} }
} }
params.put("states",stateList); params.put("states", stateList);
List<TbDeviceApplyDTO> dtoList = tbDeviceApplyDao.queryList(params); List<TbDeviceApplyDTO> dtoList = tbDeviceApplyDao.queryList(params);
List<TbDeviceApplyDTO> result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); List<TbDeviceApplyDTO> result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList());
return new PageData(result, dtoList.size()); return new PageData(result, dtoList.size());

View File

@ -70,7 +70,7 @@ public class TbDeviceServiceImpl extends CrudServiceImpl<TbDeviceDao, TbDeviceEn
@Override @Override
public TbDeviceDTO getDeviceById(Long id) { public TbDeviceDTO getDeviceById(Long id) {
TbDeviceEntity deviceEntity = baseDao.selectById(id); TbDeviceEntity deviceEntity = baseDao.selectById(id);
if(deviceEntity==null){ if (deviceEntity == null) {
return null; return null;
} }
TbDeviceDTO deviceDTO = new TbDeviceDTO(); TbDeviceDTO deviceDTO = new TbDeviceDTO();

View File

@ -11,7 +11,6 @@ import java.sql.SQLException;
/** /**
* 数据源信息 * 数据源信息
*
*/ */
@Data @Data
public class DataSourceInfo { public class DataSourceInfo {
@ -47,19 +46,19 @@ public class DataSourceInfo {
this.username = entity.getUsername(); this.username = entity.getUsername();
this.password = entity.getPassword(); this.password = entity.getPassword();
if(dbType == DbType.MySQL) { if (dbType == DbType.MySQL) {
this.dbQuery = new MySqlQuery(); this.dbQuery = new MySqlQuery();
}else if(dbType == DbType.Oracle) { } else if (dbType == DbType.Oracle) {
this.dbQuery = new OracleQuery(); this.dbQuery = new OracleQuery();
}else if(dbType == DbType.SQLServer) { } else if (dbType == DbType.SQLServer) {
this.dbQuery = new SqlServerQuery(); this.dbQuery = new SqlServerQuery();
}else if(dbType == DbType.PostgreSQL) { } else if (dbType == DbType.PostgreSQL) {
this.dbQuery = new PostgreSqlQuery(); this.dbQuery = new PostgreSqlQuery();
} }
try { try {
this.connection = DbUtils.getConnection(this); this.connection = DbUtils.getConnection(this);
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -68,13 +67,13 @@ public class DataSourceInfo {
this.id = 0L; this.id = 0L;
this.dbType = DbType.valueOf(connection.getMetaData().getDatabaseProductName()); this.dbType = DbType.valueOf(connection.getMetaData().getDatabaseProductName());
if(dbType == DbType.MySQL) { if (dbType == DbType.MySQL) {
this.dbQuery = new MySqlQuery(); this.dbQuery = new MySqlQuery();
}else if(dbType == DbType.Oracle) { } else if (dbType == DbType.Oracle) {
this.dbQuery = new OracleQuery(); this.dbQuery = new OracleQuery();
}else if(dbType == DbType.SQLServer) { } else if (dbType == DbType.SQLServer) {
this.dbQuery = new SqlServerQuery(); this.dbQuery = new SqlServerQuery();
}else if(dbType == DbType.PostgreSQL) { } else if (dbType == DbType.PostgreSQL) {
this.dbQuery = new PostgreSqlQuery(); this.dbQuery = new PostgreSqlQuery();
} }

View File

@ -5,7 +5,6 @@ import io.renren.modules.devtools.utils.DbType;
/** /**
* Query * Query
*
*/ */
public interface AbstractQuery { public interface AbstractQuery {

View File

@ -5,7 +5,6 @@ import org.apache.commons.lang.StringUtils;
/** /**
* MySQL查询 * MySQL查询
*
*/ */
public class MySqlQuery implements AbstractQuery { public class MySqlQuery implements AbstractQuery {
@ -20,7 +19,7 @@ public class MySqlQuery implements AbstractQuery {
sql.append("select table_name, table_comment from information_schema.tables "); sql.append("select table_name, table_comment from information_schema.tables ");
sql.append("where table_schema = (select database()) "); sql.append("where table_schema = (select database()) ");
//表名查询 //表名查询
if(StringUtils.isNotBlank(tableName)){ if (StringUtils.isNotBlank(tableName)) {
sql.append("and table_name = '").append(tableName).append("' "); sql.append("and table_name = '").append(tableName).append("' ");
} }
sql.append("order by table_name asc"); sql.append("order by table_name asc");

View File

@ -6,7 +6,6 @@ import org.apache.commons.lang.StringUtils;
/** /**
* Oracle查询 * Oracle查询
*
*/ */
public class OracleQuery implements AbstractQuery { public class OracleQuery implements AbstractQuery {
@ -21,7 +20,7 @@ public class OracleQuery implements AbstractQuery {
sql.append("select dt.table_name, dtc.comments from user_tables dt,user_tab_comments dtc "); sql.append("select dt.table_name, dtc.comments from user_tables dt,user_tab_comments dtc ");
sql.append("where dt.table_name = dtc.table_name "); sql.append("where dt.table_name = dtc.table_name ");
//表名查询 //表名查询
if(StringUtils.isNotBlank(tableName)){ if (StringUtils.isNotBlank(tableName)) {
sql.append("and dt.table_name = '").append(tableName).append("' "); sql.append("and dt.table_name = '").append(tableName).append("' ");
} }
sql.append("order by dt.table_name asc"); sql.append("order by dt.table_name asc");

View File

@ -5,7 +5,6 @@ import org.apache.commons.lang.StringUtils;
/** /**
* PostgreSql查询 * PostgreSql查询
*
*/ */
public class PostgreSqlQuery implements AbstractQuery { public class PostgreSqlQuery implements AbstractQuery {
@ -20,7 +19,7 @@ public class PostgreSqlQuery implements AbstractQuery {
sql.append("select t1.tablename, obj_description(relfilenode, 'pg_class') as comments from pg_tables t1, pg_class t2 "); sql.append("select t1.tablename, obj_description(relfilenode, 'pg_class') as comments from pg_tables t1, pg_class t2 ");
sql.append("where t1.tablename not like 'pg%' and t1.tablename not like 'sql_%' and t1.tablename = t2.relname "); sql.append("where t1.tablename not like 'pg%' and t1.tablename not like 'sql_%' and t1.tablename = t2.relname ");
//表名查询 //表名查询
if(StringUtils.isNotBlank(tableName)){ if (StringUtils.isNotBlank(tableName)) {
sql.append("and t1.tablename = '").append(tableName).append("' "); sql.append("and t1.tablename = '").append(tableName).append("' ");
} }
@ -30,10 +29,10 @@ public class PostgreSqlQuery implements AbstractQuery {
@Override @Override
public String tableFieldsSql() { public String tableFieldsSql() {
return "select t2.attname as columnName, pg_type.typname as dataType, col_description(t2.attrelid,t2.attnum) as columnComment," return "select t2.attname as columnName, pg_type.typname as dataType, col_description(t2.attrelid,t2.attnum) as columnComment,"
+"(CASE t3.contype WHEN 'p' THEN 'PRI' ELSE '' END) as columnKey " + "(CASE t3.contype WHEN 'p' THEN 'PRI' ELSE '' END) as columnKey "
+"from pg_class as t1, pg_attribute as t2 inner join pg_type on pg_type.oid = t2.atttypid " + "from pg_class as t1, pg_attribute as t2 inner join pg_type on pg_type.oid = t2.atttypid "
+"left join pg_constraint t3 on t2.attnum = t3.conkey[1] and t2.attrelid = t3.conrelid " + "left join pg_constraint t3 on t2.attnum = t3.conkey[1] and t2.attrelid = t3.conrelid "
+"where t1.relname = '%s' and t2.attrelid = t1.oid and t2.attnum>0"; + "where t1.relname = '%s' and t2.attrelid = t1.oid and t2.attnum>0";
} }

View File

@ -5,7 +5,6 @@ import org.apache.commons.lang.StringUtils;
/** /**
* SqlServer查询 * SqlServer查询
*
*/ */
public class SqlServerQuery implements AbstractQuery { public class SqlServerQuery implements AbstractQuery {
@ -21,7 +20,7 @@ public class SqlServerQuery implements AbstractQuery {
sql.append("left JOIN sys.extended_properties sep on sep.major_id=so.id and sep.minor_id=0 where (xtype='U' or xtype='v') "); sql.append("left JOIN sys.extended_properties sep on sep.major_id=so.id and sep.minor_id=0 where (xtype='U' or xtype='v') ");
//表名查询 //表名查询
if(StringUtils.isNotBlank(tableName)){ if (StringUtils.isNotBlank(tableName)) {
sql.append("and cast(so.name as varchar(500)) = '").append(tableName).append("' "); sql.append("and cast(so.name as varchar(500)) = '").append(tableName).append("' ");
} }
sql.append(" order by cast(so.name as varchar(500))"); sql.append(" order by cast(so.name as varchar(500))");

View File

@ -13,7 +13,6 @@ import java.util.Map;
/** /**
* 基类管理 * 基类管理
*
*/ */
@RestController @RestController
@RequestMapping("devtools/baseclass") @RequestMapping("devtools/baseclass")
@ -22,42 +21,42 @@ public class BaseClassController {
private BaseClassService baseClassService; private BaseClassService baseClassService;
@GetMapping("page") @GetMapping("page")
public Result<PageData<BaseClassEntity>> page(@RequestParam Map<String, Object> params){ public Result<PageData<BaseClassEntity>> page(@RequestParam Map<String, Object> params) {
PageData<BaseClassEntity> page = baseClassService.page(params); PageData<BaseClassEntity> page = baseClassService.page(params);
return new Result<PageData<BaseClassEntity>>().ok(page); return new Result<PageData<BaseClassEntity>>().ok(page);
} }
@GetMapping("list") @GetMapping("list")
public Result<List<BaseClassEntity>> list(){ public Result<List<BaseClassEntity>> list() {
List<BaseClassEntity> list = baseClassService.list(); List<BaseClassEntity> list = baseClassService.list();
return new Result<List<BaseClassEntity>>().ok(list); return new Result<List<BaseClassEntity>>().ok(list);
} }
@GetMapping("{id}") @GetMapping("{id}")
public Result<BaseClassEntity> get(@PathVariable("id") Long id){ public Result<BaseClassEntity> get(@PathVariable("id") Long id) {
BaseClassEntity data = baseClassService.selectById(id); BaseClassEntity data = baseClassService.selectById(id);
return new Result<BaseClassEntity>().ok(data); return new Result<BaseClassEntity>().ok(data);
} }
@PostMapping @PostMapping
public Result save(@RequestBody BaseClassEntity entity){ public Result save(@RequestBody BaseClassEntity entity) {
baseClassService.insert(entity); baseClassService.insert(entity);
return new Result(); return new Result();
} }
@PutMapping @PutMapping
public Result update(@RequestBody BaseClassEntity entity){ public Result update(@RequestBody BaseClassEntity entity) {
baseClassService.updateById(entity); baseClassService.updateById(entity);
return new Result(); return new Result();
} }
@DeleteMapping @DeleteMapping
public Result delete(@RequestBody Long[] ids){ public Result delete(@RequestBody Long[] ids) {
baseClassService.deleteBatchIds(Arrays.asList(ids)); baseClassService.deleteBatchIds(Arrays.asList(ids));
return new Result(); return new Result();

View File

@ -15,7 +15,6 @@ import java.util.Map;
/** /**
* 数据源管理 * 数据源管理
*
*/ */
@RestController @RestController
@RequestMapping("devtools/datasource") @RequestMapping("devtools/datasource")
@ -24,28 +23,28 @@ public class DataSourceController {
private DataSourceService datasourceService; private DataSourceService datasourceService;
@GetMapping("page") @GetMapping("page")
public Result<PageData<DataSourceEntity>> page(@RequestParam Map<String, Object> params){ public Result<PageData<DataSourceEntity>> page(@RequestParam Map<String, Object> params) {
PageData<DataSourceEntity> page = datasourceService.page(params); PageData<DataSourceEntity> page = datasourceService.page(params);
return new Result<PageData<DataSourceEntity>>().ok(page); return new Result<PageData<DataSourceEntity>>().ok(page);
} }
@GetMapping("list") @GetMapping("list")
public Result<List<DataSourceEntity>> list(){ public Result<List<DataSourceEntity>> list() {
List<DataSourceEntity> list = datasourceService.list(); List<DataSourceEntity> list = datasourceService.list();
return new Result<List<DataSourceEntity>>().ok(list); return new Result<List<DataSourceEntity>>().ok(list);
} }
@GetMapping("{id}") @GetMapping("{id}")
public Result<DataSourceEntity> get(@PathVariable("id") Long id){ public Result<DataSourceEntity> get(@PathVariable("id") Long id) {
DataSourceEntity data = datasourceService.selectById(id); DataSourceEntity data = datasourceService.selectById(id);
return new Result<DataSourceEntity>().ok(data); return new Result<DataSourceEntity>().ok(data);
} }
@GetMapping("test/{id}") @GetMapping("test/{id}")
public Result<String> test(@PathVariable("id") Long id){ public Result<String> test(@PathVariable("id") Long id) {
try { try {
DataSourceEntity entity = datasourceService.selectById(id); DataSourceEntity entity = datasourceService.selectById(id);
@ -58,21 +57,21 @@ public class DataSourceController {
} }
@PostMapping @PostMapping
public Result save(@RequestBody DataSourceEntity entity){ public Result save(@RequestBody DataSourceEntity entity) {
datasourceService.insert(entity); datasourceService.insert(entity);
return new Result(); return new Result();
} }
@PutMapping @PutMapping
public Result update(@RequestBody DataSourceEntity entity){ public Result update(@RequestBody DataSourceEntity entity) {
datasourceService.updateById(entity); datasourceService.updateById(entity);
return new Result(); return new Result();
} }
@DeleteMapping @DeleteMapping
public Result delete(@RequestBody Long[] ids){ public Result delete(@RequestBody Long[] ids) {
datasourceService.deleteBatchIds(Arrays.asList(ids)); datasourceService.deleteBatchIds(Arrays.asList(ids));
return new Result(); return new Result();

View File

@ -13,7 +13,6 @@ import java.util.Set;
/** /**
* 字段类型管理 * 字段类型管理
*
*/ */
@RestController @RestController
@RequestMapping("devtools/fieldtype") @RequestMapping("devtools/fieldtype")
@ -22,42 +21,42 @@ public class FieldTypeController {
private FieldTypeService fieldTypeService; private FieldTypeService fieldTypeService;
@GetMapping("page") @GetMapping("page")
public Result<PageData<FieldTypeEntity>> page(@RequestParam Map<String, Object> params){ public Result<PageData<FieldTypeEntity>> page(@RequestParam Map<String, Object> params) {
PageData<FieldTypeEntity> page = fieldTypeService.page(params); PageData<FieldTypeEntity> page = fieldTypeService.page(params);
return new Result<PageData<FieldTypeEntity>>().ok(page); return new Result<PageData<FieldTypeEntity>>().ok(page);
} }
@GetMapping("{id}") @GetMapping("{id}")
public Result<FieldTypeEntity> get(@PathVariable("id") Long id){ public Result<FieldTypeEntity> get(@PathVariable("id") Long id) {
FieldTypeEntity data = fieldTypeService.selectById(id); FieldTypeEntity data = fieldTypeService.selectById(id);
return new Result<FieldTypeEntity>().ok(data); return new Result<FieldTypeEntity>().ok(data);
} }
@GetMapping("list") @GetMapping("list")
public Result<Set<String>> list(){ public Result<Set<String>> list() {
Set<String> set = fieldTypeService.list(); Set<String> set = fieldTypeService.list();
return new Result<Set<String>>().ok(set); return new Result<Set<String>>().ok(set);
} }
@PostMapping @PostMapping
public Result save(@RequestBody FieldTypeEntity entity){ public Result save(@RequestBody FieldTypeEntity entity) {
fieldTypeService.insert(entity); fieldTypeService.insert(entity);
return new Result(); return new Result();
} }
@PutMapping @PutMapping
public Result update(@RequestBody FieldTypeEntity entity){ public Result update(@RequestBody FieldTypeEntity entity) {
fieldTypeService.updateById(entity); fieldTypeService.updateById(entity);
return new Result(); return new Result();
} }
@DeleteMapping @DeleteMapping
public Result delete(@RequestBody Long[] ids){ public Result delete(@RequestBody Long[] ids) {
fieldTypeService.deleteBatchIds(Arrays.asList(ids)); fieldTypeService.deleteBatchIds(Arrays.asList(ids));
return new Result(); return new Result();

Some files were not shown because too many files have changed in this diff Show More