|
|
@@ -10,12 +10,14 @@ import com.alibaba.fastjson2.JSON; |
|
|
|
import com.alibaba.fastjson2.JSONArray; |
|
|
|
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.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.common.annotation.DataScope; |
|
|
|
import com.ruoyi.common.enums.ExcTypeStatus; |
|
|
@@ -48,6 +50,9 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
@Autowired |
|
|
|
private IRebotService rebotService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IResourceLibraryService resourceLibraryService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 指定时间执行 |
|
|
@@ -57,6 +62,11 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
@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); |
|
|
@@ -69,7 +79,6 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
// rebotService.syn(new Rebot()); |
|
|
|
return false; |
|
|
|
} |
|
|
|
List<ApplyPlan> applyPlanList = this.lambdaQuery().eq(ApplyPlan::getExcType, ExcTypeStatus.TWO.getKey()).isNull(ApplyPlan::getTaskUuid).orderByAsc(ApplyPlan::getExcTime).list(); |
|
|
|
listRebotVos.forEach(rebot -> { |
|
|
|
applyPlanList.forEach(e -> { |
|
|
|
if (e.getExcTime().getTime() <= System.currentTimeMillis() && PlanRunStatus.AWAIT_CREATE.getKey().equals(e.getTaskStatus())) { |
|
|
@@ -79,12 +88,20 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
applyStartBO.setManualTime(e.getManualTime()); |
|
|
|
//high 高 middle 中 low 低 |
|
|
|
applyStartBO.setPriority("high"); |
|
|
|
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); |
|
|
|
// 如果应用支持参数 |
|
|
|
if (!Objects.isNull(e.getSupportParam()) && e.getSupportParam() == 1) { |
|
|
|
// 获取参数 |
|
|
|
List<ApplyStartBO.RobotParam> paramList = resourceLibraryService.lambdaQuery().eq(ResourceLibrary::getAppId, applyStartBO.getRobotUuid()).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()) { |
|
|
|
applyStartBO.setPlanParamsList(paramList); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
JobStartVO jobStartVO = YinDaoHttpUtils.appStart(applyStartBO); |
|
|
@@ -96,10 +113,10 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
applyPlan.setTaskStatus(PlanRunStatus.CREATED.getKey()); |
|
|
|
this.updateById(applyPlan); |
|
|
|
Rebot updateRebot = new Rebot(); |
|
|
|
updateRebot.setUpdateBy("-1"); |
|
|
|
updateRebot.setUpdateBy("系统修改"); |
|
|
|
updateRebot.setUpdateTime(new Date()); |
|
|
|
updateRebot.setStatus(RebotStatus.RUNNING.getKey()); |
|
|
|
if(rebotService.lambdaUpdate().eq(Rebot::getRobotClientName, rebot.getRobotClientName()).update(updateRebot)){ |
|
|
|
if (rebotService.lambdaUpdate().eq(Rebot::getRobotClientName, rebot.getRobotClientName()).update(updateRebot)) { |
|
|
|
applyPlanList.remove(e); |
|
|
|
} |
|
|
|
} catch (IllegalAccessException ex) { |
|
|
@@ -117,6 +134,40 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
*/ |
|
|
|
@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.error("没有待执行的计划"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
ListRebotBO listRebotBO = new ListRebotBO(); |
|
|
|
listRebotBO.setStatus(RebotStatus.IDLE.getKey()); |
|
|
|
listRebotBO.setPage(1); |
|
|
@@ -129,77 +180,67 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
// rebotService.syn(new Rebot()); |
|
|
|
return false; |
|
|
|
} |
|
|
|
List<ApplyPlan> applyPlanList = this.lambdaQuery().eq(ApplyPlan::getExcType, ExcTypeStatus.TREE.getKey()).list(); |
|
|
|
listRebotVos.forEach(rebot -> { |
|
|
|
applyPlanList.forEach(e -> { |
|
|
|
// 是否满足执行条件 |
|
|
|
boolean isExec = false; |
|
|
|
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) { |
|
|
|
// 获取参数 |
|
|
|
List<ApplyStartBO.RobotParam> paramList = resourceLibraryService.lambdaQuery().eq(ResourceLibrary::getAppId, applyStartBO.getRobotUuid()).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()) { |
|
|
|
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())) { |
|
|
|
// 判断当前时间是否满足表达式 |
|
|
|
Date nextDate = cron.getNextValidTimeAfter(new Date()); |
|
|
|
if (new Date().compareTo(nextDate) > -1) { |
|
|
|
isExec = true; |
|
|
|
} |
|
|
|
nextDate = cron.getNextValidTimeAfter(new Date()); |
|
|
|
} else { |
|
|
|
// 根据表达式返回下一个执行时间 |
|
|
|
Date nextDate = cron.getNextValidTimeAfter(e.getNextExecTime()); |
|
|
|
if (new Date().compareTo(nextDate) > -1) { |
|
|
|
isExec = true; |
|
|
|
} |
|
|
|
nextDate = cron.getNextValidTimeAfter(e.getLastExecTime()); |
|
|
|
} |
|
|
|
} catch (ParseException ex) { |
|
|
|
log.error(e.getPlanName() + "的时间表达式错误!"); |
|
|
|
throw new RuntimeException(ex); |
|
|
|
} |
|
|
|
|
|
|
|
// 该计划满足执行条件 |
|
|
|
if (isExec) { |
|
|
|
ApplyStartBO applyStartBO = new ApplyStartBO(); |
|
|
|
applyStartBO.setRobotUuid(e.getAppId()); |
|
|
|
applyStartBO.setAccountName(rebot.getRobotClientName()); |
|
|
|
applyStartBO.setManualTime(e.getManualTime()); |
|
|
|
//high 高 middle 中 low 低 |
|
|
|
applyStartBO.setPriority("high"); |
|
|
|
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); |
|
|
|
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); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@@ -207,21 +248,6 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 判断下次执行时间是否满足条件 |
|
|
|
* |
|
|
|
* @param cronExpression cronExpression |
|
|
|
* @param lastExecutionTime 上次执行时间 |
|
|
|
* @return |
|
|
|
* @throws ParseException |
|
|
|
*/ |
|
|
|
private static boolean shouldExecute(String cronExpression, ZonedDateTime lastExecutionTime) throws ParseException { |
|
|
|
CronExpression cron = new CronExpression(cronExpression); |
|
|
|
Date now = Date.from(lastExecutionTime.toInstant()); |
|
|
|
return cron.isSatisfiedBy(now); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 获取应用执行结果 |
|
|
|
* |
|
|
@@ -247,7 +273,6 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
log.debug("没有需要更新状态的计划任务"); |
|
|
|
return; |
|
|
|
} |
|
|
|
List<JobQueryVO> jobQueryVOS = new ArrayList<>(); |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
ApplyPlan applyPlan = list.get(i); |
|
|
|
JobQueryBO jobQueryBO = new JobQueryBO(); |
|
|
@@ -265,11 +290,24 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
long diff = updateApplyPlan.getEndTime().getTime() - updateApplyPlan.getStartTime().getTime(); |
|
|
|
long planTime = diff / (60 * 1000); |
|
|
|
updateApplyPlan.setPlanTime(planTime + ""); |
|
|
|
updateApplyPlan.setTimeSaving((Long.parseLong(applyPlan.getManualTime()) - 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()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.updateById(updateApplyPlan); |
|
|
|
} |
|
|
|
// 如果是终态改变机器人状态 |
|
|
@@ -299,6 +337,16 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
@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); |
|
|
@@ -312,15 +360,6 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
// 获取每个部门优先级最高的计划 |
|
|
|
List<ApplyPlan> applyPlans = new ArrayList<>(); |
|
|
|
applyPlanMap.forEach((k, v) -> { |
|
|
@@ -336,7 +375,7 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
int i = 0; |
|
|
|
for (ListRebotVO listRebotVO : listRebotVos) { |
|
|
|
ApplyPlan applyPlan = null; |
|
|
|
if(applyPlans.isEmpty()){ |
|
|
|
if (applyPlans.isEmpty()) { |
|
|
|
log.debug("没有等待执行的计划!"); |
|
|
|
continue; |
|
|
|
} |
|
|
@@ -345,7 +384,6 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
applyStartBO = new ApplyStartBO(); |
|
|
|
applyStartBO.setRobotUuid(applyPlan.getAppId()); |
|
|
|
} else { |
|
|
|
|
|
|
|
applyPlan = new ApplyPlan(); |
|
|
|
BeanUtils.copyBeanProp(applyPlan, applyStartBO); |
|
|
|
applyStartBO.setRobotUuid(applyStartBO.getRobotUuid()); |
|
|
@@ -354,13 +392,22 @@ public class ApplyPlanServiceImpl extends ServiceImpl<ApplyPlanMapper, ApplyPlan |
|
|
|
applyStartBO.setAccountName(listRebotVO.getRobotClientName()); |
|
|
|
//high 高 middle 中 low 低 |
|
|
|
applyStartBO.setPriority("high"); |
|
|
|
String planParams = applyPlan.getPlanParams(); |
|
|
|
if (StringUtils.isNotEmpty(planParams)) { |
|
|
|
JSONArray jsonArray = JSON.parseArray(planParams); |
|
|
|
// 直接转换成List |
|
|
|
List<ApplyStartBO.RobotParam> list = jsonArray.toJavaList(ApplyStartBO.RobotParam.class); |
|
|
|
applyStartBO.setPlanParamsList(list); |
|
|
|
// 如果应用支持参数 |
|
|
|
if (!Objects.isNull(applyPlan.getSupportParam()) && applyPlan.getSupportParam() == 1) { |
|
|
|
// 获取参数 |
|
|
|
List<ApplyStartBO.RobotParam> paramList = resourceLibraryService.lambdaQuery().eq(ResourceLibrary::getAppId, applyStartBO.getRobotUuid()).list().stream() |
|
|
|
.map(e -> { |
|
|
|
ApplyStartBO.RobotParam robotParam = new ApplyStartBO.RobotParam(); |
|
|
|
robotParam.setName(e.getResourceName()); |
|
|
|
robotParam.setValue(e.getResourceValue()); |
|
|
|
robotParam.setType(e.getResourceType()); |
|
|
|
return robotParam; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
if (paramList.isEmpty()) { |
|
|
|
applyStartBO.setPlanParamsList(paramList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
JobStartVO jobStartVO = YinDaoHttpUtils.appStart(applyStartBO); |
|
|
|
|
|
|
|
ApplyPlan updateApplyPlan = new ApplyPlan(); |
|
|
|