소스 검색

功能提交

pull/4/head
lcr 5 달 전
부모
커밋
c6e10d635d
39개의 변경된 파일1784개의 추가작업 그리고 86개의 파일을 삭제
  1. +6
    -0
      ruoyi-business/pom.xml
  2. +11
    -1
      ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyController.java
  3. +113
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyPlanController.java
  4. +110
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyPlanLogController.java
  5. +14
    -1
      ruoyi-business/src/main/java/com/ruoyi/business/controller/RebotController.java
  6. +9
    -3
      ruoyi-business/src/main/java/com/ruoyi/business/domain/Apply.java
  7. +145
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/ApplyPlan.java
  8. +142
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/ApplyPlanLog.java
  9. +1
    -1
      ruoyi-business/src/main/java/com/ruoyi/business/domain/Rebot.java
  10. +136
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/AddApplyPlanBO.java
  11. +97
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/ApplyStartBO.java
  12. +19
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/JobQueryBO.java
  13. +104
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/JobQueryVO.java
  14. +18
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/JobStartVO.java
  15. +24
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyPlanLogMapper.java
  16. +24
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyPlanMapper.java
  17. +24
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyPlanLogService.java
  18. +45
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyPlanService.java
  19. +17
    -2
      ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyService.java
  20. +1
    -1
      ruoyi-business/src/main/java/com/ruoyi/business/service/IRebotService.java
  21. +34
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanLogServiceImpl.java
  22. +139
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanServiceImpl.java
  23. +60
    -16
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyServiceImpl.java
  24. +9
    -8
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/RebotServiceImpl.java
  25. +70
    -14
      ruoyi-business/src/main/java/com/ruoyi/business/util/YinDaoHttpUtils.java
  26. +12
    -3
      ruoyi-business/src/main/java/com/ruoyi/business/yddoman/BaseDTO.java
  27. +32
    -21
      ruoyi-business/src/main/resources/mapper/business/ApplyMapper.xml
  28. +91
    -0
      ruoyi-business/src/main/resources/mapper/business/ApplyPlanLogMapper.xml
  29. +102
    -0
      ruoyi-business/src/main/resources/mapper/business/ApplyPlanMapper.xml
  30. +1
    -5
      ruoyi-business/src/main/resources/mapper/business/RebotMapper.xml
  31. +35
    -0
      ruoyi-common/src/main/java/com/ruoyi/common/enums/ExcTypeStatus.java
  32. +39
    -0
      ruoyi-common/src/main/java/com/ruoyi/common/enums/RebotStatus.java
  33. +30
    -0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/BeanToMapUtil.java
  34. +6
    -0
      ruoyi-quartz/pom.xml
  35. +21
    -9
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
  36. +6
    -0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
  37. +8
    -0
      ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
  38. +11
    -0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
  39. +18
    -1
      ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

+ 6
- 0
ruoyi-business/pom.xml 파일 보기

@@ -23,6 +23,12 @@
<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>


+ 11
- 1
ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyController.java 파일 보기

@@ -46,11 +46,21 @@ public class ApplyController extends BaseController {
*/
@ApiOperation(value = "同步应用数据", httpMethod = "POST", response = Rebot.class)
@PostMapping("/syn")
public AjaxResult syn(Apply apply) {
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.list(apply);
return AjaxResult.success(list);
}


/**
* 查询应用信息管理列表


+ 113
- 0
ruoyi-business/src/main/java/com/ruoyi/business/controller/ApplyPlanController.java 파일 보기

@@ -0,0 +1,113 @@
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.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 = "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 파일 보기

@@ -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)));
}
}

+ 14
- 1
ruoyi-business/src/main/java/com/ruoyi/business/controller/RebotController.java 파일 보기

@@ -4,6 +4,8 @@ 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;
@@ -45,11 +47,22 @@ public class RebotController extends BaseController {
*/
@ApiOperation(value = "同步机器人数据", httpMethod = "POST", response = Rebot.class)
@PostMapping("/syn")
public AjaxResult syn(Rebot rebot) {
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);
}

/**
* 查询机器人管理列表
*/


+ 9
- 3
ruoyi-business/src/main/java/com/ruoyi/business/domain/Apply.java 파일 보기

@@ -88,10 +88,16 @@ public class Apply extends BaseEntity
@Excel(name = "预计人工耗时")
@ApiModelProperty(name="manualTime",value = "预计人工耗时")
private String manualTime;
/** 所属公司 */
@Excel(name = "所属公司")
@ApiModelProperty(name="deptId",value = "所属公司")

/** 部门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)


+ 145
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/ApplyPlan.java 파일 보기

@@ -0,0 +1,145 @@
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="manualTime",value = "预计人工耗时")
private String manualTime;

/** 计划参数 */
@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;
/** 任务运行uuid */
@Excel(name = "任务运行uuid")
@ApiModelProperty(name="taskUuid",value = "任务运行uuid")
private String taskUuid;

@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 파일 보기

@@ -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();
}
}

+ 1
- 1
ruoyi-business/src/main/java/com/ruoyi/business/domain/Rebot.java 파일 보기

@@ -48,7 +48,7 @@ public class Rebot extends BaseEntity


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



+ 136
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/AddApplyPlanBO.java 파일 보기

@@ -0,0 +1,136 @@
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="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();
}
}

+ 97
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/bo/ApplyStartBO.java 파일 보기

@@ -0,0 +1,97 @@
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;

/**
* 指定的机器人名称
* <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
private 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 파일 보기

@@ -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;
}


+ 104
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/JobQueryVO.java 파일 보기

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

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

import java.util.Date;

/**
* 查询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 RobotParam robotParams;

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

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

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

}
}

+ 18
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/JobStartVO.java 파일 보기

@@ -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;
}

+ 24
- 0
ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyPlanLogMapper.java 파일 보기

@@ -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);

}

+ 24
- 0
ruoyi-business/src/main/java/com/ruoyi/business/mapper/ApplyPlanMapper.java 파일 보기

@@ -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.ApplyPlan;

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

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

}

+ 24
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyPlanLogService.java 파일 보기

@@ -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);

}

+ 45
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyPlanService.java 파일 보기

@@ -0,0 +1,45 @@
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;

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

/**
* 执行计划
* @param addApplyPlanBO
* @return
*/
boolean execPlan() throws IllegalAccessException;

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

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

}

+ 17
- 2
ruoyi-business/src/main/java/com/ruoyi/business/service/IApplyService.java 파일 보기

@@ -4,6 +4,11 @@ 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接口
@@ -14,10 +19,20 @@ import com.ruoyi.business.domain.Rebot;
public interface IApplyService extends IService<Apply>
{
/**
* 同步机器人数据
* 启动应用
* @return
*/
void syn(Apply apply);
JobStartVO appStart(ApplyStartBO applyStartBO) throws IllegalAccessException;
/**
* 查询应用运行结果
* @return
*/
JobQueryVO queryAppStartResult(JobQueryBO jobQueryBO) throws IllegalAccessException;
/**
* 同步应用数据
* @return
*/
void syn(Apply apply) throws IllegalAccessException;
/**
* 查询应用信息管理列表
*


+ 1
- 1
ruoyi-business/src/main/java/com/ruoyi/business/service/IRebotService.java 파일 보기

@@ -17,7 +17,7 @@ public interface IRebotService extends IService<Rebot>
* 同步机器人数据
* @return
*/
void syn(Rebot rebot);
void syn(Rebot rebot) throws IllegalAccessException;
/**
* 查询机器人管理列表
*


+ 34
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanLogServiceImpl.java 파일 보기

@@ -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);
}
}

+ 139
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanServiceImpl.java 파일 보기

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

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

import com.ruoyi.business.domain.Apply;
import com.ruoyi.business.domain.Rebot;
import com.ruoyi.business.domain.bo.AddApplyPlanBO;
import com.ruoyi.business.domain.bo.ApplyStartBO;
import com.ruoyi.business.domain.bo.ListApplyBO;
import com.ruoyi.business.domain.bo.ListRebotBO;
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.util.YinDaoHttpUtils;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.enums.ExcTypeStatus;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
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;

import static cn.hutool.json.XMLTokener.entity;

/**
* 应用执行计划管理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;

/**
* 执行计划(针对立即执行的计划)
*
* @return
*/
@Override
@Transactional
public boolean execPlan() throws IllegalAccessException {
ListRebotBO listRebotBO = new ListRebotBO();
listRebotBO.setStatus("idle");
listRebotBO.setPage(1);
listRebotBO.setSize(100);
// 只获取空闲的机器人
List<ListRebotVO> listRebotVOS = YinDaoHttpUtils.listRebot(listRebotBO);
if (listRebotVOS.isEmpty()) {
log.error("暂无空闲机器人");
// 刷新机器人数据
// rebotService.syn(new Rebot());
}
for (ListRebotVO listRebotVO : listRebotVOS) {
List<ApplyPlan> list = this.lambdaQuery().eq(ApplyPlan::getExcType, ExcTypeStatus.ONE.getKey()).isNull(ApplyPlan::getTaskUuid).orderByAsc(ApplyPlan::getPriority).list();
if (list.isEmpty()) {
log.debug("没有等待执行的计划");
break;
}
ApplyStartBO applyStartBO = new ApplyStartBO();
ApplyPlan applyPlan = list.get(0);
applyStartBO.setRobotUuid(applyPlan.getAppId());
applyStartBO.setAccountName(listRebotVO.getRobotClientName());
//high 高 middle 中 low 低
applyStartBO.setPriority("high");
JobStartVO jobStartVO = YinDaoHttpUtils.appStart(applyStartBO);
ApplyPlan updateApplyPlan = new ApplyPlan();
updateApplyPlan.setId(applyPlan.getId());
updateApplyPlan.setUpdateBy("-1");
updateApplyPlan.setUpdateTime(new Date());
updateApplyPlan.setTaskUuid(jobStartVO.getJobUuid());
this.updateById(updateApplyPlan);
}

return false;
}

@Override
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));
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.saveBatch(applyPlanList);
}

@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);
}
}

+ 60
- 16
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyServiceImpl.java 파일 보기

@@ -6,15 +6,21 @@ 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;
@@ -25,13 +31,37 @@ import org.springframework.transaction.annotation.Transactional;

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


/**
@@ -40,50 +70,64 @@ public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements
* @return
*/
@Override
@DataScope(deptAlias = "d", userAlias = "u")
@DataScope(deptAlias = "apply")
@Transactional
public void syn(Apply entity) {
public void syn(Apply entity) throws IllegalAccessException {
ListApplyBO listApplyBO = new ListApplyBO();
listApplyBO.setPage(1);
listApplyBO.setSize(10000);
// 影刀最大限制
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.getAppCreateTime());
newApply.setAppUpdateTime(listRebotVO.getAppUpdateTime());
newApply.setDeptId(SecurityUtils.getDeptId());
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();
Apply newApply = new Apply();
BeanUtils.copyBeanProp(newApply, listRebotVO);
newApply.setAppCreateTime(listRebotVO.getAppCreateTime());
newApply.setAppUpdateTime(listRebotVO.getAppUpdateTime());
newApply.setAppCreateTime(listRebotVO.getCreateTime());
newApply.setAppUpdateTime(listRebotVO.getUpdateTime());
newApply.setId(apply.getId());
newApply.setDeptId(SecurityUtils.getDeptId());
if(null != sysDepts){
newApply.setDeptId(sysDepts.get(0).getDeptId());
newApply.setDeptName(sysDepts.get(0).getDeptName());
}
updateById(newApply);
}
});
}

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

+ 9
- 8
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/RebotServiceImpl.java 파일 보기

@@ -9,7 +9,10 @@ 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;
@@ -25,27 +28,26 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Service
public class RebotServiceImpl extends ServiceImpl<RebotMapper, Rebot> implements IRebotService {


/**
* 同步机器人数据
*
* @return
*/
@Override
@DataScope(deptAlias = "d", userAlias = "u")
@Transactional
public void syn(Rebot entity) {
public void syn(Rebot entity) throws IllegalAccessException {
ListRebotBO listRebotBO = new ListRebotBO();
listRebotBO.setPage(1);
listRebotBO.setSize(10000);
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).eq(Rebot::getDeptId, SecurityUtils.getDeptId()));
// 删除不存在的机器人
this.remove(new LambdaUpdateWrapper<Rebot>().notIn(Rebot::getRobotClientName, clientNameList));

listRebotVoList.forEach(listRebotVO -> {
// 数据库里是否存在
List<Rebot> rebots = rebotMap.get(listRebotVO.getRobotClientName());
@@ -56,7 +58,6 @@ public class RebotServiceImpl extends ServiceImpl<RebotMapper, Rebot> implements
rebot.setRobotClientName(listRebotVO.getRobotClientName());
rebot.setWindowsAccount(listRebotVO.getWindowsAccount());
rebot.setClientIp(listRebotVO.getClientIp());
rebot.setDeptId(SecurityUtils.getDeptId());
save(rebot);
} else {
Rebot rebot = rebots.get(0);
@@ -65,7 +66,6 @@ public class RebotServiceImpl extends ServiceImpl<RebotMapper, Rebot> implements
rebot.setRobotClientName(listRebotVO.getRobotClientName());
rebot.setWindowsAccount(listRebotVO.getWindowsAccount());
rebot.setClientIp(listRebotVO.getClientIp());
rebot.setDeptId(SecurityUtils.getDeptId());
updateById(rebot);
}
});
@@ -78,6 +78,7 @@ public class RebotServiceImpl extends ServiceImpl<RebotMapper, Rebot> implements
* @return 机器人管理
*/
@Override
@DataScope(deptAlias = "d", userAlias = "u")
public List<Rebot> list(Rebot rebot) {
return baseMapper.selectRebotList(rebot);
}


+ 70
- 14
ruoyi-business/src/main/java/com/ruoyi/business/util/YinDaoHttpUtils.java 파일 보기

@@ -2,17 +2,23 @@ package com.ruoyi.business.util;

import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON;
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.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;
@@ -34,31 +40,81 @@ public class YinDaoHttpUtils {
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 QUERY_APP_START_RESULT = REQUEST_PREFIX + "/dispatch/v2/job/query";


/**
* 查询机器人列表
* 启动应用
*/
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 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 List<ListApplyVO> listApp(ListApplyBO ListApplyBO) {
Map<String, Object> data = new HashMap<>();
data.put("page", ListApplyBO.getPage().toString());
data.put("size", ListApplyBO.getSize().toString());
public static List<ListApplyVO> listApp(ListApplyBO ListApplyBO) throws IllegalAccessException {
Map<String, Object> data = BeanToMapUtil.convertEntityToMap(ListApplyBO);
BaseDTO baseDTO = sendPost(APP_LIST, data);
return JSON.parseArray(baseDTO.getData().toString(), ListApplyVO.class);
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) {
Map<String, Object> data = new HashMap<>();
data.put("page", listRebotBO.getPage().toString());
data.put("size", listRebotBO.getSize().toString());
// data.put("status", listRebotBO.getStatus());
// data.put("key", listRebotBO.getKey());
// data.put("robotClientUuid", "176befff-0dc4-4df1-badf-346305c28ae8");
public static List<ListRebotVO> listRebot(ListRebotBO listRebotBO) throws IllegalAccessException {
Map<String, Object> data = BeanToMapUtil.convertEntityToMap(listRebotBO);
BaseDTO baseDTO = sendGet(CLIENT_LIST, data);
return JSON.parseArray(baseDTO.getData().toString(), ListRebotVO.class);
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;
}




+ 12
- 3
ruoyi-business/src/main/java/com/ruoyi/business/yddoman/BaseDTO.java 파일 보기

@@ -4,16 +4,25 @@ import lombok.Data;

/**
* 影刀统一响应父类
*
*
* @author #author#
*/
@Data
public class BaseDTO
{
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;
}
}

+ 32
- 21
ruoyi-business/src/main/resources/mapper/business/ApplyMapper.xml 파일 보기

@@ -33,6 +33,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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" />
<!-- 创建时间 -->
@@ -49,30 +53,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"

<sql id="selectApplyVo">
select
id,<!-- 主键 -->
owner_name,<!-- 应用所有者名称 -->
owner_account,<!-- 应用所有者账号 -->
owner_id,<!-- 所有者id -->
app_id,<!-- appid -->
app_name,<!-- 应用名称 -->
app_type_name,<!-- 应用类型名称 -->
app_type,<!-- 应用类型枚举(app:应用 activity:指令) -->
app_create_time,<!-- 应用创建时间 -->
app_update_time,<!-- 应用修改时间 -->
version,<!-- 版本,值内容:未发版、版本 -->
support_param,<!-- 是否支持应用参数 -->
icon,<!-- icon图下载地址 -->
manual_time,<!-- 预计人工耗时 -->
create_by,<!-- 创建者 -->
create_time,<!-- 创建时间 -->
update_by,<!-- 更新者 -->
update_time,<!-- 更新时间 -->
remark,<!-- 备注 -->
deleted </sql>
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
from ct_apply apply
<where>
deleted = 0
<if test="ownerName != null and ownerName != ''"> and owner_name like concat(#{ownerName}, '%')</if>
@@ -81,6 +88,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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>
</mapper>

+ 91
- 0
ruoyi-business/src/main/resources/mapper/business/ApplyPlanLogMapper.xml 파일 보기

@@ -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>

+ 102
- 0
ruoyi-business/src/main/resources/mapper/business/ApplyPlanMapper.xml 파일 보기

@@ -0,0 +1,102 @@
<?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="manualTime" column="manual_time"/>
<!-- 计划参数 -->
<result property="planParams" column="plan_params"/>
<!-- 等待超时时间 -->
<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"/>
<!-- 任务运行uuid -->
<result property="taskUuid" column="task_uuid" />
<!-- 创建者 -->
<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.manual_time,<!-- 预计人工耗时 -->
plan.plan_params,<!-- 计划参数 -->
plan.wait_timeout,<!-- 等待超时时间 -->
plan.priority,<!-- 优先级 -->
plan.exc_type,<!-- 执行类型(0立即执行 1指定时间执行 2周期执行) -->
plan.exc_time,<!-- 执行时间 -->
plan.cron_expression,<!-- 执行表达式 -->
plan.task_uuid,<!-- 任务运行uuid -->
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="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="taskUuid != null and taskUuid != ''"> and task_uuid = #{taskUuid}</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
</mapper>

+ 1
- 5
ruoyi-business/src/main/resources/mapper/business/RebotMapper.xml 파일 보기

@@ -57,19 +57,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRebotList" parameterType="Rebot" resultMap="RebotResult">
<include refid="selectRebotVo"/>
from ct_rebot rebot
left JOIN sys_user u ON rebot.create_by = u.user_name
left join sys_dept d on u.dept_id = d.dept_id
<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 status = #{status}</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>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
</mapper>

+ 35
- 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/ExcTypeStatus.java 파일 보기

@@ -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;
}
}

+ 39
- 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/RebotStatus.java 파일 보기

@@ -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;
}
}

+ 30
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/BeanToMapUtil.java 파일 보기

@@ -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;
}
}

+ 6
- 0
ruoyi-quartz/pom.xml 파일 보기

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

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

</dependencies>

</project>

+ 21
- 9
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java 파일 보기

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

import com.ruoyi.business.domain.ApplyPlan;
import com.ruoyi.business.service.IApplyPlanService;
import com.ruoyi.common.enums.ExcTypeStatus;
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)
{
public class RyTask {
@Autowired
private IApplyPlanService applyPlanService;

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

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

public void ryNoParams()
{
public void ryNoParams() {
System.out.println("执行无参方法");
}

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

+ 6
- 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java 파일 보기

@@ -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);

/**


+ 8
- 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java 파일 보기

@@ -11,6 +11,14 @@ import com.ruoyi.common.core.domain.entity.SysDept;
*/
public interface ISysDeptService
{

/**
* 查询部门管理数据
*
* @param dept 部门信息
* @return 部门信息集合
*/
public List<SysDept> selectDeptAllList(SysDept dept);
/**
* 查询部门管理数据
*


+ 11
- 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java 파일 보기

@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
@@ -34,6 +35,16 @@ public class SysDeptServiceImpl implements ISysDeptService

@Autowired
private SysRoleMapper roleMapper;
/**
* 查询部门管理数据
*
* @param dept 部门信息
* @return 部门信息集合
*/
@Override
public List<SysDept> selectDeptAllList(SysDept dept) {
return deptMapper.selectDeptAllList(dept);
}

/**
* 查询部门管理数据


+ 18
- 1
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml 파일 보기

@@ -26,7 +26,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
from sys_dept d
</sql>

<select id="selectDeptAllList" parameterType="SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</select>

<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'


불러오는 중...
취소
저장