fix: 2.5.0
1. 修复普通用户未使用配置的组权限过滤数据 2. 通知添加帮助文档链接
This commit is contained in:
parent
dfc1243d58
commit
5cd7d074eb
@ -24,7 +24,8 @@ import java.util.Objects;
|
||||
public class EasyRetryProperties {
|
||||
|
||||
/**
|
||||
* 服务端对应的group
|
||||
* 命名空间ID
|
||||
* 若不填则默认为 SystemConstants::DEFAULT_NAMESPACE
|
||||
*/
|
||||
private String namespace;
|
||||
|
||||
|
@ -41,7 +41,7 @@ import java.util.function.Consumer;
|
||||
public abstract class AbstractRetryStrategies implements RetryStrategy {
|
||||
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
private static String retryErrorMoreThresholdTextMessageFormatter =
|
||||
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试期间发生非预期异常</font> \n" +
|
||||
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试组件异常</font> \n" +
|
||||
"> IP:{} \n" +
|
||||
"> 空间ID:{} \n" +
|
||||
"> 名称:{} \n" +
|
||||
|
@ -2,6 +2,8 @@ package com.aizuda.easy.retry.template.datasource.persistence.dataobject;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author www.byteblogs.com
|
||||
* @date 2023-10-15 23:03:01
|
||||
@ -10,7 +12,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class JobBatchQueryDO {
|
||||
|
||||
private String groupName;
|
||||
private List<String> groupNames;
|
||||
private Integer taskBatchStatus;
|
||||
private String jobName;
|
||||
private Long jobId;
|
||||
|
@ -2,6 +2,8 @@ package com.aizuda.easy.retry.template.datasource.persistence.dataobject;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zuoJunLin
|
||||
* @date 2023-12-02 23:03:01
|
||||
@ -10,7 +12,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class JobNotifyConfigQueryDO {
|
||||
|
||||
private String groupName;
|
||||
private List<String> groupNames;
|
||||
|
||||
private Long jobId;
|
||||
/**
|
||||
|
@ -30,8 +30,11 @@
|
||||
<if test="queryDO.jobId != null">
|
||||
and a.job_id = #{queryDO.jobId}
|
||||
</if>
|
||||
<if test="queryDO.groupName != null">
|
||||
and a.group_name = #{queryDO.groupName}
|
||||
<if test="queryDO.groupNames != null and queryDO.groupNames.size > 0">
|
||||
and a.group_name IN
|
||||
<foreach collection="queryDO.groupNames" item="groupName" open="(" separator="," close=")">
|
||||
#{groupName}
|
||||
</foreach>
|
||||
</if>
|
||||
order by a.id desc
|
||||
</where>
|
||||
|
@ -0,0 +1,125 @@
|
||||
<?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.aizuda.easy.retry.template.datasource.persistence.mapper.JobSummaryMapper">
|
||||
<resultMap id="BaseResultMap" type="com.aizuda.easy.retry.template.datasource.persistence.po.JobSummary">
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="namespace_id" jdbcType="TINYINT" property="namespaceId"/>
|
||||
<result column="group_name" jdbcType="TINYINT" property="groupName"/>
|
||||
<result column="job_id" jdbcType="TINYINT" property="jobId"/>
|
||||
<result column="trigger_at" jdbcType="TIMESTAMP" property="triggerAt"/>
|
||||
<result column="success_num" jdbcType="TINYINT" property="successNum"/>
|
||||
<result column="fail_num" jdbcType="TINYINT" property="failNum"/>
|
||||
<result column="fail_reason" jdbcType="VARCHAR" property="failReason"/>
|
||||
<result column="stop_num" jdbcType="TINYINT" property="stopNum"/>
|
||||
<result column="stop_reason" jdbcType="VARCHAR" property="stopReason"/>
|
||||
<result column="cancel_num" jdbcType="TINYINT" property="cancelNum"/>
|
||||
<result column="cancel_reason" jdbcType="VARCHAR" property="cancelReason"/>
|
||||
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt"/>
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO
|
||||
job_summary (namespace_id, group_name, job_id, trigger_at,
|
||||
success_num,fail_num,fail_reason,stop_num,stop_reason, cancel_num,cancel_reason)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.jobId},
|
||||
#{item.triggerAt},
|
||||
#{item.successNum},
|
||||
#{item.failNum},
|
||||
#{item.failReason},
|
||||
#{item.stopNum},
|
||||
#{item.stopReason},
|
||||
#{item.cancelNum},
|
||||
#{item.cancelReason}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
success_num = values(`success_num`),
|
||||
fail_num = values(`fail_num`),
|
||||
fail_reason = values(`fail_reason`),
|
||||
stop_num = values(`stop_num`),
|
||||
stop_reason = values(`stop_reason`),
|
||||
cancel_num = values(`cancel_num`),
|
||||
cancel_reason = values(`cancel_reason`)
|
||||
</insert>
|
||||
|
||||
<select id="jobLineList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO">
|
||||
SELECT
|
||||
<choose>
|
||||
<when test="type == 'DAY'">
|
||||
DATE_FORMAT(create_dt,'%H')
|
||||
</when>
|
||||
<when test="type == 'WEEK'">
|
||||
DATE_FORMAT(create_dt,'%Y-%m-%d')
|
||||
</when>
|
||||
<when test="type =='MONTH'">
|
||||
DATE_FORMAT(create_dt,'%Y-%m-%d')
|
||||
</when>
|
||||
<when test="type == 'YEAR'">
|
||||
DATE_FORMAT(create_dt,'%Y-%m')
|
||||
</when>
|
||||
<otherwise>
|
||||
DATE_FORMAT(create_dt,'%Y-%m-%d')
|
||||
</otherwise>
|
||||
</choose>
|
||||
AS createDt,
|
||||
ifnull(SUM(success_num), 0) AS success,
|
||||
ifnull(SUM(fail_num), 0) AS failNum,
|
||||
ifnull(SUM(stop_num), 0) AS stop,
|
||||
ifnull(SUM(cancel_num), 0) AS cancel,
|
||||
ifnull(SUM(fail_num + stop_num + cancel_num), 0) AS fail,
|
||||
ifnull(SUM(success_num + fail_num + stop_num + cancel_num), 0) AS total
|
||||
FROM job_summary
|
||||
<where>
|
||||
<if test="groupName != null and groupName != '' ">
|
||||
AND group_name = #{groupName}
|
||||
</if>
|
||||
AND namespace_id = #{namespaceId} AND trigger_at BETWEEN #{from} AND #{to}
|
||||
</where>
|
||||
GROUP BY createDt
|
||||
</select>
|
||||
|
||||
<select id="toJobTask"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$JobTask">
|
||||
SELECT ifnull(sum(success_num), 0) AS successNum,
|
||||
ifnull(sum(stop_num), 0) AS stopNum,
|
||||
ifnull(sum(cancel_num), 0) AS cancelNum,
|
||||
ifnull(sum(fail_num), 0) AS failNum,
|
||||
ifnull(sum(success_num + fail_num + stop_num + cancel_num), 0) AS totalNum
|
||||
FROM job_summary
|
||||
WHERE namespace_id = #{namespaceId}
|
||||
</select>
|
||||
|
||||
<select id="dashboardRank"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Rank">
|
||||
SELECT
|
||||
CONCAT(group_name, '/', (SELECT job_name FROM job WHERE id=job_id)) `name`,
|
||||
SUM(fail_num) AS total FROM job_summary
|
||||
<where>
|
||||
<if test="groupName != '' and groupName != null">
|
||||
AND group_name = #{groupName}
|
||||
</if>
|
||||
AND trigger_at >= #{startTime} AND trigger_at <= #{endTime}
|
||||
</where>
|
||||
AND namespace_id = #{namespaceId}
|
||||
GROUP BY namespace_id, group_name, job_id
|
||||
HAVING total > 0
|
||||
ORDER BY total DESC LIMIT 10
|
||||
</select>
|
||||
|
||||
<select id="jobTaskList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Task">
|
||||
SELECT group_name AS groupName,
|
||||
SUM(CASE WHEN (job_status = 1) THEN 1 ELSE 0 END) AS run,
|
||||
count(*) AS total
|
||||
FROM job
|
||||
WHERE namespace_id = #{namespaceId}
|
||||
GROUP BY namespace_id, group_name
|
||||
</select>
|
||||
</mapper>
|
@ -23,8 +23,11 @@
|
||||
<if test="queryDO.jobId != null">
|
||||
and a.job_id = #{queryDO.jobId}
|
||||
</if>
|
||||
<if test="queryDO.groupName != null">
|
||||
and a.group_name = #{queryDO.groupName}
|
||||
<if test="queryDO.groupNames != null and queryDO.groupNames.size > 0">
|
||||
and a.group_name IN
|
||||
<foreach collection="queryDO.groupNames" item="groupName" open="(" separator="," close=")">
|
||||
#{groupName}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="queryDO.taskBatchStatus != null">
|
||||
and task_batch_status = #{queryDO.taskBatchStatus}
|
||||
|
@ -0,0 +1,139 @@
|
||||
<?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.aizuda.easy.retry.template.datasource.persistence.mapper.RetrySummaryMapper">
|
||||
<resultMap id="BaseResultMap" type="com.aizuda.easy.retry.template.datasource.persistence.po.RetrySummary">
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="namespace_id" jdbcType="TINYINT" property="namespaceId"/>
|
||||
<result column="group_name" jdbcType="TINYINT" property="groupName"/>
|
||||
<result column="scene_name" jdbcType="TINYINT" property="sceneName"/>
|
||||
<result column="trigger_at" jdbcType="TIMESTAMP" property="triggerAt"/>
|
||||
<result column="running_num" jdbcType="TINYINT" property="runningNum"/>
|
||||
<result column="finish_num" jdbcType="TINYINT" property="finishNum"/>
|
||||
<result column="max_count_num" jdbcType="VARCHAR" property="maxCountNum"/>
|
||||
<result column="suspend_num" jdbcType="TINYINT" property="suspendNum"/>
|
||||
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt"/>
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO
|
||||
retry_summary (namespace_id, group_name, scene_name, trigger_at, running_num, finish_num, max_count_num,
|
||||
suspend_num)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.sceneName},
|
||||
#{item.triggerAt},
|
||||
#{item.runningNum},
|
||||
#{item.finishNum},
|
||||
#{item.maxCountNum},
|
||||
#{item.suspendNum}
|
||||
)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
running_num = values(`running_num`),
|
||||
finish_num = values(`finish_num`),
|
||||
max_count_num = values(`max_count_num`),
|
||||
suspend_num = values(`suspend_num`)
|
||||
</insert>
|
||||
|
||||
<select id="retryTask"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTask">
|
||||
SELECT ifnull(sum(running_num), 0) AS runningNum,
|
||||
ifnull(sum(finish_num), 0) AS finishNum,
|
||||
ifnull(sum(max_count_num), 0) AS maxCountNum,
|
||||
ifnull(sum(suspend_num), 0) AS suspendNum,
|
||||
ifnull(sum(running_num + finish_num + max_count_num + suspend_num), 0) AS totalNum
|
||||
FROM retry_summary
|
||||
WHERE namespace_id = #{namespaceId}
|
||||
</select>
|
||||
|
||||
<select id="retryTaskBarList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTaskBar">
|
||||
SELECT tmp.date AS x, ifnull(b.taskTotal, 0) AS taskTotal
|
||||
FROM (SELECT curdate() AS date
|
||||
UNION ALL
|
||||
SELECT DATE_SUB(CURDATE(), INTERVAL 1 DAY) AS date
|
||||
UNION ALL
|
||||
SELECT DATE_SUB(CURDATE(), interval 2 day) AS date
|
||||
UNION ALL
|
||||
SELECT DATE_SUB(CURDATE(), interval 3 day) AS date
|
||||
UNION ALL
|
||||
SELECT DATE_SUB(CURDATE(), interval 4 day) AS date
|
||||
UNION ALL
|
||||
SELECT DATE_SUB(CURDATE(), interval 5 day) AS date
|
||||
UNION ALL
|
||||
SELECT DATE_SUB(CURDATE(), interval 6 day) AS date) tmp
|
||||
LEFT JOIN (SELECT DATE (trigger_at) AS triggerAt,
|
||||
SUM(running_num + finish_num + max_count_num + suspend_num) AS taskTotal FROM retry_summary
|
||||
WHERE namespace_id = #{namespaceId}
|
||||
GROUP BY triggerAt
|
||||
) b
|
||||
ON tmp.date = b.triggerAt
|
||||
</select>
|
||||
|
||||
<select id="retryLineList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO">
|
||||
SELECT
|
||||
<choose>
|
||||
<when test="type == 'DAY'">
|
||||
DATE_FORMAT(create_dt,'%H')
|
||||
</when>
|
||||
<when test="type == 'WEEK'">
|
||||
DATE_FORMAT(create_dt,'%Y-%m-%d')
|
||||
</when>
|
||||
<when test="type =='MONTH'">
|
||||
DATE_FORMAT(create_dt,'%Y-%m-%d')
|
||||
</when>
|
||||
<when test="type == 'YEAR'">
|
||||
DATE_FORMAT(create_dt,'%Y-%m')
|
||||
</when>
|
||||
<otherwise>
|
||||
DATE_FORMAT(create_dt,'%Y-%m-%d')
|
||||
</otherwise>
|
||||
</choose>
|
||||
AS createDt,
|
||||
ifnull(SUM(finish_num), 0) AS successNum,
|
||||
ifnull(SUM(running_num), 0) AS runningNum,
|
||||
ifnull(SUM(max_count_num), 0) AS maxCountNum,
|
||||
ifnull(SUM(suspend_num), 0) AS suspendNum,
|
||||
ifnull(SUM(finish_num + running_num + max_count_num + suspend_num), 0) AS total
|
||||
FROM retry_summary
|
||||
<where>
|
||||
<if test="groupName != null and groupName != '' ">
|
||||
AND group_name = #{groupName}
|
||||
</if>
|
||||
AND namespace_id = #{namespaceId} AND trigger_at BETWEEN #{from} AND #{to}
|
||||
</where>
|
||||
GROUP BY createDt
|
||||
</select>
|
||||
|
||||
<select id="dashboardRank"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Rank">
|
||||
SELECT
|
||||
CONCAT(group_name, '/', scene_name) `name`,
|
||||
SUM(running_num + finish_num + max_count_num + suspend_num) AS total FROM retry_summary
|
||||
<where>
|
||||
<if test="groupName != '' and groupName != null">
|
||||
AND group_name = #{groupName}
|
||||
</if>
|
||||
AND namespace_id = #{namespaceId}
|
||||
AND trigger_at >= #{startTime} AND trigger_at <= #{endTime}
|
||||
</where>
|
||||
GROUP BY namespace_id, group_name, scene_name
|
||||
HAVING total > 0
|
||||
ORDER BY total DESC LIMIT 10
|
||||
</select>
|
||||
|
||||
<select id="retryTaskList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Task">
|
||||
SELECT group_name AS groupName,
|
||||
sum(CASE WHEN (scene_status = 1) THEN 1 ELSE 0 END) AS run,
|
||||
count(*) AS total
|
||||
FROM scene_config
|
||||
WHERE namespace_id = #{namespaceId}
|
||||
GROUP BY namespace_id, group_name
|
||||
</select>
|
||||
</mapper>
|
@ -30,8 +30,11 @@
|
||||
<if test="queryDO.jobId != null">
|
||||
and a.job_id = #{queryDO.jobId}
|
||||
</if>
|
||||
<if test="queryDO.groupName != null">
|
||||
and a.group_name = #{queryDO.groupName}
|
||||
<if test="queryDO.groupNames != null and queryDO.groupNames.size > 0">
|
||||
and a.group_name IN
|
||||
<foreach collection="queryDO.groupNames" item="groupName" open="(" separator="," close=")">
|
||||
#{groupName}
|
||||
</foreach>
|
||||
</if>
|
||||
order by a.id desc
|
||||
</where>
|
||||
|
@ -23,8 +23,11 @@
|
||||
<if test="queryDO.jobId != null">
|
||||
and a.job_id = #{queryDO.jobId}
|
||||
</if>
|
||||
<if test="queryDO.groupName != null">
|
||||
and a.group_name = #{queryDO.groupName}
|
||||
<if test="queryDO.groupNames != null and queryDO.groupNames.size > 0">
|
||||
and a.group_name IN
|
||||
<foreach collection="queryDO.groupNames" item="groupName" open="(" separator="," close=")">
|
||||
#{groupName}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="queryDO.taskBatchStatus != null">
|
||||
and task_batch_status = #{queryDO.taskBatchStatus}
|
||||
|
@ -31,8 +31,11 @@
|
||||
<if test="queryDO.jobId != null">
|
||||
and a.job_id = #{queryDO.jobId}
|
||||
</if>
|
||||
<if test="queryDO.groupName != null">
|
||||
and a.group_name = #{queryDO.groupName}
|
||||
<if test="queryDO.groupNames != null and queryDO.groupNames.size > 0">
|
||||
and a.group_name IN
|
||||
<foreach collection="queryDO.groupNames" item="groupName" open="(" separator="," close=")">
|
||||
#{groupName}
|
||||
</foreach>
|
||||
</if>
|
||||
order by a.id desc
|
||||
</where>
|
||||
|
@ -0,0 +1,125 @@
|
||||
<?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.aizuda.easy.retry.template.datasource.persistence.mapper.JobSummaryMapper">
|
||||
<resultMap id="BaseResultMap" type="com.aizuda.easy.retry.template.datasource.persistence.po.JobSummary">
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="namespace_id" jdbcType="TINYINT" property="namespaceId"/>
|
||||
<result column="group_name" jdbcType="TINYINT" property="groupName"/>
|
||||
<result column="job_id" jdbcType="TINYINT" property="jobId"/>
|
||||
<result column="trigger_at" jdbcType="TIMESTAMP" property="triggerAt"/>
|
||||
<result column="success_num" jdbcType="TINYINT" property="successNum"/>
|
||||
<result column="fail_num" jdbcType="TINYINT" property="failNum"/>
|
||||
<result column="fail_reason" jdbcType="VARCHAR" property="failReason"/>
|
||||
<result column="stop_num" jdbcType="TINYINT" property="stopNum"/>
|
||||
<result column="stop_reason" jdbcType="VARCHAR" property="stopReason"/>
|
||||
<result column="cancel_num" jdbcType="TINYINT" property="cancelNum"/>
|
||||
<result column="cancel_reason" jdbcType="VARCHAR" property="cancelReason"/>
|
||||
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt"/>
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO
|
||||
job_summary (namespace_id, group_name, job_id, trigger_at,
|
||||
success_num,fail_num,fail_reason,stop_num,stop_reason, cancel_num,cancel_reason)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.jobId},
|
||||
#{item.triggerAt},
|
||||
#{item.successNum},
|
||||
#{item.failNum},
|
||||
#{item.failReason},
|
||||
#{item.stopNum},
|
||||
#{item.stopReason},
|
||||
#{item.cancelNum},
|
||||
#{item.cancelReason}
|
||||
)
|
||||
</foreach>
|
||||
ON CONFLICT (job_id, trigger_at) DO UPDATE
|
||||
SET success_num = EXCLUDED.success_num,
|
||||
fail_num = EXCLUDED.fail_num,
|
||||
fail_reason = EXCLUDED.fail_reason,
|
||||
stop_num = EXCLUDED.stop_num,
|
||||
stop_reason = EXCLUDED.stop_reason,
|
||||
cancel_num = EXCLUDED.cancel_num,
|
||||
cancel_reason = EXCLUDED.cancel_reason
|
||||
</insert>
|
||||
|
||||
<select id="jobLineList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO">
|
||||
SELECT
|
||||
<choose>
|
||||
<when test="type == 'DAY'">
|
||||
DATE_FORMAT(create_dt,'%H')
|
||||
</when>
|
||||
<when test="type == 'WEEK'">
|
||||
DATE_FORMAT(create_dt,'%Y-%m-%d')
|
||||
</when>
|
||||
<when test="type =='MONTH'">
|
||||
DATE_FORMAT(create_dt,'%Y-%m-%d')
|
||||
</when>
|
||||
<when test="type == 'YEAR'">
|
||||
DATE_FORMAT(create_dt,'%Y-%m')
|
||||
</when>
|
||||
<otherwise>
|
||||
DATE_FORMAT(create_dt,'%Y-%m-%d')
|
||||
</otherwise>
|
||||
</choose>
|
||||
AS createDt,
|
||||
ifnull(SUM(success_num), 0) AS success,
|
||||
ifnull(SUM(fail_num), 0) AS failNum,
|
||||
ifnull(SUM(stop_num), 0) AS stop,
|
||||
ifnull(SUM(cancel_num), 0) AS cancel,
|
||||
ifnull(SUM(fail_num + stop_num + cancel_num), 0) AS fail,
|
||||
ifnull(SUM(success_num + fail_num + stop_num + cancel_num), 0) AS total
|
||||
FROM job_summary
|
||||
<where>
|
||||
<if test="groupName != null and groupName != '' ">
|
||||
AND group_name = #{groupName}
|
||||
</if>
|
||||
AND namespace_id = #{namespaceId} AND trigger_at BETWEEN #{from} AND #{to}
|
||||
</where>
|
||||
GROUP BY createDt
|
||||
</select>
|
||||
|
||||
<select id="toJobTask"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$JobTask">
|
||||
SELECT ifnull(sum(success_num), 0) AS successNum,
|
||||
ifnull(sum(stop_num), 0) AS stopNum,
|
||||
ifnull(sum(cancel_num), 0) AS cancelNum,
|
||||
ifnull(sum(fail_num), 0) AS failNum,
|
||||
ifnull(sum(success_num + fail_num + stop_num + cancel_num), 0) AS totalNum
|
||||
FROM job_summary
|
||||
WHERE namespace_id = #{namespaceId}
|
||||
</select>
|
||||
|
||||
<select id="dashboardRank"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Rank">
|
||||
SELECT
|
||||
CONCAT(group_name, '/', (SELECT job_name FROM job WHERE id=job_id)) `name`,
|
||||
SUM(fail_num) AS total FROM job_summary
|
||||
<where>
|
||||
<if test="groupName != '' and groupName != null">
|
||||
AND group_name = #{groupName}
|
||||
</if>
|
||||
AND trigger_at >= #{startTime} AND trigger_at <= #{endTime}
|
||||
</where>
|
||||
AND namespace_id = #{namespaceId}
|
||||
GROUP BY namespace_id, group_name, job_id
|
||||
HAVING total > 0
|
||||
ORDER BY total DESC LIMIT 10
|
||||
</select>
|
||||
|
||||
<select id="jobTaskList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Task">
|
||||
SELECT group_name AS groupName,
|
||||
SUM(CASE WHEN (job_status = 1) THEN 1 ELSE 0 END) AS run,
|
||||
count(*) AS total
|
||||
FROM job
|
||||
WHERE namespace_id = #{namespaceId}
|
||||
GROUP BY namespace_id, group_name
|
||||
</select>
|
||||
</mapper>
|
@ -23,8 +23,11 @@
|
||||
<if test="queryDO.jobId != null">
|
||||
and a.job_id = #{queryDO.jobId}
|
||||
</if>
|
||||
<if test="queryDO.groupName != null">
|
||||
and a.group_name = #{queryDO.groupName}
|
||||
<if test="queryDO.groupNames != null and queryDO.groupNames.size > 0">
|
||||
and a.group_name IN
|
||||
<foreach collection="queryDO.groupNames" item="groupName" open="(" separator="," close=")">
|
||||
#{groupName}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="queryDO.taskBatchStatus != null">
|
||||
and task_batch_status = #{queryDO.taskBatchStatus}
|
||||
|
@ -0,0 +1,139 @@
|
||||
<?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.aizuda.easy.retry.template.datasource.persistence.mapper.RetrySummaryMapper">
|
||||
<resultMap id="BaseResultMap" type="com.aizuda.easy.retry.template.datasource.persistence.po.RetrySummary">
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="namespace_id" jdbcType="TINYINT" property="namespaceId"/>
|
||||
<result column="group_name" jdbcType="TINYINT" property="groupName"/>
|
||||
<result column="scene_name" jdbcType="TINYINT" property="sceneName"/>
|
||||
<result column="trigger_at" jdbcType="TIMESTAMP" property="triggerAt"/>
|
||||
<result column="running_num" jdbcType="TINYINT" property="runningNum"/>
|
||||
<result column="finish_num" jdbcType="TINYINT" property="finishNum"/>
|
||||
<result column="max_count_num" jdbcType="VARCHAR" property="maxCountNum"/>
|
||||
<result column="suspend_num" jdbcType="TINYINT" property="suspendNum"/>
|
||||
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt"/>
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO
|
||||
retry_summary (namespace_id, group_name, scene_name, trigger_at, running_num, finish_num, max_count_num,
|
||||
suspend_num)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.namespaceId},
|
||||
#{item.groupName},
|
||||
#{item.sceneName},
|
||||
#{item.triggerAt},
|
||||
#{item.runningNum},
|
||||
#{item.finishNum},
|
||||
#{item.maxCountNum},
|
||||
#{item.suspendNum}
|
||||
)
|
||||
</foreach>
|
||||
ON CONFLICT (namespace_id, group_name, scene_name, trigger_at) DO UPDATE
|
||||
SET running_num = EXCLUDED.running_num,
|
||||
finish_num = EXCLUDED.finish_num,
|
||||
max_count_num = EXCLUDED.max_count_num,
|
||||
suspend_num = EXCLUDED.suspend_num
|
||||
</insert>
|
||||
|
||||
<select id="retryTask"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTask">
|
||||
SELECT ifnull(sum(running_num), 0) AS runningNum,
|
||||
ifnull(sum(finish_num), 0) AS finishNum,
|
||||
ifnull(sum(max_count_num), 0) AS maxCountNum,
|
||||
ifnull(sum(suspend_num), 0) AS suspendNum,
|
||||
ifnull(sum(running_num + finish_num + max_count_num + suspend_num), 0) AS totalNum
|
||||
FROM retry_summary
|
||||
WHERE namespace_id = #{namespaceId}
|
||||
</select>
|
||||
|
||||
<select id="retryTaskBarList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTaskBar">
|
||||
SELECT tmp.date AS x, ifnull(b.taskTotal, 0) AS taskTotal
|
||||
FROM (SELECT curdate() AS date
|
||||
UNION ALL
|
||||
SELECT DATE_SUB(CURDATE(), INTERVAL 1 DAY) AS date
|
||||
UNION ALL
|
||||
SELECT DATE_SUB(CURDATE(), interval 2 day) AS date
|
||||
UNION ALL
|
||||
SELECT DATE_SUB(CURDATE(), interval 3 day) AS date
|
||||
UNION ALL
|
||||
SELECT DATE_SUB(CURDATE(), interval 4 day) AS date
|
||||
UNION ALL
|
||||
SELECT DATE_SUB(CURDATE(), interval 5 day) AS date
|
||||
UNION ALL
|
||||
SELECT DATE_SUB(CURDATE(), interval 6 day) AS date) tmp
|
||||
LEFT JOIN (SELECT DATE (trigger_at) AS triggerAt,
|
||||
SUM(running_num + finish_num + max_count_num + suspend_num) AS taskTotal FROM retry_summary
|
||||
WHERE namespace_id = #{namespaceId}
|
||||
GROUP BY triggerAt
|
||||
) b
|
||||
ON tmp.date = b.triggerAt
|
||||
</select>
|
||||
|
||||
<select id="retryLineList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO">
|
||||
SELECT
|
||||
<choose>
|
||||
<when test="type == 'DAY'">
|
||||
DATE_FORMAT(create_dt,'%H')
|
||||
</when>
|
||||
<when test="type == 'WEEK'">
|
||||
DATE_FORMAT(create_dt,'%Y-%m-%d')
|
||||
</when>
|
||||
<when test="type =='MONTH'">
|
||||
DATE_FORMAT(create_dt,'%Y-%m-%d')
|
||||
</when>
|
||||
<when test="type == 'YEAR'">
|
||||
DATE_FORMAT(create_dt,'%Y-%m')
|
||||
</when>
|
||||
<otherwise>
|
||||
DATE_FORMAT(create_dt,'%Y-%m-%d')
|
||||
</otherwise>
|
||||
</choose>
|
||||
AS createDt,
|
||||
ifnull(SUM(finish_num), 0) AS successNum,
|
||||
ifnull(SUM(running_num), 0) AS runningNum,
|
||||
ifnull(SUM(max_count_num), 0) AS maxCountNum,
|
||||
ifnull(SUM(suspend_num), 0) AS suspendNum,
|
||||
ifnull(SUM(finish_num + running_num + max_count_num + suspend_num), 0) AS total
|
||||
FROM retry_summary
|
||||
<where>
|
||||
<if test="groupName != null and groupName != '' ">
|
||||
AND group_name = #{groupName}
|
||||
</if>
|
||||
AND namespace_id = #{namespaceId} AND trigger_at BETWEEN #{from} AND #{to}
|
||||
</where>
|
||||
GROUP BY createDt
|
||||
</select>
|
||||
|
||||
<select id="dashboardRank"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Rank">
|
||||
SELECT
|
||||
CONCAT(group_name, '/', scene_name) `name`,
|
||||
SUM(running_num + finish_num + max_count_num + suspend_num) AS total FROM retry_summary
|
||||
<where>
|
||||
<if test="groupName != '' and groupName != null">
|
||||
AND group_name = #{groupName}
|
||||
</if>
|
||||
AND namespace_id = #{namespaceId}
|
||||
AND trigger_at >= #{startTime} AND trigger_at <= #{endTime}
|
||||
</where>
|
||||
GROUP BY namespace_id, group_name, scene_name
|
||||
HAVING total > 0
|
||||
ORDER BY total DESC LIMIT 10
|
||||
</select>
|
||||
|
||||
<select id="retryTaskList"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Task">
|
||||
SELECT group_name AS groupName,
|
||||
sum(CASE WHEN (scene_status = 1) THEN 1 ELSE 0 END) AS run,
|
||||
count(*) AS total
|
||||
FROM scene_config
|
||||
WHERE namespace_id = #{namespaceId}
|
||||
GROUP BY namespace_id, group_name
|
||||
</select>
|
||||
</mapper>
|
@ -21,8 +21,12 @@
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO server_node (group_name, host_id, host_ip, host_port,
|
||||
expire_at, node_type, ext_attrs, context_path, create_dt)
|
||||
VALUES (#{groupName}, #{hostId}, #{hostIp}, #{hostPort},
|
||||
#{expireAt}, #{nodeType}, #{extAttrs}, #{contextPath}, #{createDt})
|
||||
VALUES
|
||||
<foreach collection="records" item="item" index="index" separator=",">
|
||||
(#{item.namespaceId,jdbcType=VARCHAR}, #{item.groupName,jdbcType=VARCHAR}, #{item.hostId,jdbcType=VARCHAR}, #{item.hostIp,jdbcType=VARCHAR},
|
||||
#{item.hostPort,jdbcType=INTEGER}, #{item.expireAt,jdbcType=TIMESTAMP}, #{item.nodeType,jdbcType=TINYINT},
|
||||
#{item.extAttrs,jdbcType=VARCHAR}, #{item.contextPath,jdbcType=VARCHAR}, #{item.createDt,jdbcType=TIMESTAMP})
|
||||
</foreach>
|
||||
ON CONFLICT (host_id, host_ip) DO UPDATE SET expire_at = EXCLUDED.expire_at
|
||||
|
||||
</insert>
|
||||
|
@ -6,8 +6,10 @@ import com.aizuda.easy.retry.server.common.exception.EasyRetryServerException;
|
||||
import com.aizuda.easy.retry.server.web.model.request.UserSessionVO;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.NamespaceMapper;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.SystemUserMapper;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.SystemUserPermissionMapper;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.Namespace;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.SystemUser;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.SystemUserPermission;
|
||||
import com.auth0.jwt.JWT;
|
||||
import com.auth0.jwt.JWTVerifier;
|
||||
import com.auth0.jwt.algorithms.Algorithm;
|
||||
@ -26,7 +28,9 @@ import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 系统登陆认证
|
||||
@ -44,6 +48,8 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
|
||||
private SystemUserMapper systemUserMapper;
|
||||
@Autowired
|
||||
private NamespaceMapper namespaceMapper;
|
||||
@Autowired
|
||||
private SystemUserPermissionMapper systemUserPermissionMapper;
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object object) throws Exception {
|
||||
@ -82,20 +88,31 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
|
||||
throw new EasyRetryServerException("登陆过期,请重新登陆");
|
||||
}
|
||||
|
||||
systemUser = systemUserMapper.selectOne(new LambdaQueryWrapper<SystemUser>().eq(SystemUser::getUsername, systemUser.getUsername()));
|
||||
systemUser = systemUserMapper.selectById(systemUser.getId());
|
||||
if (Objects.isNull(systemUser)) {
|
||||
throw new EasyRetryServerException("{} 用户不存在", systemUser.getUsername());
|
||||
throw new EasyRetryServerException("用户不存在");
|
||||
}
|
||||
|
||||
Long count = namespaceMapper.selectCount(
|
||||
new LambdaQueryWrapper<Namespace>().eq(Namespace::getUniqueId, namespaceId));
|
||||
Assert.isTrue(count > 0, ()->new EasyRetryServerException("[{}] 命名空间不存在", namespaceId));
|
||||
new LambdaQueryWrapper<Namespace>().eq(Namespace::getUniqueId, namespaceId));
|
||||
Assert.isTrue(count > 0, () -> new EasyRetryServerException("[{}] 命名空间不存在", namespaceId));
|
||||
UserSessionVO userSessionVO = new UserSessionVO();
|
||||
userSessionVO.setId(systemUser.getId());
|
||||
userSessionVO.setUsername(systemUser.getUsername());
|
||||
userSessionVO.setRole(systemUser.getRole());
|
||||
userSessionVO.setNamespaceId(namespaceId);
|
||||
|
||||
// 普通用户才获取权限
|
||||
if (userSessionVO.isUser()) {
|
||||
List<SystemUserPermission> systemUserPermissions = systemUserPermissionMapper.selectList(
|
||||
new LambdaQueryWrapper<SystemUserPermission>()
|
||||
.select(SystemUserPermission::getGroupName)
|
||||
.eq(SystemUserPermission::getSystemUserId, systemUser.getId())
|
||||
.eq(SystemUserPermission::getNamespaceId, namespaceId)
|
||||
);
|
||||
userSessionVO.setGroupNames(systemUserPermissions.stream().map(SystemUserPermission::getGroupName).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
httpServletRequest.setAttribute("currentUser", userSessionVO);
|
||||
|
||||
// 验证 token
|
||||
|
@ -1,7 +1,11 @@
|
||||
package com.aizuda.easy.retry.server.web.model.request;
|
||||
|
||||
import com.aizuda.easy.retry.server.web.annotation.RoleEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author xiaowoniu
|
||||
* @date 2023-11-22 22:42:26
|
||||
@ -18,4 +22,14 @@ public final class UserSessionVO {
|
||||
|
||||
private String namespaceId;
|
||||
|
||||
private List<String> groupNames;
|
||||
|
||||
/**
|
||||
* 是否是普通用户
|
||||
*/
|
||||
public boolean isUser() {
|
||||
return Objects.equals(this.role, RoleEnum.USER.getRoleId());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -160,18 +160,24 @@ public class GroupConfigServiceImpl implements GroupConfigService {
|
||||
@Override
|
||||
public PageResult<List<GroupConfigResponseVO>> getGroupConfigForPage(GroupConfigQueryVO queryVO) {
|
||||
|
||||
LambdaQueryWrapper<GroupConfig> groupConfigLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
groupConfigLambdaQueryWrapper.eq(GroupConfig::getNamespaceId,
|
||||
UserSessionUtils.currentUserSession().getNamespaceId());
|
||||
UserSessionVO userSessionVO = UserSessionUtils.currentUserSession();
|
||||
String namespaceId = userSessionVO.getNamespaceId();
|
||||
LambdaQueryWrapper<GroupConfig> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(GroupConfig::getNamespaceId, namespaceId);
|
||||
|
||||
if (userSessionVO.isUser()) {
|
||||
queryWrapper.in(GroupConfig::getGroupName, userSessionVO.getGroupNames());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(queryVO.getGroupName())) {
|
||||
groupConfigLambdaQueryWrapper.like(GroupConfig::getGroupName, queryVO.getGroupName() + "%");
|
||||
queryWrapper.like(GroupConfig::getGroupName, queryVO.getGroupName() + "%");
|
||||
}
|
||||
|
||||
ConfigAccess<GroupConfig> groupConfigAccess = accessTemplate.getGroupConfigAccess();
|
||||
|
||||
groupConfigLambdaQueryWrapper.orderByDesc(GroupConfig::getId);
|
||||
queryWrapper.orderByDesc(GroupConfig::getId);
|
||||
PageDTO<GroupConfig> groupConfigPageDTO = groupConfigAccess.listPage(
|
||||
new PageDTO<>(queryVO.getPage(), queryVO.getSize()), groupConfigLambdaQueryWrapper);
|
||||
new PageDTO<>(queryVO.getPage(), queryVO.getSize()), queryWrapper);
|
||||
List<GroupConfig> records = groupConfigPageDTO.getRecords();
|
||||
if (CollectionUtils.isEmpty(records)) {
|
||||
return new PageResult<>(groupConfigPageDTO.getCurrent(), groupConfigPageDTO.getSize(),
|
||||
@ -289,10 +295,15 @@ public class GroupConfigServiceImpl implements GroupConfigService {
|
||||
|
||||
@Override
|
||||
public List<String> getAllGroupNameList() {
|
||||
ConfigAccess<GroupConfig> groupConfigAccess = accessTemplate.getGroupConfigAccess();
|
||||
|
||||
UserSessionVO userSessionVO = UserSessionUtils.currentUserSession();
|
||||
if (userSessionVO.isUser()) {
|
||||
return userSessionVO.getGroupNames();
|
||||
}
|
||||
|
||||
ConfigAccess<GroupConfig> groupConfigAccess = accessTemplate.getGroupConfigAccess();
|
||||
List<GroupConfig> groupConfigs = groupConfigAccess.list(new LambdaQueryWrapper<GroupConfig>()
|
||||
.in(GroupConfig::getNamespaceId, UserSessionUtils.currentUserSession().getNamespaceId())
|
||||
.eq(GroupConfig::getNamespaceId, userSessionVO.getNamespaceId())
|
||||
.select(GroupConfig::getGroupName))
|
||||
.stream()
|
||||
.collect(Collectors.toList());
|
||||
|
@ -14,6 +14,7 @@ import com.aizuda.easy.retry.server.job.task.support.stop.JobTaskStopFactory;
|
||||
import com.aizuda.easy.retry.server.job.task.support.stop.TaskStopJobContext;
|
||||
import com.aizuda.easy.retry.server.web.model.base.PageResult;
|
||||
import com.aizuda.easy.retry.server.web.model.request.JobBatchQueryVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.UserSessionVO;
|
||||
import com.aizuda.easy.retry.server.web.model.response.JobBatchResponseVO;
|
||||
import com.aizuda.easy.retry.server.web.service.JobBatchService;
|
||||
import com.aizuda.easy.retry.server.web.service.convert.JobBatchResponseVOConverter;
|
||||
@ -26,9 +27,11 @@ import com.aizuda.easy.retry.template.datasource.persistence.po.Job;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.JobTaskBatch;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -51,6 +54,21 @@ public class JobBatchServiceImpl implements JobBatchService {
|
||||
|
||||
PageDTO<JobTaskBatch> pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize());
|
||||
|
||||
UserSessionVO userSessionVO = UserSessionUtils.currentUserSession();
|
||||
List<String> groupNames = Lists.newArrayList();
|
||||
if (userSessionVO.isUser()) {
|
||||
groupNames = userSessionVO.getGroupNames();
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(queryVO.getGroupName())) {
|
||||
// 说明当前组不在用户配置的权限中
|
||||
if (!CollectionUtils.isEmpty(groupNames) && !groupNames.contains(queryVO.getGroupName())) {
|
||||
return new PageResult<>(pageDTO, Lists.newArrayList());
|
||||
} else {
|
||||
groupNames = Lists.newArrayList(queryVO.getGroupName());
|
||||
}
|
||||
}
|
||||
|
||||
JobBatchQueryDO jobBatchQueryDO = new JobBatchQueryDO();
|
||||
if (StrUtil.isNotBlank(queryVO.getJobName())) {
|
||||
jobBatchQueryDO.setJobName(queryVO.getJobName() + "%");
|
||||
@ -58,8 +76,8 @@ public class JobBatchServiceImpl implements JobBatchService {
|
||||
|
||||
jobBatchQueryDO.setJobId(queryVO.getJobId());
|
||||
jobBatchQueryDO.setTaskBatchStatus(queryVO.getTaskBatchStatus());
|
||||
jobBatchQueryDO.setGroupName(queryVO.getGroupName());
|
||||
jobBatchQueryDO.setNamespaceId(UserSessionUtils.currentUserSession().getNamespaceId());
|
||||
jobBatchQueryDO.setGroupNames(groupNames);
|
||||
jobBatchQueryDO.setNamespaceId(userSessionVO.getNamespaceId());
|
||||
List<JobBatchResponseDO> batchResponseDOList = jobTaskBatchMapper.selectJobBatchPageList(pageDTO, jobBatchQueryDO);
|
||||
|
||||
List<JobBatchResponseVO> batchResponseVOList = JobBatchResponseVOConverter.INSTANCE.toJobBatchResponseVOs(
|
||||
|
@ -7,6 +7,7 @@ import com.aizuda.easy.retry.server.common.exception.EasyRetryServerException;
|
||||
import com.aizuda.easy.retry.server.web.model.base.PageResult;
|
||||
import com.aizuda.easy.retry.server.web.model.request.JobNotifyConfigQueryVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.JobNotifyConfigRequestVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.UserSessionVO;
|
||||
import com.aizuda.easy.retry.server.web.model.response.JobNotifyConfigResponseVO;
|
||||
import com.aizuda.easy.retry.server.web.service.JobNotifyConfigService;
|
||||
import com.aizuda.easy.retry.server.web.service.convert.JobNotifyConfigConverter;
|
||||
@ -17,11 +18,14 @@ import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatch
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobNotifyConfigQueryDO;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobNotifyConfigResponseDO;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobNotifyConfigMapper;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.Job;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.JobNotifyConfig;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@ -41,11 +45,25 @@ public class JobNotifyConfigServiceImpl implements JobNotifyConfigService {
|
||||
@Override
|
||||
public PageResult<List<JobNotifyConfigResponseVO>> getJobNotifyConfigList(JobNotifyConfigQueryVO queryVO) {
|
||||
PageDTO<JobNotifyConfig> pageDTO = new PageDTO<>();
|
||||
UserSessionVO userSessionVO = UserSessionUtils.currentUserSession();
|
||||
JobNotifyConfigQueryDO jobNotifyConfigQueryDO = new JobNotifyConfigQueryDO();
|
||||
jobNotifyConfigQueryDO.setNamespaceId(UserSessionUtils.currentUserSession().getNamespaceId());
|
||||
if (StrUtil.isNotBlank(queryVO.getGroupName())) {
|
||||
jobNotifyConfigQueryDO.setGroupName(queryVO.getGroupName());
|
||||
jobNotifyConfigQueryDO.setNamespaceId(userSessionVO.getNamespaceId());
|
||||
|
||||
List<String> groupNames = Lists.newArrayList();
|
||||
if (userSessionVO.isUser()) {
|
||||
groupNames = userSessionVO.getGroupNames();
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(queryVO.getGroupName())) {
|
||||
// 说明当前组不在用户配置的权限中
|
||||
if (!CollectionUtils.isEmpty(groupNames) && !groupNames.contains(queryVO.getGroupName())) {
|
||||
return new PageResult<>(pageDTO, Lists.newArrayList());
|
||||
} else {
|
||||
groupNames = Lists.newArrayList(queryVO.getGroupName());
|
||||
}
|
||||
}
|
||||
|
||||
jobNotifyConfigQueryDO.setGroupNames(groupNames);
|
||||
if (Objects.nonNull(queryVO.getJobId())) {
|
||||
jobNotifyConfigQueryDO.setJobId(queryVO.getJobId());
|
||||
}
|
||||
|
@ -19,12 +19,14 @@ import com.aizuda.easy.retry.server.web.model.base.PageResult;
|
||||
import com.aizuda.easy.retry.server.web.model.request.JobQueryVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.JobRequestVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.JobUpdateJobStatusRequestVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.UserSessionVO;
|
||||
import com.aizuda.easy.retry.server.web.model.response.JobResponseVO;
|
||||
import com.aizuda.easy.retry.server.web.service.JobService;
|
||||
import com.aizuda.easy.retry.server.web.service.convert.JobConverter;
|
||||
import com.aizuda.easy.retry.server.web.service.convert.JobResponseVOConverter;
|
||||
import com.aizuda.easy.retry.server.web.util.UserSessionUtils;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobMapper;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.GroupConfig;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.Job;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
@ -58,10 +60,15 @@ public class JobServiceImpl implements JobService {
|
||||
public PageResult<List<JobResponseVO>> getJobPage(JobQueryVO queryVO) {
|
||||
|
||||
PageDTO<Job> pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize());
|
||||
|
||||
UserSessionVO userSessionVO = UserSessionUtils.currentUserSession();
|
||||
LambdaQueryWrapper<Job> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Job::getDeleted, StatusEnum.NO.getStatus());
|
||||
queryWrapper.eq(Job::getNamespaceId, UserSessionUtils.currentUserSession().getNamespaceId());
|
||||
queryWrapper.eq(Job::getNamespaceId, userSessionVO.getNamespaceId());
|
||||
|
||||
if (userSessionVO.isUser()) {
|
||||
queryWrapper.in(Job::getGroupName, userSessionVO.getGroupNames());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(queryVO.getGroupName())) {
|
||||
queryWrapper.eq(Job::getGroupName, queryVO.getGroupName());
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import com.aizuda.easy.retry.server.common.exception.EasyRetryServerException;
|
||||
import com.aizuda.easy.retry.server.web.model.base.PageResult;
|
||||
import com.aizuda.easy.retry.server.web.model.request.NotifyConfigQueryVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.NotifyConfigRequestVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.UserSessionVO;
|
||||
import com.aizuda.easy.retry.server.web.model.response.NotifyConfigResponseVO;
|
||||
import com.aizuda.easy.retry.server.web.service.NotifyConfigService;
|
||||
import com.aizuda.easy.retry.server.web.service.convert.NotifyConfigConverter;
|
||||
@ -14,6 +15,7 @@ import com.aizuda.easy.retry.server.web.service.convert.NotifyConfigResponseVOCo
|
||||
import com.aizuda.easy.retry.server.web.util.UserSessionUtils;
|
||||
import com.aizuda.easy.retry.template.datasource.access.AccessTemplate;
|
||||
import com.aizuda.easy.retry.template.datasource.access.ConfigAccess;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.GroupConfig;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.NotifyConfig;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
@ -37,14 +39,22 @@ public class NotifyConfigServiceImpl implements NotifyConfigService {
|
||||
public PageResult<List<NotifyConfigResponseVO>> getNotifyConfigList(NotifyConfigQueryVO queryVO) {
|
||||
PageDTO<NotifyConfig> pageDTO = new PageDTO<>();
|
||||
|
||||
UserSessionVO userSessionVO = UserSessionUtils.currentUserSession();
|
||||
LambdaQueryWrapper<NotifyConfig> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(NotifyConfig::getNamespaceId, UserSessionUtils.currentUserSession().getNamespaceId());
|
||||
queryWrapper.eq(NotifyConfig::getNamespaceId, userSessionVO.getNamespaceId());
|
||||
|
||||
if (userSessionVO.isUser()) {
|
||||
queryWrapper.in(NotifyConfig::getGroupName, userSessionVO.getGroupNames());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(queryVO.getGroupName())) {
|
||||
queryWrapper.eq(NotifyConfig::getGroupName, queryVO.getGroupName());
|
||||
}
|
||||
if (StrUtil.isNotBlank(queryVO.getSceneName())) {
|
||||
queryWrapper.eq(NotifyConfig::getSceneName, queryVO.getSceneName());
|
||||
}
|
||||
|
||||
queryWrapper.orderByDesc(NotifyConfig::getId);
|
||||
List<NotifyConfig> notifyConfigs = accessTemplate.getNotifyConfigAccess().listPage(pageDTO, queryWrapper).getRecords();
|
||||
return new PageResult<>(pageDTO, NotifyConfigResponseVOConverter.INSTANCE.batchConvert(notifyConfigs));
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.easy.retry.server.web.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.easy.retry.server.web.model.request.UserSessionVO;
|
||||
import com.aizuda.easy.retry.server.web.util.UserSessionUtils;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.RetryTaskLogMapper;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.RetryTaskLogMessageMapper;
|
||||
@ -8,6 +9,7 @@ import com.aizuda.easy.retry.template.datasource.persistence.po.RetryTaskLog;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.RetryTaskLogMessage;
|
||||
import com.aizuda.easy.retry.server.web.model.request.RetryTaskLogMessageQueryVO;
|
||||
import com.aizuda.easy.retry.server.web.model.response.RetryTaskLogMessageResponseVO;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.SceneConfig;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.aizuda.easy.retry.server.web.model.base.PageResult;
|
||||
@ -35,11 +37,16 @@ public class RetryTaskLogServiceImpl implements RetryTaskLogService {
|
||||
@Override
|
||||
public PageResult<List<RetryTaskLogResponseVO>> getRetryTaskLogPage(RetryTaskLogQueryVO queryVO) {
|
||||
|
||||
String namespaceId = UserSessionUtils.currentUserSession().getNamespaceId();
|
||||
UserSessionVO userSessionVO = UserSessionUtils.currentUserSession();
|
||||
String namespaceId = userSessionVO.getNamespaceId();
|
||||
PageDTO<RetryTaskLog> pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize());
|
||||
LambdaQueryWrapper<RetryTaskLog> retryTaskLogLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
retryTaskLogLambdaQueryWrapper.eq(RetryTaskLog::getNamespaceId, namespaceId);
|
||||
|
||||
if (userSessionVO.isUser()) {
|
||||
retryTaskLogLambdaQueryWrapper.in(RetryTaskLog::getGroupName, userSessionVO.getGroupNames());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(queryVO.getGroupName())) {
|
||||
retryTaskLogLambdaQueryWrapper.eq(RetryTaskLog::getGroupName, queryVO.getGroupName());
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import com.aizuda.easy.retry.server.common.strategy.WaitStrategies;
|
||||
import com.aizuda.easy.retry.server.web.model.base.PageResult;
|
||||
import com.aizuda.easy.retry.server.web.model.request.SceneConfigQueryVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.SceneConfigRequestVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.UserSessionVO;
|
||||
import com.aizuda.easy.retry.server.web.model.response.SceneConfigResponseVO;
|
||||
import com.aizuda.easy.retry.server.web.service.SceneConfigService;
|
||||
import com.aizuda.easy.retry.server.web.service.convert.SceneConfigConverter;
|
||||
@ -16,6 +17,7 @@ import com.aizuda.easy.retry.server.web.service.convert.SceneConfigResponseVOCon
|
||||
import com.aizuda.easy.retry.server.web.util.UserSessionUtils;
|
||||
import com.aizuda.easy.retry.template.datasource.access.AccessTemplate;
|
||||
import com.aizuda.easy.retry.template.datasource.access.ConfigAccess;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.NotifyConfig;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.SceneConfig;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@ -42,9 +44,15 @@ public class SceneConfigServiceImpl implements SceneConfigService {
|
||||
public PageResult<List<SceneConfigResponseVO>> getSceneConfigPageList(SceneConfigQueryVO queryVO) {
|
||||
PageDTO<SceneConfig> pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize());
|
||||
|
||||
String namespaceId = UserSessionUtils.currentUserSession().getNamespaceId();
|
||||
UserSessionVO userSessionVO = UserSessionUtils.currentUserSession();
|
||||
String namespaceId = userSessionVO.getNamespaceId();
|
||||
LambdaQueryWrapper<SceneConfig> sceneConfigLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
sceneConfigLambdaQueryWrapper.eq(SceneConfig::getNamespaceId, namespaceId);
|
||||
|
||||
if (userSessionVO.isUser()) {
|
||||
sceneConfigLambdaQueryWrapper.in(SceneConfig::getGroupName, userSessionVO.getGroupNames());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(queryVO.getGroupName())) {
|
||||
sceneConfigLambdaQueryWrapper.eq(SceneConfig::getGroupName, queryVO.getGroupName().trim());
|
||||
}
|
||||
|
@ -12,7 +12,8 @@
|
||||
hidden
|
||||
v-decorator="['id']" />
|
||||
</a-form-item>
|
||||
<a-form-item label="通知场景">
|
||||
<a-form-item>
|
||||
<span slot="label">通知场景 <a :href="officialWebsite + '/pages/571499/' +''" target="_blank"> <a-icon type="question-circle-o" /></a></span>
|
||||
<a-select
|
||||
placeholder="通知场景"
|
||||
style="width: 100%;"
|
||||
@ -71,7 +72,8 @@
|
||||
</a-row>
|
||||
<a-row class="form-row" :gutter="16">
|
||||
<a-col :lg="8" :md="12" :sm="12">
|
||||
<a-form-item label="通知类型">
|
||||
<a-form-item>
|
||||
<span slot="label">通知类型 <a :href="officialWebsite + '/pages/6dbf43/' +''" target="_blank"> <a-icon type="question-circle-o" /></a></span>
|
||||
<a-select
|
||||
@change="handleChange"
|
||||
placeholder="通知类型"
|
||||
@ -163,7 +165,7 @@
|
||||
]" />
|
||||
</a-form-item>
|
||||
<a-form-item v-if="this.tempNotifyTypeValue === '1'">
|
||||
<span slot="label">被@人手机号或钉钉号 <a :href="officialWebsite + '/pages/32e4a0/#被@人手机号是何物' +''" target="_blank"> <a-icon type="question-circle-o" /></a></span>
|
||||
<span slot="label">被@人手机号或钉钉号 </span>
|
||||
<a-input
|
||||
placeholder="请输入被@人手机号或钉钉号"
|
||||
type="textarea"
|
||||
@ -185,7 +187,7 @@
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
v-if="this.tempNotifyTypeValue === '4'">
|
||||
<span slot="label">被@负责人用户id <a :href="officialWebsite + '/pages/32e4a0/#被@人open_id是何物' +''" target="_blank"> <a-icon type="question-circle-o" /></a></span>
|
||||
<span slot="label">被@负责人用户id</span>
|
||||
<a-input
|
||||
placeholder="请输入被@人open_id"
|
||||
type="textarea"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<page-header-wrapper content="场景配置" @back="() => $router.go(-1)" style="margin: -24px -1px 0">
|
||||
<page-header-wrapper content="通知配置" @back="() => $router.go(-1)" style="margin: -24px -1px 0">
|
||||
<div></div>
|
||||
</page-header-wrapper>
|
||||
<a-card :body-style="{padding: '24px 32px'}" :bordered="false" :loading="loading">
|
||||
@ -12,7 +12,8 @@
|
||||
hidden
|
||||
v-decorator="['id']" />
|
||||
</a-form-item>
|
||||
<a-form-item label="通知场景">
|
||||
<a-form-item>
|
||||
<span slot="label">通知场景 <a :href="officialWebsite + '/pages/038b42/' +''" target="_blank"> <a-icon type="question-circle-o" /></a></span>
|
||||
<a-select
|
||||
placeholder="通知场景"
|
||||
style="width: 100%;"
|
||||
@ -72,7 +73,8 @@
|
||||
</a-row>
|
||||
<a-row class="form-row" :gutter="16">
|
||||
<a-col :lg="8" :md="12" :sm="12">
|
||||
<a-form-item label="通知类型">
|
||||
<a-form-item>
|
||||
<span slot="label">通知类型 <a :href="officialWebsite + '/pages/6dbf43/' +''" target="_blank"> <a-icon type="question-circle-o" /></a></span>
|
||||
<a-select
|
||||
@change="handleChange"
|
||||
placeholder="通知类型"
|
||||
@ -164,7 +166,7 @@
|
||||
]" />
|
||||
</a-form-item>
|
||||
<a-form-item v-if="this.tempNotifyTypeValue === '1'">
|
||||
<span slot="label">被@人手机号或钉钉号 <a :href="officialWebsite + '/pages/32e4a0/#被被@人手机号或钉钉号是何物' +''" target="_blank"> <a-icon type="question-circle-o" /></a></span>
|
||||
<span slot="label">被@人手机号或钉钉号 </span>
|
||||
<a-input
|
||||
placeholder="请输入被@人手机号或钉钉号"
|
||||
type="textarea"
|
||||
@ -186,7 +188,7 @@
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
v-if="this.tempNotifyTypeValue === '4'">
|
||||
<span slot="label">被@人用户id <a :href="officialWebsite + '/pages/32e4a0/#被@人open_id是何物' +''" target="_blank"> <a-icon type="question-circle-o" /></a></span>
|
||||
<span slot="label">被@人用户id </span>
|
||||
<a-input
|
||||
placeholder="请输入被@人open_id"
|
||||
type="textarea"
|
||||
|
Loading…
Reference in New Issue
Block a user