部分代码整理

pull/214/head
taest 3 years ago committed by Gitee
parent 0d58ecb09c
commit 7d49e12fab
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -37,7 +37,6 @@ public class ScheduleConfig
prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true"); prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true");
// sqlserver 启用 // sqlserver 启用
// prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
prop.put("org.quartz.jobStore.misfireThreshold", "12000"); prop.put("org.quartz.jobStore.misfireThreshold", "12000");
prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_"); prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
factory.setQuartzProperties(prop); factory.setQuartzProperties(prop);

@ -178,7 +178,7 @@ public class SysJobController extends BaseController
@RequiresPermissions("monitor:job:remove") @RequiresPermissions("monitor:job:remove")
@Log(title = "定时任务", businessType = BusinessType.DELETE) @Log(title = "定时任务", businessType = BusinessType.DELETE)
@DeleteMapping("/{jobIds}") @DeleteMapping("/{jobIds}")
public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException
{ {
jobService.deleteJobByIds(jobIds); jobService.deleteJobByIds(jobIds);
return AjaxResult.success(); return AjaxResult.success();

@ -3,7 +3,6 @@ package com.ruoyi.job.util;
import java.util.Date; import java.util.Date;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.ruoyi.common.core.constant.ScheduleConstants; import com.ruoyi.common.core.constant.ScheduleConstants;
@ -30,7 +29,7 @@ public abstract class AbstractQuartzJob implements Job
private static ThreadLocal<Date> threadLocal = new ThreadLocal<>(); private static ThreadLocal<Date> threadLocal = new ThreadLocal<>();
@Override @Override
public void execute(JobExecutionContext context) throws JobExecutionException public void execute(JobExecutionContext context)
{ {
SysJob sysJob = new SysJob(); SysJob sysJob = new SysJob();
BeanUtils.copyBeanProp(sysJob, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES)); BeanUtils.copyBeanProp(sysJob, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES));

@ -112,32 +112,26 @@ public class JobInvokeUtil
} }
String[] methodParams = methodStr.split(",(?=([^\"']*[\"'][^\"']*[\"'])*[^\"']*$)"); String[] methodParams = methodStr.split(",(?=([^\"']*[\"'][^\"']*[\"'])*[^\"']*$)");
List<Object[]> classs = new LinkedList<>(); List<Object[]> classs = new LinkedList<>();
for (int i = 0; i < methodParams.length; i++) for (String methodParam : methodParams) {
{ String str = StringUtils.trimToEmpty(methodParam);
String str = StringUtils.trimToEmpty(methodParams[i]);
// String字符串类型以'或"开头 // String字符串类型以'或"开头
if (StringUtils.startsWithAny(str, "'", "\"")) if (StringUtils.startsWithAny(str, "'", "\"")) {
{
classs.add(new Object[]{StringUtils.substring(str, 1, str.length() - 1), String.class}); classs.add(new Object[]{StringUtils.substring(str, 1, str.length() - 1), String.class});
} }
// boolean布尔类型等于true或者false // boolean布尔类型等于true或者false
else if ("true".equalsIgnoreCase(str) || "false".equalsIgnoreCase(str)) else if ("true".equalsIgnoreCase(str) || "false".equalsIgnoreCase(str)) {
{
classs.add(new Object[]{Boolean.valueOf(str), Boolean.class}); classs.add(new Object[]{Boolean.valueOf(str), Boolean.class});
} }
// long长整形以L结尾 // long长整形以L结尾
else if (StringUtils.endsWith(str, "L")) else if (StringUtils.endsWith(str, "L")) {
{
classs.add(new Object[]{Long.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Long.class}); classs.add(new Object[]{Long.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Long.class});
} }
// double浮点类型以D结尾 // double浮点类型以D结尾
else if (StringUtils.endsWith(str, "D")) else if (StringUtils.endsWith(str, "D")) {
{
classs.add(new Object[]{Double.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Double.class}); classs.add(new Object[]{Double.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Double.class});
} }
// 其他类型归类为整形 // 其他类型归类为整形
else else {
{
classs.add(new Object[]{Integer.valueOf(str), Integer.class}); classs.add(new Object[]{Integer.valueOf(str), Integer.class});
} }
} }

@ -1,6 +1,5 @@
package com.ruoyi.system.controller; package com.ruoyi.system.controller;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -55,16 +54,8 @@ public class SysDeptController extends BaseController
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
{ {
List<SysDept> depts = deptService.selectDeptList(new SysDept()); List<SysDept> depts = deptService.selectDeptList(new SysDept());
Iterator<SysDept> it = depts.iterator(); depts.removeIf(d -> d.getDeptId().intValue() == deptId
while (it.hasNext()) || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
{
SysDept d = (SysDept) it.next();
if (d.getDeptId().intValue() == deptId
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
{
it.remove();
}
}
return AjaxResult.success(depts); return AjaxResult.success(depts);
} }

@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by d.parent_id, d.order_num order by d.parent_id, d.order_num
</select> </select>
<select id="selectDeptListByRoleId" resultType="Integer"> <select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id select d.dept_id
from sys_dept d from sys_dept d
left join sys_role_dept rd on d.dept_id = rd.dept_id left join sys_role_dept rd on d.dept_id = rd.dept_id

Loading…
Cancel
Save