全局格式化代码

This commit is contained in:
wangliwen 2022-09-29 17:51:37 +08:00
parent dc7821387c
commit ea141edbfa
708 changed files with 25534 additions and 23812 deletions

View File

@ -2,7 +2,8 @@
### 关于数据库或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语句增加表的字段时不要指定新增字段位于已有字段后;防止表内不存在指定表字段导致ddl失败

View File

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

12
pom.xml
View File

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

View File

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

View File

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

View File

@ -1,27 +1,22 @@
package io.renren.common.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.*;
/**
* 操作日志注解
*
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
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
@Component
@ -36,24 +35,24 @@ public class DataFilterAspect {
@Before("dataFilterCut()")
public void dataFilter(JoinPoint point) {
Object params = point.getArgs()[0];
if(params instanceof Map){
if (params instanceof Map) {
UserDetail user = SecurityUser.getUser();
//如果是超级管理员则不进行数据过滤
if(user.getSuperAdmin() == SuperAdminEnum.YES.value()) {
return ;
if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) {
return;
}
try {
//否则进行数据过滤
Map map = (Map)params;
Map map = (Map) params;
String sqlFilter = getSqlFilter(user, point);
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);
@ -69,8 +68,8 @@ public class DataFilterAspect {
//获取表的别名
String tableAlias = dataFilter.tableAlias();
if(StringUtils.isNotBlank(tableAlias)){
tableAlias += ".";
if (StringUtils.isNotBlank(tableAlias)) {
tableAlias += ".";
}
StringBuilder sqlFilter = new StringBuilder();
@ -78,14 +77,14 @@ public class DataFilterAspect {
//部门ID列表
List<Long> deptIdList = user.getDeptIdList();
if(CollUtil.isNotEmpty(deptIdList)){
if (CollUtil.isNotEmpty(deptIdList)) {
sqlFilter.append(tableAlias).append(dataFilter.deptId());
sqlFilter.append(" in(").append(StringUtils.join(deptIdList, ",")).append(")");
}
//查询本人数据
if(CollUtil.isNotEmpty(deptIdList)){
if (CollUtil.isNotEmpty(deptIdList)) {
sqlFilter.append(" or ");
}
sqlFilter.append(tableAlias).append(dataFilter.userId()).append("=").append(user.getId());

View File

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

View File

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

View File

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

View File

@ -58,7 +58,6 @@ public class CensusController {
private String[] censusApplyTypes; // 需要进行申请统计的资源类型
/**
* 获取各类资源数目
*
@ -382,7 +381,7 @@ public class CensusController {
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@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));
}
@ -396,7 +395,7 @@ public class CensusController {
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@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));
}

View File

@ -23,7 +23,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -182,7 +181,7 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
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" +
" 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")
})
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" +
" 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);
@ -247,7 +246,7 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType", value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
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" +
" (\n" +
" SELECT DISTINCT(c.id) AS id,c.name FROM \n" +

View File

@ -26,69 +26,69 @@ import java.util.Map;
*/
@RestControllerAdvice
public class RenExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(RenExceptionHandler.class);
private static final Logger logger = LoggerFactory.getLogger(RenExceptionHandler.class);
@Autowired
private SysLogErrorService sysLogErrorService;
@Autowired
private SysLogErrorService sysLogErrorService;
/**
* 处理自定义异常
*/
@ExceptionHandler(RenException.class)
public Result handleRenException(RenException ex){
Result result = new Result();
result.error(ex.getCode(), ex.getMsg());
/**
* 处理自定义异常
*/
@ExceptionHandler(RenException.class)
public Result handleRenException(RenException ex) {
Result result = new Result();
result.error(ex.getCode(), ex.getMsg());
return result;
}
return result;
}
@ExceptionHandler(DuplicateKeyException.class)
public Result handleDuplicateKeyException(DuplicateKeyException ex){
Result result = new Result();
result.error(ErrorCode.DB_RECORD_EXISTS);
@ExceptionHandler(DuplicateKeyException.class)
public Result handleDuplicateKeyException(DuplicateKeyException ex) {
Result result = new Result();
result.error(ErrorCode.DB_RECORD_EXISTS);
return result;
}
return result;
}
@ExceptionHandler(UnauthorizedException.class)
public Result handleUnauthorizedException(UnauthorizedException ex){
Result result = new Result();
result.error(ErrorCode.FORBIDDEN);
@ExceptionHandler(UnauthorizedException.class)
public Result handleUnauthorizedException(UnauthorizedException ex) {
Result result = new Result();
result.error(ErrorCode.FORBIDDEN);
return result;
}
return result;
}
@ExceptionHandler(Exception.class)
public Result handleException(Exception ex){
logger.error(ex.getMessage(), ex);
@ExceptionHandler(Exception.class)
public Result handleException(Exception ex) {
logger.error(ex.getMessage(), ex);
saveLog(ex);
saveLog(ex);
return new Result().error();
}
return new Result().error();
}
/**
* 保存异常日志
*/
private void saveLog(Exception ex){
SysLogErrorEntity log = new SysLogErrorEntity();
/**
* 保存异常日志
*/
private void saveLog(Exception ex) {
SysLogErrorEntity log = new SysLogErrorEntity();
//请求相关信息
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
log.setIp(IpUtils.getIpAddr(request));
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
log.setRequestUri(request.getRequestURI());
log.setRequestMethod(request.getMethod());
Map<String, String> params = HttpContextUtils.getParameterMap(request);
if(MapUtil.isNotEmpty(params)){
log.setRequestParams(JSON.toJSONString(params));
}
//请求相关信息
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
log.setIp(IpUtils.getIpAddr(request));
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
log.setRequestUri(request.getRequestURI());
log.setRequestMethod(request.getMethod());
Map<String, String> params = HttpContextUtils.getParameterMap(request);
if (MapUtil.isNotEmpty(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
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();
}
@ -74,21 +74,21 @@ public class DataFilterInterceptor extends AbstractSqlParserHandler implements I
return invocation.proceed();
}
private String getSelect(String originalSql, DataScope scope){
private String getSelect(String originalSql, DataScope scope) {
try {
Select select = (Select) CCJSqlParserUtil.parse(originalSql);
PlainSelect plainSelect = (PlainSelect) select.getSelectBody();
Expression expression = plainSelect.getWhere();
if(expression == null){
if (expression == null) {
plainSelect.setWhere(new StringValue(scope.getSqlFilter()));
}else{
AndExpression andExpression = new AndExpression(expression, new StringValue(scope.getSqlFilter()));
} else {
AndExpression andExpression = new AndExpression(expression, new StringValue(scope.getSqlFilter()));
plainSelect.setWhere(andExpression);
}
return select.toString().replaceAll("'", "");
}catch (JSQLParserException e){
} catch (JSQLParserException e) {
return originalSql;
}
}

View File

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

View File

@ -13,22 +13,21 @@ import java.util.List;
/**
* excel工具类
*
*/
public class ExcelUtils {
/**
* Excel导出
*
* @param response response
* @param fileName 文件名
* @param sheetName sheetName
* @param list 数据List
* @param pojoClass 对象Class
* @param response response
* @param fileName 文件名
* @param sheetName sheetName
* @param list 数据List
* @param pojoClass 对象Class
*/
public static void exportExcel(HttpServletResponse response, String fileName, String sheetName, List<?> list,
Class<?> pojoClass) throws IOException {
if(StringUtils.isBlank(fileName)){
Class<?> pojoClass) throws IOException {
if (StringUtils.isBlank(fileName)) {
//当前日期
fileName = DateUtils.format(new Date());
}
@ -36,23 +35,23 @@ public class ExcelUtils {
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("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);
}
/**
* Excel导出先sourceList转换成List<targetClass>再导出
*
* @param response response
* @param fileName 文件名
* @param sheetName sheetName
* @param sourceList 原数据List
* @param targetClass 目标对象Class
* @param response response
* @param fileName 文件名
* @param sheetName sheetName
* @param sourceList 原数据List
* @param targetClass 目标对象Class
*/
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());
for(Object source : sourceList){
for (Object source : sourceList) {
Object target = targetClass.newInstance();
BeanUtils.copyProperties(source, target);
targetList.add(target);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,11 +22,10 @@ import java.util.Map;
/**
* 模型管理
*
*/
@RestController
@RequestMapping("/act/model")
@Api(tags="模型管理")
@Api(tags = "模型管理")
public class ActModelController {
@Autowired
private ActModelService actModelService;
@ -35,13 +34,13 @@ public class ActModelController {
@ApiOperation("模型管理-分页查询")
@LogOperation("模型管理-分页查询")
@ApiImplicitParams({
@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 = "key", value = "key", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "name", value = "name", paramType = "query", dataType="String")
@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 = "key", value = "key", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "name", value = "name", paramType = "query", dataType = "String")
})
// @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);
return new Result<PageData<Model>>().ok(page);
@ -51,7 +50,7 @@ public class ActModelController {
@ApiOperation("模型管理-新增模型")
@LogOperation("模型管理-新增模型")
// @RequiresPermissions("sys:model:all")
public Result save(@RequestBody ModelDTO dto) throws Exception{
public Result save(@RequestBody ModelDTO dto) throws Exception {
//效验数据
ValidatorUtils.validateEntity(dto);
@ -82,17 +81,17 @@ public class ActModelController {
@LogOperation("模型管理-删除")
// @RequiresPermissions("sys:model:all")
public Result delete(@RequestBody String[] ids) {
for(String id : ids) {
for (String id : ids) {
actModelService.delete(id);
}
return new Result();
}
// @GetMapping("image/{deploymentId}")
@ApiOperation(value = "查看流程图", produces="application/octet-stream")
// @GetMapping("image/{deploymentId}")
@ApiOperation(value = "查看流程图", produces = "application/octet-stream")
@LogOperation("模型管理-查看流程图")
@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);
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -9,34 +9,33 @@ import java.util.Date;
/**
* 转正申请
*
*/
@Data
@EqualsAndHashCode(callSuper=false)
@EqualsAndHashCode(callSuper = false)
@TableName("tb_correction")
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> {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,19 +11,18 @@ import java.io.InputStream;
/**
* Stencilset
*
*/
@RestController
@RequestMapping("service")
public class StencilsetRestResource {
@RequestMapping(value="/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
public @ResponseBody String getStencilset() {
InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
try {
return IOUtils.toString(stencilsetStream, "utf-8");
} catch (Exception e) {
throw new ActivitiException("Error while loading stencil set", e);
@RequestMapping(value = "/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
public @ResponseBody String getStencilset() {
InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
try {
return IOUtils.toString(stencilsetStream, "utf-8");
} catch (Exception 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
*
*/
@RestController
@RequestMapping("service")
public class ModelEditorJsonRestResource implements ModelDataJsonConstants {
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelEditorJsonRestResource.class);
@Autowired
private RepositoryService repositoryService;
@Autowired
private ObjectMapper objectMapper;
@RequestMapping(value="/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
public ObjectNode getEditorJson(@PathVariable String modelId) {
ObjectNode modelNode = null;
Model model = repositoryService.getModel(modelId);
if (model != null) {
try {
if (StringUtils.isNotEmpty(model.getMetaInfo())) {
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
} else {
modelNode = objectMapper.createObjectNode();
modelNode.put(MODEL_NAME, model.getName());
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelEditorJsonRestResource.class);
@Autowired
private RepositoryService repositoryService;
@Autowired
private ObjectMapper objectMapper;
@RequestMapping(value = "/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
public ObjectNode getEditorJson(@PathVariable String modelId) {
ObjectNode modelNode = null;
Model model = repositoryService.getModel(modelId);
if (model != null) {
try {
if (StringUtils.isNotEmpty(model.getMetaInfo())) {
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
} else {
modelNode = objectMapper.createObjectNode();
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());
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;
}
return modelNode;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,10 @@
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 com.baomidou.mybatisplus.annotation.*;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@ -15,7 +18,7 @@ import java.util.Date;
* @since 1.0 2022-04-12
*/
@Data
@EqualsAndHashCode(callSuper=false)
@EqualsAndHashCode(callSuper = false)
@ToString
@TableName("tb_data_category")
public class Category implements Serializable {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -64,6 +64,6 @@ public class TDemandCommentDTO extends AuditingBaseDTO implements Serializable {
}
}
return "";
}
}

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.HeadRowHeight;
import lombok.Data;
import java.util.Date;
/**

View File

@ -29,13 +29,13 @@ import java.util.Map;
/**
* Excel导入演示
*
* @author Mark sunlightcs@gmail.com
*/
* Excel导入演示
*
* @author Mark sunlightcs@gmail.com
*/
@RestController
@RequestMapping("demo/excel")
@Api(tags="Excel导入演示")
@Api(tags = "Excel导入演示")
public class ExcelDataController {
@Autowired
private ExcelDataService excelDataService;
@ -43,13 +43,13 @@ public class ExcelDataController {
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@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.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
@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.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")
})
// @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);
return new Result<PageData<ExcelDataDTO>>().ok(page);
@ -58,7 +58,7 @@ public class ExcelDataController {
@GetMapping("{id}")
@ApiOperation("信息")
// @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);
return new Result<ExcelDataDTO>().ok(data);
@ -67,7 +67,7 @@ public class ExcelDataController {
@PostMapping
@ApiOperation("保存")
// @RequiresPermissions("demo:excel:all")
public Result save(@RequestBody ExcelDataDTO dto){
public Result save(@RequestBody ExcelDataDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -79,7 +79,7 @@ public class ExcelDataController {
@PutMapping
@ApiOperation("修改")
// @RequiresPermissions("demo:excel:all")
public Result update(@RequestBody ExcelDataDTO dto){
public Result update(@RequestBody ExcelDataDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -91,7 +91,7 @@ public class ExcelDataController {
@DeleteMapping
@ApiOperation("删除")
// @RequiresPermissions("demo:excel:all")
public Result delete(@RequestBody Long[] ids){
public Result delete(@RequestBody Long[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
@ -103,7 +103,7 @@ public class ExcelDataController {
@PostMapping("import")
@ApiOperation("导入")
// @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 {
//解析并保存到数据库
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.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -25,11 +24,10 @@ import java.util.Map;
/**
* 新闻
*
*/
@RestController
@RequestMapping("demo/news")
@Api(tags="新闻管理")
@Api(tags = "新闻管理")
public class NewsController {
@Autowired
private NewsService newsService;
@ -37,16 +35,16 @@ public class NewsController {
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@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.ORDER_FIELD, value = "排序字段", 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 = "startDate", value = "开始时间", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType="String")
@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.ORDER_FIELD, value = "排序字段", 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 = "startDate", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String")
})
// @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);
return new Result<PageData<NewsDTO>>().ok(page);
@ -55,7 +53,7 @@ public class NewsController {
@ApiOperation("信息")
@GetMapping("{id}")
// @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);
return new Result<NewsDTO>().ok(news);
@ -65,7 +63,7 @@ public class NewsController {
@ApiOperation("保存")
@LogOperation("保存")
// @RequiresPermissions("demo:news:all")
public Result save(NewsDTO dto){
public Result save(NewsDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -78,7 +76,7 @@ public class NewsController {
@ApiOperation("修改")
@LogOperation("修改")
// @RequiresPermissions("demo:news:all")
public Result update(NewsDTO dto){
public Result update(NewsDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -91,7 +89,7 @@ public class NewsController {
@ApiOperation("删除")
@LogOperation("删除")
// @RequiresPermissions("demo:news:all")
public Result delete(@RequestBody Long[] ids){
public Result delete(@RequestBody Long[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");

View File

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

View File

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

View File

@ -9,11 +9,10 @@ import java.util.Map;
/**
* 新闻
*
*/
@Mapper
public interface NewsDao extends BaseDao<NewsEntity> {
List<NewsEntity> getList(Map<String, Object> params);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,30 +11,29 @@ import java.util.Date;
/**
* 产品管理
*
*/
@Data
@EqualsAndHashCode(callSuper=false)
@EqualsAndHashCode(callSuper = false)
@TableName("tb_product")
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)
private Long updater;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
}

View File

@ -11,34 +11,33 @@ import java.util.Date;
/**
* 产品参数管理
*
*/
@Data
@EqualsAndHashCode(callSuper=false)
@EqualsAndHashCode(callSuper = false)
@TableName("tb_product_params")
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
*/
private Long productId;
private Long productId;
/**
* 更新者
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
}

View File

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

View File

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

View File

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

View File

@ -8,7 +8,6 @@ import java.util.List;
/**
* 产品参数管理
*
*/
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> {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,7 +26,7 @@ import java.util.Map;
* @date:2022/9/20
* @des
*/
@Api(tags="设备")
@Api(tags = "设备")
@RestController
@RequestMapping("device")
public class TbDeviceController {
@ -39,11 +39,11 @@ public class TbDeviceController {
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@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 = "type", value = "设备类型", paramType = "query",dataType="String") ,
@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 = "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);
return new Result<PageData<TbDeviceDTO>>().ok(page);
}
@ -58,11 +58,11 @@ public class TbDeviceController {
@PostMapping
@ApiOperation("新增")
@LogOperation("新增")
public Result save(@RequestBody TbDeviceDTO dto){
public Result save(@RequestBody TbDeviceDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tbDeviceService.save(dto);
dto.getDeviceAttrDTOList().stream().forEach(attr->{
dto.getDeviceAttrDTOList().stream().forEach(attr -> {
attr.setDeviceId(dto.getId());
tbDeviceAttrService.save(attr);
});
@ -79,5 +79,4 @@ public class TbDeviceController {
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,6 @@ import org.apache.commons.lang.StringUtils;
/**
* MySQL查询
*
*/
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("where table_schema = (select database()) ");
//表名查询
if(StringUtils.isNotBlank(tableName)){
if (StringUtils.isNotBlank(tableName)) {
sql.append("and table_name = '").append(tableName).append("' ");
}
sql.append("order by table_name asc");

View File

@ -6,7 +6,6 @@ import org.apache.commons.lang.StringUtils;
/**
* Oracle查询
*
*/
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("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("order by dt.table_name asc");

View File

@ -5,7 +5,6 @@ import org.apache.commons.lang.StringUtils;
/**
* PostgreSql查询
*
*/
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("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("' ");
}
@ -30,10 +29,10 @@ public class PostgreSqlQuery implements AbstractQuery {
@Override
public String tableFieldsSql() {
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 "
+"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 "
+"where t1.relname = '%s' and t2.attrelid = t1.oid and t2.attnum>0";
+ "(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 "
+ "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";
}

View File

@ -5,7 +5,6 @@ import org.apache.commons.lang.StringUtils;
/**
* SqlServer查询
*
*/
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') ");
//表名查询
if(StringUtils.isNotBlank(tableName)){
if (StringUtils.isNotBlank(tableName)) {
sql.append("and cast(so.name as varchar(500)) = '").append(tableName).append("' ");
}
sql.append(" order by cast(so.name as varchar(500))");

View File

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

View File

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

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