Browse Source

Merge pull request 'dev-lcr' (#4) from dev-lcr into master

master
lcr 5 months ago
parent
commit
70b2a5ddba
100 changed files with 5531 additions and 2110 deletions
  1. +4
    -5
      pom.xml
  2. +83
    -0
      ruoyi-admin/src/main/resources/application-dev.yml
  3. +26
    -4
      ruoyi-admin/src/main/resources/application-prod.yml
  4. +83
    -0
      ruoyi-admin/src/main/resources/application-test.yml
  5. +4
    -6
      ruoyi-admin/src/main/resources/application.yml
  6. +1
    -1
      ruoyi-admin/src/main/resources/logback.xml
  7. +28
    -0
      ruoyi-business/pom.xml
  8. +126
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyController.java
  9. +125
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyPlanController.java
  10. +110
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyPlanLogController.java
  11. +0
    -138
      ruoyi-business/src/main/java/com/ruoyi/business/controller/BusinessSurveyController.java
  12. +0
    -138
      ruoyi-business/src/main/java/com/ruoyi/business/controller/BusinessTemplateController.java
  13. +0
    -121
      ruoyi-business/src/main/java/com/ruoyi/business/controller/BusinessTemplatePropController.java
  14. +0
    -128
      ruoyi-business/src/main/java/com/ruoyi/business/controller/BusinessTemplatePropValueController.java
  15. +127
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/controller/RebotController.java
  16. +110
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/controller/ResourceLibraryController.java
  17. +127
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/Apply.java
  18. +209
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/ApplyPlan.java
  19. +142
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/ApplyPlanLog.java
  20. +0
    -64
      ruoyi-business/src/main/java/com/ruoyi/business/domain/BusinessSurvey.java
  21. +0
    -73
      ruoyi-business/src/main/java/com/ruoyi/business/domain/BusinessTemplate.java
  22. +0
    -182
      ruoyi-business/src/main/java/com/ruoyi/business/domain/BusinessTemplateProp.java
  23. +0
    -111
      ruoyi-business/src/main/java/com/ruoyi/business/domain/BusinessTemplatePropValue.java
  24. +95
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/Rebot.java
  25. +95
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/ResourceLibrary.java
  26. +141
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/AddApplyPlanBO.java
  27. +109
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/ApplyStartBO.java
  28. +19
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/JobQueryBO.java
  29. +27
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/JobQueryLogBO.java
  30. +121
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/ListApplyBO.java
  31. +47
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/ListRebotBO.java
  32. +65
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/JobQueryLogVO.java
  33. +119
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/JobQueryVO.java
  34. +18
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/JobStartVO.java
  35. +116
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/ListApplyVO.java
  36. +83
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/ListRebotVO.java
  37. +32
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyMapper.java
  38. +24
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyPlanLogMapper.java
  39. +29
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyPlanMapper.java
  40. +0
    -16
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/BusinessSurveyMapper.java
  41. +0
    -16
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/BusinessTemplateMapper.java
  42. +0
    -16
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/BusinessTemplatePropMapper.java
  43. +0
    -23
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/BusinessTemplatePropValueMapper.java
  44. +25
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/RebotMapper.java
  45. +24
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/ResourceLibraryMapper.java
  46. +24
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyPlanLogService.java
  47. +88
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyPlanService.java
  48. +52
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyService.java
  49. +0
    -22
      ruoyi-business/src/main/java/com/ruoyi/business/service/IBusinessSurveyService.java
  50. +0
    -15
      ruoyi-business/src/main/java/com/ruoyi/business/service/IBusinessTemplatePropService.java
  51. +0
    -28
      ruoyi-business/src/main/java/com/ruoyi/business/service/IBusinessTemplatePropValueService.java
  52. +0
    -15
      ruoyi-business/src/main/java/com/ruoyi/business/service/IBusinessTemplateService.java
  53. +29
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/IRebotService.java
  54. +24
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/IResourceLibraryService.java
  55. +34
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanLogServiceImpl.java
  56. +523
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanServiceImpl.java
  57. +145
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyServiceImpl.java
  58. +0
    -102
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BusinessSurveyServiceImpl.java
  59. +0
    -27
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BusinessTemplatePropServiceImpl.java
  60. +0
    -149
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BusinessTemplatePropValueServiceImpl.java
  61. +0
    -27
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BusinessTemplateServiceImpl.java
  62. +85
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/RebotServiceImpl.java
  63. +51
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ResourceLibraryServiceImpl.java
  64. +216
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/util/YinDaoHttpUtils.java
  65. +28
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/yddoman/BaseDTO.java
  66. +17
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/yddoman/CreateTokenDTO.java
  67. +118
    -0
      ruoyi-business/src/main/resources/mapper/business/ApplyMapper.xml
  68. +91
    -0
      ruoyi-business/src/main/resources/mapper/business/ApplyPlanLogMapper.xml
  69. +157
    -0
      ruoyi-business/src/main/resources/mapper/business/ApplyPlanMapper.xml
  70. +0
    -95
      ruoyi-business/src/main/resources/mapper/business/BusinessSurveyMapper.xml
  71. +0
    -90
      ruoyi-business/src/main/resources/mapper/business/BusinessTemplateMapper.xml
  72. +0
    -115
      ruoyi-business/src/main/resources/mapper/business/BusinessTemplatePropMapper.xml
  73. +0
    -113
      ruoyi-business/src/main/resources/mapper/business/BusinessTemplatePropValueMapper.xml
  74. +71
    -0
      ruoyi-business/src/main/resources/mapper/business/RebotMapper.xml
  75. +73
    -0
      ruoyi-business/src/main/resources/mapper/business/ResourceLibraryMapper.xml
  76. +21
    -0
      ruoyi-common/pom.xml
  77. +18
    -6
      ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
  78. +35
    -0
      ruoyi-common/src/main/java/com/ruoyi/common/enums/ExcTypeStatus.java
  79. +41
    -0
      ruoyi-common/src/main/java/com/ruoyi/common/enums/PlanRunStatus.java
  80. +39
    -0
      ruoyi-common/src/main/java/com/ruoyi/common/enums/RebotStatus.java
  81. +0
    -2
      ruoyi-common/src/main/java/com/ruoyi/common/handler/MyMetaObjectHandler.java
  82. +30
    -0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/BeanToMapUtil.java
  83. +358
    -0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpClientUtil.java
  84. +57
    -0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpConnectionManager.java
  85. +2
    -0
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
  86. +59
    -86
      ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
  87. +4
    -4
      ruoyi-generator/src/main/resources/generator.yml
  88. +9
    -9
      ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
  89. +1
    -0
      ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
  90. +22
    -11
      ruoyi-generator/src/main/resources/vm/java/controller.java.vm
  91. +67
    -34
      ruoyi-generator/src/main/resources/vm/java/domain.java.vm
  92. +74
    -1
      ruoyi-generator/src/main/resources/vm/java/mapper.java.vm
  93. +47
    -0
      ruoyi-generator/src/main/resources/vm/java/service.java.vm
  94. +138
    -3
      ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm
  95. +34
    -18
      ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
  96. +0
    -5
      ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm
  97. +85
    -79
      ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm
  98. +6
    -0
      ruoyi-quartz/pom.xml
  99. +58
    -12
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
  100. +6
    -0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java

+ 4
- 5
pom.xml View File

@@ -2,15 +2,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<version>3.8.5</version>

<name></name>
<description>管理系统</description>
<properties>
<ruoyi.version>3.8.5</ruoyi.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -31,7 +31,7 @@
<velocity.version>2.3</velocity.version>
<jwt.version>0.9.1</jwt.version>
</properties>
<!-- 依赖声明 -->
<dependencyManagement>
<dependencies>
@@ -197,7 +197,6 @@
<version>3.4.2</version>
</dependency>


</dependencies>
</dependencyManagement>



+ 83
- 0
ruoyi-admin/src/main/resources/application-dev.yml View File

@@ -0,0 +1,83 @@
# 项目相关配置
ruoyi:
# 文件路径 示例( Windows配置D:/poject,Linux配置 /home/poject)
profile: E:\poject
# Spring配置 数据源配置
spring:
# redis 配置
redis:
# 地址
host: 192.168.10.136
# 端口,默认为6379
port: 6379
# 数据库索引
database: 13
# 密码
password: wjcy@123456
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.10.136:3306/wjcy_new?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: wjcy@123456
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

ruoyi-admin/src/main/resources/application-druid.yml → ruoyi-admin/src/main/resources/application-prod.yml View File

@@ -1,14 +1,36 @@
# 数据源配置
# Spring配置 数据源配置
spring:
# redis 配置
redis:
# 地址
host: 192.168.10.136
# 端口,默认为6379
port: 6379
# 数据库索引
database: 13
# 密码
password: wjcy@123456
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.124.67:3306/dba?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: dba
password: 123456
url: jdbc:mysql://192.168.10.136:3306/wjcy_new?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: wjcy@123456
# 从库数据源
slave:
# 从数据源开关/默认关闭

+ 83
- 0
ruoyi-admin/src/main/resources/application-test.yml View File

@@ -0,0 +1,83 @@
# 项目相关配置
ruoyi:
# 文件路径 示例( Windows配置D:/poject,Linux配置 /home/poject)
profile: /home/pojectFile
# Spring配置 数据源配置
spring:
# redis 配置
redis:
# 地址
host: 192.168.10.136
# 端口,默认为6379
port: 6379
# 数据库索引
database: 13
# 密码
password: wjcy@123456
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.10.136:3306/wjcy_new?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: wjcy@123456
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

+ 4
- 6
ruoyi-admin/src/main/resources/application.yml View File

@@ -8,8 +8,6 @@ ruoyi:
copyrightYear: 2023
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
profile: D:/poject/log/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数组计算 char 字符验证
@@ -54,7 +52,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
active: dev
# 文件上传
servlet:
multipart:
@@ -70,13 +68,13 @@ spring:
# redis 配置
redis:
# 地址
host: 192.168.124.67
host: 192.168.10.136
# 端口,默认为6379
port: 6379
# 数据库索引
database: 0
database: 13
# 密码
password: 123456
password: wjcy@123456
# 连接超时时间
timeout: 10s
lettuce:


+ 1
- 1
ruoyi-admin/src/main/resources/logback.xml View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/poject/logs" />
<property name="log.path" value="logs" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />



+ 28
- 0
ruoyi-business/pom.xml View File

@@ -23,6 +23,34 @@
<artifactId>ruoyi-common</artifactId>
</dependency>

<!-- 权限-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
</dependency>

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
</dependency>

</dependencies>

</project>

+ 126
- 0
ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyController.java View File

@@ -0,0 +1,126 @@
package com.ruoyi.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;

import com.ruoyi.business.domain.Rebot;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.Apply;
import com.ruoyi.business.service.IApplyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
* 应用信息管理Controller
*
* @author LiuChengRan
* @date 2024-06-13
*/
@Api(tags = "应用信息管理接口")
@RestController
@RequestMapping("/business/ctApply")
public class ApplyController extends BaseController {
@Autowired
private IApplyService applyService;

/**
* 同步应用数据
*/
@ApiOperation(value = "同步应用数据", httpMethod = "POST", response = Rebot.class)
@PostMapping("/syn")
public AjaxResult syn(Apply apply) throws IllegalAccessException {
applyService.syn(apply);
return AjaxResult.success();
}

/**
* 查询所有应用列表
*/
@ApiOperation(value = "查询所有应用列表", httpMethod = "GET", response = Apply.class)
@GetMapping("/listAll")
public AjaxResult listAll(Apply apply) {
List<Apply> list = applyService.listAll(apply);
return AjaxResult.success(list);
}


/**
* 查询应用信息管理列表
*/
@ApiOperation(value = "查询应用信息管理列表", httpMethod = "GET", response = Apply.class)
@GetMapping("/list")
public TableDataInfo list(Apply apply) {
startPage();
List<Apply> list = applyService.list(apply);
return getDataTable(list);
}

/**
* 导出应用信息管理列表
*/
@ApiOperation(value = "导出应用信息管理列表", httpMethod = "POST")
@Log(title = "应用信息管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Apply apply) {
List<Apply> list = applyService.list(apply);
ExcelUtil<Apply> util = new ExcelUtil<Apply>(Apply.class);
util.exportExcel(response, list, "应用信息管理数据");
}

/**
* 获取应用信息管理详细信息
*/
@ApiOperation(value = "获取应用信息管理详细信息", httpMethod = "GET", response = Apply.class)
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(applyService.getById(id));
}

/**
* 新增应用信息管理
*/
@ApiOperation(value = "新增应用信息管理", httpMethod = "POST")
@Log(title = "应用信息管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Apply apply) {
return toAjax(applyService.save(apply));
}

/**
* 修改应用信息管理
*/
@ApiOperation(value = "修改应用信息管理", httpMethod = "PUT")
@Log(title = "应用信息管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Apply apply) {
return toAjax(applyService.updateById(apply));
}

/**
* 删除应用信息管理
*/
@ApiOperation(value = "删除应用信息管理", httpMethod = "DELETE")
@Log(title = "应用信息管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(applyService.removeByIds(Arrays.asList(ids)));
}
}

+ 125
- 0
ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyPlanController.java View File

@@ -0,0 +1,125 @@
package com.ruoyi.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;

import com.ruoyi.business.domain.bo.AddApplyPlanBO;
import com.ruoyi.business.domain.bo.JobQueryBO;
import com.ruoyi.common.utils.bean.BeanUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.ApplyPlan;
import com.ruoyi.business.service.IApplyPlanService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
* 应用执行计划管理Controller
*
* @author LiuChengRan
* @date 2024-06-14
*/
@Api(tags = "应用执行计划管理接口")
@RestController
@RequestMapping("/business/ctApplyPlan")
public class ApplyPlanController extends BaseController {
@Autowired
private IApplyPlanService applyPlanService;

/**
* 重新运行
*/
@ApiOperation(value = "重新运行", httpMethod = "POST", response = ApplyPlan.class)
@PostMapping("/appRetry")
public AjaxResult appRetry(@RequestBody JobQueryBO jobQueryBO) throws IllegalAccessException {
return toAjax(applyPlanService.appRetry(jobQueryBO));
}

/**
* 停止计划运行
*/
@ApiOperation(value = "停止计划运行", httpMethod = "POST", response = ApplyPlan.class)
@PostMapping("/stopRun")
public AjaxResult stopRun(@RequestBody JobQueryBO jobQueryBO) throws IllegalAccessException {
return toAjax(applyPlanService.stopRun(jobQueryBO));
}

/**
* 查询应用执行计划管理列表
*/
@ApiOperation(value = "查询应用执行计划管理列表", httpMethod = "GET", response = ApplyPlan.class)
@GetMapping("/list")
public TableDataInfo list(ApplyPlan applyPlan) {
startPage();
List<ApplyPlan> list = applyPlanService.list(applyPlan);
return getDataTable(list);
}

/**
* 导出应用执行计划管理列表
*/
@ApiOperation(value = "导出应用执行计划管理列表", httpMethod = "POST")
@Log(title = "应用执行计划管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ApplyPlan applyPlan) {
List<ApplyPlan> list = applyPlanService.list(applyPlan);
ExcelUtil<ApplyPlan> util = new ExcelUtil<ApplyPlan>(ApplyPlan.class);
util.exportExcel(response, list, "应用执行计划管理数据");
}

/**
* 获取应用执行计划管理详细信息
*/
@ApiOperation(value = "获取应用执行计划管理详细信息", httpMethod = "GET", response = ApplyPlan.class)
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(applyPlanService.getById(id));
}

/**
* 新增应用执行计划管理
*/
@ApiOperation(value = "新增应用执行计划管理", httpMethod = "POST")
@Log(title = "应用执行计划管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody AddApplyPlanBO addApplyPlanBO) {
return toAjax(applyPlanService.save(addApplyPlanBO));
}

/**
* 修改应用执行计划管理
*/
@ApiOperation(value = "修改应用执行计划管理", httpMethod = "PUT")
@Log(title = "应用执行计划管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody AddApplyPlanBO addApplyPlanBO) {
return toAjax(applyPlanService.update(addApplyPlanBO));
}

/**
* 删除应用执行计划管理
*/
@ApiOperation(value = "删除应用执行计划管理", httpMethod = "DELETE")
@Log(title = "应用执行计划管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(applyPlanService.removeByIds(Arrays.asList(ids)));
}
}

+ 110
- 0
ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyPlanLogController.java View File

@@ -0,0 +1,110 @@
package com.ruoyi.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.ApplyPlanLog;
import com.ruoyi.business.service.IApplyPlanLogService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
* 应用执行结果记录管理Controller
*
* @author LiuChengRan
* @date 2024-06-14
*/
@Api(tags = "应用执行结果记录管理接口")
@RestController
@RequestMapping("/business/ctApplyPlanLog")
public class ApplyPlanLogController extends BaseController
{
@Autowired
private IApplyPlanLogService applyPlanLogService;

/**
* 查询应用执行结果记录管理列表
*/
@ApiOperation(value="查询应用执行结果记录管理列表", httpMethod = "GET", response = ApplyPlanLog.class)
@GetMapping("/list")
public TableDataInfo list(ApplyPlanLog applyPlanLog)
{
startPage();
List<ApplyPlanLog> list = applyPlanLogService.list(applyPlanLog);
return getDataTable(list);
}

/**
* 导出应用执行结果记录管理列表
*/
@ApiOperation(value="导出应用执行结果记录管理列表", httpMethod = "POST")
@Log(title = "应用执行结果记录管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ApplyPlanLog applyPlanLog)
{
List<ApplyPlanLog> list = applyPlanLogService.list(applyPlanLog);
ExcelUtil<ApplyPlanLog> util = new ExcelUtil<ApplyPlanLog>(ApplyPlanLog.class);
util.exportExcel(response, list, "应用执行结果记录管理数据");
}

/**
* 获取应用执行结果记录管理详细信息
*/
@ApiOperation(value="获取应用执行结果记录管理详细信息", httpMethod = "GET", response = ApplyPlanLog.class)
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(applyPlanLogService.getById(id));
}

/**
* 新增应用执行结果记录管理
*/
@ApiOperation(value="新增应用执行结果记录管理", httpMethod = "POST")
@Log(title = "应用执行结果记录管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ApplyPlanLog applyPlanLog)
{
return toAjax(applyPlanLogService.save(applyPlanLog));
}

/**
* 修改应用执行结果记录管理
*/
@ApiOperation(value="修改应用执行结果记录管理", httpMethod = "PUT")
@Log(title = "应用执行结果记录管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ApplyPlanLog applyPlanLog)
{
return toAjax(applyPlanLogService.updateById(applyPlanLog));
}

/**
* 删除应用执行结果记录管理
*/
@ApiOperation(value="删除应用执行结果记录管理", httpMethod = "DELETE")
@Log(title = "应用执行结果记录管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(applyPlanLogService.removeByIds(Arrays.asList(ids)));
}
}

+ 0
- 138
ruoyi-business/src/main/java/com/ruoyi/business/controller/BusinessSurveyController.java View File

@@ -1,138 +0,0 @@
package com.ruoyi.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.business.domain.BusinessTemplate;
import com.ruoyi.business.domain.BusinessTemplateProp;
import com.ruoyi.business.domain.BusinessTemplatePropValue;
import com.ruoyi.business.service.IBusinessTemplatePropService;
import com.ruoyi.business.service.IBusinessTemplateService;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.BusinessSurvey;
import com.ruoyi.business.service.IBusinessSurveyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import java.util.Arrays;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.ruoyi.common.core.page.TableDataInfo;

/**
* 调查问卷管理Controller
*
* @author ruoyi
* @date 2024-04-01
*/
@RestController
@RequestMapping("/business/survey")
public class BusinessSurveyController extends BaseController
{
@Autowired
private IBusinessSurveyService businessSurveyService;


/**
* 获取问卷属性
*/
@GetMapping("/listBySurveyId")
public AjaxResult listBySurveyId(String surveyId) {
return businessSurveyService.listBySurveyId(surveyId);
}



/**
* 查询调查问卷管理列表
*/
@PreAuthorize("@ss.hasPermi('business:survey:list')")
@GetMapping("/list")
public TableDataInfo list(BusinessSurvey businessSurvey)
{
startPage();
List<BusinessSurvey> list = businessSurveyService.lambdaQuery()
.eq(StringUtils.isNotEmpty(businessSurvey.getTitle()),BusinessSurvey::getTitle,businessSurvey.getTitle())
.eq(StringUtils.isNotBlank(businessSurvey.getOpen()),BusinessSurvey::getOpen,businessSurvey.getOpen()).list();
return getDataTable(list);
}

/**
* 导出调查问卷管理列表
*/
@PreAuthorize("@ss.hasPermi('business:survey:export')")
@Log(title = "调查问卷管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BusinessSurvey businessSurvey)
{
List<BusinessSurvey> list = businessSurveyService.list();
ExcelUtil<BusinessSurvey> util = new ExcelUtil<BusinessSurvey>(BusinessSurvey.class);
util.exportExcel(response, list, "调查问卷管理数据");
}

/**
* 获取调查问卷管理详细信息
*/
@PreAuthorize("@ss.hasPermi('business:survey:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(businessSurveyService.getById(id));
}
@Autowired
private IBusinessTemplateService businessTemplateService;
/**
* 新增调查问卷管理
*/
@PreAuthorize("@ss.hasPermi('business:survey:add')")
@Log(title = "调查问卷管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BusinessSurvey businessSurvey)
{
BusinessTemplate one = businessTemplateService.lambdaQuery().eq(BusinessTemplate::getId, businessSurvey.getTempId()).one();
businessSurvey.setTempName(one.getTitle());
return toAjax(businessSurveyService.save(businessSurvey));
}

/**
* 修改调查问卷管理
*/
@PreAuthorize("@ss.hasPermi('business:survey:edit')")
@Log(title = "调查问卷管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BusinessSurvey businessSurvey)
{
BusinessTemplate one = businessTemplateService.lambdaQuery().eq(BusinessTemplate::getId, businessSurvey.getTempId()).one();
businessSurvey.setTempName(one.getTitle());
return toAjax(businessSurveyService.updateById(businessSurvey));
}

/**
* 删除调查问卷管理
*/
@PreAuthorize("@ss.hasPermi('business:survey:remove')")
@Log(title = "调查问卷管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(businessSurveyService.removeByIds(Arrays.asList(ids)));
}
}

+ 0
- 138
ruoyi-business/src/main/java/com/ruoyi/business/controller/BusinessTemplateController.java View File

@@ -1,138 +0,0 @@
package com.ruoyi.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.business.domain.BusinessSurvey;
import com.ruoyi.business.service.IBusinessSurveyService;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.BusinessTemplate;
import com.ruoyi.business.service.IBusinessTemplateService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import java.util.Arrays;
import com.ruoyi.common.core.page.TableDataInfo;

/**
* 模版管理Controller
*
* @author ruoyi
* @date 2024-03-31
*/
@RestController
@RequestMapping("/business/template")
public class BusinessTemplateController extends BaseController
{
@Autowired
private IBusinessTemplateService businessTemplateService;

/**
* 查询模版管理列表
*/
@PreAuthorize("@ss.hasPermi('business:template:list')")
@GetMapping("/list")
public TableDataInfo list(BusinessTemplate businessTemplate)
{
startPage();
LambdaQueryWrapper<BusinessTemplate> like = new LambdaQueryWrapper<BusinessTemplate>()
.eq(StringUtils.isNotBlank( businessTemplate.getOpen()),BusinessTemplate::getOpen, businessTemplate.getOpen())
.like(StringUtils.isNotBlank(businessTemplate.getTitle()), BusinessTemplate::getTitle, businessTemplate.getTitle());
if(businessTemplate.getCreateBy() != null){
logger.debug("SecurityUtils.getUsername():{}",SecurityUtils.getUsername());
like.eq(BusinessTemplate::getCreateBy, SecurityUtils.getUsername());
}
List<BusinessTemplate> list = businessTemplateService.list(like);
return getDataTable(list);
}

/**
* 查询模版管理列表
*/
@PreAuthorize("@ss.hasPermi('business:template:list')")
@GetMapping("/listAll")
public AjaxResult listAll(BusinessTemplate businessTemplate)
{
List<BusinessTemplate> list = businessTemplateService.list(
new LambdaQueryWrapper<BusinessTemplate>().eq(BusinessTemplate::getCreateBy,SecurityUtils.getUsername())
.eq(StringUtils.isNotBlank(businessTemplate.getId()),BusinessTemplate::getId,businessTemplate.getId())
);
return AjaxResult.success(list);
}

/**
* 导出模版管理列表
*/
@PreAuthorize("@ss.hasPermi('business:template:export')")
@Log(title = "模版管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BusinessTemplate businessTemplate)
{
List<BusinessTemplate> list = businessTemplateService.list();
ExcelUtil<BusinessTemplate> util = new ExcelUtil<BusinessTemplate>(BusinessTemplate.class);
util.exportExcel(response, list, "模版管理数据");
}

/**
* 获取模版管理详细信息
*/
@PreAuthorize("@ss.hasPermi('business:template:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(businessTemplateService.getById(id));
}


/**
* 新增模版管理
*/
@PreAuthorize("@ss.hasPermi('business:template:add')")
@Log(title = "模版管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BusinessTemplate businessTemplate)
{
return toAjax(businessTemplateService.save(businessTemplate));
}

@Autowired
private IBusinessSurveyService businessSurveyService;
/**
* 修改模版管理
*/
@PreAuthorize("@ss.hasPermi('business:template:edit')")
@Log(title = "模版管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BusinessTemplate businessTemplate)
{
BusinessSurvey businessSurvey = new BusinessSurvey();
businessSurvey.setTempName(businessTemplate.getTitle());
businessSurveyService.lambdaUpdate().eq(BusinessSurvey::getTempId, businessTemplate.getId()).update(businessSurvey);
return toAjax(businessTemplateService.updateById(businessTemplate));
}

/**
* 删除模版管理
*/
@PreAuthorize("@ss.hasPermi('business:template:remove')")
@Log(title = "模版管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(businessTemplateService.removeByIds(Arrays.asList(ids)));
}
}

+ 0
- 121
ruoyi-business/src/main/java/com/ruoyi/business/controller/BusinessTemplatePropController.java View File

@@ -1,121 +0,0 @@
package com.ruoyi.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.business.domain.BusinessTemplatePropValue;
import com.ruoyi.business.service.IBusinessTemplatePropValueService;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.BusinessTemplateProp;
import com.ruoyi.business.service.IBusinessTemplatePropService;
import com.ruoyi.common.utils.poi.ExcelUtil;

import java.util.Arrays;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.ruoyi.common.core.page.TableDataInfo;

/**
* 模版属性Controller
*
* @author ruoyi
* @date 2024-03-31
*/
@RestController
@RequestMapping("/business/templateProp")
public class BusinessTemplatePropController extends BaseController {
@Autowired
private IBusinessTemplatePropService businessTemplatePropService;

@Autowired
private IBusinessTemplatePropValueService businessTemplatePropValueService;


/**
* 查询模版属性列表
*/
@PreAuthorize("@ss.hasPermi('business:templateProp:list')")
@GetMapping("/list")
public TableDataInfo list(BusinessTemplateProp businessTemplateProp) {
startPage();
List<BusinessTemplateProp> list = businessTemplatePropService.list(new LambdaQueryWrapper<BusinessTemplateProp>()
.eq(StringUtils.isNotBlank(businessTemplateProp.getCompType()),BusinessTemplateProp::getCompType,businessTemplateProp.getCompType())
.eq(StringUtils.isNotBlank(businessTemplateProp.getFieldName()),BusinessTemplateProp::getFieldName,businessTemplateProp.getFieldName())
.eq(StringUtils.isNotBlank(businessTemplateProp.getId()),BusinessTemplateProp::getId,businessTemplateProp.getId())
.eq(BusinessTemplateProp::getTempId,businessTemplateProp.getTempId())
);
return getDataTable(list);
}

/**
* 导出模版属性列表
*/
@PreAuthorize("@ss.hasPermi('business:templateProp:export')")
@Log(title = "模版属性" , businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BusinessTemplateProp businessTemplateProp) {
List<BusinessTemplateProp> list = businessTemplatePropService.list();
ExcelUtil<BusinessTemplateProp> util = new ExcelUtil<BusinessTemplateProp>(BusinessTemplateProp.class);
util.exportExcel(response, list, "模版属性数据");
}

/**
* 获取模版属性详细信息
*/
@PreAuthorize("@ss.hasPermi('business:templateProp:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(businessTemplatePropService.getById(id));
}

/**
* 新增模版属性
*/
@PreAuthorize("@ss.hasPermi('business:templateProp:add')")
@Log(title = "模版属性" , businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BusinessTemplateProp businessTemplateProp) {
return toAjax(businessTemplatePropService.save(businessTemplateProp));
}

/**
* 修改模版属性
*/
@PreAuthorize("@ss.hasPermi('business:templateProp:edit')")
@Log(title = "模版属性" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BusinessTemplateProp businessTemplateProp) {
return toAjax(businessTemplatePropService.updateById(businessTemplateProp));
}

/**
* 删除模版属性
*/
@PreAuthorize("@ss.hasPermi('business:templateProp:remove')")
@Log(title = "模版属性" , businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(businessTemplatePropService.removeByIds(Arrays.asList(ids)));
}
}

+ 0
- 128
ruoyi-business/src/main/java/com/ruoyi/business/controller/BusinessTemplatePropValueController.java View File

@@ -1,128 +0,0 @@
package com.ruoyi.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.BusinessTemplatePropValue;
import com.ruoyi.business.service.IBusinessTemplatePropValueService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import java.util.Arrays;
import java.util.Map;

import com.ruoyi.common.core.page.TableDataInfo;

/**
* 模版属性值Controller
*
* @author ruoyi
* @date 2024-03-31
*/
@RestController
@RequestMapping("/business/templatePropValue")
public class BusinessTemplatePropValueController extends BaseController
{
@Autowired
private IBusinessTemplatePropValueService businessTemplatePropValueService;

/**
* 查询模版属性值列表
*/
@PreAuthorize("@ss.hasPermi('business:templatePropValue:list')")
@GetMapping("/list")
public TableDataInfo list(BusinessTemplatePropValue businessTemplatePropValue)
{
startPage();
List<BusinessTemplatePropValue> list = businessTemplatePropValueService.list();
return getDataTable(list);
}

/**
* 统计问卷
*/
@GetMapping("/countGroup")
public AjaxResult countGroup(String surveyId)
{
Object o = businessTemplatePropValueService.countGroup(surveyId);
return AjaxResult.success(o);
}

/**
* 导出模版属性值列表
*/
@PreAuthorize("@ss.hasPermi('business:templatePropValue:export')")
@Log(title = "模版属性值", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BusinessTemplatePropValue businessTemplatePropValue)
{
List<BusinessTemplatePropValue> list = businessTemplatePropValueService.list();
ExcelUtil<BusinessTemplatePropValue> util = new ExcelUtil<BusinessTemplatePropValue>(BusinessTemplatePropValue.class);
util.exportExcel(response, list, "模版属性值数据");
}

/**
* 获取模版属性值详细信息
*/
@PreAuthorize("@ss.hasPermi('business:templatePropValue:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(businessTemplatePropValueService.getById(id));
}

/**
* 新增模版属性值
*/
@PreAuthorize("@ss.hasPermi('business:templatePropValue:add')")
@Log(title = "模版属性值", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BusinessTemplatePropValue businessTemplatePropValue)
{
return toAjax(businessTemplatePropValueService.save(businessTemplatePropValue));
}


/**
* 新增模版属性值
*/
@Log(title = "模版属性值", businessType = BusinessType.INSERT)
@PostMapping("/addList")
public AjaxResult addList(@RequestBody Map<String,Object> data)
{
return toAjax(businessTemplatePropValueService.addList(data));
}

/**
* 修改模版属性值
*/
@PreAuthorize("@ss.hasPermi('business:templatePropValue:edit')")
@Log(title = "模版属性值", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BusinessTemplatePropValue businessTemplatePropValue)
{
return toAjax(businessTemplatePropValueService.updateById(businessTemplatePropValue));
}

/**
* 删除模版属性值
*/
@PreAuthorize("@ss.hasPermi('business:templatePropValue:remove')")
@Log(title = "模版属性值", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(businessTemplatePropValueService.removeByIds(Arrays.asList(ids)));
}
}

+ 127
- 0
ruoyi-business/src/main/java/com/ruoyi/business/controller/RebotController.java View File

@@ -0,0 +1,127 @@
package com.ruoyi.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;

import com.ruoyi.common.enums.RebotStatus;
import com.ruoyi.common.utils.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.Rebot;
import com.ruoyi.business.service.IRebotService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
* 机器人管理Controller
*
* @author LiuChengRan
* @date 2024-06-13
*/
@Api(tags = "机器人管理接口")
@RestController
@RequestMapping("/business/ctRebot")
public class RebotController extends BaseController {
@Autowired
private IRebotService rebotService;

/**
* 同步机器人数据
*/
@ApiOperation(value = "同步机器人数据", httpMethod = "POST", response = Rebot.class)
@PostMapping("/syn")
public AjaxResult syn(Rebot rebot) throws IllegalAccessException {
rebotService.syn(rebot);
return AjaxResult.success();
}

/**
* 查询所有可用(空闲)机器人
*/
@ApiOperation(value = "查询所有可用(空闲)机器人", httpMethod = "GET", response = Rebot.class)
@GetMapping("/listAll")
public AjaxResult listAll(Rebot rebot) {
rebot.setStatus(RebotStatus.IDLE.getKey());
List<Rebot> list = rebotService.list(rebot);
return AjaxResult.success(list);
}

/**
* 查询机器人管理列表
*/
@ApiOperation(value = "查询机器人管理列表", httpMethod = "GET", response = Rebot.class)
@GetMapping("/list")
public TableDataInfo list(Rebot rebot) {
startPage();
List<Rebot> list = rebotService.list(rebot);
return getDataTable(list);
}

/**
* 导出机器人管理列表
*/
@ApiOperation(value = "导出机器人管理列表", httpMethod = "POST")
@Log(title = "机器人管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Rebot rebot) {
List<Rebot> list = rebotService.list(rebot);
ExcelUtil<Rebot> util = new ExcelUtil<Rebot>(Rebot.class);
util.exportExcel(response, list, "机器人管理数据");
}

/**
* 获取机器人管理详细信息
*/
@ApiOperation(value = "获取机器人管理详细信息", httpMethod = "GET", response = Rebot.class)
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(rebotService.getById(id));
}

/**
* 新增机器人管理
*/
@ApiOperation(value = "新增机器人管理", httpMethod = "POST")
@Log(title = "机器人管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Rebot rebot) {
return toAjax(rebotService.save(rebot));
}

/**
* 修改机器人管理
*/
@ApiOperation(value = "修改机器人管理", httpMethod = "PUT")
@Log(title = "机器人管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Rebot rebot) {
return toAjax(rebotService.updateById(rebot));
}

/**
* 删除机器人管理
*/
@ApiOperation(value = "删除机器人管理", httpMethod = "DELETE")
@Log(title = "机器人管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(rebotService.removeByIds(Arrays.asList(ids)));
}
}

+ 110
- 0
ruoyi-business/src/main/java/com/ruoyi/business/controller/ResourceLibraryController.java View File

@@ -0,0 +1,110 @@
package com.ruoyi.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.ResourceLibrary;
import com.ruoyi.business.service.IResourceLibraryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
* 资源库管理Controller
*
* @author LiuChengRan
* @date 2024-06-17
*/
@Api(tags = "资源库管理接口")
@RestController
@RequestMapping("/business/ctResourceLibrary")
public class ResourceLibraryController extends BaseController
{
@Autowired
private IResourceLibraryService resourceLibraryService;

/**
* 查询资源库管理列表
*/
@ApiOperation(value="查询资源库管理列表", httpMethod = "GET", response = ResourceLibrary.class)
@GetMapping("/list")
public TableDataInfo list(ResourceLibrary resourceLibrary)
{
startPage();
List<ResourceLibrary> list = resourceLibraryService.list(resourceLibrary);
return getDataTable(list);
}

/**
* 导出资源库管理列表
*/
@ApiOperation(value="导出资源库管理列表", httpMethod = "POST")
@Log(title = "资源库管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ResourceLibrary resourceLibrary)
{
List<ResourceLibrary> list = resourceLibraryService.list(resourceLibrary);
ExcelUtil<ResourceLibrary> util = new ExcelUtil<ResourceLibrary>(ResourceLibrary.class);
util.exportExcel(response, list, "资源库管理数据");
}

/**
* 获取资源库管理详细信息
*/
@ApiOperation(value="获取资源库管理详细信息", httpMethod = "GET", response = ResourceLibrary.class)
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(resourceLibraryService.getById(id));
}

/**
* 新增资源库管理
*/
@ApiOperation(value="新增资源库管理", httpMethod = "POST")
@Log(title = "资源库管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ResourceLibrary resourceLibrary)
{
return toAjax(resourceLibraryService.save(resourceLibrary));
}

/**
* 修改资源库管理
*/
@ApiOperation(value="修改资源库管理", httpMethod = "PUT")
@Log(title = "资源库管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ResourceLibrary resourceLibrary)
{
return toAjax(resourceLibraryService.updateById(resourceLibrary));
}

/**
* 删除资源库管理
*/
@ApiOperation(value="删除资源库管理", httpMethod = "DELETE")
@Log(title = "资源库管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(resourceLibraryService.removeByIds(Arrays.asList(ids)));
}
}

+ 127
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/Apply.java View File

@@ -0,0 +1,127 @@
package com.ruoyi.business.domain;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import com.ruoyi.common.core.domain.BaseEntity;

/**
* 应用信息管理对象 ct_apply
*
* @author LiuChengRan
* @date 2024-06-13
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="Apply",description = "应用信息管理")
@TableName(value = "ct_apply")
public class Apply extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** 应用所有者名称 */
@Excel(name = "应用所有者名称")
@ApiModelProperty(name="ownerName",value = "应用所有者名称")
private String ownerName;
/** 应用所有者账号 */
@Excel(name = "应用所有者账号")
@ApiModelProperty(name="ownerAccount",value = "应用所有者账号")
private String ownerAccount;
/** 所有者id */
@Excel(name = "所有者id")
@ApiModelProperty(name="ownerId",value = "所有者id")
private String ownerId;
/** appid */
@Excel(name = "appid")
@ApiModelProperty(name="appId",value = "appid")
private String appId;
/** 应用名称 */
@Excel(name = "应用名称")
@ApiModelProperty(name="appName",value = "应用名称")
private String appName;
/** 应用类型名称 */
@Excel(name = "应用类型名称")
@ApiModelProperty(name="appTypeName",value = "应用类型名称")
private String appTypeName;
/** 应用类型枚举(app:应用 activity:指令) */
@Excel(name = "应用类型枚举", readConverterExp = "a=pp:应用,a=ctivity:指令")
@ApiModelProperty(name="appType",value = "应用类型枚举")
private String appType;
/** 应用创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "应用创建时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name="appCreateTime",value = "应用创建时间")
private Date appCreateTime;
/** 应用修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "应用修改时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name="appUpdateTime",value = "应用修改时间")
private Date appUpdateTime;
/** 版本,值内容:未发版、版本 */
@Excel(name = "版本,值内容:未发版、版本")
@ApiModelProperty(name="version",value = "版本,值内容:未发版、版本")
private String version;
/** 是否支持应用参数 */
@Excel(name = "是否支持应用参数")
@ApiModelProperty(name="supportParam",value = "是否支持应用参数")
private Integer supportParam;

/** icon图下载地址 */
@Excel(name = "icon图下载地址")
@ApiModelProperty(name="icon",value = "icon图下载地址")
private String icon;
/** 预计人工耗时 */
@Excel(name = "预计人工耗时")
@ApiModelProperty(name="manualTime",value = "预计人工耗时")
private String manualTime;

/** 部门id */
@Excel(name = "部门id")
@ApiModelProperty(name="deptId",value = "部门id")
private Long deptId;

/** 部门名称 */
@Excel(name = "部门名称")
@ApiModelProperty(name="deptName",value = "部门名称")
private String deptName;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("ownerName", getOwnerName())
.append("ownerAccount", getOwnerAccount())
.append("ownerId", getOwnerId())
.append("appId", getAppId())
.append("appName", getAppName())
.append("appTypeName", getAppTypeName())
.append("appType", getAppType())
.append("appCreateTime", getAppCreateTime())
.append("appUpdateTime", getAppUpdateTime())
.append("version", getVersion())
.append("supportParam", getSupportParam())
.append("icon", getIcon())
.append("manualTime", getManualTime())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("deleted", getDeleted())
.toString();
}
}

+ 209
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/ApplyPlan.java View File

@@ -0,0 +1,209 @@
package com.ruoyi.business.domain;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import com.ruoyi.common.core.domain.BaseEntity;

/**
* 应用执行计划管理对象 ct_apply_plan
*
* @author LiuChengRan
* @date 2024-06-14
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="ApplyPlan",description = "应用执行计划管理")
@TableName(value = "ct_apply_plan")
public class ApplyPlan extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;



/** 计划名称 */
@Excel(name = "计划名称")
@ApiModelProperty(name="planName",value = "计划名称")
private String planName;


/** 执行类型(0指定机器人 1随机分配空闲) */
@Excel(name = "执行类型", readConverterExp = "0=指定机器人,1=随机分配空闲")
@ApiModelProperty(name="planType",value = "执行类型")
private String planType;

/** 计划执行的机器人名称 */
@Excel(name = "计划执行的机器人名称")
@ApiModelProperty(name="robotName",value = "计划执行的机器人名称")
private String robotName;

/** 应用类型名称 */
@Excel(name = "应用类型名称")
@ApiModelProperty(name="appTypeName",value = "应用类型名称")
private String appTypeName;

/** 应用名称 */
@Excel(name = "应用名称")
@ApiModelProperty(name="appName",value = "应用名称")
private String appName;

/** appid */
@Excel(name = "appid")
@ApiModelProperty(name="appId",value = "appid")
private String appId;


/** 应用类型枚举(app:应用 activity:指令) */
@Excel(name = "应用类型枚举", readConverterExp = "app:应用,activity:指令")
@ApiModelProperty(name="appType",value = "应用类型枚举")
private String appType;

/** 是否支持应用参数 */
@Excel(name = "是否支持应用参数")
@ApiModelProperty(name="supportParam",value = "是否支持应用参数")
private Integer supportParam;

/** 计划参数 */
@Excel(name = "计划参数")
@ApiModelProperty(name="planParams",value = "计划参数")
private String planParams;

/** 输出参数 */
@Excel(name = "输出参数")
@ApiModelProperty(name="outParam",value = "输出参数")
private String outParam;

/** 等待超时时间 */
@Excel(name = "等待超时时间")
@ApiModelProperty(name="waitTimeout",value = "等待超时时间")
private String waitTimeout;

/** 优先级 */
@Excel(name = "优先级")
@ApiModelProperty(name="priority",value = "优先级")
private Integer priority;


/** 执行类型(0立即执行 1指定时间执行 2周期执行) */
@Excel(name = "执行类型", readConverterExp = "0=立即执行,1=指定时间执行,2=周期执行")
@ApiModelProperty(name="excType",value = "执行类型")
private String excType;


/** 执行时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name="excTime",value = "执行时间")
private Date excTime;

/** 执行表达式 */
@Excel(name = "执行表达式")
@ApiModelProperty(name="cronExpression",value = "执行表达式")
private String cronExpression;

/** 上次执行时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "上次执行时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(name="lastExecTime",value = "上次执行时间")
private Date lastExecTime;

/** 下次执行时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "下次执行时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(name="nextExecTime",value = "下次执行时间")
private Date nextExecTime;

/** 任务执行状态 */
@Excel(name = "任务执行状态")
@ApiModelProperty(name="taskStatus",value = "任务执行状态")
private String taskStatus;

/** 任务运行uuid */
@Excel(name = "任务运行uuid")
@ApiModelProperty(name="taskUuid",value = "任务运行uuid")
private String taskUuid;

/** 预计人工耗时 */
@Excel(name = "预计人工耗时")
@ApiModelProperty(name="manualTime",value = "预计人工耗时")
private String manualTime;



/** 任务开始运行的时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "任务开始运行的时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name="startTime",value = "任务开始运行的时间")
private Date startTime;


/** 任务结束运行的时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "任务结束运行的时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name="endTime",value = "任务结束运行的时间")
private Date endTime;

/** 实际耗时 */
@Excel(name = "实际耗时")
@ApiModelProperty(name="planTime",value = "实际耗时")
private String planTime;

/** 节约时间 */
@Excel(name = "节约时间")
@ApiModelProperty(name="timeSaving",value = "节约时间")
private String timeSaving;

/** 部门id */
@Excel(name = "部门id")
@ApiModelProperty(name="deptId",value = "部门id")
private Long deptId;

/** 部门名称 */
@Excel(name = "部门名称")
@ApiModelProperty(name="deptName",value = "部门名称")
private String deptName;


@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("planName", getPlanName())
.append("planType", getPlanType())
.append("robotName", getRobotName())
.append("appTypeName", getAppTypeName())
.append("appName", getAppName())
.append("appId", getAppId())
.append("appType", getAppType())
.append("manualTime", getManualTime())
.append("planParams", getPlanParams())
.append("waitTimeout", getWaitTimeout())
.append("priority", getPriority())
.append("excType", getExcType())
.append("excTime", getExcTime())
.append("cronExpression", getCronExpression())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("deleted", getDeleted())
.toString();
}
}

+ 142
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/ApplyPlanLog.java View File

@@ -0,0 +1,142 @@
package com.ruoyi.business.domain;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import com.ruoyi.common.core.domain.BaseEntity;

/**
* 应用执行结果记录管理对象 ct_apply_plan_log
*
* @author LiuChengRan
* @date 2024-06-14
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="ApplyPlanLog",description = "应用执行结果记录管理")
@TableName(value = "ct_apply_plan_log")
public class ApplyPlanLog extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;



/** 启动的任务的uuid */
@Excel(name = "启动的任务的uuid")
@ApiModelProperty(name="jobUuid",value = "启动的任务的uuid")
private String jobUuid;

/** 计划名称 */
@Excel(name = "计划名称")
@ApiModelProperty(name="planName",value = "计划名称")
private String planName;


/** 执行类型(0指定机器人 1随机分配空闲) */
@Excel(name = "执行类型", readConverterExp = "0=指定机器人,1=随机分配空闲")
@ApiModelProperty(name="planType",value = "执行类型")
private String planType;

/** 计划执行的机器人名称 */
@Excel(name = "计划执行的机器人名称")
@ApiModelProperty(name="robotName",value = "计划执行的机器人名称")
private String robotName;

/** 应用类型名称 */
@Excel(name = "应用类型名称")
@ApiModelProperty(name="appTypeName",value = "应用类型名称")
private String appTypeName;

/** 应用名称 */
@Excel(name = "应用名称")
@ApiModelProperty(name="appName",value = "应用名称")
private String appName;

/** appid */
@Excel(name = "appid")
@ApiModelProperty(name="appId",value = "appid")
private String appId;

/** 任务状态 */
@Excel(name = "任务状态")
@ApiModelProperty(name="status",value = "任务状态")
private String status;

/** 任务状态名称 */
@Excel(name = "任务状态名称")
@ApiModelProperty(name="statusName",value = "任务状态名称")
private String statusName;


/** 任务开始运行的时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "任务开始运行的时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name="startTime",value = "任务开始运行的时间")
private Date startTime;


/** 任务结束运行的时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "任务结束运行的时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name="endTime",value = "任务结束运行的时间")
private Date endTime;

/** 预计人工耗时 */
@Excel(name = "预计人工耗时")
@ApiModelProperty(name="manualTime",value = "预计人工耗时")
private String manualTime;

/** 实际耗时 */
@Excel(name = "实际耗时")
@ApiModelProperty(name="planTime",value = "实际耗时")
private String planTime;

/** 节约时间 */
@Excel(name = "节约时间")
@ApiModelProperty(name="timeSaving",value = "节约时间")
private String timeSaving;


@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("jobUuid", getJobUuid())
.append("planName", getPlanName())
.append("planType", getPlanType())
.append("robotName", getRobotName())
.append("appTypeName", getAppTypeName())
.append("appName", getAppName())
.append("appId", getAppId())
.append("status", getStatus())
.append("statusName", getStatusName())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("manualTime", getManualTime())
.append("planTime", getPlanTime())
.append("timeSaving", getTimeSaving())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("deleted", getDeleted())
.toString();
}
}

+ 0
- 64
ruoyi-business/src/main/java/com/ruoyi/business/domain/BusinessSurvey.java View File

@@ -1,64 +0,0 @@
package com.ruoyi.business.domain;

import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

import java.util.ArrayList;

/**
* 调查问卷管理对象 business_survey
*
* @author ruoyi
* @date 2024-04-01
*/
@Data
public class BusinessSurvey extends BaseEntity
{
private static final long serialVersionUID = 1L;



/** 问卷名称 */
@Excel(name = "问卷名称")
private String title;


/** 问卷描述 */
@Excel(name = "问卷描述")
private String context;


/** 模板id */
@Excel(name = "模板id")
private String tempId;


/** 模板名称 */
@Excel(name = "模板名称")
private String tempName;


/** 是否开放 */
@Excel(name = "是否开放")
private String open;

@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("title", getTitle())
.append("context", getContext())
.append("tempId", getTempId())
.append("open", getOpen())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("deleted", getDeleted())
.append("remark", getRemark())
.toString();
}
}

+ 0
- 73
ruoyi-business/src/main/java/com/ruoyi/business/domain/BusinessTemplate.java View File

@@ -1,73 +0,0 @@
package com.ruoyi.business.domain;

import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
* 模版管理对象 business_template
*
* @author ruoyi
* @date 2024-03-31
*/
@Data
public class BusinessTemplate extends BaseEntity
{
private static final long serialVersionUID = 1L;

/** 标题 */
@Excel(name = "标题")
private String title;


/** 内容 */
@Excel(name = "内容")
private String context;


/** 是否开放 */
@Excel(name = "是否开放")
private String open;


public void setTitle(String title)
{
this.title = title;
}

public String getTitle()
{
return title;
}
public void setContext(String context)
{
this.context = context;
}

public String getContext()
{
return context;
}
public void setOpen(String open)
{
this.open = open;
}


@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("title", getTitle())
.append("context", getContext())
.append("open", getOpen())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

+ 0
- 182
ruoyi-business/src/main/java/com/ruoyi/business/domain/BusinessTemplateProp.java View File

@@ -1,182 +0,0 @@
package com.ruoyi.business.domain;

import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* 模版属性对象 business_template_prop
*
* @author ruoyi
* @date 2024-03-31
*/
@Data
public class BusinessTemplateProp extends BaseEntity
{
private static final long serialVersionUID = 1L;

/** 标题 */
@Excel(name = "标题")
private String title;


/** 组件类型(0单选框 1多选框) */
@Excel(name = "组件类型", readConverterExp = "0=单选框,1=多选框")
private String compType;


/** 字段名 */
@Excel(name = "字段名")
private String fieldName;


/** 占位提示 */
@Excel(name = "占位提示")
private String placPrompt;


/** 默认值 */
@Excel(name = "默认值")
private String defaultValue;


/** 可选值 */
@Excel(name = "可选值")
private String optionalValue;

/** 可选值数组 */
@Excel(name = "可选值数组")
@TableField(exist = false)
private List<Map<String,Object>> optionalValues = new ArrayList<Map<String,Object>>();

/** 是否开放 */
@Excel(name = "是否开放")
private String open;


/** 模版id */
@Excel(name = "模版id")
private Long tempId;

/** 排序 */
@Excel(name = "排序")
private Integer sort;

public void setTitle(String title)
{
this.title = title;
}

public String getTitle()
{
return title;
}
public void setCompType(String compType)
{
this.compType = compType;
}

public String getCompType()
{
return compType;
}
public void setFieldName(String fieldName)
{
this.fieldName = fieldName;
}

public String getFieldName()
{
return fieldName;
}
public void setPlacPrompt(String placPrompt)
{
this.placPrompt = placPrompt;
}

public String getPlacPrompt()
{
return placPrompt;
}
public void setDefaultValue(String defaultValue)
{
this.defaultValue = defaultValue;
}

public String getDefaultValue()
{
return defaultValue;
}
public void setOptionalValue(String optionalValue)
{
if(StringUtils.isNotBlank(optionalValue)){
String[] split = optionalValue.split("\\|");

for (String s : split) {
Map<String, Object> dataMap = new HashMap<>();
String[] value = s.split(",");
dataMap.put("key",value[0]);
dataMap.put("value",value[1]);
this.optionalValues.add(dataMap);
}

}
this.optionalValue = optionalValue;
}

public String getOptionalValue()
{
return optionalValue;
}
public void setOpen(String open)
{
this.open = open;
}

public String getOpen()
{
return open;
}
public void setTempId(Long tempId)
{
this.tempId = tempId;
}

public Long getTempId()
{
return tempId;
}

@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("title", getTitle())
.append("compType", getCompType())
.append("fieldName", getFieldName())
.append("placPrompt", getPlacPrompt())
.append("defaultValue", getDefaultValue())
.append("optionalValue", getOptionalValue())
.append("open", getOpen())
.append("tempId", getTempId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("deleted", getDeleted())
.append("remark", getRemark())
.toString();
}

}

+ 0
- 111
ruoyi-business/src/main/java/com/ruoyi/business/domain/BusinessTemplatePropValue.java View File

@@ -1,111 +0,0 @@
package com.ruoyi.business.domain;

import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
* 模版属性值对象 business_template_prop_value
*
* @author ruoyi
* @date 2024-03-31
*/
@Data
public class BusinessTemplatePropValue extends BaseEntity
{
private static final long serialVersionUID = 1L;



/** 字段id */
@Excel(name = "字段id")
private String propId;


/** 字段名称 */
@Excel(name = "字段名称")
private String propName;


/** 字段类型 */
@Excel(name = "字段类型")
private String propType;

/** 值键 */
@Excel(name = "值键")
private String valueKey;


/** 值描述 */
@Excel(name = "值描述")
private String valueText;


/** 原值对象 */
@Excel(name = "原值对象")
private String valueSources;


/** 试卷id */
@Excel(name = "试卷id")
private String surveyId;





public void setPropId(String propId)
{
this.propId = propId;
}

public String getPropId()
{
return propId;
}
public void setPropName(String propName)
{
this.propName = propName;
}

public String getPropName()
{
return propName;
}
public void setValueKey(String valueKey)
{
this.valueKey = valueKey;
}

public String getValueKey()
{
return valueKey;
}
public void setValueText(String valueText)
{
this.valueText = valueText;
}

public String getValueText()
{
return valueText;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("propId", getPropId())
.append("propName", getPropName())
.append("valueKey", getValueKey())
.append("valueText", getValueText())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("deleted", getDeleted())
.append("remark", getRemark())
.toString();
}
}

+ 95
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/Rebot.java View File

@@ -0,0 +1,95 @@
package com.ruoyi.business.domain;


import com.baomidou.mybatisplus.annotation.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import com.ruoyi.common.core.domain.BaseEntity;

/**
* 机器人管理对象 ct_rebot
*
* @author LiuChengRan
* @date 2024-06-14
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="Rebot",description = "机器人管理")
@TableName(value = "ct_rebot")
public class Rebot extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;



/** 机器人名称 */
@Excel(name = "机器人名称")
@ApiModelProperty(name="robotClientName",value = "机器人名称")
private String robotClientName;

/** 机器人Uuid信息 */
@Excel(name = "机器人Uuid信息")
@ApiModelProperty(name="robotClientUuid",value = "机器人Uuid信息")
private String robotClientUuid;


/** 运行状态(waiting:等待调度 running:任务运行中 finish:任务运行结束 stopping:任务正在停止 stopped:已结束 error:异常) */
@Excel(name = "运行状态", readConverterExp = "waiting:等待调度,running:任务运行中,finish:任务运行结束,stopping:任务正在停止,stopped:已结束,error:异常")
@ApiModelProperty(name="status",value = "运行状态")
private String status;

/** 描述 */
@Excel(name = "描述")
@ApiModelProperty(name="description",value = "描述")
private String description;

/** 客户端系统账号 */
@Excel(name = "客户端系统账号")
@ApiModelProperty(name="windowsAccount",value = "客户端系统账号")
private String windowsAccount;

/** 客户端ip */
@Excel(name = "客户端ip")
@ApiModelProperty(name="clientIp",value = "客户端ip")
private String clientIp;

/** 部门id */
@Excel(name = "部门id")
@ApiModelProperty(name="deptId",value = "部门id")
private Long deptId;


@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("robotClientName", getRobotClientName())
.append("robotClientUuid", getRobotClientUuid())
.append("status", getStatus())
.append("description", getDescription())
.append("windowsAccount", getWindowsAccount())
.append("clientIp", getClientIp())
.append("deptId", getDeptId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("deleted", getDeleted())
.toString();
}
}

+ 95
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/ResourceLibrary.java View File

@@ -0,0 +1,95 @@
package com.ruoyi.business.domain;

import com.baomidou.mybatisplus.annotation.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import com.ruoyi.common.core.domain.BaseEntity;

/**
* 资源库管理对象 ct_resource_library
*
* @author LiuChengRan
* @date 2024-06-17
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="ResourceLibrary",description = "资源库管理")
@TableName(value = "ct_resource_library")
public class ResourceLibrary extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;



/** 资源描述 */
@Excel(name = "资源描述")
@ApiModelProperty(name="resource",value = "资源描述")
private String resource;

/** 资源内容 */
@Excel(name = "资源内容")
@ApiModelProperty(name="resourceValue",value = "资源内容")
private String resourceValue;

/** 资源类型 */
@Excel(name = "资源类型")
@ApiModelProperty(name="resourceType",value = "资源类型")
private String resourceType;

/** 资源键 */
@Excel(name = "资源键")
@ApiModelProperty(name="resourceName",value = "资源键")
private String resourceName;

/** 所属应用id */
@Excel(name = "所属应用id")
@ApiModelProperty(name="appId",value = "所属应用id")
private String appId;

/** 所属应用名称 */
@Excel(name = "所属应用名称")
@ApiModelProperty(name="appName",value = "所属应用名称")
private String appName;

/** 部门id */
@Excel(name = "部门id")
@ApiModelProperty(name="deptId",value = "部门id")
private Long deptId;

/** 部门名称 */
@Excel(name = "部门名称")
@ApiModelProperty(name="deptName",value = "部门名称")
private String deptName;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("resource", getResource())
.append("resourceValue", getResourceValue())
.append("resourceType", getResourceType())
.append("resourceName", getResourceName())
.append("appName", getAppName())
.append("deptId", getDeptId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("deleted", getDeleted())
.toString();
}
}

+ 141
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/AddApplyPlanBO.java View File

@@ -0,0 +1,141 @@
package com.ruoyi.business.domain.bo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;
import java.util.List;

/**
* 应用执行计划管理对象 ct_apply_plan
*
* @author LiuChengRan
* @date 2024-06-14
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="ApplyPlan",description = "应用执行计划管理")
public class AddApplyPlanBO extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;



/** 计划名称 */
@Excel(name = "计划名称")
@ApiModelProperty(name="planName",value = "计划名称")
private String planName;


/** 执行类型(0指定机器人 1随机分配空闲) */
@Excel(name = "执行类型", readConverterExp = "0=指定机器人,1=随机分配空闲")
@ApiModelProperty(name="planType",value = "执行类型")
private String planType;

/** 计划执行的机器人名称 */
@Excel(name = "计划执行的机器人名称")
@ApiModelProperty(name="robotName",value = "计划执行的机器人名称")
private String robotName;

/** 应用类型名称 */
@Excel(name = "应用类型名称")
@ApiModelProperty(name="appTypeName",value = "应用类型名称")
private String appTypeName;

/** 应用名称 */
@Excel(name = "应用名称")
@ApiModelProperty(name="appName",value = "应用名称")
private String appName;

/** appid */
@Excel(name = "appid")
@ApiModelProperty(name="appId",value = "appid")
private List<String> appId;


/** 应用类型枚举(app:应用 activity:指令) */
@Excel(name = "应用类型枚举", readConverterExp = "a=pp:应用,a=ctivity:指令")
@ApiModelProperty(name="appType",value = "应用类型枚举")
private String appType;

/** 预计人工耗时 */
@Excel(name = "预计人工耗时")
@ApiModelProperty(name="manualTime",value = "预计人工耗时")
private String manualTime;

/** 是否支持应用参数 */
@Excel(name = "是否支持应用参数")
@ApiModelProperty(name="supportParam",value = "是否支持应用参数")
private Integer supportParam;

/** 参数 */
@Excel(name = "参数")
@ApiModelProperty(name="planParams",value = "参数")
private String planParams;

/** 等待超时时间 */
@Excel(name = "等待超时时间")
@ApiModelProperty(name="waitTimeout",value = "等待超时时间")
private String waitTimeout;

/** 优先级 */
@Excel(name = "优先级")
@ApiModelProperty(name="priority",value = "优先级")
private Integer priority;


/** 执行类型(0立即执行 1指定时间执行 2周期执行) */
@Excel(name = "执行类型", readConverterExp = "0=立即执行,1=指定时间执行,2=周期执行")
@ApiModelProperty(name="excType",value = "执行类型")
private String excType;


/** 执行时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name="excTime",value = "执行时间")
private Date excTime;

/** 执行表达式 */
@Excel(name = "执行表达式")
@ApiModelProperty(name="cronExpression",value = "执行表达式")
private String cronExpression;

@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("planName", getPlanName())
.append("planType", getPlanType())
.append("robotName", getRobotName())
.append("appTypeName", getAppTypeName())
.append("appName", getAppName())
.append("appId", getAppId())
.append("appType", getAppType())
.append("manualTime", getManualTime())
.append("params", getParams())
.append("waitTimeout", getWaitTimeout())
.append("priority", getPriority())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("deleted", getDeleted())
.toString();
}
}

+ 109
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/ApplyStartBO.java View File

@@ -0,0 +1,109 @@
package com.ruoyi.business.domain.bo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;
import java.util.List;

/**
* 应用信息管理对象 ct_apply
*
* @author LiuChengRan
* @date 2024-06-13
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "ApplyStartBO", description = "启动应用")
public class ApplyStartBO {
private static final long serialVersionUID = 1L;

/**
* 冗余
*/
@Excel(name = "计划名称")
@ApiModelProperty(name="planName",value = "计划名称")
private String planName;

/** 预计人工耗时 */
@Excel(name = "预计人工耗时")
@ApiModelProperty(name="manualTime",value = "预计人工耗时")
private String manualTime;

/**
* 指定的机器人名称
* <p>
* 与robotClientGroupUuid二选一
*/
private String accountName;

/**
* 机器人分组Id
* <p>
* 与accountName二选一
*/
private String robotClientGroupUuid;

/**
* 需要运行的应用
* <p>
* 必填
*/
private String robotUuid;
/** 计划参数 */
@Excel(name = "计划参数")
@ApiModelProperty(name="planParams",value = "计划参数")
private String planParams;
/**
* 应用运行参数
* <p>
* 非必填
*/
private List<RobotParam> planParamsList;

/**
* 等待超时时间
*
* @see com.xybot.api.sdk.enums.WaitTimeoutEnum
* <p>
* 非必填,不填,默认为10分钟
*/
private String waitTimeout;

/**
* 优先级
*
* @see com.xybot.api.sdk.enums.PriorityEnum
* 非必填,不填,默认为middle
*/
private String priority;

@Excel(name = "所属公司")
@ApiModelProperty(name = "deptId", value = "所属公司")
private Long deptId;

/**
* 应用运行参数
*/
@Data
public static class RobotParam {
// 参数名
private String name;
// 参数值
private String value;
// 参数类型
private String type;

}
}

+ 19
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/JobQueryBO.java View File

@@ -0,0 +1,19 @@
package com.ruoyi.business.domain.bo;

import lombok.Data;

/**
* 停止job请求
*
* @author boyi
* @since 2022/8/26 10:16
*/
@Data
public class JobQueryBO {

/**
* 应用运行的uuid, 由job/start接口返回
*/
private String jobUuid;
}


+ 27
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/JobQueryLogBO.java View File

@@ -0,0 +1,27 @@
package com.ruoyi.business.domain.bo;

import lombok.Data;

/**
* 查询运行日志
*
* @author boyi
* @since 2022/8/26 10:16
*/
@Data
public class JobQueryLogBO {

/**
* 计划uuid
*/
private String scheduleUuid;
/**
* 翻页方向
*/
private String cursorDirection;
/**
* 每页数量
*/
private Integer size;
}


+ 121
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/ListApplyBO.java View File

@@ -0,0 +1,121 @@
package com.ruoyi.business.domain.bo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
* 应用信息管理对象 ct_apply
*
* @author LiuChengRan
* @date 2024-06-13
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="ListApplyVO",description = "应用信息管理")
public class ListApplyBO extends BaseEntity
{
private static final long serialVersionUID = 1L;

@ApiModelProperty(name = "page", value = "第几页")
private Integer page;

@ApiModelProperty(name = "size", value = "页大小")
private Integer size;

/** 应用所有者名称 */
@Excel(name = "应用所有者名称")
@ApiModelProperty(name="ownerName",value = "应用所有者名称")
private String ownerName;
/** 应用所有者账号 */
@Excel(name = "应用所有者账号")
@ApiModelProperty(name="ownerAccount",value = "应用所有者账号")
private String ownerAccount;
/** 所有者id */
@Excel(name = "所有者id")
@ApiModelProperty(name="ownerId",value = "所有者id")
private String ownerId;
/** appid */
@Excel(name = "appid")
@ApiModelProperty(name="appId",value = "appid")
private String appId;
/** 应用名称 */
@Excel(name = "应用名称")
@ApiModelProperty(name="appName",value = "应用名称")
private String appName;
/** 应用类型名称 */
@Excel(name = "应用类型名称")
@ApiModelProperty(name="appTypeName",value = "应用类型名称")
private String appTypeName;
/** 应用类型枚举(app:应用 activity:指令) */
@Excel(name = "应用类型枚举", readConverterExp = "a=pp:应用,a=ctivity:指令")
@ApiModelProperty(name="appType",value = "应用类型枚举")
private String appType;
/** 应用创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "应用创建时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name="appCreateTime",value = "应用创建时间")
private Date appCreateTime;
/** 应用修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "应用修改时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name="appUpdateTime",value = "应用修改时间")
private Date appUpdateTime;
/** 版本,值内容:未发版、版本 */
@Excel(name = "版本,值内容:未发版、版本")
@ApiModelProperty(name="version",value = "版本,值内容:未发版、版本")
private String version;
/** 是否支持应用参数 */
@Excel(name = "是否支持应用参数")
@ApiModelProperty(name="supportParam",value = "是否支持应用参数")
private Integer supportParam;
/** icon图下载地址 */
@Excel(name = "icon图下载地址")
@ApiModelProperty(name="icon",value = "icon图下载地址")
private String icon;
/** 预计人工耗时 */
@Excel(name = "预计人工耗时")
@ApiModelProperty(name="manualTime",value = "预计人工耗时")
private String manualTime;
/** 所属公司 */
@Excel(name = "所属公司")
@ApiModelProperty(name="deptId",value = "所属公司")
private Long deptId;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("ownerName", getOwnerName())
.append("ownerAccount", getOwnerAccount())
.append("ownerId", getOwnerId())
.append("appId", getAppId())
.append("appName", getAppName())
.append("appTypeName", getAppTypeName())
.append("appType", getAppType())
.append("appCreateTime", getAppCreateTime())
.append("appUpdateTime", getAppUpdateTime())
.append("version", getVersion())
.append("supportParam", getSupportParam())
.append("icon", getIcon())
.append("manualTime", getManualTime())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("deleted", getDeleted())
.toString();
}
}

+ 47
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/ListRebotBO.java View File

@@ -0,0 +1,47 @@
package com.ruoyi.business.domain.bo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serializable;

/**
* 机器人查询参数
*
* @author LiuChengRan
* @date 2024-06-13
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "ListRebotBO", description = "机器人查询参数")
public class ListRebotBO implements Serializable {
private static final long serialVersionUID = 1L;

@ApiModelProperty(name = "status", value = "机器人状态")
private String status;

@ApiModelProperty(name = "key", value = "关键字模糊搜索")
private String key;

@ApiModelProperty(name = "robotClientGroupUuid", value = "robotClientGroupUuid")
private String robotClientGroupUuid;

@ApiModelProperty(name = "page", value = "第几页")
private Integer page;

@ApiModelProperty(name = "size", value = "页大小")
private Integer size;

}

+ 65
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/JobQueryLogVO.java View File

@@ -0,0 +1,65 @@
package com.ruoyi.business.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
* 查询job响应
*
* @author boyi
* @since 2022/8/26 10:17
*/
@Data
public class JobQueryLogVO {

/**
* 用于判断继续翻页时是否有数据,可用作翻页按钮置灰操作比如当往下翻页到20页时,第21页没有数据,则在20页时hasData为false,表示不能继续往下翻页,只能往上翻页
*/
private Boolean hasData;


/**
* 往下翻页时,可作为 cursorId 使用,表示从这个id开始往下翻页
*/
private Long nextId;

/**
* 往上翻页时,可作为 cursorId 使用,表示从这个id开始往上翻页
*/
private Long preId;

/**
* 当前的翻页方向 next表示当前往下翻页 pre表示当前往上翻页
*/
private String cursorDirection;

/**
* 日志
*/
private List<DataList> dataList;

/**
* 任务结束运行的时

/**
* 应用运行参数
*/
@Data
public static class DataList {
private String id;
private String jobUuid;
private String status;
private String taskName;
private String robotUuid;
private String robotName;
private String triggerTime;
private String robotClientUuid;
// remark
private String remark;

}

}

+ 119
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/JobQueryVO.java View File

@@ -0,0 +1,119 @@
package com.ruoyi.business.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
* 查询job响应
*
* @author boyi
* @since 2022/8/26 10:17
*/
@Data
public class JobQueryVO {

/**
* 启动的任务的uuid
*
* 不为空
*/
private String jobUuid;

/**
* 任务状态
*
* 不为空
* @see com.xybot.api.sdk.enums.JobStatusEnum
*/
private String status;

/**
* 任务状态名称
*
* 不为空
*
* @see com.xybot.api.sdk.enums.JobStatusEnum
*/
private String statusName;

/**
* 运行的应用
*
* 不为空
*/
private String robotUuid;

/**
* 运行的应用名称
*
* 不为空
*/
private String robotName;

/**
* 任务开始运行的时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;

/**
* 任务结束运行的时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;

/**
* 备注
*/
private String remark;

/**
* 应用运行参数
*/
private Param robotParams;

/**
* 机器人账号
*
* 不为空
*/
private String robotClientUuid;

/**
* 机器人名称
*
* 不为空
*/
private String robotClientName;



/**
* 应用运行参数
*/
@Data
public static class RobotParam {
// 参数名
private String name;
// 参数值
private String value;
// 参数类型
private String type;

}

/**
* 应用运行参数
*/
@Data
public static class Param {
// 输入参数
private List<RobotParam> inputs;
// 输出参数
private List<RobotParam> outputs;

}
}

+ 18
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/JobStartVO.java View File

@@ -0,0 +1,18 @@
package com.ruoyi.business.domain.vo;

import lombok.Data;

/**
* jobStart响应
*
* @author boyi
* @since 2022/8/24 10:54
*/
@Data
public class JobStartVO {

/**
* 启动的job的uuid
*/
private String jobUuid;
}

+ 116
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/ListApplyVO.java View File

@@ -0,0 +1,116 @@
package com.ruoyi.business.domain.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
* 应用信息管理对象 ct_apply
*
* @author LiuChengRan
* @date 2024-06-13
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="ListApplyVO",description = "应用信息管理")
public class ListApplyVO extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 应用所有者名称 */
@Excel(name = "应用所有者名称")
@ApiModelProperty(name="ownerName",value = "应用所有者名称")
private String ownerName;
/** 应用所有者账号 */
@Excel(name = "应用所有者账号")
@ApiModelProperty(name="ownerAccount",value = "应用所有者账号")
private String ownerAccount;
/** 所有者id */
@Excel(name = "所有者id")
@ApiModelProperty(name="ownerId",value = "所有者id")
private String ownerId;
/** appid */
@Excel(name = "appid")
@ApiModelProperty(name="appId",value = "appid")
private String appId;
/** 应用名称 */
@Excel(name = "应用名称")
@ApiModelProperty(name="appName",value = "应用名称")
private String appName;
/** 应用类型名称 */
@Excel(name = "应用类型名称")
@ApiModelProperty(name="appTypeName",value = "应用类型名称")
private String appTypeName;
/** 应用类型枚举(app:应用 activity:指令) */
@Excel(name = "应用类型枚举", readConverterExp = "a=pp:应用,a=ctivity:指令")
@ApiModelProperty(name="appType",value = "应用类型枚举")
private String appType;
/** 应用创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "应用创建时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name="appCreateTime",value = "应用创建时间")
private Date appCreateTime;
/** 应用修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "应用修改时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name="appUpdateTime",value = "应用修改时间")
private Date appUpdateTime;
/** 版本,值内容:未发版、版本 */
@Excel(name = "版本,值内容:未发版、版本")
@ApiModelProperty(name="version",value = "版本,值内容:未发版、版本")
private String version;
/** 是否支持应用参数 */
@Excel(name = "是否支持应用参数")
@ApiModelProperty(name="supportParam",value = "是否支持应用参数")
private Integer supportParam;
/** icon图下载地址 */
@Excel(name = "icon图下载地址")
@ApiModelProperty(name="icon",value = "icon图下载地址")
private String icon;
/** 预计人工耗时 */
@Excel(name = "预计人工耗时")
@ApiModelProperty(name="manualTime",value = "预计人工耗时")
private String manualTime;
/** 所属公司 */
@Excel(name = "所属公司")
@ApiModelProperty(name="deptId",value = "所属公司")
private Long deptId;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("ownerName", getOwnerName())
.append("ownerAccount", getOwnerAccount())
.append("ownerId", getOwnerId())
.append("appId", getAppId())
.append("appName", getAppName())
.append("appTypeName", getAppTypeName())
.append("appType", getAppType())
.append("appCreateTime", getAppCreateTime())
.append("appUpdateTime", getAppUpdateTime())
.append("version", getVersion())
.append("supportParam", getSupportParam())
.append("icon", getIcon())
.append("manualTime", getManualTime())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("deleted", getDeleted())
.toString();
}
}

+ 83
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/ListRebotVO.java View File

@@ -0,0 +1,83 @@
package com.ruoyi.business.domain.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
* 机器人管理对象 ct_rebot
*
* @author LiuChengRan
* @date 2024-06-13
*/
@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "ListRebotVo", description = "机器人管理")
public class ListRebotVO extends BaseEntity {

private static final long serialVersionUID = 1L;


/** 机器人名称 */
@Excel(name = "机器人名称")
@ApiModelProperty(name="robotClientName",value = "机器人名称")
private String robotClientName;

/** 机器人Uuid信息 */
@Excel(name = "机器人Uuid信息")
@ApiModelProperty(name="robotClientUuid",value = "机器人Uuid信息")
private String robotClientUuid;


/** 运行状态(waiting:等待调度 running:任务运行中 finish:任务运行结束 stopping:任务正在停止 stopped:已结束 error:异常) */
@Excel(name = "运行状态", readConverterExp = "w=aiting:等待调度,r=unning:任务运行中,f=inish:任务运行结束,s=topping:任务正在停止,s=topped:已结束,e=rror:异常")
@ApiModelProperty(name="status",value = "运行状态")
private String status;

/** 描述 */
@Excel(name = "描述")
@ApiModelProperty(name="description",value = "描述")
private String description;

/** 客户端系统账号 */
@Excel(name = "客户端系统账号")
@ApiModelProperty(name="windowsAccount",value = "客户端系统账号")
private String windowsAccount;

/** 客户端ip */
@Excel(name = "客户端ip")
@ApiModelProperty(name="clientIp",value = "客户端ip")
private String clientIp;

/** 部门id */
@Excel(name = "部门id")
@ApiModelProperty(name="deptId",value = "部门id")
private Long deptId;

@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("robotClientUuid", getRobotClientUuid())
.append("status", getStatus())
.append("description", getDescription())
.append("clientIp", getClientIp())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("deleted", getDeleted())
.toString();
}
}

+ 32
- 0
ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyMapper.java View File

@@ -0,0 +1,32 @@
package com.ruoyi.business.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.business.domain.Apply;

/**
* 应用信息管理Mapper接口
*
* @author LiuChengRan
* @date 2024-06-13
*/
public interface ApplyMapper extends BaseMapper<Apply>
{

/**
* 查询应用信息管理列表
*
* @param apply 应用信息管理
* @return 应用信息管理集合
*/
List<Apply> selectApplyList(Apply apply);

/**
* 查询所有应用信息列表
*
* @param apply 应用信息管理
* @return 应用信息管理集合
*/
List<Apply> selectApplyAllList(Apply apply);

}

+ 24
- 0
ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyPlanLogMapper.java View File

@@ -0,0 +1,24 @@
package com.ruoyi.business.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.business.domain.ApplyPlanLog;

/**
* 应用执行结果记录管理Mapper接口
*
* @author LiuChengRan
* @date 2024-06-14
*/
public interface ApplyPlanLogMapper extends BaseMapper<ApplyPlanLog>
{

/**
* 查询应用执行结果记录管理列表
*
* @param applyPlanLog 应用执行结果记录管理
* @return 应用执行结果记录管理集合
*/
List<ApplyPlanLog> selectApplyPlanLogList(ApplyPlanLog applyPlanLog);

}

+ 29
- 0
ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyPlanMapper.java View File

@@ -0,0 +1,29 @@
package com.ruoyi.business.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.business.domain.ApplyPlan;

/**
* 应用执行计划管理Mapper接口
*
* @author LiuChengRan
* @date 2024-06-14
*/
public interface ApplyPlanMapper extends BaseMapper<ApplyPlan>
{

/**
* 查询应用执行计划管理列表
*
* @param applyPlan 应用执行计划管理
* @return 应用执行计划管理集合
*/
List<ApplyPlan> selectApplyPlanList(ApplyPlan applyPlan);

/**
* 重新运行
* @return
*/
Integer appRetry(String taskUuid);
}

+ 0
- 16
ruoyi-business/src/main/java/com/ruoyi/business/mapper/BusinessSurveyMapper.java View File

@@ -1,16 +0,0 @@
package com.ruoyi.business.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.business.domain.BusinessSurvey;

/**
* 调查问卷管理Mapper接口
*
* @author ruoyi
* @date 2024-04-01
*/
public interface BusinessSurveyMapper extends BaseMapper<BusinessSurvey>
{

}

+ 0
- 16
ruoyi-business/src/main/java/com/ruoyi/business/mapper/BusinessTemplateMapper.java View File

@@ -1,16 +0,0 @@
package com.ruoyi.business.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.business.domain.BusinessTemplate;

/**
* 模版管理Mapper接口
*
* @author ruoyi
* @date 2024-03-31
*/
public interface BusinessTemplateMapper extends BaseMapper<BusinessTemplate>
{

}

+ 0
- 16
ruoyi-business/src/main/java/com/ruoyi/business/mapper/BusinessTemplatePropMapper.java View File

@@ -1,16 +0,0 @@
package com.ruoyi.business.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.business.domain.BusinessTemplateProp;

/**
* 模版属性Mapper接口
*
* @author ruoyi
* @date 2024-03-31
*/
public interface BusinessTemplatePropMapper extends BaseMapper<BusinessTemplateProp>
{

}

+ 0
- 23
ruoyi-business/src/main/java/com/ruoyi/business/mapper/BusinessTemplatePropValueMapper.java View File

@@ -1,23 +0,0 @@
package com.ruoyi.business.mapper;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.business.domain.BusinessTemplatePropValue;
import org.apache.ibatis.annotations.Param;

/**
* 模版属性值Mapper接口
*
* @author ruoyi
* @date 2024-03-31
*/
public interface BusinessTemplatePropValueMapper extends BaseMapper<BusinessTemplatePropValue>
{
/**
* 获取统计数据
* @param surveyId
*/
List<Map<String,Object>> countGroup(@Param("surveyId") String surveyId, @Param("propId") String propId);
}

+ 25
- 0
ruoyi-business/src/main/java/com/ruoyi/business/mapper/RebotMapper.java View File

@@ -0,0 +1,25 @@
package com.ruoyi.business.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.business.domain.Rebot;

/**
* 机器人管理Mapper接口
*
* @author LiuChengRan
* @date 2024-06-13
*/
public interface RebotMapper extends BaseMapper<Rebot>
{


/**
* 查询机器人管理列表
*
* @param rebot 机器人管理
* @return 机器人管理集合
*/
List<Rebot> selectRebotList(Rebot rebot);

}

+ 24
- 0
ruoyi-business/src/main/java/com/ruoyi/business/mapper/ResourceLibraryMapper.java View File

@@ -0,0 +1,24 @@
package com.ruoyi.business.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.business.domain.ResourceLibrary;

/**
* 资源库管理Mapper接口
*
* @author LiuChengRan
* @date 2024-06-17
*/
public interface ResourceLibraryMapper extends BaseMapper<ResourceLibrary>
{

/**
* 查询资源库管理列表
*
* @param resourceLibrary 资源库管理
* @return 资源库管理集合
*/
List<ResourceLibrary> selectResourceLibraryList(ResourceLibrary resourceLibrary);

}

+ 24
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyPlanLogService.java View File

@@ -0,0 +1,24 @@
package com.ruoyi.business.service;

import java.util.List;
import com.ruoyi.business.domain.ApplyPlanLog;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* 应用执行结果记录管理Service接口
*
* @author LiuChengRan
* @date 2024-06-14
*/
public interface IApplyPlanLogService extends IService<ApplyPlanLog>
{

/**
* 查询应用执行结果记录管理列表
*
* @param applyPlanLog 应用执行结果记录管理
* @return 应用执行结果记录管理集合
*/
List<ApplyPlanLog> list(ApplyPlanLog applyPlanLog);

}

+ 88
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyPlanService.java View File

@@ -0,0 +1,88 @@
package com.ruoyi.business.service;

import java.util.List;

import com.ruoyi.business.domain.ApplyPlan;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.business.domain.bo.AddApplyPlanBO;
import com.ruoyi.business.domain.bo.ApplyStartBO;
import com.ruoyi.business.domain.bo.JobQueryBO;
import com.ruoyi.business.domain.vo.JobQueryVO;

/**
* 应用执行计划管理Service接口
*
* @author LiuChengRan
* @date 2024-06-14
*/
public interface IApplyPlanService extends IService<ApplyPlan> {

/**
* 重新运行
*
* @param
* @return
*/
boolean appRetry(JobQueryBO jobQueryBO) throws IllegalAccessException;

/**
* 停止运行
*
* @param
* @return
*/
boolean stopRun(JobQueryBO jobQueryBO) throws IllegalAccessException;

/**
* 更新计划应用执行结果
*
* @param
* @return
*/
void queryAppStartResult() throws IllegalAccessException;


/**
* 获取应用执行结果
*
* @return
*/
boolean execPlan(ApplyStartBO applyStartBO) throws IllegalAccessException;

/**
* 定时查询指定时间执行的数据
*
* @return
*/
boolean runAppBySetTime() throws IllegalAccessException;

/**
* 表达式执行
*/
boolean runAppByCron() throws IllegalAccessException;

/**
* 创建计划
*
* @param addApplyPlanBO
* @return
*/
boolean save(AddApplyPlanBO addApplyPlanBO);

/**
* 修改计划
*
* @param addApplyPlanBO
* @return
*/
boolean update(AddApplyPlanBO addApplyPlanBO);

/**
* 查询应用执行计划管理列表
*
* @param applyPlan 应用执行计划管理
* @return 应用执行计划管理集合
*/
List<ApplyPlan> list(ApplyPlan applyPlan);

}

+ 52
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyService.java View File

@@ -0,0 +1,52 @@
package com.ruoyi.business.service;

import java.util.List;
import com.ruoyi.business.domain.Apply;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.business.domain.Rebot;
import com.ruoyi.business.domain.bo.ApplyStartBO;
import com.ruoyi.business.domain.bo.JobQueryBO;
import com.ruoyi.business.domain.vo.JobQueryVO;
import com.ruoyi.business.domain.vo.JobStartVO;
import com.ruoyi.common.annotation.DataScope;

/**
* 应用信息管理Service接口
*
* @author LiuChengRan
* @date 2024-06-13
*/
public interface IApplyService extends IService<Apply>
{
/**
* 启动应用
* @return
*/
JobStartVO appStart(ApplyStartBO applyStartBO) throws IllegalAccessException;
/**
* 查询应用运行结果
* @return
*/
JobQueryVO queryAppStartResult(JobQueryBO jobQueryBO) throws IllegalAccessException;
/**
* 同步应用数据
* @return
*/
void syn(Apply apply) throws IllegalAccessException;
/**
* 查询应用信息管理列表
*
* @param apply 应用信息管理
* @return 应用信息管理集合
*/
List<Apply> list(Apply apply);

/**
* 查询所有应用信息列表
*
* @param apply 应用信息管理
* @return 应用信息管理集合
*/
List<Apply> listAll(Apply apply);

}

+ 0
- 22
ruoyi-business/src/main/java/com/ruoyi/business/service/IBusinessSurveyService.java View File

@@ -1,22 +0,0 @@
package com.ruoyi.business.service;

import java.util.List;
import com.ruoyi.business.domain.BusinessSurvey;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;

/**
* 调查问卷管理Service接口
*
* @author ruoyi
* @date 2024-04-01
*/
public interface IBusinessSurveyService extends IService<BusinessSurvey>
{

/**
* 根据试卷获取题目
* @param surveyId
*/
AjaxResult listBySurveyId(String surveyId);
}

+ 0
- 15
ruoyi-business/src/main/java/com/ruoyi/business/service/IBusinessTemplatePropService.java View File

@@ -1,15 +0,0 @@
package com.ruoyi.business.service;

import java.util.List;
import com.ruoyi.business.domain.BusinessTemplateProp;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 模版属性Service接口
*
* @author ruoyi
* @date 2024-03-31
*/
public interface IBusinessTemplatePropService extends IService<BusinessTemplateProp>
{

}

+ 0
- 28
ruoyi-business/src/main/java/com/ruoyi/business/service/IBusinessTemplatePropValueService.java View File

@@ -1,28 +0,0 @@
package com.ruoyi.business.service;

import java.util.List;
import java.util.Map;

import com.ruoyi.business.domain.BusinessTemplatePropValue;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 模版属性值Service接口
*
* @author ruoyi
* @date 2024-03-31
*/
public interface IBusinessTemplatePropValueService extends IService<BusinessTemplatePropValue>
{

/**
*获取统计数据
* @param tempId
*/
Object countGroup(String tempId);
/**
* 批量写入值
* @param data
* @return
*/
boolean addList(Map<String, Object> data);
}

+ 0
- 15
ruoyi-business/src/main/java/com/ruoyi/business/service/IBusinessTemplateService.java View File

@@ -1,15 +0,0 @@
package com.ruoyi.business.service;

import java.util.List;
import com.ruoyi.business.domain.BusinessTemplate;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 模版管理Service接口
*
* @author ruoyi
* @date 2024-03-31
*/
public interface IBusinessTemplateService extends IService<BusinessTemplate>
{

}

+ 29
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/IRebotService.java View File

@@ -0,0 +1,29 @@
package com.ruoyi.business.service;

import java.util.List;
import com.ruoyi.business.domain.Rebot;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* 机器人管理Service接口
*
* @author LiuChengRan
* @date 2024-06-13
*/
public interface IRebotService extends IService<Rebot>
{

/**
* 同步机器人数据
* @return
*/
void syn(Rebot rebot) throws IllegalAccessException;
/**
* 查询机器人管理列表
*
* @param rebot 机器人管理
* @return 机器人管理集合
*/
List<Rebot> list(Rebot rebot);

}

+ 24
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/IResourceLibraryService.java View File

@@ -0,0 +1,24 @@
package com.ruoyi.business.service;

import java.util.List;
import com.ruoyi.business.domain.ResourceLibrary;
import com.baomidou.mybatisplus.extension.service.IService;

/**
* 资源库管理Service接口
*
* @author LiuChengRan
* @date 2024-06-17
*/
public interface IResourceLibraryService extends IService<ResourceLibrary>
{

/**
* 查询资源库管理列表
*
* @param resourceLibrary 资源库管理
* @return 资源库管理集合
*/
List<ResourceLibrary> list(ResourceLibrary resourceLibrary);

}

+ 34
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanLogServiceImpl.java View File

@@ -0,0 +1,34 @@
package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.ApplyPlanLogMapper;
import com.ruoyi.business.domain.ApplyPlanLog;
import com.ruoyi.business.service.IApplyPlanLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
* 应用执行结果记录管理Service业务层处理
*
* @author LiuChengRan
* @date 2024-06-14
*/
@Service
public class ApplyPlanLogServiceImpl extends ServiceImpl<ApplyPlanLogMapper, ApplyPlanLog> implements IApplyPlanLogService
{


/**
* 查询应用执行结果记录管理列表
*
* @param applyPlanLog 应用执行结果记录管理
* @return 应用执行结果记录管理
*/
@Override
public List<ApplyPlanLog> list(ApplyPlanLog applyPlanLog)
{
return baseMapper.selectApplyPlanLogList(applyPlanLog);
}
}

+ 523
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanServiceImpl.java View File

@@ -0,0 +1,523 @@
package com.ruoyi.business.service.impl;

import java.text.ParseException;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.business.domain.Apply;
import com.ruoyi.business.domain.Rebot;
import com.ruoyi.business.domain.ResourceLibrary;
import com.ruoyi.business.domain.bo.*;
import com.ruoyi.business.domain.vo.JobQueryLogVO;
import com.ruoyi.business.domain.vo.JobQueryVO;
import com.ruoyi.business.domain.vo.JobStartVO;
import com.ruoyi.business.domain.vo.ListRebotVO;
import com.ruoyi.business.service.IApplyService;
import com.ruoyi.business.service.IRebotService;
import com.ruoyi.business.service.IResourceLibraryService;
import com.ruoyi.business.util.YinDaoHttpUtils;
import com.ruoyi.business.yddoman.BaseDTO;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.enums.ExcTypeStatus;
import com.ruoyi.common.enums.PlanRunStatus;
import com.ruoyi.common.enums.RebotStatus;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.support.CronSequenceGenerator;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.ApplyPlanMapper;
import com.ruoyi.business.domain.ApplyPlan;
import com.ruoyi.business.service.IApplyPlanService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

/**
* 应用执行计划管理Service业务层处理
*
* @author LiuChengRan
* @date 2024-06-14
*/
@Service
public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan> implements IApplyPlanService {
@Autowired
private IApplyService applyService;

@Autowired
private IRebotService rebotService;

@Autowired
private IResourceLibraryService resourceLibraryService;

/**
* 重新运行
*
* @param jobQueryBO
* @return
* @throws IllegalAccessException
*/
@Override
public boolean appRetry(JobQueryBO jobQueryBO) throws IllegalAccessException {
BaseDTO baseDTO = YinDaoHttpUtils.appRetry(jobQueryBO);
if (baseDTO.getSuccess()) {
return baseMapper.appRetry(jobQueryBO.getJobUuid()) > 0;
} else {
return false;
}
}

/**
* 停止计划运行
*
* @return
*/
@Override
public boolean stopRun(JobQueryBO jobQueryBO) throws IllegalAccessException {
BaseDTO baseDTO = YinDaoHttpUtils.appStop(jobQueryBO);
return baseDTO.getSuccess();
}

/**
* 指定时间执行
*
* @return
*/
@Override
@Transactional
public boolean runAppBySetTime() throws IllegalAccessException {
List<ApplyPlan> applyPlanList = this.lambdaQuery().eq(ApplyPlan::getExcType, ExcTypeStatus.TWO.getKey()).isNull(ApplyPlan::getTaskUuid).orderByAsc(ApplyPlan::getExcTime).list();
if (applyPlanList.isEmpty()) {
return false;
}

ListRebotBO listRebotBO = new ListRebotBO();
listRebotBO.setStatus(RebotStatus.IDLE.getKey());
listRebotBO.setPage(1);
listRebotBO.setSize(100);
// 只获取空闲的机器人
List<ListRebotVO> listRebotVos = YinDaoHttpUtils.listRebot(listRebotBO);
if (listRebotVos.isEmpty()) {
log.debug("暂无空闲机器人");
// 刷新机器人数据
// rebotService.syn(new Rebot());
return false;
}
listRebotVos.forEach(rebot -> {
applyPlanList.forEach(e -> {
if (e.getExcTime().getTime() <= System.currentTimeMillis() && PlanRunStatus.AWAIT_CREATE.getKey().equals(e.getTaskStatus())) {
ApplyStartBO applyStartBO = new ApplyStartBO();
applyStartBO.setRobotUuid(e.getAppId());
applyStartBO.setAccountName(rebot.getRobotClientName());
applyStartBO.setManualTime(e.getManualTime());
//high 高 middle 中 low 低
applyStartBO.setPriority("high");
// 如果应用支持参数
if (!Objects.isNull(e.getSupportParam()) && e.getSupportParam() == 1) {
if (StringUtils.isNotEmpty(e.getPlanParams())) {
applyStartBO.setPlanParams(e.getPlanParams());
List<ApplyStartBO.RobotParam> paramList = JSON.parseArray(e.getPlanParams(), ApplyStartBO.RobotParam.class);
applyStartBO.setPlanParamsList(paramList);
}
}
try {
JobStartVO jobStartVO = YinDaoHttpUtils.appStart(applyStartBO);
ApplyPlan applyPlan = new ApplyPlan();
applyPlan.setId(e.getId());
applyPlan.setUpdateBy("系统修改");
applyPlan.setUpdateTime(new Date());
applyPlan.setTaskUuid(jobStartVO.getJobUuid());
applyPlan.setTaskStatus(PlanRunStatus.CREATED.getKey());
this.updateById(applyPlan);
Rebot updateRebot = new Rebot();
updateRebot.setUpdateBy("系统修改");
updateRebot.setUpdateTime(new Date());
updateRebot.setStatus(RebotStatus.RUNNING.getKey());
if (rebotService.lambdaUpdate().eq(Rebot::getRobotClientName, rebot.getRobotClientName()).update(updateRebot)) {
applyPlanList.remove(e);
}
} catch (IllegalAccessException ex) {
throw new RuntimeException(ex);
}
}
});
});

return false;
}

/**
* 表达式执行
*/
@Override
public boolean runAppByCron() throws IllegalAccessException {
// 先查计划,避免每次命中第三方接口
List<ApplyPlan> applyPlanList = this.lambdaQuery().eq(ApplyPlan::getExcType, ExcTypeStatus.TREE.getKey()).list();
if (applyPlanList.isEmpty()) {
return false;
}
// 需要执行的计划
List<ApplyPlan> execApplyPlan = new ArrayList<>();
applyPlanList.forEach(e -> {
try {
CronExpression cron = new CronExpression(e.getCronExpression());
// 如果该计划没有执行过
if (Objects.isNull(e.getLastExecTime())) {
// 判断当前时间是否满足表达式
Date nextDate = cron.getNextValidTimeAfter(new Date());
if (new Date().compareTo(nextDate) > -1) {
execApplyPlan.add(e);
}
} else {
// 根据表达式返回下一个执行时间
Date nextDate = cron.getNextValidTimeAfter(e.getNextExecTime());
if (new Date().compareTo(nextDate) > -1) {
execApplyPlan.add(e);
}
}
} catch (ParseException ex) {
log.error(e.getPlanName() + "的时间表达式错误!");
throw new RuntimeException(ex);
}
});
if (execApplyPlan.isEmpty()) {
log.debug("没有待执行的计划");
return false;
}

ListRebotBO listRebotBO = new ListRebotBO();
listRebotBO.setStatus(RebotStatus.IDLE.getKey());
listRebotBO.setPage(1);
listRebotBO.setSize(100);
// 只获取空闲的机器人
List<ListRebotVO> listRebotVos = YinDaoHttpUtils.listRebot(listRebotBO);
if (listRebotVos.isEmpty()) {
log.debug("暂无空闲机器人");
// 刷新机器人数据
// rebotService.syn(new Rebot());
return false;
}
listRebotVos.forEach(rebot -> {
execApplyPlan.forEach(e -> {
// 该计划满足执行条件
ApplyStartBO applyStartBO = new ApplyStartBO();
applyStartBO.setRobotUuid(e.getAppId());
applyStartBO.setAccountName(rebot.getRobotClientName());
applyStartBO.setManualTime(e.getManualTime());
//high 高 middle 中 low 低
applyStartBO.setPriority("high");

// 如果应用支持参数
if (!Objects.isNull(e.getSupportParam()) && e.getSupportParam() == 1) {
// 获取参数
if (StringUtils.isNotEmpty(e.getPlanParams())) {
applyStartBO.setPlanParams(e.getPlanParams());
List<ApplyStartBO.RobotParam> paramList = JSON.parseArray(e.getPlanParams(), ApplyStartBO.RobotParam.class);
applyStartBO.setPlanParamsList(paramList);
}
}
String planParams = e.getPlanParams();
if (StringUtils.isNotEmpty(planParams)) {
JSONArray jsonArray = JSON.parseArray(planParams);
// 直接转换成List
List<ApplyStartBO.RobotParam> list = jsonArray.toJavaList(ApplyStartBO.RobotParam.class);
applyStartBO.setPlanParamsList(list);
}
try {
JobStartVO jobStartVO = YinDaoHttpUtils.appStart(applyStartBO);
ApplyPlan applyPlan = new ApplyPlan();
applyPlan.setId(e.getId());
applyPlan.setUpdateBy("系统修改");
applyPlan.setUpdateTime(new Date());
applyPlan.setTaskUuid(jobStartVO.getJobUuid());
applyPlan.setTaskStatus(PlanRunStatus.CREATED.getKey());
// 根据表达式返回下一个执行时间
CronExpression cron = new CronExpression(e.getCronExpression());
Date nextDate = null;
if (Objects.isNull(e.getLastExecTime())) {
nextDate = cron.getNextValidTimeAfter(new Date());
} else {
nextDate = cron.getNextValidTimeAfter(e.getLastExecTime());
}
Date date = new Date();
applyPlan.setLastExecTime(date);
applyPlan.setNextExecTime(nextDate);
this.updateById(applyPlan);
Rebot updateRebot = new Rebot();
updateRebot.setUpdateBy("系统修改");
updateRebot.setUpdateTime(new Date());
updateRebot.setStatus(RebotStatus.RUNNING.getKey());
if (rebotService.lambdaUpdate().eq(Rebot::getRobotClientName, rebot.getRobotClientName()).update(updateRebot)) {
applyPlanList.remove(e);
}
} catch (IllegalAccessException | ParseException ex) {
throw new RuntimeException(ex);
}
});
});

return false;
}


/**
* 获取应用执行结果
*
* @return
* @throws IllegalAccessException
*/
@Override
@Transactional
public void queryAppStartResult() throws IllegalAccessException {
// 不查询的状态
List<String> noStatus = new ArrayList<>();
noStatus.add(PlanRunStatus.FINISH.getKey());
noStatus.add(PlanRunStatus.STOPPED.getKey());
noStatus.add(PlanRunStatus.ERROR.getKey());
noStatus.add(PlanRunStatus.SKIPPED.getKey());
noStatus.add(PlanRunStatus.CANCEL.getKey());
// 查询任务运行状态非空非终态并且已经创建的任务
List<ApplyPlan> list = this.lambdaQuery().notIn(ApplyPlan::getTaskStatus, noStatus).isNotNull(ApplyPlan::getTaskStatus).orderByAsc(ApplyPlan::getPriority).list();
if (list.isEmpty()) {
log.debug("没有需要更新状态的计划任务");
return;
}
for (ApplyPlan applyPlan : list) {
JobQueryBO jobQueryBO = new JobQueryBO();
jobQueryBO.setJobUuid(applyPlan.getTaskUuid());
JobQueryVO jobQueryVO = YinDaoHttpUtils.queryAppStartResult(jobQueryBO);
// 如果状态不一致,更新最新状态
if (jobQueryVO != null && !applyPlan.getTaskStatus().equals(jobQueryVO.getStatus())) {
// 修改的任务计划
ApplyPlan updateApplyPlan = new ApplyPlan();
updateApplyPlan.setTaskStatus(jobQueryVO.getStatus());
if (null != jobQueryVO.getEndTime()) {
updateApplyPlan.setEndTime(jobQueryVO.getEndTime());
updateApplyPlan.setStartTime(jobQueryVO.getStartTime());
updateApplyPlan.setEndTime(jobQueryVO.getEndTime());
long diff = updateApplyPlan.getEndTime().getTime() - updateApplyPlan.getStartTime().getTime();
long planTime = diff / (60 * 1000);
updateApplyPlan.setPlanTime(planTime + "");
if (!Objects.isNull(applyPlan.getManualTime())) {
updateApplyPlan.setTimeSaving((Long.parseLong(applyPlan.getManualTime()) - planTime) + "");
}
}
updateApplyPlan.setId(applyPlan.getId());
updateApplyPlan.setUpdateBy("系统修改");
updateApplyPlan.setUpdateTime(new Date());

// 如果是终态并且有响应参数 获取返回值
List<String> finishStatus = Arrays.asList(PlanRunStatus.FINISH.getKey(), PlanRunStatus.STOPPED.getKey(), PlanRunStatus.ERROR.getKey(), PlanRunStatus.SKIPPED.getKey(), PlanRunStatus.CANCEL.getKey());
if (finishStatus.contains(jobQueryVO.getStatus())) {
List<JobQueryVO.RobotParam> outputs = jobQueryVO.getRobotParams().getOutputs();
if (null != outputs && !outputs.isEmpty()) {
JobQueryVO.RobotParam robotParam = outputs.get(0);
updateApplyPlan.setOutParam(robotParam.getValue());
}
}
updateApplyPlan.setRemark(jobQueryVO.getRemark());
this.updateById(updateApplyPlan);
}
// 如果是终态改变机器人状态
List<String> finishStatus = Arrays.asList(PlanRunStatus.FINISH.getKey(), PlanRunStatus.STOPPED.getKey(), PlanRunStatus.ERROR.getKey(), PlanRunStatus.SKIPPED.getKey(), PlanRunStatus.CANCEL.getKey());
if (finishStatus.contains(jobQueryVO.getStatus())) {
Rebot rebot = new Rebot();
rebot.setStatus(RebotStatus.IDLE.getKey());
rebot.setUpdateBy("系统修改");
rebot.setUpdateTime(new Date());
rebot.setStatus(RebotStatus.IDLE.getKey());
rebotService.lambdaUpdate().eq(Rebot::getRobotClientName, jobQueryVO.getRobotClientName()).update(rebot);
} else if (PlanRunStatus.RUNNING.getKey().equals(jobQueryVO.getStatus())) {
Rebot rebot = new Rebot();
rebot.setStatus(RebotStatus.RUNNING.getKey());
rebot.setUpdateBy("系统修改");
rebot.setUpdateTime(new Date());
rebotService.lambdaUpdate().eq(Rebot::getRobotClientName, jobQueryVO.getRobotClientName()).update(rebot);
}
}
}

/**
* 执行计划(针对立即执行的计划)
*
* @param applyStartBO 该对象只有 应用id 优先级和人工用时
* @return
*/
@Override
@Transactional
public boolean execPlan(ApplyStartBO applyStartBO) throws IllegalAccessException {
// 先查计划 避免每次直接命中第三方接口
Map<Long, List<ApplyPlan>> applyPlanMap = this.lambdaQuery().eq(ApplyPlan::getExcType, ExcTypeStatus.ONE.getKey()).isNull(ApplyPlan::getTaskUuid)
.orderByAsc(ApplyPlan::getPriority).list().stream().collect(Collectors.groupingBy(ApplyPlan::getDeptId));

// 查询所有待执行的任务
if (null == applyStartBO && applyPlanMap.isEmpty()) {
log.debug("没有等待执行的计划");
return false;
}

ListRebotBO listRebotBO = new ListRebotBO();
listRebotBO.setStatus(RebotStatus.IDLE.getKey());
listRebotBO.setPage(1);
listRebotBO.setSize(100);
// 只获取空闲的机器人
List<ListRebotVO> listRebotVos = YinDaoHttpUtils.listRebot(listRebotBO);
if (listRebotVos.isEmpty()) {
log.debug("暂无空闲机器人");
// 刷新机器人数据
// rebotService.syn(new Rebot());
return false;
}

// 获取每个部门优先级最高的计划
List<ApplyPlan> applyPlans = new ArrayList<>();
applyPlanMap.forEach((k, v) -> {
v.sort((Comparator.comparingInt(ApplyPlan::getPriority)));
applyPlans.add(v.get(0));
});
if (null == applyStartBO && applyPlans.isEmpty()) {
log.debug("没有等待执行的计划");
return false;
}
applyPlans.sort((Comparator.comparingInt(ApplyPlan::getPriority)));

int i = 0;
for (ListRebotVO listRebotVO : listRebotVos) {
ApplyPlan applyPlan = null;
if (applyPlans.isEmpty()) {
log.debug("没有等待执行的计划!");
continue;
}
if (null == applyStartBO) {
applyPlan = applyPlans.get(0);
applyStartBO = new ApplyStartBO();
applyStartBO.setRobotUuid(applyPlan.getAppId());
//high 高 middle 中 low 低
applyStartBO.setPriority("high");
} else {
applyPlan = new ApplyPlan();
BeanUtils.copyBeanProp(applyPlan, applyStartBO);
// 运行的应用上一步已给值,此处无需再给
}
applyStartBO.setAccountName(listRebotVO.getRobotClientName());
// 如果应用支持参数
if (!Objects.isNull(applyPlan.getSupportParam()) && applyPlan.getSupportParam() == 1) {
if (StringUtils.isNotEmpty(applyPlan.getPlanParams())) {
applyStartBO.setPlanParams(applyPlan.getPlanParams());
List<ApplyStartBO.RobotParam> paramList = JSON.parseArray(applyPlan.getPlanParams(), ApplyStartBO.RobotParam.class);
applyStartBO.setPlanParamsList(paramList);
}
}
JobStartVO jobStartVO = YinDaoHttpUtils.appStart(applyStartBO);
ApplyPlan updateApplyPlan = new ApplyPlan();
updateApplyPlan.setId(applyPlan.getId());
updateApplyPlan.setCreateBy("系统创建");
updateApplyPlan.setCreateTime(new Date());
updateApplyPlan.setUpdateBy("系统修改");
updateApplyPlan.setUpdateTime(new Date());
updateApplyPlan.setStartTime(new Date());
updateApplyPlan.setTaskUuid(jobStartVO.getJobUuid());
updateApplyPlan.setPlanName(applyPlan.getPlanName());
updateApplyPlan.setTaskStatus(PlanRunStatus.CREATED.getKey());
updateApplyPlan.setRobotName(listRebotVO.getRobotClientName());
updateApplyPlan.setManualTime(applyPlan.getManualTime());
updateApplyPlan.setDeptId(applyStartBO.getDeptId());
if (this.saveOrUpdate(updateApplyPlan)) {
applyPlans.remove(0);
i++;
}
}
return i > 0;
}


@Override
@Transactional
public boolean save(AddApplyPlanBO addApplyPlanBO) {
List<ApplyPlan> applyPlanList = new ArrayList<>();
Map<String, List<Apply>> appMap = applyService.lambdaQuery().in(Apply::getAppId, addApplyPlanBO.getAppId()).list().stream().collect(Collectors.groupingBy(Apply::getAppId));
// 是否有空闲机器人并且创建计划成功
AtomicBoolean insert = new AtomicBoolean(false);

addApplyPlanBO.getAppId().forEach(e -> {
ApplyPlan applyPlan = new ApplyPlan();
BeanUtils.copyBeanProp(applyPlan, addApplyPlanBO);
Apply apply = appMap.get(e).get(0);
applyPlan.setAppName(apply.getAppName());
applyPlan.setAppId(apply.getAppId());
applyPlan.setAppType(apply.getAppType());
applyPlan.setAppTypeName(apply.getAppTypeName());
applyPlan.setManualTime(apply.getManualTime());
if (null != apply.getSupportParam() && apply.getSupportParam() == 1) {
// 获取参数 每一次执行计划的参数都是独立的
List<ApplyStartBO.RobotParam> paramList = resourceLibraryService.lambdaQuery().eq(ResourceLibrary::getAppId, apply.getAppId()).list().stream()
.map(item -> {
ApplyStartBO.RobotParam robotParam = new ApplyStartBO.RobotParam();
robotParam.setName(item.getResourceName());
robotParam.setValue(item.getResourceValue());
robotParam.setType(item.getResourceType());
return robotParam;
}).collect(Collectors.toList());
if (!paramList.isEmpty()) {
// json集合转字符串
applyPlan.setPlanParams(JSONArray.toJSONString(paramList));
}
}
applyPlan.setDeptId(SecurityUtils.getDeptId());

try {
// 只指定优先级和应用和人工用时 机器人等下一个阶段判读是否有空闲
ApplyStartBO applyStartBO = new ApplyStartBO();
applyStartBO.setRobotUuid(applyPlan.getAppId());
//high 高 middle 中 low 低
applyStartBO.setPriority("high");
applyStartBO.setManualTime(applyPlan.getManualTime());
applyStartBO.setPlanName(addApplyPlanBO.getPlanName());
insert.set(execPlan(applyStartBO));
} catch (Exception ex) {
log.error("分配机器人异常:" + ex.getMessage());
}
if (!insert.get()) {
applyPlan.setTaskStatus(PlanRunStatus.AWAIT_CREATE.getKey());
applyPlanList.add(applyPlan);
}
});
return this.saveBatch(applyPlanList) || insert.get();
}

@Override
public boolean update(AddApplyPlanBO addApplyPlanBO) {
List<ApplyPlan> applyPlanList = new ArrayList<>();
Map<String, List<Apply>> appMap = applyService.lambdaQuery().in(Apply::getAppId, addApplyPlanBO.getAppId()).eq(Apply::getDeptId, SecurityUtils.getDeptId()).list().stream().collect(Collectors.groupingBy(Apply::getAppId));
addApplyPlanBO.getAppId().forEach(e -> {
ApplyPlan applyPlan = new ApplyPlan();
BeanUtils.copyBeanProp(applyPlan, addApplyPlanBO);
Apply apply = appMap.get(e).get(0);
applyPlan.setAppName(apply.getAppName());
applyPlan.setAppId(apply.getAppId());
applyPlan.setAppType(apply.getAppType());
applyPlan.setAppTypeName(apply.getAppTypeName());
applyPlanList.add(applyPlan);
});

return super.updateBatchById(applyPlanList);
}

/**
* 查询应用执行计划管理列表
*
* @param applyPlan 应用执行计划管理
* @return 应用执行计划管理
*/
@Override
@DataScope(deptAlias = "d")
public List<ApplyPlan> list(ApplyPlan applyPlan) {
return baseMapper.selectApplyPlanList(applyPlan);
}
}

+ 145
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyServiceImpl.java View File

@@ -0,0 +1,145 @@
package com.ruoyi.business.service.impl;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.business.domain.Rebot;
import com.ruoyi.business.domain.bo.ApplyStartBO;
import com.ruoyi.business.domain.bo.JobQueryBO;
import com.ruoyi.business.domain.bo.ListApplyBO;
import com.ruoyi.business.domain.bo.ListRebotBO;
import com.ruoyi.business.domain.vo.JobQueryVO;
import com.ruoyi.business.domain.vo.JobStartVO;
import com.ruoyi.business.domain.vo.ListApplyVO;
import com.ruoyi.business.domain.vo.ListRebotVO;
import com.ruoyi.business.util.YinDaoHttpUtils;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.ApplyMapper;
import com.ruoyi.business.domain.Apply;
import com.ruoyi.business.service.IApplyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

/**
* 应用信息管理Service业务层处理
*
* @author LiuChengRan
* @date 2024-06-13
*/
@Service
public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements IApplyService {

@Autowired
private ISysDeptService sysDeptService;
/**
* 启动应用
*
* @param applyStartBO
*/
@Override
@Transactional
public JobStartVO appStart(ApplyStartBO applyStartBO) throws IllegalAccessException {
JobStartVO jobStartVO = YinDaoHttpUtils.appStart(applyStartBO);
return jobStartVO;
}

/**
* 查询应用运行结果
*
* @param jobQueryBO
*/
@Override
public JobQueryVO queryAppStartResult(JobQueryBO jobQueryBO) throws IllegalAccessException {
JobQueryVO jobQueryVO = YinDaoHttpUtils.queryAppStartResult(jobQueryBO);
return jobQueryVO;
}


/**
* 同步机器人数据
*
* @return
*/
@Override
@DataScope(deptAlias = "apply")
@Transactional
public void syn(Apply entity) throws IllegalAccessException {
ListApplyBO listApplyBO = new ListApplyBO();
listApplyBO.setPage(1);
// 影刀最大限制
listApplyBO.setSize(100);
List<Apply> applyList = baseMapper.selectApplyList(new Apply());
Map<String, List<Apply>> applyMap = applyList.stream().collect(Collectors.groupingBy(Apply::getAppId));

List<ListApplyVO> listApplyVOList = YinDaoHttpUtils.listApp(listApplyBO);
// 获取客户端名称集合
List<String> appIdList = listApplyVOList.stream().map(ListApplyVO::getAppId).collect(Collectors.toList());
// 只能移除当前用户部门的
this.remove(new LambdaUpdateWrapper<Apply>().notIn(Apply::getAppId, appIdList).eq(Apply::getDeptId, SecurityUtils.getDeptId()));

Map<String, List<SysDept>> deptMap = sysDeptService.selectDeptAllList(new SysDept()).stream().collect(Collectors.groupingBy(SysDept::getDeptName));
listApplyVOList.forEach(listRebotVO -> {
// 数据库里是否存在
List<Apply> applys = applyMap.get(listRebotVO.getAppId());
String[] deptName = listRebotVO.getAppName().split("-");
List<SysDept> sysDepts = deptMap.get(deptName[0]);

if (null == applys) {
Apply newApply = new Apply();
BeanUtils.copyBeanProp(newApply, listRebotVO);
newApply.setAppCreateTime(listRebotVO.getCreateTime());
newApply.setAppUpdateTime(listRebotVO.getUpdateTime());
if(null != sysDepts){
newApply.setDeptId(sysDepts.get(0).getDeptId());
newApply.setDeptName(sysDepts.get(0).getDeptName());
}
save(newApply);
} else {
Apply apply = applys.get(0);
Apply newApply = new Apply();
BeanUtils.copyBeanProp(newApply, listRebotVO);
newApply.setAppCreateTime(listRebotVO.getCreateTime());
newApply.setAppUpdateTime(listRebotVO.getUpdateTime());
newApply.setId(apply.getId());
if(null != sysDepts){
newApply.setDeptId(sysDepts.get(0).getDeptId());
newApply.setDeptName(sysDepts.get(0).getDeptName());
}
updateById(newApply);
}
});
}

/**
* 查询应用信息管理列表
*
* @param apply 应用信息管理
* @return 应用信息管理
*/
@Override
@DataScope(deptAlias = "apply")
public List<Apply> list(Apply apply) {
return baseMapper.selectApplyList(apply);
}

/**
* 查询所有应用信息列表
*
* @param apply 应用信息管理
* @return 应用信息管理
*/
@Override
@DataScope(deptAlias = "apply")
public List<Apply> listAll(Apply apply) {
return baseMapper.selectApplyAllList(apply);
}
}

+ 0
- 102
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BusinessSurveyServiceImpl.java View File

@@ -1,102 +0,0 @@
package com.ruoyi.business.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.business.domain.BusinessTemplateProp;
import com.ruoyi.business.domain.BusinessTemplatePropValue;
import com.ruoyi.business.mapper.BusinessTemplatePropMapper;
import com.ruoyi.business.mapper.BusinessTemplatePropValueMapper;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.BusinessSurveyMapper;
import com.ruoyi.business.domain.BusinessSurvey;
import com.ruoyi.business.service.IBusinessSurveyService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
* 调查问卷管理Service业务层处理
*
* @author ruoyi
* @date 2024-04-01
*/
@Service
public class BusinessSurveyServiceImpl extends ServiceImpl<BusinessSurveyMapper, BusinessSurvey> implements IBusinessSurveyService
{
@Autowired
private BusinessTemplatePropMapper businessTemplatePropMapper;
@Autowired
private BusinessTemplatePropValueMapper businessTemplatePropValueMapper;

/**
* 根据试卷获取题目
* @param surveyId
* @return
*/
@Override
public AjaxResult listBySurveyId(String surveyId) {
BusinessSurvey businessSurvey = baseMapper.selectOne(new LambdaQueryWrapper<BusinessSurvey>().eq(BusinessSurvey::getId, surveyId));

List<BusinessTemplateProp> list = businessTemplatePropMapper.selectList(new LambdaQueryWrapper<BusinessTemplateProp>()
.eq(BusinessTemplateProp::getTempId, businessSurvey.getTempId())
.orderByDesc(BusinessTemplateProp::getSort));

JSONObject jsonObject = new JSONObject();
list.forEach(e -> {
BusinessTemplatePropValue one = businessTemplatePropValueMapper.selectOne(new LambdaQueryWrapper<BusinessTemplatePropValue>()
.eq(BusinessTemplatePropValue::getPropId, e.getId())
.eq(BusinessTemplatePropValue::getSurveyId, surveyId)
.eq(BusinessTemplatePropValue::getCreateBy, SecurityUtils.getUsername()));
if (e.getCompType().equals("0")) {
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources());
}
if (e.getCompType().equals("1")) {
String valueSources = Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources();
if(null != valueSources){
List<String> collect = Stream.of(valueSources.substring(1, valueSources.length() - 1).split(", ")).collect(Collectors.toList());
jsonObject.put(e.getId(),collect);
}else{
jsonObject.put(e.getId(),new ArrayList<>());
}
}
if (e.getCompType().equals("2")) {
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources());
}
if (e.getCompType().equals("3")) {
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources());
}
if (e.getCompType().equals("4")) {
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources());
}
if (e.getCompType().equals("5")) {
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources());
}
if (e.getCompType().equals("6")) {
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources());
}
if (e.getCompType().equals("7")) {
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources());
}
if (e.getCompType().equals("8")) {
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources());
}
if (e.getCompType().equals("9")) {
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources() == null ? new JSONArray() : Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources());
}
});
AjaxResult success = AjaxResult.success(list);
success.put("form" , jsonObject);
return success;

}
}

+ 0
- 27
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BusinessTemplatePropServiceImpl.java View File

@@ -1,27 +0,0 @@
package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.BusinessTemplatePropMapper;
import com.ruoyi.business.domain.BusinessTemplateProp;
import com.ruoyi.business.service.IBusinessTemplatePropService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
* 模版属性Service业务层处理
*
* @author ruoyi
* @date 2024-03-31
*/
@Service
public class BusinessTemplatePropServiceImpl extends ServiceImpl<BusinessTemplatePropMapper, BusinessTemplateProp> implements IBusinessTemplatePropService
{
@Autowired
private BusinessTemplatePropMapper businessTemplatePropMapper;


}

+ 0
- 149
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BusinessTemplatePropValueServiceImpl.java View File

@@ -1,149 +0,0 @@
package com.ruoyi.business.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.business.domain.BusinessSurvey;
import com.ruoyi.business.domain.BusinessTemplate;
import com.ruoyi.business.domain.BusinessTemplateProp;
import com.ruoyi.business.mapper.BusinessSurveyMapper;
import com.ruoyi.business.mapper.BusinessTemplatePropMapper;
import com.ruoyi.business.service.IBusinessSurveyService;
import com.ruoyi.business.service.IBusinessTemplatePropService;
import com.ruoyi.business.service.IBusinessTemplateService;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.BusinessTemplatePropValueMapper;
import com.ruoyi.business.domain.BusinessTemplatePropValue;
import com.ruoyi.business.service.IBusinessTemplatePropValueService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
* 模版属性值Service业务层处理
*
* @author ruoyi
* @date 2024-03-31
*/
@Service
public class BusinessTemplatePropValueServiceImpl extends ServiceImpl<BusinessTemplatePropValueMapper, BusinessTemplatePropValue> implements IBusinessTemplatePropValueService {
@Autowired
private BusinessTemplatePropValueMapper businessTemplatePropValueMapper;

@Autowired
private IBusinessTemplateService businessTemplateService;

@Autowired
private IBusinessTemplatePropService businessTemplatePropService;

@Autowired
private IBusinessSurveyService businessSurveyService;


/**
* 获取统计数据
*
* @param surveyId
* @return
*/
@Override
public Object countGroup(String surveyId) {
BusinessSurvey businessSurvey = businessSurveyService.lambdaQuery().eq(BusinessSurvey::getId, surveyId).one();

BusinessTemplate businessTemplate = businessTemplateService.lambdaQuery().eq(BusinessTemplate::getId, businessSurvey.getTempId()).one();

List<BusinessTemplateProp> businessTemplateProps = businessTemplatePropService.lambdaQuery()
.eq(BusinessTemplateProp::getTempId, businessTemplate.getId()).in(BusinessTemplateProp::getCompType, new String[]{"0" , "1" , "6"}).list();

JSONObject map = new JSONObject();
List<Map<String, Object>> list = new ArrayList<>();
businessTemplateProps.forEach(e -> {
List<Map<String, Object>> countList = businessTemplatePropValueMapper.countGroup(surveyId, e.getId());
map.put(e.getTitle(), countList);
});

return map;
}

/**
* 批量写入值
*
* @param data
* @return
*/
@Override
public boolean addList(Map<String, Object> data) {

// 试卷id
String surveyId = data.get("surveyId").toString();
data.remove("surveyId");
List<BusinessTemplatePropValue> datas = new ArrayList<>();
data.forEach((k, v) -> {
BusinessTemplatePropValue businessTemplatePropValue = new BusinessTemplatePropValue();
BusinessTemplateProp businessTemplateProp = businessTemplatePropService.getById(k);
List<BusinessTemplatePropValue> businessTemplatePropValues = businessTemplatePropValueMapper.selectList(new LambdaQueryWrapper<BusinessTemplatePropValue>()
.eq(BusinessTemplatePropValue::getPropId, k).eq(BusinessTemplatePropValue::getCreateBy, SecurityUtils.getUsername()));

businessTemplatePropValues.forEach(e -> {
if (e.getPropId().equals(k)) {
businessTemplatePropValue.setId(e.getId());
}
});
businessTemplatePropValue.setPropName(businessTemplateProp.getFieldName());
businessTemplatePropValue.setPropType(businessTemplateProp.getCompType());
businessTemplatePropValue.setPropId(k);
businessTemplatePropValue.setValueKey(v.toString());
if (businessTemplateProp.getCompType().equals("0")) {
String optionalValue = businessTemplateProp.getOptionalValue();
String[] split = optionalValue.split("\\|");
for (String v1 : split) {
String[] v2 = v1.split(",");
if (v2[0].equals(v)) {
businessTemplatePropValue.setValueText(v2[1]);
}
}
businessTemplatePropValue.setValueSources(v.toString());
} else if (businessTemplateProp.getCompType().equals("1")) {
String optionalValue = businessTemplateProp.getOptionalValue();
String[] split = optionalValue.split("\\|");
StringBuilder sb = new StringBuilder();

for (String v1 : split) {
String[] v2 = v1.split(",");
if (((ArrayList) v).contains(v2[0])) {
sb.append(v2[1]).append(",");
}
}
businessTemplatePropValue.setValueText(sb.substring(0, sb.length() - 1));
businessTemplatePropValue.setValueSources(v.toString());
} else if (businessTemplateProp.getCompType().equals("6")) {
String optionalValue = businessTemplateProp.getOptionalValue();
String[] split = optionalValue.split("\\|");
StringBuilder sb = new StringBuilder();

for (String v1 : split) {
String[] v2 = v1.split(",");
if (v.equals(v2[0])) {
sb.append(v2[1]).append(",");
}
}
businessTemplatePropValue.setValueText(sb.substring(0, sb.length() - 1));
businessTemplatePropValue.setValueSources(v.toString());
} else {
businessTemplatePropValue.setValueText(v.toString());
businessTemplatePropValue.setValueSources(v.toString());
}
businessTemplatePropValue.setSurveyId(surveyId);
datas.add(businessTemplatePropValue);
});

return saveOrUpdateBatch(datas);
}
}

+ 0
- 27
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BusinessTemplateServiceImpl.java View File

@@ -1,27 +0,0 @@
package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.BusinessTemplateMapper;
import com.ruoyi.business.domain.BusinessTemplate;
import com.ruoyi.business.service.IBusinessTemplateService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
* 模版管理Service业务层处理
*
* @author ruoyi
* @date 2024-03-31
*/
@Service
public class BusinessTemplateServiceImpl extends ServiceImpl<BusinessTemplateMapper, BusinessTemplate> implements IBusinessTemplateService
{
@Autowired
private BusinessTemplateMapper businessTemplateMapper;


}

+ 85
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/RebotServiceImpl.java View File

@@ -0,0 +1,85 @@
package com.ruoyi.business.service.impl;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.business.domain.bo.ListRebotBO;
import com.ruoyi.business.domain.vo.ListRebotVO;
import com.ruoyi.business.util.YinDaoHttpUtils;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.RebotMapper;
import com.ruoyi.business.domain.Rebot;
import com.ruoyi.business.service.IRebotService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

/**
* 机器人管理Service业务层处理
*
* @author LiuChengRan
* @date 2024-06-13
*/
@Service
public class RebotServiceImpl extends ServiceImpl<RebotMapper, Rebot> implements IRebotService {
/**
* 同步机器人数据
*
* @return
*/
@Override
@Transactional
public void syn(Rebot entity) throws IllegalAccessException {
ListRebotBO listRebotBO = new ListRebotBO();
listRebotBO.setPage(1);
listRebotBO.setSize(100);
List<Rebot> rebotsList = baseMapper.selectRebotList(new Rebot());
Map<String, List<Rebot>> rebotMap = rebotsList.stream().collect(Collectors.groupingBy(Rebot::getRobotClientName));

List<ListRebotVO> listRebotVoList = YinDaoHttpUtils.listRebot(listRebotBO);
// 获取客户端名称集合
List<String> clientNameList = listRebotVoList.stream().map(ListRebotVO::getRobotClientName).collect(Collectors.toList());
// 删除不存在的机器人
this.remove(new LambdaUpdateWrapper<Rebot>().notIn(Rebot::getRobotClientName, clientNameList));

listRebotVoList.forEach(listRebotVO -> {
// 数据库里是否存在
List<Rebot> rebots = rebotMap.get(listRebotVO.getRobotClientName());
if (null == rebots) {
Rebot rebot = new Rebot();
rebot.setStatus(listRebotVO.getStatus());
rebot.setRobotClientUuid(listRebotVO.getRobotClientUuid());
rebot.setRobotClientName(listRebotVO.getRobotClientName());
rebot.setWindowsAccount(listRebotVO.getWindowsAccount());
rebot.setClientIp(listRebotVO.getClientIp());
save(rebot);
} else {
Rebot rebot = rebots.get(0);
rebot.setStatus(listRebotVO.getStatus());
rebot.setRobotClientUuid(listRebotVO.getRobotClientUuid());
rebot.setRobotClientName(listRebotVO.getRobotClientName());
rebot.setWindowsAccount(listRebotVO.getWindowsAccount());
rebot.setClientIp(listRebotVO.getClientIp());
updateById(rebot);
}
});
}

/**
* 查询机器人管理列表
*
* @param rebot 机器人管理
* @return 机器人管理
*/
@Override
@DataScope(deptAlias = "d", userAlias = "u")
public List<Rebot> list(Rebot rebot) {
return baseMapper.selectRebotList(rebot);
}
}

+ 51
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ResourceLibraryServiceImpl.java View File

@@ -0,0 +1,51 @@
package com.ruoyi.business.service.impl;

import java.util.List;
import java.util.Optional;

import com.ruoyi.business.domain.Apply;
import com.ruoyi.business.service.IApplyService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.ResourceLibraryMapper;
import com.ruoyi.business.domain.ResourceLibrary;
import com.ruoyi.business.service.IResourceLibraryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
* 资源库管理Service业务层处理
*
* @author LiuChengRan
* @date 2024-06-17
*/
@Service
public class ResourceLibraryServiceImpl extends ServiceImpl<ResourceLibraryMapper, ResourceLibrary> implements IResourceLibraryService
{

@Autowired
private IApplyService applyService;

/**
* 查询资源库管理列表
*
* @param resourceLibrary 资源库管理
* @return 资源库管理
*/
@Override
public List<ResourceLibrary> list(ResourceLibrary resourceLibrary)
{
return baseMapper.selectResourceLibraryList(resourceLibrary);
}

@Override
public boolean save(ResourceLibrary entity) {
Apply apply = Optional.ofNullable(applyService.lambdaQuery().eq(Apply::getAppId, entity.getAppId()).one())
.orElseThrow(()->new RuntimeException("应用不存在"));
entity.setAppId(apply.getAppId());
entity.setAppName(apply.getAppName());
entity.setDeptId(apply.getDeptId());
entity.setDeptName(apply.getDeptName());
return super.save(entity);
}
}

+ 216
- 0
ruoyi-business/src/main/java/com/ruoyi/business/util/YinDaoHttpUtils.java View File

@@ -0,0 +1,216 @@
package com.ruoyi.business.util;

import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.business.domain.bo.*;
import com.ruoyi.business.domain.vo.*;
import com.ruoyi.business.yddoman.BaseDTO;
import com.ruoyi.business.yddoman.CreateTokenDTO;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.BeanToMapUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpClientUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* 影刀请求工具类
*
* @author #author#
*/
@Slf4j
public class YinDaoHttpUtils {


// 请求前缀
private static final String REQUEST_PREFIX = "https://api.winrobot360.com/oapi";
// 获取token
private static final String CREATE_TOKEN = REQUEST_PREFIX + "/token/v2/token/create";
// 查询机器人列表
private static final String CLIENT_LIST = REQUEST_PREFIX + "/dispatch/v2/client/list";
// 查询应用列表
private static final String APP_LIST = REQUEST_PREFIX + "/app/open/query/list";
// 启动应用
private static final String APP_START = REQUEST_PREFIX + "/dispatch/v2/job/start";
// 停止应用
private static final String APP_STOP = REQUEST_PREFIX + "/dispatch/v2/job/stop";
// 重新运行
private static final String APP_RETRY = REQUEST_PREFIX + "/dispatch/v2/job/retry";
// 查询应用运行结果
private static final String QUERY_APP_START_RESULT = REQUEST_PREFIX + "/dispatch/v2/job/query";
// 查询应用运行日志(异常时可以查询原因)
private static final String QUERY_APP_START_RESULT_LOG = REQUEST_PREFIX + "/dispatch/v2/job/list";


/**
* 启动应用
*/
public static JobStartVO appStart(ApplyStartBO applyStartBO) throws IllegalAccessException {
// 实体类转map
Map<String, Object> data = BeanToMapUtil.convertEntityToMap(applyStartBO);
BaseDTO baseDTO = sendPost(APP_START, data);
return JSON.parseObject(baseDTO.getData().toString(), JobStartVO.class);
}

/**
* 停止运行
*/
public static BaseDTO appStop(JobQueryBO jobQueryBO) throws IllegalAccessException {
// 实体类转map
Map<String, Object> data = BeanToMapUtil.convertEntityToMap(jobQueryBO);
BaseDTO baseDTO = sendPost(APP_STOP, data);
return baseDTO;
}

/**
* 重新运行
*/
public static BaseDTO appRetry(JobQueryBO jobQueryBO) throws IllegalAccessException {
// 实体类转map
Map<String, Object> data = BeanToMapUtil.convertEntityToMap(jobQueryBO);
BaseDTO baseDTO = sendPost(APP_RETRY, data);
return baseDTO;
}

/**
* 查询应用运行结果
*/
public static JobQueryVO queryAppStartResult(JobQueryBO jobQueryBO) throws IllegalAccessException {
// 实体类转map
Map<String, Object> data = BeanToMapUtil.convertEntityToMap(jobQueryBO);
BaseDTO baseDTO = sendPost(QUERY_APP_START_RESULT, data);
return JSON.parseObject(baseDTO.getData().toString(), JobQueryVO.class);
}

/**
* 查询应用运行结果
*/
public static JobQueryLogVO queryAppStartResultLog(JobQueryLogBO jobQueryLogBO) throws IllegalAccessException {
// 实体类转map
Map<String, Object> data = BeanToMapUtil.convertEntityToMap(jobQueryLogBO);
BaseDTO baseDTO = sendPost(QUERY_APP_START_RESULT_LOG, data);
return JSON.parseObject(baseDTO.getData().toString(), JobQueryLogVO.class);
}

/**
* 查询应用列表
*/
public static List<ListApplyVO> listApp(ListApplyBO ListApplyBO) throws IllegalAccessException {
Map<String, Object> data = BeanToMapUtil.convertEntityToMap(ListApplyBO);
BaseDTO baseDTO = sendPost(APP_LIST, data);
BaseDTO.Page page = baseDTO.getPage();
List<ListApplyVO> allList = new ArrayList<>();
boolean isNext = true;
while (isNext) {
List<ListApplyVO> ListApplyVos = JSON.parseArray(baseDTO.getData().toString(), ListApplyVO.class);
allList.addAll(ListApplyVos);
data = new HashMap<>();
data.put("page", page.getPage() + 1);
data.put("size", ListApplyBO.getSize());
if (page.getPage() + 1 > page.getPages()) {
isNext = false;
} else {
baseDTO = sendGet(APP_LIST, data);
page = baseDTO.getPage();
}
}
return allList;
}

/**
* 查询机器人列表
*/
public static List<ListRebotVO> listRebot(ListRebotBO listRebotBO) throws IllegalAccessException {
Map<String, Object> data = BeanToMapUtil.convertEntityToMap(listRebotBO);
BaseDTO baseDTO = sendGet(CLIENT_LIST, data);
BaseDTO.Page page = baseDTO.getPage();
List<ListRebotVO> allList = new ArrayList<>();
boolean isNext = true;
while (isNext) {
List<ListRebotVO> listRebotVOS = JSON.parseArray(baseDTO.getData().toString(), ListRebotVO.class);
allList.addAll(listRebotVOS);
data = new HashMap<>();
data.put("page", page.getPage() + 1 + "");
data.put("size", listRebotBO.getSize().toString());
if (page.getPage() + 1 > page.getPages()) {
isNext = false;
} else {
baseDTO = sendGet(CLIENT_LIST, data);
page = baseDTO.getPage();
}

}
return allList;
}


/**
* 统一get请求
*
* @param map
*/
private static BaseDTO sendGet(String url, Map<String, Object> map) {
Map<String, Object> newMap = new HashMap<>();
// 写死
newMap.put("accessKeyId", "hVYUk1yCZ3RX6f9q@platform");
newMap.put("accessKeySecret", "CKaVmug0TcPYhf1nGUjASyveN2s6dpFR");
Map<String, Object> headMap = new HashMap<>();
headMap.put("Authorization", "Bearer " + getToken(newMap));
headMap.put("Content-Type", "application/json");
String returnStr = HttpClientUtil.postJson(url, headMap, JSONUtil.toJsonStr(map), "utf-8");
BaseDTO baseDTO = JSON.parseObject(returnStr, BaseDTO.class);
if (!baseDTO.getSuccess()) {
throw new ServiceException("请求影刀接口失败,状态码为" + baseDTO.getCode() + "原因是:" + baseDTO.getMsg());
}
return baseDTO;
}


/**
* 统一post请求
*
* @param map
*/
private static BaseDTO sendPost(String url, Map<String, Object> map) {
Map<String, Object> tokenMap = new HashMap<>();
// 写死
tokenMap.put("accessKeyId", "hVYUk1yCZ3RX6f9q@platform");
tokenMap.put("accessKeySecret", "CKaVmug0TcPYhf1nGUjASyveN2s6dpFR");
Map<String, Object> headMap = new HashMap<>();
headMap.put("Accept", "application/json");
headMap.put("Content-Type", "application/json;charset=utf-8");
headMap.put("authorization", "Bearer " + getToken(tokenMap));

String returnStr = HttpClientUtil.postJson(url, headMap, JSONUtil.toJsonStr(map), "utf-8");
if (StringUtils.isEmpty(returnStr)) {
throw new ServiceException("请求影刀接口失败");
}
BaseDTO baseDTO = JSON.parseObject(returnStr, BaseDTO.class);
if (!baseDTO.getSuccess()) {
throw new ServiceException("请求影刀接口失败,状态码为" + baseDTO.getCode() + "原因是:" + baseDTO.getMsg());
}
return baseDTO;
}

/**
* 获取token
*
* @param map accessKeyId accessKeySecret
* @return
*/
private static String getToken(Map<String, Object> map) {
String s = HttpClientUtil.getHttp(CREATE_TOKEN, map);
BaseDTO baseDTO = JSON.parseObject(s, BaseDTO.class);
if (!baseDTO.getSuccess()) {
throw new ServiceException("获取影刀token失败!");
}
Object data = baseDTO.getData();
CreateTokenDTO createTokenDTO = JSON.parseObject(data.toString(), CreateTokenDTO.class);
return createTokenDTO.getAccessToken();
}

}

+ 28
- 0
ruoyi-business/src/main/java/com/ruoyi/business/yddoman/BaseDTO.java View File

@@ -0,0 +1,28 @@
package com.ruoyi.business.yddoman;

import lombok.Data;

/**
* 影刀统一响应父类
*
* @author #author#
*/
@Data
public class BaseDTO {

private Integer code;
private Boolean success;
private String msg;
private Object data;
private Page page;

@Data
public static class Page {
private Integer page;
private Integer total;
private Integer size;
private Integer pages;
private Integer offset;
private String order;
}
}

+ 17
- 0
ruoyi-business/src/main/java/com/ruoyi/business/yddoman/CreateTokenDTO.java View File

@@ -0,0 +1,17 @@
package com.ruoyi.business.yddoman;

import lombok.Data;

/**
* 创建token
*
* @author #author#
*/
@Data
public class CreateTokenDTO
{

private String accessToken;
private String expiresIn;

}

+ 118
- 0
ruoyi-business/src/main/resources/mapper/business/ApplyMapper.xml View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.ApplyMapper">
<!--应用信息管理对象 ct_apply-->
<resultMap type="Apply" id="ApplyResult">
<!-- 主键 -->
<result property="id" column="id" />
<!-- 应用所有者名称 -->
<result property="ownerName" column="owner_name" />
<!-- 应用所有者账号 -->
<result property="ownerAccount" column="owner_account" />
<!-- 所有者id -->
<result property="ownerId" column="owner_id" />
<!-- appid -->
<result property="appId" column="app_id" />
<!-- 应用名称 -->
<result property="appName" column="app_name" />
<!-- 应用类型名称 -->
<result property="appTypeName" column="app_type_name" />
<!-- 应用类型枚举(app:应用 activity:指令) -->
<result property="appType" column="app_type" />
<!-- 应用创建时间 -->
<result property="appCreateTime" column="app_create_time" />
<!-- 应用修改时间 -->
<result property="appUpdateTime" column="app_update_time" />
<!-- 版本,值内容:未发版、版本 -->
<result property="version" column="version" />
<!-- 是否支持应用参数 -->
<result property="supportParam" column="support_param" />
<!-- icon图下载地址 -->
<result property="icon" column="icon" />
<!-- 预计人工耗时 -->
<result property="manualTime" column="manual_time" />
<!-- 部门id -->
<result property="deptId" column="dept_id" />
<!-- 部门名称 -->
<result property="deptName" column="dept_name" />
<!-- 创建者 -->
<result property="createBy" column="create_by" />
<!-- 创建时间 -->
<result property="createTime" column="create_time" />
<!-- 更新者 -->
<result property="updateBy" column="update_by" />
<!-- 更新时间 -->
<result property="updateTime" column="update_time" />
<!-- 备注 -->
<result property="remark" column="remark" />
<!-- 是否删除 -->
<result property="deleted" column="deleted" />
</resultMap>

<sql id="selectApplyVo">
select
apply.id,<!-- 主键 -->
apply.owner_name,<!-- 应用所有者名称 -->
apply.owner_account,<!-- 应用所有者账号 -->
apply.owner_id,<!-- 所有者id -->
apply.app_id,<!-- appid -->
apply.app_name,<!-- 应用名称 -->
apply.app_type_name,<!-- 应用类型名称 -->
apply.app_type,<!-- 应用类型枚举(app:应用 activity:指令) -->
apply.app_create_time,<!-- 应用创建时间 -->
apply.app_update_time,<!-- 应用修改时间 -->
apply.version,<!-- 版本,值内容:未发版、版本 -->
apply.support_param,<!-- 是否支持应用参数 -->
apply.icon,<!-- icon图下载地址 -->
apply.manual_time,<!-- 预计人工耗时 -->
apply.dept_id,<!-- 部门id -->
apply.dept_name,<!-- 部门名称 -->
apply.create_by,<!-- 创建者 -->
apply.create_time,<!-- 创建时间 -->
apply.update_by,<!-- 更新者 -->
apply.update_time,<!-- 更新时间 -->
apply.remark,<!-- 备注 -->
apply.deleted
</sql>

<select id="selectApplyList" parameterType="Apply" resultMap="ApplyResult">
<include refid="selectApplyVo"/>
from ct_apply apply
<where>
deleted = 0
<if test="ownerName != null and ownerName != ''"> and owner_name like concat(#{ownerName}, '%')</if>
<if test="ownerAccount != null and ownerAccount != ''"> and owner_account like concat(#{ownerAccount}, '%')</if>
<if test="appName != null and appName != ''"> and app_name like concat(#{appName}, '%')</if>
<if test="version != null and version != ''"> and version = #{version}</if>
<if test="appTypeName != null and appTypeName != ''"> and app_type_name like concat(#{appTypeName}, '%')</if>
<if test="appType != null and appType != ''"> and app_type = #{appType}</if>
<if test="supportParam != null "> and support_param = #{supportParam}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat(#{deptName}, '%')</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>

<!--查询所有已发版的应用列表-->
<select id="selectApplyAllList" parameterType="Apply" resultMap="ApplyResult">
<include refid="selectApplyVo"/>
from ct_apply apply
<where>
deleted = 0
<if test="ownerName != null and ownerName != ''"> and owner_name like concat(#{ownerName}, '%')</if>
<if test="ownerAccount != null and ownerAccount != ''"> and owner_account like concat(#{ownerAccount}, '%')</if>
<if test="appName != null and appName != ''"> and app_name like concat(#{appName}, '%')</if>
<if test="appTypeName != null and appTypeName != ''"> and app_type_name like concat(#{appTypeName}, '%')</if>
<if test="appType != null and appType != ''"> and app_type = #{appType}</if>
<if test="supportParam != null "> and support_param = #{supportParam}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat(#{deptName}, '%')</if>
and version != '未发版'
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
</mapper>

+ 91
- 0
ruoyi-business/src/main/resources/mapper/business/ApplyPlanLogMapper.xml View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.ApplyPlanLogMapper">
<!--应用执行结果记录管理对象 ct_apply_plan_log-->
<resultMap type="ApplyPlanLog" id="ApplyPlanLogResult">
<!-- 主键 -->
<result property="id" column="id" />
<!-- 启动的任务的uuid -->
<result property="jobUuid" column="job_uuid" />
<!-- 计划名称 -->
<result property="planName" column="plan_name" />
<!-- 执行类型(0指定机器人 1随机分配空闲) -->
<result property="planType" column="plan_type" />
<!-- 计划执行的机器人名称 -->
<result property="robotName" column="robot_name" />
<!-- 应用类型名称 -->
<result property="appTypeName" column="app_type_name" />
<!-- 应用名称 -->
<result property="appName" column="app_name" />
<!-- appid -->
<result property="appId" column="app_id" />
<!-- 任务状态 -->
<result property="status" column="status" />
<!-- 任务状态名称 -->
<result property="statusName" column="status_name" />
<!-- 任务开始运行的时间 -->
<result property="startTime" column="start_time" />
<!-- 任务结束运行的时间 -->
<result property="endTime" column="end_time" />
<!-- 预计人工耗时 -->
<result property="manualTime" column="manual_time" />
<!-- 实际耗时 -->
<result property="planTime" column="plan_time" />
<!-- 节约时间 -->
<result property="timeSaving" column="time_saving" />
<!-- 创建者 -->
<result property="createBy" column="create_by" />
<!-- 创建时间 -->
<result property="createTime" column="create_time" />
<!-- 更新者 -->
<result property="updateBy" column="update_by" />
<!-- 更新时间 -->
<result property="updateTime" column="update_time" />
<!-- 备注 -->
<result property="remark" column="remark" />
<!-- 是否删除 -->
<result property="deleted" column="deleted" />
</resultMap>

<sql id="selectApplyPlanLogVo">
select
id,<!-- 主键 -->
job_uuid,<!-- 启动的任务的uuid -->
plan_name,<!-- 计划名称 -->
plan_type,<!-- 执行类型(0指定机器人 1随机分配空闲) -->
robot_name,<!-- 计划执行的机器人名称 -->
app_type_name,<!-- 应用类型名称 -->
app_name,<!-- 应用名称 -->
app_id,<!-- appid -->
status,<!-- 任务状态 -->
status_name,<!-- 任务状态名称 -->
start_time,<!-- 任务开始运行的时间 -->
end_time,<!-- 任务结束运行的时间 -->
manual_time,<!-- 预计人工耗时 -->
plan_time,<!-- 实际耗时 -->
time_saving,<!-- 节约时间 -->
create_by,<!-- 创建者 -->
create_time,<!-- 创建时间 -->
update_by,<!-- 更新者 -->
update_time,<!-- 更新时间 -->
remark,<!-- 备注 -->
deleted </sql>

<select id="selectApplyPlanLogList" parameterType="ApplyPlanLog" resultMap="ApplyPlanLogResult">
<include refid="selectApplyPlanLogVo"/>
from ct_apply_plan_log
<where>
deleted = 0
<if test="jobUuid != null and jobUuid != ''"> and job_uuid = #{jobUuid}</if>
<if test="planName != null and planName != ''"> and plan_name like concat(#{planName}, '%')</if>
<if test="robotName != null and robotName != ''"> and robot_name like concat(#{robotName}, '%')</if>
<if test="appTypeName != null and appTypeName != ''"> and app_type_name like concat(#{appTypeName}, '%')</if>
<if test="appName != null and appName != ''"> and app_name like concat(#{appName}, '%')</if>
<if test="appId != null and appId != ''"> and app_id = #{appId}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="statusName != null and statusName != ''"> and status_name like concat(#{statusName}, '%')</if>
</where>
</select>
</mapper>

+ 157
- 0
ruoyi-business/src/main/resources/mapper/business/ApplyPlanMapper.xml View File

@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.ApplyPlanMapper">
<!--应用执行计划管理对象 ct_apply_plan-->
<resultMap type="ApplyPlan" id="ApplyPlanResult">
<!-- 主键 -->
<result property="id" column="id"/>
<!-- 计划名称 -->
<result property="planName" column="plan_name"/>
<!-- 执行类型(0指定机器人 1随机分配空闲) -->
<result property="planType" column="plan_type"/>
<!-- 计划执行的机器人名称 -->
<result property="robotName" column="robot_name"/>
<!-- 应用类型名称 -->
<result property="appTypeName" column="app_type_name"/>
<!-- 应用名称 -->
<result property="appName" column="app_name"/>
<!-- appid -->
<result property="appId" column="app_id"/>
<!-- 应用类型枚举(app:应用 activity:指令) -->
<result property="appType" column="app_type"/>
<!-- 是否支持应用参数 -->
<result property="supportParam" column="support_param"/>
<!-- 计划参数 -->
<result property="planParams" column="plan_params"/>
<!-- 输出参数 -->
<result property="outParam" column="out_param"/>
<!-- 等待超时时间 -->
<result property="waitTimeout" column="wait_timeout"/>
<!-- 优先级 -->
<result property="priority" column="priority"/>
<!-- 执行类型(0立即执行 1指定时间执行 2周期执行) -->
<result property="excType" column="exc_type"/>
<!-- 执行时间 -->
<result property="excTime" column="exc_time"/>
<!-- 执行表达式 -->
<result property="cronExpression" column="cron_expression"/>
<!-- 上次执行时间 -->
<result property="lastExecTime" column="last_exec_time"/>
<!-- 下次执行时间 -->
<result property="nextExecTime" column="next_exec_time"/>
<!-- 任务执行状态 -->
<result property="taskStatus" column="task_status"/>
<!-- 任务运行uuid -->
<result property="taskUuid" column="task_uuid"/>
<!-- 任务开始运行的时间 -->
<result property="startTime" column="start_time"/>
<!-- 任务结束运行的时间 -->
<result property="endTime" column="end_time"/>
<!-- 实际耗时 -->
<result property="planTime" column="plan_time"/>
<!-- 节约时间 -->
<result property="timeSaving" column="time_saving"/>
<!-- 部门id -->
<result property="deptId" column="dept_id"/>
<!-- 部门名称 -->
<result property="deptName" column="dept_name"/>
<!-- 创建者 -->
<result property="createBy" column="create_by"/>
<!-- 创建时间 -->
<result property="createTime" column="create_time"/>
<!-- 更新者 -->
<result property="updateBy" column="update_by"/>
<!-- 更新时间 -->
<result property="updateTime" column="update_time"/>
<!-- 备注 -->
<result property="remark" column="remark"/>
<!-- 是否删除 -->
<result property="deleted" column="deleted"/>
</resultMap>

<sql id="selectApplyPlanVo">
select
plan.id,<!-- 主键 -->
plan.plan_name,<!-- 计划名称 -->
plan.plan_type,<!-- 执行类型(0指定机器人 1随机分配空闲) -->
plan.robot_name,<!-- 计划执行的机器人名称 -->
plan.app_type_name,<!-- 应用类型名称 -->
plan.app_name,<!-- 应用名称 -->
plan.app_id,<!-- appid -->
plan.app_type,<!-- 应用类型枚举(app:应用 activity:指令) -->
plan.support_param,<!-- 是否支持应用参数 -->
plan.plan_params,<!-- 计划参数 -->
plan.out_param,<!-- 输出参数 -->
plan.wait_timeout,<!-- 等待超时时间 -->
plan.priority,<!-- 优先级 -->
plan.exc_type,<!-- 执行类型(0立即执行 1指定时间执行 2周期执行) -->
plan.exc_time,<!-- 执行时间 -->
plan.cron_expression,<!-- 执行表达式 -->
plan.last_exec_time,<!-- 上次执行时间 -->
plan.next_exec_time,<!-- 下次执行时间 -->
plan.task_status,<!-- 任务执行状态 -->
plan.task_uuid,<!-- 任务运行uuid -->
plan.manual_time,<!-- 预计人工耗时 -->
plan.start_time,<!-- 任务开始运行的时间 -->
plan.end_time,<!-- 任务结束运行的时间 -->
plan.plan_time,<!-- 实际耗时 -->
plan.time_saving,<!-- 节约时间 -->
plan.dept_id,<!-- 部门id -->
plan.dept_name,<!-- 部门名称 -->
plan.create_by,<!-- 创建者 -->
plan.create_time,<!-- 创建时间 -->
plan.update_by,<!-- 更新者 -->
plan.update_time,<!-- 更新时间 -->
plan.remark,<!-- 备注 -->
plan.deleted
</sql>

<select id="selectApplyPlanList" parameterType="ApplyPlan" resultMap="ApplyPlanResult">
<include refid="selectApplyPlanVo"/>
from ct_apply_plan plan
left JOIN sys_user u ON plan.create_by = u.user_name
left join sys_dept d on u.dept_id = d.dept_id
<where>
deleted = 0
<if test="planName != null and planName != ''">and plan_name like concat(#{planName}, '%')</if>
<if test="planType != null and planType != ''">and plan_type = #{planType}</if>
<if test="robotName != null and robotName != ''">and robot_name like concat(#{robotName}, '%')</if>
<if test="appTypeName != null and appTypeName != ''">and app_type_name like concat(#{appTypeName}, '%')
</if>
<if test="supportParam != null ">and support_param = #{supportParam}</if>
<if test="appName != null and appName != ''">and app_name like concat(#{appName}, '%')</if>
<if test="appId != null and appId != ''">and app_id = #{appId}</if>
<if test="excType != null and excType != ''">and exc_type = #{excType}</if>
<if test="excTime != null ">and exc_time = #{excTime}</if>
<if test="cronExpression != null and cronExpression != ''">and cron_expression = #{cronExpression}</if>
<if test="lastExecTime != null ">and last_exec_time = #{lastExecTime}</if>
<if test="nextExecTime != null ">and next_exec_time = #{nextExecTime}</if>
<if test="taskStatus != null and taskStatus != ''">and task_status = #{taskStatus}</if>
<if test="taskUuid != null and taskUuid != ''">and task_uuid = #{taskUuid}</if>
<if test="manualTime != null and manualTime != ''">and manual_time = #{manualTime}</if>
<if test="startTime != null ">and start_time = #{startTime}</if>
<if test="endTime != null ">and end_time = #{endTime}</if>
<if test="planTime != null and planTime != ''">and plan_time = #{planTime}</if>
<if test="timeSaving != null and timeSaving != ''">and time_saving = #{timeSaving}</if>
<if test="deptId != null ">and dept_id = #{deptId}</if>
<if test="deptName != null and deptName != ''">and dept_name like concat(#{deptName}, '%')</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
order by plan.priority asc,plan.create_time desc
</select>

<update id="appRetry">
update ct_apply_plan
set task_status = 'await_create',
start_time = null,
end_time = null,
plan_time = null,
time_saving = null,
last_exec_time = null,
next_exec_time = null
where task_uuid = #{taskUuid}
</update>
</mapper>

+ 0
- 95
ruoyi-business/src/main/resources/mapper/business/BusinessSurveyMapper.xml View File

@@ -1,95 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.BusinessSurveyMapper">
<resultMap type="BusinessSurvey" id="BusinessSurveyResult">
<result property="id" column="id" />
<result property="title" column="title" />
<result property="context" column="context" />
<result property="tempId" column="temp_id" />
<result property="open" column="open" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deleted" column="deleted" />
<result property="remark" column="remark" />
</resultMap>

<sql id="selectBusinessSurveyVo">
select id, title, context, temp_id, open, create_by, create_time, update_by, update_time, deleted, remark from business_survey
</sql>

<select id="selectBusinessSurveyList" parameterType="BusinessSurvey" resultMap="BusinessSurveyResult">
<include refid="selectBusinessSurveyVo"/>
<where>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="context != null and context != ''"> and context = #{context}</if>
<if test="tempId != null "> and temp_id = #{tempId}</if>
<if test="open != null and open != ''"> and open = #{open}</if>
</where>
</select>
<select id="selectBusinessSurveyById" parameterType="Long" resultMap="BusinessSurveyResult">
<include refid="selectBusinessSurveyVo"/>
where id = #{id}
</select>
<insert id="insertBusinessSurvey" parameterType="BusinessSurvey" useGeneratedKeys="true" keyProperty="id">
insert into business_survey
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">title,</if>
<if test="context != null">context,</if>
<if test="tempId != null">temp_id,</if>
<if test="open != null">open,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleted != null">deleted,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">#{title},</if>
<if test="context != null">#{context},</if>
<if test="tempId != null">#{tempId},</if>
<if test="open != null">#{open},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleted != null">#{deleted},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>

<update id="updateBusinessSurvey" parameterType="BusinessSurvey">
update business_survey
<trim prefix="SET" suffixOverrides=",">
<if test="title != null">title = #{title},</if>
<if test="context != null">context = #{context},</if>
<if test="tempId != null">temp_id = #{tempId},</if>
<if test="open != null">open = #{open},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deleted != null">deleted = #{deleted},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>

<delete id="deleteBusinessSurveyById" parameterType="Long">
delete from business_survey where id = #{id}
</delete>

<delete id="deleteBusinessSurveyByIds" parameterType="String">
delete from business_survey where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

+ 0
- 90
ruoyi-business/src/main/resources/mapper/business/BusinessTemplateMapper.xml View File

@@ -1,90 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.BusinessTemplateMapper">
<resultMap type="BusinessTemplate" id="BusinessTemplateResult">
<result property="id" column="id" />
<result property="title" column="title" />
<result property="context" column="context" />
<result property="open" column="open" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deleted" column="deleted" />
<result property="remark" column="remark" />
</resultMap>

<sql id="selectBusinessTemplateVo">
select id, title, context, open, create_by, create_time, update_by, update_time, deleted, remark from business_template
</sql>

<select id="selectBusinessTemplateList" parameterType="BusinessTemplate" resultMap="BusinessTemplateResult">
<include refid="selectBusinessTemplateVo"/>
<where>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="context != null and context != ''"> and context = #{context}</if>
<if test="open != null and open != ''"> and open = #{open}</if>
</where>
</select>
<select id="selectBusinessTemplateById" parameterType="Long" resultMap="BusinessTemplateResult">
<include refid="selectBusinessTemplateVo"/>
where id = #{id}
</select>
<insert id="insertBusinessTemplate" parameterType="BusinessTemplate" useGeneratedKeys="true" keyProperty="id">
insert into business_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">title,</if>
<if test="context != null">context,</if>
<if test="open != null">open,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleted != null">deleted,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">#{title},</if>
<if test="context != null">#{context},</if>
<if test="open != null">#{open},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleted != null">#{deleted},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>

<update id="updateBusinessTemplate" parameterType="BusinessTemplate">
update business_template
<trim prefix="SET" suffixOverrides=",">
<if test="title != null">title = #{title},</if>
<if test="context != null">context = #{context},</if>
<if test="open != null">open = #{open},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deleted != null">deleted = #{deleted},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>

<delete id="deleteBusinessTemplateById" parameterType="Long">
delete from business_template where id = #{id}
</delete>

<delete id="deleteBusinessTemplateByIds" parameterType="String">
delete from business_template where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

+ 0
- 115
ruoyi-business/src/main/resources/mapper/business/BusinessTemplatePropMapper.xml View File

@@ -1,115 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.BusinessTemplatePropMapper">
<resultMap type="BusinessTemplateProp" id="BusinessTemplatePropResult">
<result property="id" column="id" />
<result property="title" column="title" />
<result property="compType" column="comp_type" />
<result property="fieldName" column="field_name" />
<result property="placPrompt" column="plac_prompt" />
<result property="defaultValue" column="default_value" />
<result property="optionalValue" column="optional_value" />
<result property="open" column="open" />
<result property="tempId" column="temp_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deleted" column="deleted" />
<result property="remark" column="remark" />
</resultMap>

<sql id="selectBusinessTemplatePropVo">
select id, title, comp_type, field_name, plac_prompt, default_value, optional_value, open, temp_id, create_by, create_time, update_by, update_time, deleted, remark from business_template_prop
</sql>

<select id="selectBusinessTemplatePropList" parameterType="BusinessTemplateProp" resultMap="BusinessTemplatePropResult">
<include refid="selectBusinessTemplatePropVo"/>
<where>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="compType != null and compType != ''"> and comp_type = #{compType}</if>
<if test="fieldName != null and fieldName != ''"> and field_name like concat('%', #{fieldName}, '%')</if>
<if test="placPrompt != null and placPrompt != ''"> and plac_prompt = #{placPrompt}</if>
<if test="defaultValue != null and defaultValue != ''"> and default_value = #{defaultValue}</if>
<if test="optionalValue != null and optionalValue != ''"> and optional_value = #{optionalValue}</if>
<if test="open != null and open != ''"> and open = #{open}</if>
<if test="tempId != null "> and temp_id = #{tempId}</if>
</where>
</select>
<select id="selectBusinessTemplatePropById" parameterType="Long" resultMap="BusinessTemplatePropResult">
<include refid="selectBusinessTemplatePropVo"/>
where id = #{id}
</select>
<insert id="insertBusinessTemplateProp" parameterType="BusinessTemplateProp" useGeneratedKeys="true" keyProperty="id">
insert into business_template_prop
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">title,</if>
<if test="compType != null and compType != ''">comp_type,</if>
<if test="fieldName != null and fieldName != ''">field_name,</if>
<if test="placPrompt != null">plac_prompt,</if>
<if test="defaultValue != null">default_value,</if>
<if test="optionalValue != null">optional_value,</if>
<if test="open != null">open,</if>
<if test="tempId != null">temp_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleted != null">deleted,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">#{title},</if>
<if test="compType != null and compType != ''">#{compType},</if>
<if test="fieldName != null and fieldName != ''">#{fieldName},</if>
<if test="placPrompt != null">#{placPrompt},</if>
<if test="defaultValue != null">#{defaultValue},</if>
<if test="optionalValue != null">#{optionalValue},</if>
<if test="open != null">#{open},</if>
<if test="tempId != null">#{tempId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleted != null">#{deleted},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>

<update id="updateBusinessTemplateProp" parameterType="BusinessTemplateProp">
update business_template_prop
<trim prefix="SET" suffixOverrides=",">
<if test="title != null and title != ''">title = #{title},</if>
<if test="compType != null and compType != ''">comp_type = #{compType},</if>
<if test="fieldName != null and fieldName != ''">field_name = #{fieldName},</if>
<if test="placPrompt != null">plac_prompt = #{placPrompt},</if>
<if test="defaultValue != null">default_value = #{defaultValue},</if>
<if test="optionalValue != null">optional_value = #{optionalValue},</if>
<if test="open != null">open = #{open},</if>
<if test="tempId != null">temp_id = #{tempId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deleted != null">deleted = #{deleted},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>

<delete id="deleteBusinessTemplatePropById" parameterType="Long">
delete from business_template_prop where id = #{id}
</delete>

<delete id="deleteBusinessTemplatePropByIds" parameterType="String">
delete from business_template_prop where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

+ 0
- 113
ruoyi-business/src/main/resources/mapper/business/BusinessTemplatePropValueMapper.xml View File

@@ -1,113 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.BusinessTemplatePropValueMapper">
<resultMap type="BusinessTemplatePropValue" id="BusinessTemplatePropValueResult">
<result property="id" column="id" />
<result property="propId" column="prop_id" />
<result property="propName" column="prop_name" />
<result property="valueKey" column="value_key" />
<result property="valueText" column="value_text" />
<result property="tempId" column="temp_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deleted" column="deleted" />
<result property="remark" column="remark" />
</resultMap>

<sql id="selectBusinessTemplatePropValueVo">
select id, prop_id, prop_name, value_key, value_text, temp_id, create_by, create_time, update_by, update_time, deleted, remark from business_template_prop_value
</sql>

<select id="selectBusinessTemplatePropValueList" parameterType="BusinessTemplatePropValue" resultMap="BusinessTemplatePropValueResult">
<include refid="selectBusinessTemplatePropValueVo"/>
<where>
<if test="propId != null and propId != ''"> and prop_id = #{propId}</if>
<if test="propName != null and propName != ''"> and prop_name like concat('%', #{propName}, '%')</if>
<if test="valueKey != null and valueKey != ''"> and value_key = #{valueKey}</if>
<if test="valueText != null and valueText != ''"> and value_text = #{valueText}</if>
<if test="tempId != null "> and temp_id = #{tempId}</if>
</where>
</select>
<select id="selectBusinessTemplatePropValueById" parameterType="Long" resultMap="BusinessTemplatePropValueResult">
<include refid="selectBusinessTemplatePropValueVo"/>
where id = #{id}
</select>

<!--获取统计数据-->
<select id="countGroup" resultType="map">
select
count(1) as value,
value_text as name
from business_template_prop_value
where survey_id = #{surveyId}
and prop_type in ('0','1','6')
and prop_id = #{propId}
and deleted = '0'
group by value_key
</select>

<insert id="insertBusinessTemplatePropValue" parameterType="BusinessTemplatePropValue" useGeneratedKeys="true" keyProperty="id">
insert into business_template_prop_value
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="propId != null">prop_id,</if>
<if test="propName != null">prop_name,</if>
<if test="valueKey != null">value_key,</if>
<if test="valueText != null">value_text,</if>
<if test="tempId != null">temp_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleted != null">deleted,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="propId != null">#{propId},</if>
<if test="propName != null">#{propName},</if>
<if test="valueKey != null">#{valueKey},</if>
<if test="valueText != null">#{valueText},</if>
<if test="tempId != null">#{tempId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleted != null">#{deleted},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>

<update id="updateBusinessTemplatePropValue" parameterType="BusinessTemplatePropValue">
update business_template_prop_value
<trim prefix="SET" suffixOverrides=",">
<if test="propId != null">prop_id = #{propId},</if>
<if test="propName != null">prop_name = #{propName},</if>
<if test="valueKey != null">value_key = #{valueKey},</if>
<if test="valueText != null">value_text = #{valueText},</if>
<if test="tempId != null">temp_id = #{tempId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deleted != null">deleted = #{deleted},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>

<delete id="deleteBusinessTemplatePropValueById" parameterType="Long">
delete from business_template_prop_value where id = #{id}
</delete>

<delete id="deleteBusinessTemplatePropValueByIds" parameterType="String">
delete from business_template_prop_value where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

+ 71
- 0
ruoyi-business/src/main/resources/mapper/business/RebotMapper.xml View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.RebotMapper">
<!--机器人管理对象 ct_rebot-->
<resultMap type="Rebot" id="RebotResult">
<!-- 主键 -->
<result property="id" column="id" />
<!-- 机器人名称 -->
<result property="robotClientName" column="robot_client_name" />
<!-- 机器人Uuid信息 -->
<result property="robotClientUuid" column="robot_client_uuid" />
<!-- 运行状态(waiting:等待调度 running:任务运行中 finish:任务运行结束 stopping:任务正在停止 stopped:已结束 error:异常) -->
<result property="status" column="status" />
<!-- 描述 -->
<result property="description" column="description" />
<!-- 客户端系统账号 -->
<result property="windowsAccount" column="windows_account" />
<!-- 客户端ip -->
<result property="clientIp" column="client_ip" />
<!-- 部门id -->
<result property="deptId" column="dept_id" />
<!-- 创建者 -->
<result property="createBy" column="create_by" />
<!-- 创建时间 -->
<result property="createTime" column="create_time" />
<!-- 更新者 -->
<result property="updateBy" column="update_by" />
<!-- 更新时间 -->
<result property="updateTime" column="update_time" />
<!-- 备注 -->
<result property="remark" column="remark" />
<!-- 是否删除 -->
<result property="deleted" column="deleted" />
</resultMap>

<sql id="selectRebotVo">
select
rebot.id,<!-- 主键 -->
rebot.robot_client_name,<!-- 机器人名称 -->
rebot.robot_client_uuid,<!-- 机器人Uuid信息 -->
rebot.status,<!-- 运行状态(waiting:等待调度 running:任务运行中 finish:任务运行结束 stopping:任务正在停止 stopped:已结束 error:异常) -->
rebot.description,<!-- 描述 -->
rebot.windows_account,<!-- 客户端系统账号 -->
rebot.client_ip,<!-- 客户端ip -->
rebot.dept_id,<!-- 部门id -->
rebot.create_by,<!-- 创建者 -->
rebot.create_time,<!-- 创建时间 -->
rebot.update_by,<!-- 更新者 -->
rebot.update_time,<!-- 更新时间 -->
rebot.remark,<!-- 备注 -->
rebot.deleted
</sql>


<select id="selectRebotList" parameterType="Rebot" resultMap="RebotResult">
<include refid="selectRebotVo"/>
from ct_rebot rebot
<where>
rebot.deleted = 0
<if test="robotClientName != null and robotClientName != ''"> and robot_client_name like concat(#{robotClientName}, '%')</if>
<if test="robotClientUuid != null and robotClientUuid != ''"> and robot_client_uuid = #{robotClientUuid}</if>
<if test="status != null and status != ''"> and rebot.status = #{status}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="windowsAccount != null and windowsAccount != ''"> and windows_account = #{windowsAccount}</if>
<if test="clientIp != null and clientIp != ''"> and client_ip = #{clientIp}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
</where>
</select>
</mapper>

+ 73
- 0
ruoyi-business/src/main/resources/mapper/business/ResourceLibraryMapper.xml View File

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.ResourceLibraryMapper">
<!--资源库管理对象 ct_resource_library-->
<resultMap type="ResourceLibrary" id="ResourceLibraryResult">
<!-- 主键 -->
<result property="id" column="id" />
<!-- 资源描述 -->
<result property="resource" column="resource" />
<!-- 资源内容 -->
<result property="resourceValue" column="resource_value" />
<!-- 资源类型 -->
<result property="resourceType" column="resource_type" />
<!-- 资源键 -->
<result property="resourceName" column="resource_name" />
<!-- 所属应用id -->
<result property="appId" column="app_id" />
<!-- 所属应用名称 -->
<result property="appName" column="app_name" />
<!-- 部门id -->
<result property="deptId" column="dept_id" />
<!-- 部门名程 -->
<result property="deptName" column="dept_name" />
<!-- 创建者 -->
<result property="createBy" column="create_by" />
<!-- 创建时间 -->
<result property="createTime" column="create_time" />
<!-- 更新者 -->
<result property="updateBy" column="update_by" />
<!-- 更新时间 -->
<result property="updateTime" column="update_time" />
<!-- 备注 -->
<result property="remark" column="remark" />
<!-- 是否删除 -->
<result property="deleted" column="deleted" />
</resultMap>

<sql id="selectResourceLibraryVo">
select
id,<!-- 主键 -->
resource,<!-- 资源描述 -->
resource_value,<!-- 资源内容 -->
resource_type,<!-- 资源类型 -->
resource_name,<!-- 资源键 -->
app_id,<!-- 所属应用id -->
app_name,<!-- 所属应用名称 -->
dept_id,<!-- 部门id -->
dept_name,<!-- 部门id -->
create_by,<!-- 创建者 -->
create_time,<!-- 创建时间 -->
update_by,<!-- 更新者 -->
update_time,<!-- 更新时间 -->
remark,<!-- 备注 -->
deleted </sql>

<select id="selectResourceLibraryList" parameterType="ResourceLibrary" resultMap="ResourceLibraryResult">
<include refid="selectResourceLibraryVo"/>
from ct_resource_library
<where>
deleted = 0
<if test="resource != null and resource != ''"> and resource like concat(#{resource}, '%')</if>
<if test="resourceValue != null and resourceValue != ''"> and resource_value = #{resourceValue}</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="resourceName != null and resourceName != ''"> and resource_name like concat(#{resourceName}, '%')</if>
<if test="appId != null and appId != ''"> and app_id = #{appId}</if>
<if test="appName != null and appName != ''"> and app_name like concat(#{appName}, '%')</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat(#{deptName}, '%')</if>
</where>
</select>
</mapper>

+ 21
- 0
ruoyi-common/pom.xml View File

@@ -132,17 +132,38 @@
<artifactId>javax.servlet-api</artifactId>
</dependency>

<!--工具包-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.3.4</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.12</version>
</dependency>
<dependency>
<groupId>org.jodd</groupId>
<artifactId>jodd-core</artifactId>
<version>3.7.1</version>
</dependency>

<!-- mybatis-plus 增强CRUD -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.2</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
</dependency>


</dependencies>

</project>

+ 18
- 6
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java View File

@@ -1,9 +1,13 @@
package com.ruoyi.common.constant;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* 代码生成通用常量
*
* @author #author#
* @author
*/
public class GenConstants
{
@@ -45,15 +49,20 @@ public class GenConstants
"bit", "bigint", "float", "double", "decimal" };

/** 页面不需要编辑字段 */
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
public static final String[] COLUMNNAME_NOT_EDIT = { "id","uuid", "create_by", "create_time","update_by","update_time", "deleted" };

/** 页面不需要新增字段 */
public static final String[] COLUMNNAME_NOT_INSERT = { "id","uuid", "create_by", "create_time","update_by","update_time", "deleted" };

/** 页面不需要显示的列表字段 */
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time" };
public static final String[] COLUMNNAME_NOT_LIST = { "id","uuid", "deleted" };

/** 页面不需要查询字段 */
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time", "remark" };
public static final String[] COLUMNNAME_NOT_QUERY = { "id","uuid", "create_by", "create_time", "update_by",
"update_time", "remark" , "deleted"};

// 排除固定字段cud默认选中状态
// private final static List<String> NOT_CRUD_COLUMN = Stream.of("id","uuid","create_by","create_time","update_by","update_time","deleted").collect(Collectors.toList());

/** Entity基类字段 */
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
@@ -114,4 +123,7 @@ public class GenConstants

/** 需要 */
public static final String REQUIRE = "1";

/** 不需要 */
public static final String NO_REQUIRE = "0";
}

+ 35
- 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/ExcTypeStatus.java View File

@@ -0,0 +1,35 @@
package com.ruoyi.common.enums;

/**
* 机器人状态枚举
*/

public enum ExcTypeStatus {
ONE("0", "立即执行"),
TWO("1", "指定时间执行"),
TREE("2", "周期执行");

private String key;
private String value;

public String getKey() {
return key;
}

public void setKey(String key) {
this.key = key;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}

ExcTypeStatus(String key, String value) {
this.key = key;
this.value = value;
}
}

+ 41
- 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/PlanRunStatus.java View File

@@ -0,0 +1,41 @@
package com.ruoyi.common.enums;

/**
* 计划任务应用执行状态
*/
public enum PlanRunStatus {
AWAIT_CREATE("await_create", "等待创建"),
CREATED("created", "已创建"),
WAITING("waiting", "等待调度"),
RUNNING("running", "运行中"),
FINISH("finish", "完成"),
STOPPING("stopping", "停止中"),
STOPPED("stopped", "已停止"),
ERROR("error", "异常"),
SKIPPED("skipped", "已跳过"),
CANCEL("cancel", "已取消");

private String key;
private String value;

public String getKey() {
return key;
}

public void setKey(String key) {
this.key = key;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}

PlanRunStatus(String key, String value) {
this.key = key;
this.value = value;
}
}

+ 39
- 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/RebotStatus.java View File

@@ -0,0 +1,39 @@
package com.ruoyi.common.enums;

import lombok.Data;

/**
* 机器人状态枚举
*/

public enum RebotStatus {
CONNECTED("connected", "已连接"),
IDLE("idle", "空闲"),
ALLOCATED("allocated", "已分配"),
RUNNING("running", "运行中"),
OFFLINE("offline", "离线");

private String key;
private String value;

public String getKey() {
return key;
}

public void setKey(String key) {
this.key = key;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}

RebotStatus(String key, String value) {
this.key = key;
this.value = value;
}
}

+ 0
- 2
ruoyi-common/src/main/java/com/ruoyi/common/handler/MyMetaObjectHandler.java View File

@@ -20,7 +20,6 @@ public class MyMetaObjectHandler implements MetaObjectHandler {

@Override
public void insertFill(MetaObject metaObject) {
log.info("start insert fill ....");
Object createBy = metaObject.getValue("createBy");
// String uuid = UUID.randomUUID().toString();
// this.strictInsertFill(metaObject, "id", String.class, uuid); // 起始版本 3.3.0(推荐使用)
@@ -38,7 +37,6 @@ public class MyMetaObjectHandler implements MetaObjectHandler {

@Override
public void updateFill(MetaObject metaObject) {
log.info("start update fill ....");
Object updateBy = metaObject.getValue("updateBy");
if (StringUtils.isNull(updateBy) || updateBy.equals("")) {
this.strictInsertFill(metaObject, "updateBy", String.class, SecurityUtils.getUsername());


+ 30
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/BeanToMapUtil.java View File

@@ -0,0 +1,30 @@
package com.ruoyi.common.utils;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

/**
* 实体类转map
*/
public class BeanToMapUtil {
public static <T> Map<String, Object> convertEntityToMap(T entity) throws IllegalAccessException {
Map<String, Object> map = new HashMap<>();
// 获取对象的类
Class<?> clazz = entity.getClass();
// 获取类中的所有字段
Field[] fields = clazz.getDeclaredFields();
// 遍历字段,将字段名和值存入Map
for (Field field : fields) {
// 设置字段可访问(非public字段需要设置访问权限)
field.setAccessible(true);
// 获取字段名
String fieldName = field.getName();
// 获取字段值
Object fieldValue = field.get(entity);
// 将字段名和值存入Map
map.put(fieldName, fieldValue);
}
return map;
}
}

+ 358
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpClientUtil.java View File

@@ -0,0 +1,358 @@
package com.ruoyi.common.utils.http;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

/**
* @author rch
* @date 2022-06-22
*/
public class HttpClientUtil {

private static final Logger log = LoggerFactory.getLogger(HttpClientUtil.class);
public static String postJson(String url, String body, String charset) {
String result = null;
if (null == charset) {
charset = "UTF-8";
}
CloseableHttpClient httpClient = null;
HttpPost httpPost = null;
try {
httpClient = HttpConnectionManager.getInstance().getHttpClient();
httpPost = new HttpPost(url);

// 设置连接超时,设置读取超时
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(3000)
.setSocketTimeout(3000)
.build();
httpPost.setConfig(requestConfig);

httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-Type", "application/json;charset=utf-8");

// 设置参数
StringEntity se = new StringEntity(body, "UTF-8");
httpPost.setEntity(se);
HttpResponse response = httpClient.execute(httpPost);
if (response != null) {
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
result = EntityUtils.toString(resEntity, charset);
}
}
} catch (Exception ex) {
ex.printStackTrace();
log.error(ex.getMessage());
}

return result;
}


public static String postJson(String url, Map<String, Object> heards, String body, String charset) {

String result = null;
if (null == charset) {
charset = "UTF-8";
}
CloseableHttpClient httpClient = null;
HttpPost httpPost = null;
try {
httpClient = HttpConnectionManager.getInstance().getHttpClient();
httpPost = new HttpPost(url);

// 设置连接超时,设置读取超时
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(3000)
.setSocketTimeout(3000)
.build();
httpPost.setConfig(requestConfig);

for (Map.Entry<String, Object> heard:heards.entrySet()) {
httpPost.setHeader(heard.getKey(), heard.getValue().toString());
}

// 设置参数
StringEntity se = new StringEntity(body, "UTF-8");
httpPost.setEntity(se);
HttpResponse response = httpClient.execute(httpPost);
if (response != null) {
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
result = EntityUtils.toString(resEntity, charset);
}
}
} catch (Exception ex) {
ex.printStackTrace();
log.error(ex.getMessage());
}

return result;
}


/**
* 发送 POST 请求(HTTP),K-V形式
*
* @param apiUrl
* API接口URL
* @param params
* 参数map
* @return
*/
public static String doPostHttp(String apiUrl, Map<String, Object> params) {
CloseableHttpClient httpClient = HttpClients.createDefault();
String httpStr = null;
HttpPost httpPost = new HttpPost(apiUrl);
CloseableHttpResponse response = null;

try {
// 设置连接超时,设置读取超时
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(10000)
.setSocketTimeout(10000)
.build();
httpPost.setConfig(requestConfig);
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");

List<NameValuePair> pairList = new ArrayList<>(params.size());
for (Entry<String, Object> entry : params.entrySet()) {
NameValuePair pair = new BasicNameValuePair(entry.getKey(), Convert.toStr(entry.getValue()));
pairList.add(pair);
}
httpPost.setEntity(new UrlEncodedFormEntity(pairList, Charset.forName("UTF-8")));
response = httpClient.execute(httpPost);
// System.out.println("http==response.toString():" + response.toString());
HttpEntity entity = response.getEntity();
httpStr = EntityUtils.toString(entity, "UTF-8");
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
} finally {
if (response != null) {
try {
EntityUtils.consume(response.getEntity());
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
}
}
}
return httpStr;
}

/**
* 发送 GET 请求(HTTP),K-V形式
*
* @param apiUrl
* API接口URL
* @param params
* 参数map
* @return
*/
public static String getHttp(String apiUrl,Map<String,Object> params){
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
String result = "";
try {
String url = apiUrl;
if(MapUtil.isNotEmpty(params)){
String paramsStr = "";
for (String key : params.keySet()) {
if(ObjectUtil.isNotEmpty(params.get(key))){
if(StrUtil.isNotEmpty(paramsStr)){
paramsStr += "&" + key + "=" + params.get(key);
}else{
paramsStr += key + "=" + params.get(key);
}
}
}
if(StrUtil.isNotEmpty(paramsStr)){
url += "?" + paramsStr;
}
}
httpClient = HttpClients.createDefault();
System.out.println("url:" + url);
HttpGet httpGet = new HttpGet(url);
// 设置连接超时,设置读取超时
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(5000)
.setSocketTimeout(5000)
.build();
httpGet.setConfig(requestConfig);
response = httpClient.execute(httpGet);
HttpEntity entity = response.getEntity();
result = EntityUtils.toString(entity, "UTF-8");
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
} finally {
if (response != null) {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
}
}
if (httpClient != null) {
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
}
}
}
return result;
}



/**
* 发送 GET 请求(HTTP)
*
* @param apiUrl
* API接口URL
* @return
*/
public static String getUrlHttp(String apiUrl){
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
String result = "";
try {
String url = apiUrl;
httpClient = HttpClients.createDefault();
System.out.println("url:" + url);
HttpGet httpGet = new HttpGet(url);
// 设置连接超时,设置读取超时
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(5000)
.setSocketTimeout(5000)
.build();
httpGet.setConfig(requestConfig);
response = httpClient.execute(httpGet);
HttpEntity entity = response.getEntity();
result = EntityUtils.toString(entity, "UTF-8");
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
} finally {
if (response != null) {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
}
}
if (httpClient != null) {
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
}
}
}
return result;
}

/**
* 发送 POST 请求(HTTP),K-V形式
*
* @param apiUrl
* API接口URL
* @param params
* 参数map
* @return
*/
public static String postHttp(String apiUrl,Map<String,Object> params){
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
String result = "";
try {
String url = apiUrl;
httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
// 设置连接超时,设置读取超时
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(5000)
.setSocketTimeout(5000)
.build();
httpPost.setConfig(requestConfig);
if(MapUtil.isNotEmpty(params)){
StringEntity se = new StringEntity(JSONUtil.toJsonStr(params), "UTF-8");
se.setContentType("application/json");
httpPost.setEntity(se);
}
response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
result = EntityUtils.toString(entity, "UTF-8");
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
} finally {
if (response != null) {
try {
EntityUtils.consume(response.getEntity());
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
}
}
if (httpClient != null) {
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
}
}
}
return result;
}


public static void main(String[] args) {
String url = "http://kjw.utest6.com/forcol/a";
Map<String,Object> params = new HashMap<>(16);
params.put("page",1);
params.put("pageSize",10000);
params.put("beginTime","2022-04-01 21:00:00");

String result = postHttp(url,params);
System.out.println(result);
}

}

+ 57
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpConnectionManager.java View File

@@ -0,0 +1,57 @@
package com.ruoyi.common.utils.http;


import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.springframework.stereotype.Component;

import javax.net.ssl.SSLContext;
import java.security.NoSuchAlgorithmException;

@Component
public class HttpConnectionManager {

private PoolingHttpClientConnectionManager cm = null;

private static HttpConnectionManager connectionManager;

public static HttpConnectionManager getInstance() {
if (connectionManager == null) {
synchronized (HttpConnectionManager.class) {
if (connectionManager == null) {
connectionManager = new HttpConnectionManager();
connectionManager.init();
}
}
}
return connectionManager;
}

private void init() {
LayeredConnectionSocketFactory sslsf = null;
try {
sslsf = new SSLConnectionSocketFactory(SSLContext.getDefault());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}

Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create()
.register("https", sslsf).register("http", new PlainConnectionSocketFactory()).build();
cm = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
cm.setMaxTotal(200);
cm.setDefaultMaxPerRoute(20);
}

public CloseableHttpClient getHttpClient() {
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm).build();

return httpClient;
}
}

+ 2
- 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java View File

@@ -115,6 +115,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
// 上传文件
.antMatchers("/common/upload","/dev-api/profile/upload/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
.and()


+ 59
- 86
ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java View File

@@ -1,6 +1,7 @@
package com.ruoyi.generator.util;

import java.util.Arrays;

import org.apache.commons.lang3.RegExUtils;
import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.utils.StringUtils;
@@ -10,21 +11,19 @@ import com.ruoyi.generator.domain.GenTableColumn;

/**
* 代码生成器 工具类
*
*
* @author zhihuiwuliu
*/
public class GenUtils
{
public class GenUtils {
/**
* 初始化表信息
*/
public static void initTable(GenTable genTable, String operName)
{
public static void initTable(GenTable genTable, String operName) {
genTable.setClassName(convertClassName(genTable.getTableName()));
genTable.setPackageName(GenConfig.getPackageName());
genTable.setModuleName(getModuleName(GenConfig.getPackageName()));
genTable.setBusinessName(getBusinessName(genTable.getTableName()));
genTable.setFunctionName(replaceText(genTable.getTableComment()));
genTable.setBusinessName(StringUtils.toCamelCase(genTable.getTableName()));
genTable.setFunctionName(replaceText(genTable.getTableComment()).concat("管理"));
genTable.setFunctionAuthor(GenConfig.getAuthor());
genTable.setCreateBy(operName);
}
@@ -32,8 +31,7 @@ public class GenUtils
/**
* 初始化列属性字段
*/
public static void initColumnField(GenTableColumn column, GenTable table)
{
public static void initColumnField(GenTableColumn column, GenTable table) {
String dataType = getDbType(column.getColumnType());
String columnName = column.getColumnName();
column.setTableId(table.getTableId());
@@ -44,112 +42,102 @@ public class GenUtils
column.setJavaType(GenConstants.TYPE_STRING);
column.setQueryType(GenConstants.QUERY_EQ);

if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType))
{
if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) {
// 字符串长度超过500设置为文本域
Integer columnLength = getColumnLength(column.getColumnType());
String htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT;
column.setHtmlType(htmlType);
}
else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType))
{
} else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) {
column.setJavaType(GenConstants.TYPE_DATE);
column.setHtmlType(GenConstants.HTML_DATETIME);
}
else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType))
{
} else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) {
column.setHtmlType(GenConstants.HTML_INPUT);

// 如果是浮点型 统一用BigDecimal
String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ",");
if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0)
{
if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) {
column.setJavaType(GenConstants.TYPE_BIGDECIMAL);
}
// 如果是整形
else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10)
{
else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) {
column.setJavaType(GenConstants.TYPE_INTEGER);
}
// 长整形
else
{
else {
column.setJavaType(GenConstants.TYPE_LONG);
}
}

// 插入字段(默认所有字段都需要插入)
column.setIsInsert(GenConstants.REQUIRE);

// 插入字段
if (!arraysContains(GenConstants.COLUMNNAME_NOT_INSERT, columnName)) {
column.setIsInsert(GenConstants.REQUIRE);
}else{
column.setIsInsert(GenConstants.NO_REQUIRE);
}
// 编辑字段
if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk())
{
if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName)) {
column.setIsEdit(GenConstants.REQUIRE);
}else{
column.setIsEdit(GenConstants.NO_REQUIRE);
}
// 列表字段
if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk())
{
if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName)) {
column.setIsList(GenConstants.REQUIRE);
}else{
column.setIsList(GenConstants.NO_REQUIRE);
}
// 查询字段
if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk())
{
if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName)) {
column.setIsQuery(GenConstants.REQUIRE);
}else{
column.setIsQuery(GenConstants.NO_REQUIRE);
}

// 查询字段类型
if (StringUtils.endsWithIgnoreCase(columnName, "name"))
{
if (StringUtils.endsWithIgnoreCase(columnName, "name")) {
column.setQueryType(GenConstants.QUERY_LIKE);
}
// 状态字段设置单选框
if (StringUtils.endsWithIgnoreCase(columnName, "status"))
{
if (StringUtils.endsWithIgnoreCase(columnName, "status")) {
column.setHtmlType(GenConstants.HTML_RADIO);
}
// 类型&性别字段设置下拉框
else if (StringUtils.endsWithIgnoreCase(columnName, "type")
|| StringUtils.endsWithIgnoreCase(columnName, "sex"))
{
|| StringUtils.endsWithIgnoreCase(columnName, "sex")) {
column.setHtmlType(GenConstants.HTML_SELECT);
}
// 图片字段设置图片上传控件
else if (StringUtils.endsWithIgnoreCase(columnName, "image"))
{
else if (StringUtils.endsWithIgnoreCase(columnName, "image")) {
column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD);
}
// 文件字段设置文件上传控件
else if (StringUtils.endsWithIgnoreCase(columnName, "file"))
{
else if (StringUtils.endsWithIgnoreCase(columnName, "file")) {
column.setHtmlType(GenConstants.HTML_FILE_UPLOAD);
}
// 内容字段设置富文本控件
else if (StringUtils.endsWithIgnoreCase(columnName, "content"))
{
else if (StringUtils.endsWithIgnoreCase(columnName, "content")) {
column.setHtmlType(GenConstants.HTML_EDITOR);
}
}

/**
* 校验数组是否包含指定值
*
* @param arr 数组
*
* @param arr 数组
* @param targetValue 值
* @return 是否包含
*/
public static boolean arraysContains(String[] arr, String targetValue)
{
public static boolean arraysContains(String[] arr, String targetValue) {
return Arrays.asList(arr).contains(targetValue);
}

/**
* 获取模块名
*
*
* @param packageName 包名
* @return 模块名
*/
public static String getModuleName(String packageName)
{
public static String getModuleName(String packageName) {
int lastIndex = packageName.lastIndexOf(".");
int nameLength = packageName.length();
return StringUtils.substring(packageName, lastIndex + 1, nameLength);
@@ -157,12 +145,11 @@ public class GenUtils

/**
* 获取业务名
*
*
* @param tableName 表名
* @return 业务名
*/
public static String getBusinessName(String tableName)
{
public static String getBusinessName(String tableName) {
int lastIndex = tableName.lastIndexOf("_");
int nameLength = tableName.length();
return StringUtils.substring(tableName, lastIndex + 1, nameLength);
@@ -170,16 +157,14 @@ public class GenUtils

/**
* 表名转换成Java类名
*
*
* @param tableName 表名称
* @return 类名
*/
public static String convertClassName(String tableName)
{
public static String convertClassName(String tableName) {
boolean autoRemovePre = GenConfig.getAutoRemovePre();
String tablePrefix = GenConfig.getTablePrefix();
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix))
{
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) {
String[] searchList = StringUtils.split(tablePrefix, ",");
tableName = replaceFirst(tableName, searchList);
}
@@ -188,18 +173,15 @@ public class GenUtils

/**
* 批量替换前缀
*
*
* @param replacementm 替换值
* @param searchList 替换列表
* @param searchList 替换列表
* @return
*/
public static String replaceFirst(String replacementm, String[] searchList)
{
public static String replaceFirst(String replacementm, String[] searchList) {
String text = replacementm;
for (String searchString : searchList)
{
if (replacementm.startsWith(searchString))
{
for (String searchString : searchList) {
if (replacementm.startsWith(searchString)) {
text = replacementm.replaceFirst(searchString, "");
break;
}
@@ -209,48 +191,39 @@ public class GenUtils

/**
* 关键字替换
*
*
* @param text 需要被替换的名字
* @return 替换后的名字
*/
public static String replaceText(String text)
{
public static String replaceText(String text) {
return RegExUtils.replaceAll(text, "(?:表|智慧物流数据中心)", "");
}

/**
* 获取数据库类型字段
*
*
* @param columnType 列类型
* @return 截取后的列类型
*/
public static String getDbType(String columnType)
{
if (StringUtils.indexOf(columnType, "(") > 0)
{
public static String getDbType(String columnType) {
if (StringUtils.indexOf(columnType, "(") > 0) {
return StringUtils.substringBefore(columnType, "(");
}
else
{
} else {
return columnType;
}
}

/**
* 获取字段长度
*
*
* @param columnType 列类型
* @return 截取后的列类型
*/
public static Integer getColumnLength(String columnType)
{
if (StringUtils.indexOf(columnType, "(") > 0)
{
public static Integer getColumnLength(String columnType) {
if (StringUtils.indexOf(columnType, "(") > 0) {
String length = StringUtils.substringBetween(columnType, "(", ")");
return Integer.valueOf(length);
}
else
{
} else {
return 0;
}
}


+ 4
- 4
ruoyi-generator/src/main/resources/generator.yml View File

@@ -1,10 +1,10 @@
# 代码生成
gen:
gen:
# 作者
author: ruoyi
author: LiuChengRan
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: com.ruoyi.business
# 自动去除表前缀,默认是false
autoRemovePre: false
autoRemovePre: true
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix: sys_
tablePrefix: sys_,ct_

+ 9
- 9
ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml View File

@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.generator.mapper.GenTableColumnMapper">
<resultMap type="GenTableColumn" id="GenTableColumnResult">
<id property="columnId" column="column_id" />
<result property="tableId" column="table_id" />
@@ -28,23 +28,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectGenTableColumnVo">
select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column
</sql>
<select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult">
<include refid="selectGenTableColumnVo"/>
where table_id = #{tableId}
order by sort
</select>
<select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
order by ordinal_position
</select>
<insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId">
insert into gen_table_column (
<if test="tableId != null and tableId != ''">table_id,</if>
@@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sysdate()
)
</insert>
<update id="updateGenTableColumn" parameterType="GenTableColumn">
update gen_table_column
<set>
@@ -111,14 +111,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>

<delete id="deleteGenTableColumnByIds" parameterType="Long">
delete from gen_table_column where table_id in
delete from gen_table_column where table_id in
<foreach collection="array" item="tableId" open="(" separator="," close=")">
#{tableId}
</foreach>
</delete>
<delete id="deleteGenTableColumns">
delete from gen_table_column where column_id in
delete from gen_table_column where column_id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.columnId}
</foreach>


+ 1
- 0
ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml View File

@@ -73,6 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
order by create_time desc
</select>

<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">


+ 22
- 11
ruoyi-generator/src/main/resources/vm/java/controller.java.vm View File

@@ -2,6 +2,11 @@ package ${packageName}.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -19,7 +24,6 @@ import com.ruoyi.common.enums.BusinessType;
import ${packageName}.domain.${ClassName};
import ${packageName}.service.I${ClassName}Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
import java.util.Arrays;
#if($table.crud || $table.sub)
import com.ruoyi.common.core.page.TableDataInfo;
#elseif($table.tree)
@@ -27,10 +31,11 @@ import com.ruoyi.common.core.page.TableDataInfo;

/**
* ${functionName}Controller
*
*
* @author ${author}
* @date ${datetime}
*/
@Api(tags = "${functionName}接口")
@RestController
@RequestMapping("/${moduleName}/${businessName}")
public class ${ClassName}Controller extends BaseController
@@ -41,19 +46,20 @@ public class ${ClassName}Controller extends BaseController
/**
* 查询${functionName}列表
*/
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
@ApiOperation(value="查询${functionName}列表", httpMethod = "GET", response = ${ClassName}.class)
@GetMapping("/list")
#if($table.crud || $table.sub)
public TableDataInfo list(${ClassName} ${className})
{
startPage();
List<${ClassName}> list = ${className}Service.list();
List<${ClassName}> list = ${className}Service.list(${className});
return getDataTable(list);
}
#elseif($table.tree)
public AjaxResult list(${ClassName} ${className})
{
List<${ClassName}> list = ${className}Service.list();
List<${ClassName}> list = ${className}Service.list(${className});
return success(list);
}
#end
@@ -61,12 +67,13 @@ public class ${ClassName}Controller extends BaseController
/**
* 导出${functionName}列表
*/
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
@ApiOperation(value="导出${functionName}列表", httpMethod = "POST")
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ${ClassName} ${className})
{
List<${ClassName}> list = ${className}Service.list();
List<${ClassName}> list = ${className}Service.list(${className});
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
util.exportExcel(response, list, "${functionName}数据");
}
@@ -74,7 +81,8 @@ public class ${ClassName}Controller extends BaseController
/**
* 获取${functionName}详细信息
*/
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
@ApiOperation(value="获取${functionName}详细信息", httpMethod = "GET", response = ${ClassName}.class)
@GetMapping(value = "/{${pkColumn.javaField}}")
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
{
@@ -84,7 +92,8 @@ public class ${ClassName}Controller extends BaseController
/**
* 新增${functionName}
*/
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')")
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')")
@ApiOperation(value="新增${functionName}", httpMethod = "POST")
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ${ClassName} ${className})
@@ -95,7 +104,8 @@ public class ${ClassName}Controller extends BaseController
/**
* 修改${functionName}
*/
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')")
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')")
@ApiOperation(value="修改${functionName}", httpMethod = "PUT")
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ${ClassName} ${className})
@@ -106,7 +116,8 @@ public class ${ClassName}Controller extends BaseController
/**
* 删除${functionName}
*/
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
@ApiOperation(value="删除${functionName}", httpMethod = "DELETE")
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
@DeleteMapping("/{${pkColumn.javaField}s}")
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)


+ 67
- 34
ruoyi-generator/src/main/resources/vm/java/domain.java.vm View File

@@ -3,20 +3,31 @@ package ${packageName}.domain;
#foreach ($import in $importList)
import ${import};
#end
import lombok.Data;
import com.baomidou.mybatisplus.annotation.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import java.util.ArrayList;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
#if($table.crud || $table.sub)
import com.ruoyi.common.core.domain.BaseEntity;
#elseif($table.tree)
import com.ruoyi.common.core.domain.TreeEntity;


#end

/**
* ${functionName}对象 ${tableName}
*
*
* @author ${author}
* @date ${datetime}
*/
@@ -26,14 +37,19 @@ import com.ruoyi.common.core.domain.TreeEntity;
#set($Entity="TreeEntity")
#end
@Data
public class ${ClassName} extends ${Entity}
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="${ClassName}",description = "${functionName}")
@TableName(value = "${tableName}")
public class ${ClassName} extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;

#foreach ($column in $columns)

#if(!$table.isSuperColumn($column.javaField))
/** $column.columnComment */
#if($column.list)
#set($parentheseIndex=$column.columnComment.indexOf("("))
#if($parentheseIndex != -1)
@@ -41,31 +57,48 @@ public class ${ClassName} extends ${Entity}
#else
#set($comment=$column.columnComment)
#end
#if($parentheseIndex != -1)
#if($column.javaField == 'id' || $column.javaField == 'deleted')

#elseif($parentheseIndex != -1)

/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
#elseif($column.javaType == 'Date')

/** $column.columnComment */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
#else
/** $column.columnComment */
@Excel(name = "${comment}")
#end
#end
#if($column.isPk == 1)
## @TableId(type = IdType.AUTO)
## @ApiModelProperty(name="$column.javaField",value = "${comment}")
## private $column.javaType $column.javaField;
#elseif($column.javaField == 'uuid' || $column.javaField == 'deleted')
## @ApiModelProperty(name="$column.javaField",value = "${comment}")
## @TableField(fill = FieldFill.INSERT)
## private $column.javaType $column.javaField;
#else
@ApiModelProperty(name="$column.javaField",value = "${comment}")
private $column.javaType $column.javaField;

#end
#end
#end
#if($table.sub)
/** $table.subTable.functionName信息 */
private List<${subClassName}> ${subclassName}List = new ArrayList<${subClassName}>();
private List<${subClassName}> ${subclassName}List;

#end
###foreach ($column in $columns)
###if(!$table.isSuperColumn($column.javaField))
###if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
###set($AttrName=$column.javaField)
###else
###set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
###end
#foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField))
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
#set($AttrName=$column.javaField)
#else
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#end
## public void set${AttrName}($column.javaType $column.javaField)
## {
## this.$column.javaField = $column.javaField;
@@ -75,8 +108,8 @@ public class ${ClassName} extends ${Entity}
## {
## return $column.javaField;
## }
###end
###end
#end
#end

###if($table.sub)
## public List<${subClassName}> get${subClassName}List()
@@ -90,20 +123,20 @@ public class ${ClassName} extends ${Entity}
## }
##
###end
## @Override
## public String toString() {
## return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
###foreach ($column in $columns)
###if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
###set($AttrName=$column.javaField)
###else
###set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
###end
## .append("${column.javaField}", get${AttrName}())
###end
###if($table.sub)
## .append("${subclassName}List", get${subClassName}List())
###end
## .toString();
## }
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
#foreach ($column in $columns)
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
#set($AttrName=$column.javaField)
#else
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#end
.append("${column.javaField}", get${AttrName}())
#end
#if($table.sub)
.append("${subclassName}List", get${subClassName}List())
#end
.toString();
}
}

+ 74
- 1
ruoyi-generator/src/main/resources/vm/java/mapper.java.vm View File

@@ -13,7 +13,80 @@ import ${packageName}.domain.${subClassName};
* @author ${author}
* @date ${datetime}
*/
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}>
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}>
{
## /**
## * 查询${functionName}
## *
## * @param ${pkColumn.javaField} ${functionName}主键
## * @return ${functionName}
## */
## public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});

/**
* 查询${functionName}列表
*
* @param ${className} ${functionName}
* @return ${functionName}集合
*/
List<${ClassName}> select${ClassName}List(${ClassName} ${className});

## /**
## * 新增${functionName}
## *
## * @param ${className} ${functionName}
## * @return 结果
## */
## public int insert${ClassName}(${ClassName} ${className});
##
## /**
## * 修改${functionName}
## *
## * @param ${className} ${functionName}
## * @return 结果
## */
## public int update${ClassName}(${ClassName} ${className});
##
## /**
## * 删除${functionName}
## *
## * @param ${pkColumn.javaField} ${functionName}主键
## * @return 结果
## */
## public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
##
## /**
## * 批量删除${functionName}
## *
## * @param ${pkColumn.javaField}s 需要删除的数据主键集合
## * @return 结果
## */
## public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
###if($table.sub)
##
## /**
## * 批量删除${subTable.functionName}
## *
## * @param ${pkColumn.javaField}s 需要删除的数据主键集合
## * @return 结果
## */
## public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
##
## /**
## * 批量新增${subTable.functionName}
## *
## * @param ${subclassName}List ${subTable.functionName}列表
## * @return 结果
## */
## public int batch${subClassName}(List<${subClassName}> ${subclassName}List);
##
##
## /**
## * 通过${functionName}主键删除${subTable.functionName}信息
## *
## * @param ${pkColumn.javaField} ${functionName}ID
## * @return 结果
## */
## public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
###end
}

+ 47
- 0
ruoyi-generator/src/main/resources/vm/java/service.java.vm View File

@@ -3,6 +3,7 @@ package ${packageName}.service;
import java.util.List;
import ${packageName}.domain.${ClassName};
import com.baomidou.mybatisplus.extension.service.IService;

/**
* ${functionName}Service接口
*
@@ -11,5 +12,51 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface I${ClassName}Service extends IService<${ClassName}>
{
## /**
## * 查询${functionName}
## *
## * @param ${pkColumn.javaField} ${functionName}主键
## * @return ${functionName}
## */
## public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});

/**
* 查询${functionName}列表
*
* @param ${className} ${functionName}
* @return ${functionName}集合
*/
List<${ClassName}> list(${ClassName} ${className});

## /**
## * 新增${functionName}
## *
## * @param ${className} ${functionName}
## * @return 结果
## */
## public int insert${ClassName}(${ClassName} ${className});
##
## /**
## * 修改${functionName}
## *
## * @param ${className} ${functionName}
## * @return 结果
## */
## public int update${ClassName}(${ClassName} ${className});
##
## /**
## * 批量删除${functionName}
## *
## * @param ${pkColumn.javaField}s 需要删除的${functionName}主键集合
## * @return 结果
## */
## public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
##
## /**
## * 删除${functionName}信息
## *
## * @param ${pkColumn.javaField} ${functionName}主键
## * @return 结果
## */
## public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
}

+ 138
- 3
ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm View File

@@ -18,8 +18,6 @@ import ${packageName}.domain.${subClassName};
import ${packageName}.mapper.${ClassName}Mapper;
import ${packageName}.domain.${ClassName};
import ${packageName}.service.I${ClassName}Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
@@ -29,7 +27,144 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
* @date ${datetime}
*/
@Service
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements I${ClassName}Service
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements I${ClassName}Service
{
## @Autowired
## private ${ClassName}Mapper ${className}Mapper;

## /**
## * 查询${functionName}
## *
## * @param ${pkColumn.javaField} ${functionName}主键
## * @return ${functionName}
## */
## @Override
## public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
## {
## return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
## }

/**
* 查询${functionName}列表
*
* @param ${className} ${functionName}
* @return ${functionName}
*/
@Override
public List<${ClassName}> list(${ClassName} ${className})
{
return baseMapper.select${ClassName}List(${className});
}
##
## /**
## * 新增${functionName}
## *
## * @param ${className} ${functionName}
## * @return 结果
## */
###if($table.sub)
## @Transactional
###end
## @Override
## public int insert${ClassName}(${ClassName} ${className})
## {
###foreach ($column in $columns)
###if($column.javaField == 'createTime')
## ${className}.setCreateTime(DateUtils.getNowDate());
###end
###end
###if($table.sub)
## int rows = ${className}Mapper.insert${ClassName}(${className});
## insert${subClassName}(${className});
## return rows;
###else
## return ${className}Mapper.insert${ClassName}(${className});
###end
## }
##
## /**
## * 修改${functionName}
## *
## * @param ${className} ${functionName}
## * @return 结果
## */
###if($table.sub)
## @Transactional
###end
## @Override
## public int update${ClassName}(${ClassName} ${className})
## {
###foreach ($column in $columns)
###if($column.javaField == 'updateTime')
## ${className}.setUpdateTime(DateUtils.getNowDate());
###end
###end
###if($table.sub)
## ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}());
## insert${subClassName}(${className});
###end
## return ${className}Mapper.update${ClassName}(${className});
## }
##
## /**
## * 批量删除${functionName}
## *
## * @param ${pkColumn.javaField}s 需要删除的${functionName}主键
## * @return 结果
## */
###if($table.sub)
## @Transactional
###end
## @Override
## public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s)
## {
###if($table.sub)
## ${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s);
###end
## return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s);
## }
##
## /**
## * 删除${functionName}信息
## *
## * @param ${pkColumn.javaField} ${functionName}主键
## * @return 结果
## */
###if($table.sub)
## @Transactional
###end
## @Override
## public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
## {
###if($table.sub)
## ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField});
###end
## return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
## }
###if($table.sub)
##
## /**
## * 新增${subTable.functionName}信息
## *
## * @param ${className} ${functionName}对象
## */
## public void insert${subClassName}(${ClassName} ${className})
## {
## List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List();
## ${pkColumn.javaType} ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}();
## if (StringUtils.isNotNull(${subclassName}List))
## {
## List<${subClassName}> list = new ArrayList<${subClassName}>();
## for (${subClassName} ${subclassName} : ${subclassName}List)
## {
## ${subclassName}.set${subTableFkClassName}(${pkColumn.javaField});
## list.add(${subclassName});
## }
## if (list.size() > 0)
## {
## ${className}Mapper.batch${subClassName}(list);
## }
## }
## }
###end
}

+ 34
- 18
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm View File

@@ -1,6 +1,6 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
#foreach($column in $columns)
#if($column.query)
#set($dictType=$column.dictType)
@@ -114,7 +114,12 @@
</el-row>

<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="selection" width="55" align="center" fixed="left" />
<el-table-column label="序号" width="55" align="center" fixed="left" >
<template slot-scope="scope">
{{ scope.$index + 1 }}
</template>
</el-table-column>
#foreach($column in $columns)
#set($javaField=$column.javaField)
#set($parentheseIndex=$column.columnComment.indexOf("("))
@@ -123,27 +128,34 @@
#else
#set($comment=$column.columnComment)
#end
#if($column.pk)
#if($column.pk || ($column.list && ${javaField} == "uuid"))
## <el-table-column label="${comment}" align="center" prop="${javaField}" />
<el-table-column label="序列" align="center">
<template slot-scope="scope">
{{ scope.$index + 1 }}
</template>
</el-table-column>
#elseif($column.list && $column.htmlType == "datetime")
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
#elseif($column.list && (${javaField} == "createTime" || ${javaField} == "updateTime"))
<el-table-column label="${comment}" align="center" fixed="right" prop="${javaField}" width="100">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
#elseif($column.list && ${javaField} == "remark")
<el-table-column label="${comment}" align="center" prop="${javaField}"/>
#elseif($column.list && (${javaField} == "createBy" || ${javaField} == "updateBy"))
<el-table-column label="${comment}" align="center" fixed="right" prop="${javaField}" width="100"/>
#elseif($column.list && $column.htmlType == "imageUpload")
<el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.${javaField}" :width="50" :height="50"/>
</template>
</el-table-column>
#elseif($column.list && "image" == $column.htmlType)
<el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
<template slot-scope="scope">
<el-image :src="scope.row.${javaField}"
:preview-src-list="[item]" >
</el-image>
</template>
</el-table-column>
#elseif($column.list && "" != $column.dictType)
<el-table-column label="${comment}" align="center" prop="${javaField}">
<el-table-column label="${comment}" align="center" prop="${javaField}" width="100">
<template slot-scope="scope">
#if($column.htmlType == "checkbox")
<dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
@@ -153,10 +165,10 @@
</template>
</el-table-column>
#elseif($column.list && "" != $javaField)
<el-table-column label="${comment}" align="center" prop="${javaField}" />
<el-table-column label="${comment}" align="center" prop="${javaField}" width="100"/>
#end
#end
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" width="150" fixed="right" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
@@ -185,8 +197,8 @@
/>

<!-- 添加或修改${functionName}对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
#foreach($column in $columns)
#set($field=$column.javaField)
#if($column.insert && !$column.pk)
@@ -300,8 +312,12 @@
</el-col>
</el-row>
<el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column type="selection" width="50" align="center" fixed="left" />
<el-table-column label="序号" align="center" prop="index" width="50" fixed="left">
<template slot-scope="scope">
{{ scope.$index + 1 }}
</template>
</el-table-column>
#foreach($column in $subTable.columns)
#set($javaField=$column.javaField)
#set($parentheseIndex=$column.columnComment.indexOf("("))
@@ -380,7 +396,7 @@ export default {
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
showSearch: false,
// 总条数
total: 0,
// ${functionName}表格数据


+ 0
- 5
ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm View File

@@ -119,11 +119,6 @@
#set($comment=$column.columnComment)
#end
#if($column.pk)
<el-table-column label="序列" align="center" >
<template slot-scope="scope">
{{ scope.$index+1 }}
</template>
</el-table-column>
<el-table-column label="${comment}" align="center" prop="${javaField}" />
#elseif($column.list && $column.htmlType == "datetime")
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180">


+ 85
- 79
ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm View File

@@ -3,9 +3,10 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${packageName}.mapper.${ClassName}Mapper">
<!--${functionName}对象 ${tableName}-->
<resultMap type="${ClassName}" id="${ClassName}Result">
#foreach ($column in $columns)
<!-- $column.columnComment -->
<result property="${column.javaField}" column="${column.columnName}" />
#end
</resultMap>
@@ -23,12 +24,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#end

<sql id="select${ClassName}Vo">
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName}
select
#foreach($column in $columns)
$column.columnName#if($foreach.count != $columns.size()),<!-- $column.columnComment -->
#end#end
</sql>

<select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result">
<include refid="select${ClassName}Vo"/>
<where>
from ${tableName}
<where>
deleted = 0
#foreach($column in $columns)
#set($queryType=$column.queryType)
#set($javaField=$column.javaField)
@@ -49,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#elseif($queryType == "LTE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &lt;= #{$javaField}</if>
#elseif($queryType == "LIKE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if>
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat(#{$javaField}, '%')</if>
#elseif($queryType == "BETWEEN")
<if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if>
#end
@@ -57,79 +63,79 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#end
</where>
</select>
<select id="select${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end">
#if($table.crud || $table.tree)
<include refid="select${ClassName}Vo"/>
where ${pkColumn.columnName} = #{${pkColumn.javaField}}
#elseif($table.sub)
select#foreach($column in $columns) a.$column.columnName#if($foreach.count != $columns.size()),#end#end,
#foreach($column in $subTable.columns) b.$column.columnName as sub_$column.columnName#if($foreach.count != $subTable.columns.size()),#end#end
from ${tableName} a
left join ${subTableName} b on b.${subTableFkName} = a.${pkColumn.columnName}
where a.${pkColumn.columnName} = #{${pkColumn.javaField}}
#end
</select>
<insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
insert into ${tableName}
<trim prefix="(" suffix=")" suffixOverrides=",">
#foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if>
#end
#end
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if>
#end
#end
</trim>
</insert>
<update id="update${ClassName}" parameterType="${ClassName}">
update ${tableName}
<trim prefix="SET" suffixOverrides=",">
#foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName)
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if>
#end
#end
</trim>
where ${pkColumn.columnName} = #{${pkColumn.javaField}}
</update>
<delete id="delete${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}">
delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}}
</delete>
<delete id="delete${ClassName}By${pkColumn.capJavaField}s" parameterType="String">
delete from ${tableName} where ${pkColumn.columnName} in
<foreach item="${pkColumn.javaField}" collection="array" open="(" separator="," close=")">
#{${pkColumn.javaField}}
</foreach>
</delete>
#if($table.sub)
<delete id="delete${subClassName}By${subTableFkClassName}s" parameterType="String">
delete from ${subTableName} where ${subTableFkName} in
<foreach item="${subTableFkclassName}" collection="array" open="(" separator="," close=")">
#{${subTableFkclassName}}
</foreach>
</delete>
<delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}">
delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}}
</delete>
<insert id="batch${subClassName}">
insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values
<foreach item="item" index="index" collection="list" separator=",">
(#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end)
</foreach>
</insert>
#end
##
## <select id="select${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end">
###if($table.crud || $table.tree)
## <include refid="select${ClassName}Vo"/>
## where ${pkColumn.columnName} = #{${pkColumn.javaField}}
###elseif($table.sub)
## select#foreach($column in $columns) a.$column.columnName#if($foreach.count != $columns.size()),#end#end,
## #foreach($column in $subTable.columns) b.$column.columnName as sub_$column.columnName#if($foreach.count != $subTable.columns.size()),#end#end
##
## from ${tableName} a
## left join ${subTableName} b on b.${subTableFkName} = a.${pkColumn.columnName}
## where a.${pkColumn.columnName} = #{${pkColumn.javaField}}
###end
## </select>
##
## <insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
## insert into ${tableName}
## <trim prefix="(" suffix=")" suffixOverrides=",">
###foreach($column in $columns)
###if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
## <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if>
###end
###end
## </trim>
## <trim prefix="values (" suffix=")" suffixOverrides=",">
###foreach($column in $columns)
###if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
## <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if>
###end
###end
## </trim>
## </insert>
##
## <update id="update${ClassName}" parameterType="${ClassName}">
## update ${tableName}
## <trim prefix="SET" suffixOverrides=",">
###foreach($column in $columns)
###if($column.columnName != $pkColumn.columnName)
## <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if>
###end
###end
## </trim>
## where ${pkColumn.columnName} = #{${pkColumn.javaField}}
## </update>
##
## <delete id="delete${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}">
## delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}}
## </delete>
##
## <delete id="delete${ClassName}By${pkColumn.capJavaField}s" parameterType="String">
## delete from ${tableName} where ${pkColumn.columnName} in
## <foreach item="${pkColumn.javaField}" collection="array" open="(" separator="," close=")">
## #{${pkColumn.javaField}}
## </foreach>
## </delete>
###if($table.sub)
##
## <delete id="delete${subClassName}By${subTableFkClassName}s" parameterType="String">
## delete from ${subTableName} where ${subTableFkName} in
## <foreach item="${subTableFkclassName}" collection="array" open="(" separator="," close=")">
## #{${subTableFkclassName}}
## </foreach>
## </delete>
##
## <delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}">
## delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}}
## </delete>
##
## <insert id="batch${subClassName}">
## insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values
## <foreach item="item" index="index" collection="list" separator=",">
## (#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end)
## </foreach>
## </insert>
###end
</mapper>

+ 6
- 0
ruoyi-quartz/pom.xml View File

@@ -35,6 +35,12 @@
<artifactId>ruoyi-common</artifactId>
</dependency>

<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-business</artifactId>
</dependency>

</dependencies>

</project>

+ 58
- 12
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java View File

@@ -1,28 +1,74 @@
package com.ruoyi.quartz.task;

import com.ruoyi.business.domain.ApplyPlan;
import com.ruoyi.business.domain.bo.JobQueryBO;
import com.ruoyi.business.service.IApplyPlanService;
import com.ruoyi.common.enums.ExcTypeStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.ruoyi.common.utils.StringUtils;

/**
* 定时任务调度测试
*
*
* @author #author#
*/
@Component("ryTask")
public class RyTask
{
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
{
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
@Slf4j
public class RyTask {
@Autowired
private IApplyPlanService applyPlanService;

public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
log.debug(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
}

public void ryParams(String params) {
log.debug("执行有参方法:" + params);
}

public void ryParams(String params)
{
System.out.println("执行有参方法:" + params);
public void ryNoParams() {
log.debug("执行无参方法");
}

public void ryNoParams()
{
System.out.println("执行无参方法");
/**
* 按优先级执行立即执行的计划任务
*/
public void runAppNow() throws IllegalAccessException {
log.debug("执行顺序启动应用开始");
applyPlanService.execPlan(null);
log.debug("执行顺序启动应用结束");
}

/**
* 指定时间执行一次
*/
public void runAppBySetTime() throws IllegalAccessException {
log.debug("指定时间执行一次开始");
applyPlanService.runAppBySetTime();
log.debug("指定时间执行一次结束");
}


/**
* 表达式执行
*/
public void runAppByCron() throws IllegalAccessException {
log.debug("表达式执行开始");
applyPlanService.runAppByCron();
log.debug("表达式执行开始");
}

/**
* 获取应用执行结果
*/
public void getAppRunResult() throws IllegalAccessException {
log.debug("更新应用执行结果开始");
applyPlanService.queryAppStartResult();
log.debug("更新应用执行结果结束");
}



}

+ 6
- 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java View File

@@ -17,6 +17,12 @@ public interface SysDeptMapper
* @param dept 部门信息
* @return 部门信息集合
*/
public List<SysDept> selectDeptAllList(SysDept dept); /**
* 查询部门管理数据
*
* @param dept 部门信息
* @return 部门信息集合
*/
public List<SysDept> selectDeptList(SysDept dept);

/**


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

Loading…
Cancel
Save