feat(sj_1.0.0): 优化通知人查询和服务端注册

This commit is contained in:
opensnail 2024-04-19 12:35:17 +08:00
parent 755ed044d7
commit 699f716fc5
5 changed files with 24 additions and 5 deletions

View File

@ -30,7 +30,7 @@ public class QiYeWechatAlarm extends AbstractAlarm<AlarmContext> {
@Override @Override
public Integer getAlarmType() { public Integer getAlarmType() {
return AlarmTypeEnum.QI_YE_WECHAT.getValue(); return AlarmTypeEnum.WE_COM.getValue();
} }
@Override @Override

View File

@ -19,9 +19,9 @@ public enum AlarmTypeEnum {
EMAIL(2), EMAIL(2),
/** /**
* 企业通知 * 企业微信通知
*/ */
QI_YE_WECHAT(3), WE_COM(3),
/** /**
* 飞书 * 飞书

View File

@ -131,9 +131,12 @@ public class ServerRegister extends AbstractRegister {
public void start() { public void start() {
SnailJobLog.LOCAL.info("ServerRegister start"); SnailJobLog.LOCAL.info("ServerRegister start");
Register register = SpringContext.getBean(ServerRegister.BEAN_NAME, Register.class);
serverRegisterNode.scheduleAtFixedRate(()->{ serverRegisterNode.scheduleAtFixedRate(()->{
register.register(new RegisterContext()); try {
this.register(new RegisterContext());
} catch (Exception e) {
SnailJobLog.LOCAL.error("服务端注册失败", e);
}
}, 0, DELAY_TIME * 2 / 3, TimeUnit.SECONDS); }, 0, DELAY_TIME * 2 / 3, TimeUnit.SECONDS);
} }

View File

@ -1,11 +1,17 @@
package com.aizuda.snailjob.server.web.model.request; package com.aizuda.snailjob.server.web.model.request;
import com.aizuda.snailjob.server.web.model.base.BaseQueryVO; import com.aizuda.snailjob.server.web.model.base.BaseQueryVO;
import lombok.Data;
/** /**
* @author opensnail * @author opensnail
* @date 2024-04-17 21:26:22 * @date 2024-04-17 21:26:22
* @since sj_1.0.0 * @since sj_1.0.0
*/ */
@Data
public class NotifyRecipientQueryVO extends BaseQueryVO { public class NotifyRecipientQueryVO extends BaseQueryVO {
private Integer notifyType;
private String recipientName;
} }

View File

@ -1,5 +1,6 @@
package com.aizuda.snailjob.server.web.service.impl; package com.aizuda.snailjob.server.web.service.impl;
import cn.hutool.core.util.StrUtil;
import com.aizuda.snailjob.server.web.model.base.PageResult; import com.aizuda.snailjob.server.web.model.base.PageResult;
import com.aizuda.snailjob.server.web.model.request.NotifyRecipientQueryVO; import com.aizuda.snailjob.server.web.model.request.NotifyRecipientQueryVO;
import com.aizuda.snailjob.server.web.model.request.NotifyRecipientRequestVO; import com.aizuda.snailjob.server.web.model.request.NotifyRecipientRequestVO;
@ -14,6 +15,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* @author opensnail * @author opensnail
@ -29,6 +31,14 @@ public class NotifyRecipientServiceImpl implements NotifyRecipientService {
public PageResult<List<NotifyRecipientResponseVO>> getNotifyRecipientList(NotifyRecipientQueryVO queryVO) { public PageResult<List<NotifyRecipientResponseVO>> getNotifyRecipientList(NotifyRecipientQueryVO queryVO) {
PageDTO<NotifyRecipient> pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize()); PageDTO<NotifyRecipient> pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize());
LambdaQueryWrapper<NotifyRecipient> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<NotifyRecipient> queryWrapper = new LambdaQueryWrapper<>();
if (StrUtil.isNotBlank(queryVO.getRecipientName())) {
queryWrapper.likeRight(NotifyRecipient::getRecipientName, queryVO.getRecipientName());
}
if (Objects.nonNull(queryVO.getNotifyType())) {
queryWrapper.likeRight(NotifyRecipient::getNotifyType, queryVO.getNotifyType());
}
queryWrapper.orderByDesc(NotifyRecipient::getCreateDt); queryWrapper.orderByDesc(NotifyRecipient::getCreateDt);
PageDTO<NotifyRecipient> notifyRecipientPageDTO = notifyRecipientMapper.selectPage(pageDTO, queryWrapper); PageDTO<NotifyRecipient> notifyRecipientPageDTO = notifyRecipientMapper.selectPage(pageDTO, queryWrapper);