Pārlūkot izejas kodu

调整参数,增加资源模块,修改部分逻辑

pull/4/head
lcr pirms 4 mēnešiem
vecāks
revīzija
be6fb1c691
10 mainītis faili ar 217 papildinājumiem un 112 dzēšanām
  1. +1
    -1
      ruoyi-admin/src/main/resources/application.yml
  2. +5
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/domain/ApplyPlan.java
  3. +9
    -1
      ruoyi-business/src/main/java/com/ruoyi/business/domain/ResourceLibrary.java
  4. +17
    -2
      ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/JobQueryVO.java
  5. +154
    -107
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanServiceImpl.java
  6. +17
    -0
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ResourceLibraryServiceImpl.java
  7. +1
    -1
      ruoyi-business/src/main/resources/mapper/business/ApplyMapper.xml
  8. +3
    -0
      ruoyi-business/src/main/resources/mapper/business/ApplyPlanMapper.xml
  9. +8
    -0
      ruoyi-business/src/main/resources/mapper/business/ResourceLibraryMapper.xml
  10. +2
    -0
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

+ 1
- 1
ruoyi-admin/src/main/resources/application.yml Parādīt failu

@@ -9,7 +9,7 @@ ruoyi:
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
profile: D:/poject/log/uploadPath
profile: E:\poject
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数组计算 char 字符验证


+ 5
- 0
ruoyi-business/src/main/java/com/ruoyi/business/domain/ApplyPlan.java Parādīt failu

@@ -84,6 +84,11 @@ public class ApplyPlan extends BaseEntity
@ApiModelProperty(name="planParams",value = "计划参数")
private String planParams;

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

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


+ 9
- 1
ruoyi-business/src/main/java/com/ruoyi/business/domain/ResourceLibrary.java Parādīt failu

@@ -55,6 +55,11 @@ public class ResourceLibrary extends BaseEntity
@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 = "所属应用名称")
@@ -65,7 +70,10 @@ public class ResourceLibrary extends BaseEntity
@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)


+ 17
- 2
ruoyi-business/src/main/java/com/ruoyi/business/domain/vo/JobQueryVO.java Parādīt failu

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

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

/**
* 查询job响应
@@ -72,7 +73,7 @@ public class JobQueryVO {
/**
* 应用运行参数
*/
private RobotParam robotParams;
private Param robotParams;

/**
* 机器人账号
@@ -88,11 +89,13 @@ public class JobQueryVO {
*/
private String robotClientName;



/**
* 应用运行参数
*/
@Data
private static class RobotParam {
public static class RobotParam {
// 参数名
private String name;
// 参数值
@@ -101,4 +104,16 @@ public class JobQueryVO {
private String type;

}

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

}
}

+ 154
- 107
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ApplyPlanServiceImpl.java Parādīt failu

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


+ 17
- 0
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/ResourceLibraryServiceImpl.java Parādīt failu

@@ -1,6 +1,10 @@
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;
@@ -19,6 +23,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
public class ResourceLibraryServiceImpl extends ServiceImpl<ResourceLibraryMapper, ResourceLibrary> implements IResourceLibraryService
{

@Autowired
private IApplyService applyService;

/**
* 查询资源库管理列表
@@ -31,4 +37,15 @@ public class ResourceLibraryServiceImpl extends ServiceImpl<ResourceLibraryMappe
{
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);
}
}

+ 1
- 1
ruoyi-business/src/main/resources/mapper/business/ApplyMapper.xml Parādīt failu

@@ -110,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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 != '未发版' and apply.manual_time != null
and version != '未发版'
</where>
<!-- 数据范围过滤 -->
${params.dataScope}


+ 3
- 0
ruoyi-business/src/main/resources/mapper/business/ApplyPlanMapper.xml Parādīt failu

@@ -25,6 +25,8 @@
<result property="supportParam" column="support_param" />
<!-- 计划参数 -->
<result property="planParams" column="plan_params"/>
<!-- 输出参数 -->
<result property="outParam" column="out_param"/>
<!-- 等待超时时间 -->
<result property="waitTimeout" column="wait_timeout"/>
<!-- 优先级 -->
@@ -81,6 +83,7 @@
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周期执行) -->


+ 8
- 0
ruoyi-business/src/main/resources/mapper/business/ResourceLibraryMapper.xml Parādīt failu

@@ -15,10 +15,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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" />
<!-- 创建时间 -->
@@ -40,8 +44,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
resource_value,<!-- 资源内容 -->
resource_type,<!-- 资源类型 -->
resource_name,<!-- 资源键 -->
app_id,<!-- 所属应用id -->
app_name,<!-- 所属应用名称 -->
dept_id,<!-- 部门id -->
dept_name,<!-- 部门id -->
create_by,<!-- 创建者 -->
create_time,<!-- 创建时间 -->
update_by,<!-- 更新者 -->
@@ -58,8 +64,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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>

+ 2
- 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java Parādīt failu

@@ -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").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
.and()


Notiek ielāde…
Atcelt
Saglabāt