|
@@ -1,26 +1,27 @@
|
|
|
package org.dromara.backstage.basics.service.impl;
|
|
package org.dromara.backstage.basics.service.impl;
|
|
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
-import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
|
-import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
-import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
-import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
+import org.dromara.backstage.basics.domain.SendMessageRecord;
|
|
|
import org.dromara.backstage.basics.domain.bo.SendMessageRecordBo;
|
|
import org.dromara.backstage.basics.domain.bo.SendMessageRecordBo;
|
|
|
import org.dromara.backstage.basics.domain.vo.SendMessageRecordVo;
|
|
import org.dromara.backstage.basics.domain.vo.SendMessageRecordVo;
|
|
|
-import org.dromara.backstage.basics.domain.SendMessageRecord;
|
|
|
|
|
import org.dromara.backstage.basics.mapper.SendMessageRecordMapper;
|
|
import org.dromara.backstage.basics.mapper.SendMessageRecordMapper;
|
|
|
import org.dromara.backstage.basics.service.ISendMessageRecordService;
|
|
import org.dromara.backstage.basics.service.ISendMessageRecordService;
|
|
|
|
|
+import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
|
+import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
+import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
|
+import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.util.Collection;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
-import java.util.Collection;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 消息发送记录Service业务层处理
|
|
* 消息发送记录Service业务层处理
|
|
@@ -41,7 +42,7 @@ public class SendMessageRecordServiceImpl implements ISendMessageRecordService {
|
|
|
* @return 消息发送记录
|
|
* @return 消息发送记录
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public SendMessageRecordVo queryById(Long recordId){
|
|
|
|
|
|
|
+ public SendMessageRecordVo queryById(Long recordId) {
|
|
|
return baseMapper.selectVoById(recordId);
|
|
return baseMapper.selectVoById(recordId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -82,23 +83,24 @@ public class SendMessageRecordServiceImpl implements ISendMessageRecordService {
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getMessage()), SendMessageRecord::getMessage, bo.getMessage());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getMessage()), SendMessageRecord::getMessage, bo.getMessage());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getEventId()), SendMessageRecord::getEventId, bo.getEventId());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getEventId()), SendMessageRecord::getEventId, bo.getEventId());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getSender()), SendMessageRecord::getSender, bo.getSender());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getSender()), SendMessageRecord::getSender, bo.getSender());
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getConsumeStatus()), SendMessageRecord::getConsumeStatus, bo.getConsumeStatus());
|
|
|
return lqw;
|
|
return lqw;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private QueryWrapper<SendMessageRecord> buildQueryWrapper(SendMessageRecordBo bo,String tableAlias) {
|
|
|
|
|
|
|
+ private QueryWrapper<SendMessageRecord> buildQueryWrapper(SendMessageRecordBo bo, String tableAlias) {
|
|
|
QueryWrapper<SendMessageRecord> lqw = new QueryWrapper<>();
|
|
QueryWrapper<SendMessageRecord> lqw = new QueryWrapper<>();
|
|
|
String columnPrefix = "";
|
|
String columnPrefix = "";
|
|
|
- if(StringUtils.isNotBlank(tableAlias)){
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(tableAlias)) {
|
|
|
columnPrefix = tableAlias + ".";
|
|
columnPrefix = tableAlias + ".";
|
|
|
}
|
|
}
|
|
|
- lqw.eq(bo.getRecordId() != null, columnPrefix+"record_id", bo.getRecordId());
|
|
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getMqType()), columnPrefix+"mq_type", bo.getMqType());
|
|
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getTopic()), columnPrefix+"topic", bo.getTopic());
|
|
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getEventType()), columnPrefix+"event_type", bo.getEventType());
|
|
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getResult()), columnPrefix+"result", bo.getResult());
|
|
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getMessage()), columnPrefix+"message", bo.getMessage());
|
|
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getEventId()), columnPrefix+"event_id", bo.getEventId());
|
|
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getSender()), columnPrefix+"sender", bo.getSender());
|
|
|
|
|
|
|
+ lqw.eq(bo.getRecordId() != null, columnPrefix + "record_id", bo.getRecordId());
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getMqType()), columnPrefix + "mq_type", bo.getMqType());
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getTopic()), columnPrefix + "topic", bo.getTopic());
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getEventType()), columnPrefix + "event_type", bo.getEventType());
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getResult()), columnPrefix + "result", bo.getResult());
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getMessage()), columnPrefix + "message", bo.getMessage());
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getEventId()), columnPrefix + "event_id", bo.getEventId());
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getSender()), columnPrefix + "sender", bo.getSender());
|
|
|
return lqw;
|
|
return lqw;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -136,8 +138,8 @@ public class SendMessageRecordServiceImpl implements ISendMessageRecordService {
|
|
|
/**
|
|
/**
|
|
|
* 保存前的数据校验
|
|
* 保存前的数据校验
|
|
|
*/
|
|
*/
|
|
|
- private void validEntityBeforeSave(SendMessageRecord entity){
|
|
|
|
|
- //做一些数据校验,如唯一约束
|
|
|
|
|
|
|
+ private void validEntityBeforeSave(SendMessageRecord entity) {
|
|
|
|
|
+ // 做一些数据校验,如唯一约束
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -149,8 +151,8 @@ public class SendMessageRecordServiceImpl implements ISendMessageRecordService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
- if(isValid){
|
|
|
|
|
- //做一些业务上的校验,判断是否需要校验
|
|
|
|
|
|
|
+ if (isValid) {
|
|
|
|
|
+ // 做一些业务上的校验,判断是否需要校验
|
|
|
}
|
|
}
|
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
|
}
|
|
}
|
|
@@ -158,10 +160,35 @@ public class SendMessageRecordServiceImpl implements ISendMessageRecordService {
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean updateBoByEventId(SendMessageRecordBo bo) {
|
|
public Boolean updateBoByEventId(SendMessageRecordBo bo) {
|
|
|
UpdateWrapper<SendMessageRecord> updateWrapper = new UpdateWrapper<>();
|
|
UpdateWrapper<SendMessageRecord> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.eq("event_id",bo.getEventId());
|
|
|
|
|
|
|
+ updateWrapper.eq("event_id", bo.getEventId());
|
|
|
SendMessageRecord update = MapstructUtils.convert(bo, SendMessageRecord.class);
|
|
SendMessageRecord update = MapstructUtils.convert(bo, SendMessageRecord.class);
|
|
|
update.setUpdateTime(new Date());
|
|
update.setUpdateTime(new Date());
|
|
|
- return baseMapper.update(update,updateWrapper) > 0;
|
|
|
|
|
|
|
+ return baseMapper.update(update, updateWrapper) > 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询消费失败的消息发送记录列表。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param bo 查询条件
|
|
|
|
|
+ * @return 消费失败的消息发送记录列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<SendMessageRecordVo> queryConsumeErrorList(SendMessageRecordBo bo) {
|
|
|
|
|
+ LambdaQueryWrapper<SendMessageRecord> lqw = Wrappers.lambdaQuery();
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getTopic()), SendMessageRecord::getTopic, bo.getTopic());
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getEventType()), SendMessageRecord::getEventType, bo.getEventType());
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getConsumeStatus()), SendMessageRecord::getConsumeStatus, bo.getConsumeStatus());
|
|
|
|
|
+ lqw.gt(bo.getUpdateTime() != null, SendMessageRecord::getUpdateTime, bo.getUpdateTime());
|
|
|
|
|
+
|
|
|
|
|
+ return baseMapper.selectVoList(lqw);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Boolean updateConsumeStatusById(Long messageId) {
|
|
|
|
|
+ LambdaUpdateWrapper<SendMessageRecord> updateWrapper = new LambdaUpdateWrapper<SendMessageRecord>()
|
|
|
|
|
+ .set(SendMessageRecord::getConsumeStatus, "Y")
|
|
|
|
|
+ .set(SendMessageRecord::getUpdateTime, new Date())
|
|
|
|
|
+ .eq(SendMessageRecord::getRecordId, messageId);
|
|
|
|
|
+ return baseMapper.update(null, updateWrapper) > 0;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|