Merge remote-tracking branch 'origin/fix-bug-202303' into fix-bug-202303

This commit is contained in:
zer0Black
2023-03-03 11:10:59 +08:00
13 changed files with 135 additions and 97 deletions
@@ -1,5 +1,6 @@
package com.jero.modules.message.util;
import com.alibaba.fastjson.JSON;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
@@ -66,7 +67,7 @@ public class PushMsgUtil {
content = stringWriter.toString();
sysMessage.setEsTitle(title);
sysMessage.setEsContent(content);
sysMessage.setEsParam(JSONObject.toJSONString(map));
sysMessage.setEsParam(JSON.toJSONString(map));
sysMessage.setEsSendTime(new Date());
sysMessage.setEsSendStatus(SendMsgStatusEnum.WAIT.getCode());
sysMessage.setEsSendNum(0);
@@ -1,66 +1,66 @@
<template>
<div class="j-easy-cron">
<div class="content">
<div class='j-easy-cron'>
<div class='content'>
<div>
<a-tabs size="small" v-model="curtab">
<a-tab-pane tab="" key="second" v-if="!hideSecond">
<second-ui v-model="second" :disabled="disabled"></second-ui>
<a-tabs size='small' v-model='curtab'>
<a-tab-pane tab='秒' key='second' v-if='!hideSecond'>
<second-ui v-model='second' :disabled='disabled'></second-ui>
</a-tab-pane>
<a-tab-pane tab="" key="minute">
<minute-ui v-model="minute" :disabled="disabled"></minute-ui>
<a-tab-pane tab='分' key='minute'>
<minute-ui v-model='minute' :disabled='disabled'></minute-ui>
</a-tab-pane>
<a-tab-pane tab="" key="hour">
<hour-ui v-model="hour" :disabled="disabled"></hour-ui>
<a-tab-pane tab='时' key='hour'>
<hour-ui v-model='hour' :disabled='disabled'></hour-ui>
</a-tab-pane>
<a-tab-pane tab="" key="day">
<day-ui v-model="day" :week="week" :disabled="disabled"></day-ui>
<a-tab-pane tab='日' key='day'>
<day-ui v-model='day' :week='week' :disabled='disabled'></day-ui>
</a-tab-pane>
<a-tab-pane tab="" key="month">
<month-ui v-model="month" :disabled="disabled"></month-ui>
<a-tab-pane tab='月' key='month'>
<month-ui v-model='month' :disabled='disabled'></month-ui>
</a-tab-pane>
<a-tab-pane tab="" key="week">
<week-ui v-model="week" :day="day" :disabled="disabled"></week-ui>
<a-tab-pane tab='周' key='week'>
<week-ui v-model='week' :day='day' :disabled='disabled'></week-ui>
</a-tab-pane>
<a-tab-pane tab="" key="year" v-if="!hideYear && !hideSecond">
<year-ui v-model="year" :disabled="disabled"></year-ui>
<a-tab-pane tab='年' key='year' v-if='!hideYear && !hideSecond'>
<year-ui v-model='year' :disabled='disabled'></year-ui>
</a-tab-pane>
</a-tabs>
</div>
<a-divider/>
<a-divider />
<!-- 执行时间预览 -->
<a-row :gutter="8">
<a-col :span="18" style="margin-top: 22px;">
<a-row :gutter="8">
<a-col :span="8" style="margin-bottom: 8px;">
<a-input addon-before="" v-model="inputValues.second" @blur="onInputBlur"/>
<a-row :gutter='8'>
<a-col :span='18' style='margin-top: 22px;'>
<a-row :gutter='8'>
<a-col :span='8' style='margin-bottom: 8px;'>
<a-input addon-before='秒' v-model='inputValues.second' @blur='onInputBlur' />
</a-col>
<a-col :span="8" style="margin-bottom: 8px;">
<a-input addon-before="" v-model="inputValues.minute" @blur="onInputBlur"/>
<a-col :span='8' style='margin-bottom: 8px;'>
<a-input addon-before='分' v-model='inputValues.minute' @blur='onInputBlur' />
</a-col>
<a-col :span="8" style="margin-bottom: 8px;">
<a-input addon-before="" v-model="inputValues.hour" @blur="onInputBlur"/>
<a-col :span='8' style='margin-bottom: 8px;'>
<a-input addon-before='时' v-model='inputValues.hour' @blur='onInputBlur' />
</a-col>
<a-col :span="8" style="margin-bottom: 8px;">
<a-input addon-before="" v-model="inputValues.day" @blur="onInputBlur"/>
<a-col :span='8' style='margin-bottom: 8px;'>
<a-input addon-before='日' v-model='inputValues.day' @blur='onInputBlur' />
</a-col>
<a-col :span="8" style="margin-bottom: 8px;">
<a-input addon-before="" v-model="inputValues.month" @blur="onInputBlur"/>
<a-col :span='8' style='margin-bottom: 8px;'>
<a-input addon-before='月' v-model='inputValues.month' @blur='onInputBlur' />
</a-col>
<a-col :span="8" style="margin-bottom: 8px;">
<a-input addon-before="" v-model="inputValues.week" @blur="onInputBlur"/>
<a-col :span='8' style='margin-bottom: 8px;'>
<a-input addon-before='周' v-model='inputValues.week' @blur='onInputBlur' />
</a-col>
<a-col :span="8" style="margin-bottom: 8px;">
<a-input addon-before="" v-model="inputValues.year" @blur="onInputBlur"/>
<a-col :span='8' style='margin-bottom: 8px;'>
<a-input addon-before='年' v-model='inputValues.year' @blur='onInputBlur' />
</a-col>
<a-col :span="16" style="margin-bottom: 8px;">
<a-input addon-before="Cron" v-model="inputValues.cron" @blur="onInputCronBlur"/>
<a-col :span='16' style='margin-bottom: 8px;'>
<a-input addon-before='Cron' v-model='inputValues.cron' @blur='onInputCronBlur' />
</a-col>
</a-row>
</a-col>
<a-col :span="6">
<a-col :span='6'>
<div>近十次执行时间不含年</div>
<a-textarea type="textarea" :value="preTimeList" :rows="5"/>
<a-textarea type='textarea' :value='preTimeList' :rows='5' />
</a-col>
</a-row>
</div>
@@ -152,14 +152,14 @@ export default {
}
},
watch: {
cronValue (newVal, oldVal) {
cronValue (newVal) {
if (newVal === this.cronValue_c) {
// console.info('same cron value: ' + newVal)
return
}
this.formatValue()
},
cronValue_c (newVal, oldVal) {
cronValue_c (newVal) {
this.calTriggerList()
this.$emit('change', newVal)
this.assignInput()
@@ -230,6 +230,38 @@ export default {
if (values.length > i) this.year = values[i]
this.assignInput()
},
// 将 Quartz 星期 的规则转换为 CronParser 的规则:
// Quartz 的规则:1 = 周日,2 = 周一,3 = 周二,4 = 周三,5 = 周四,6 = 周五,7 = 周六
// CronParser 的规则: 0 = 周日,1 = 周一,2 = 周二,3 = 周三,4 = 周四,5 = 周五,6 = 周六,7 = 周日
convertQuartzWeekToCParser (week) {
const convert = (v) => {
if (v === '0') {
return '1'
}
if (v === '1') {
return '0'
}
return (Number.parseInt(v) - 1).toString()
}
// 匹配示例 1-7 or 1/7
const patten1 = /^([0-7])([-/])([0-7])$/
// 匹配示例 1,4,7
const patten2 = /^([0-7])(,[0-7])+$/
if (/^[0-7]$/.test(week)) {
return convert(week)
} else if (patten1.test(week)) {
return week.replace(patten1, ($0, before, separator, after) => {
if (separator === '/') {
return convert(before) + separator + after
} else {
return convert(before) + separator + convert(after)
}
})
} else if (patten2.test(week)) {
return week.split(',').map(v => convert(v)).join(',')
}
return week
},
calTriggerList: simpleDebounce(function () {
this.calTriggerListInner()
}, 500),
@@ -272,14 +304,14 @@ export default {
}
</script>
<style scoped lang="less">
.j-easy-cron {
<style scoped lang='less'>
.j-easy-cron {
/deep/ .content {
.ant-checkbox-wrapper + .ant-checkbox-wrapper {
margin-left: 0;
}
/deep/ .content {
.ant-checkbox-wrapper + .ant-checkbox-wrapper {
margin-left: 0;
}
}
}
</style>
@@ -70,13 +70,13 @@ export default {
}
},
watch: {
cronValue (newVal, oldVal) {
cronValue (newVal) {
if (newVal === this.editCronValue) {
return
}
this.editCronValue = newVal
},
editCronValue (newVal, oldVal) {
editCronValue (newVal) {
this.$emit('change', newVal)
}
},
@@ -1,45 +1,50 @@
<template>
<div class="config-list">
<a-radio-group v-model="type">
<div class="item">
<a-radio value="TYPE_NOT_SET" class="choice" :disabled="disableChoice">不设置</a-radio>
<span class="tip-info">日和周只能设置其中之一</span>
<div class='config-list'>
<a-radio-group v-model='type'>
<div class='item'>
<a-radio value='TYPE_NOT_SET' class='choice' :disabled='disableChoice'>不设置</a-radio>
<span class='tip-info'>日和周只能设置其中之一</span>
</div>
<div class="item">
<a-radio value="TYPE_EVERY" class="choice" :disabled="disableChoice">每日</a-radio>
<div class='item'>
<a-radio value='TYPE_EVERY' class='choice' :disabled='disableChoice'>每日</a-radio>
</div>
<div class="item">
<a-radio value="TYPE_RANGE" class="choice" :disabled="disableChoice">区间</a-radio>
<div class='item'>
<a-radio value='TYPE_RANGE' class='choice' :disabled='disableChoice'>区间</a-radio>
<a-input-number :disabled="type!==TYPE_RANGE || disableChoice" :max="maxValue" :min="minValue" :precision="0" class="w60" v-model="valueRange.start"/>
<a-input-number :disabled='type!==TYPE_RANGE || disableChoice' :max='maxValue' :min='minValue' :precision='0' class='w60'
v-model='valueRange.start' />
<a-input-number :disabled="type!==TYPE_RANGE || disableChoice" :max="maxValue" :min="minValue" :precision="0" class="w60" v-model="valueRange.end"/>
<a-input-number :disabled='type!==TYPE_RANGE || disableChoice' :max='maxValue' :min='minValue' :precision='0' class='w60'
v-model='valueRange.end' />
</div>
<div class="item">
<a-radio value="TYPE_LOOP" class="choice" :disabled="disableChoice">循环</a-radio>
<div class='item'>
<a-radio value='TYPE_LOOP' class='choice' :disabled='disableChoice'>循环</a-radio>
<a-input-number :disabled="type!==TYPE_LOOP || disableChoice" :max="maxValue" :min="minValue" :precision="0" class="w60" v-model="valueLoop.start"/>
<a-input-number :disabled='type!==TYPE_LOOP || disableChoice' :max='maxValue' :min='minValue' :precision='0' class='w60'
v-model='valueLoop.start' />
日开始间隔
<a-input-number :disabled="type!==TYPE_LOOP || disableChoice" :max="maxValue" :min="minValue" :precision="0" class="w60" v-model="valueLoop.interval"/>
<a-input-number :disabled='type!==TYPE_LOOP || disableChoice' :max='maxValue' :min='minValue' :precision='0' class='w60'
v-model='valueLoop.interval' />
</div>
<div class="item">
<a-radio value="TYPE_WORK" class="choice" :disabled="disableChoice">工作日</a-radio>
<div class='item'>
<a-radio value='TYPE_WORK' class='choice' :disabled='disableChoice'>工作日</a-radio>
本月
<a-input-number :disabled="type!==TYPE_WORK || disableChoice" :max="maxValue" :min="minValue" :precision="0" class="w60" v-model="valueWork"/>
<a-input-number :disabled='type!==TYPE_WORK || disableChoice' :max='maxValue' :min='minValue' :precision='0' class='w60'
v-model='valueWork' />
最近的工作日
</div>
<div class="item">
<a-radio value="TYPE_LAST" class="choice" :disabled="disableChoice">最后一日</a-radio>
<div class='item'>
<a-radio value='TYPE_LAST' class='choice' :disabled='disableChoice'>最后一日</a-radio>
</div>
<div class="item">
<a-radio value="TYPE_SPECIFY" class="choice" :disabled="disableChoice">指定</a-radio>
<div class="list">
<a-checkbox-group v-model="valueList">
<template v-for="i of specifyRange">
<a-checkbox class="list-check-item" :key="`key-${i}`" :value="i" :disabled="type!==TYPE_SPECIFY || disabled">{{i}}</a-checkbox>
<div class='item'>
<a-radio value='TYPE_SPECIFY' class='choice' :disabled='disableChoice'>指定</a-radio>
<div class='list'>
<a-checkbox-group v-model='valueList'>
<template v-for='i of specifyRange'>
<a-checkbox class='list-check-item' :key='`key-${i}`' :value='i' :disabled='type!==TYPE_SPECIFY || disabled'>{{ i }}</a-checkbox>
</template>
</a-checkbox-group>
</div>
@@ -69,11 +74,11 @@ export default {
}
},
watch: {
value_c (newVal, oldVal) {
value_c () {
// 数值变化
this.updateValue()
},
week (newVal, oldVal) {
week () {
// console.info('new week: ' + newVal)
this.updateValue()
}
@@ -96,6 +101,6 @@ export default {
}
</script>
<style lang="less" scoped>
@import "mixin.less";
<style lang='less' scoped>
@import "mixin.less";
</style>
@@ -45,7 +45,7 @@ export default {
return {}
},
watch: {
value_c (newVal, oldVal) {
value_c (newVal) {
this.$emit('change', newVal)
}
},
@@ -45,7 +45,7 @@ export default {
return {}
},
watch: {
value_c (newVal, oldVal) {
value_c (newVal) {
this.$emit('change', newVal)
}
},
@@ -54,11 +54,12 @@ export default {
valueList: [],
valueWork: 1,
maxValue: 0,
minValue: 0
minValue: 0,
valueLast: null
}
},
watch: {
prop (newVal, oldVal) {
prop (newVal) {
if (newVal === this.value_c) {
// console.info('skip ' + newVal)
return
@@ -45,7 +45,7 @@ export default {
return {}
},
watch: {
value_c (newVal, oldVal) {
value_c (newVal) {
this.$emit('change', newVal)
}
},
@@ -45,7 +45,7 @@ export default {
return {}
},
watch: {
value_c (newVal, oldVal) {
value_c (newVal) {
this.$emit('change', newVal)
}
},
@@ -10,13 +10,13 @@
<a-select v-model="valueRange.start" class="w80" :disabled="type!==TYPE_RANGE || disableChoice">
<template v-for="(v, k) of WEEK_MAP">
<a-select-option :value="v">{{k}}</a-select-option>
<a-select-option :value="v" :key='v'>{{k}}</a-select-option>
</template>
</a-select>
<a-select v-model="valueRange.end" class="w80" :disabled="type!==TYPE_RANGE || disableChoice">
<template v-for="(v, k) of WEEK_MAP">
<a-select-option :value="v">{{k}}</a-select-option>
<a-select-option :value="v" :key='v'>{{k}}</a-select-option>
</template>
</a-select>
</div>
@@ -25,7 +25,7 @@
<a-select v-model="valueLoop.start" class="w80" :disabled="type!==TYPE_LOOP || disableChoice">
<template v-for="(v, k) of WEEK_MAP">
<a-select-option :value="v">{{k}}</a-select-option>
<a-select-option :value="v" :key='v'>{{k}}</a-select-option>
</template>
</a-select>
开始,间隔
@@ -82,11 +82,11 @@ export default {
}
},
watch: {
value_c (newVal, oldVal) {
value_c () {
// 如果设置日,那么星期就直接不设置
this.updateValue()
},
day (newVal) {
day () {
// console.info('new day: ' + newVal)
this.updateValue()
}
@@ -35,7 +35,7 @@ export default {
return {}
},
watch: {
value_c (newVal, oldVal) {
value_c (newVal) {
// console.info('change:' + newVal)
this.$emit('change', newVal)
}
@@ -17,7 +17,7 @@ export default (rule, value, callback) => {
if (values.length === 7) {
const year = replaceWeekName(values[6])
if (year !== '*' && year !== '?') {
let yearValues = []
let yearValues
if (year.indexOf('-') >= 0) {
yearValues = year.split('-')
} else if (year.indexOf('/')) {
@@ -102,7 +102,7 @@ export default {
this.editor.setMarkdown(newValue)
}
},
language (val) {
language () {
this.destroyEditor()
this.initEditor()
},
@@ -137,7 +137,6 @@ export default {
*/
// 获取编辑器上的功能条
const toolbar = this.editor.getUI().getToolbar()
const fileDom = this.$refs.files
// 添加图片点击事件
this.editor.eventManager.addEventType('isShowClickEvent')
this.editor.eventManager.listen('isShowClickEvent', () => {
@@ -184,7 +183,7 @@ export default {
return this.editor.getHtml()
},
handleOk () {
if (this.index == '1') {
if (this.index === '1') {
this.imageUrl = getFileAccessHttpUrl(this.fileList)
if (this.remark) {
this.addImgToMd(this.imageUrl, this.remark)