...
|
...
|
@@ -6,6 +6,7 @@ import com.sunyo.wlpt.message.bus.service.model.MessageRouterReciver; |
|
|
import com.sunyo.wlpt.message.bus.service.response.ResultJson;
|
|
|
import com.sunyo.wlpt.message.bus.service.service.MessageRouterReciverService;
|
|
|
import com.sunyo.wlpt.message.bus.service.utils.IdUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
...
|
...
|
@@ -14,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
public class MessageRouterReciverImpl implements MessageRouterReciverService {
|
|
|
|
...
|
...
|
@@ -43,11 +45,13 @@ public class MessageRouterReciverImpl implements MessageRouterReciverService { |
|
|
) {
|
|
|
if (StringUtils.isNotBlank(rcvr.getRcvrTopic())){
|
|
|
rcvr.setMessageRouterId(messageRouter.getId());
|
|
|
rcvr.setId(IdUtils.generateId());
|
|
|
List<MessageRouterReciver> list = messageRouterReciverMapper.selectByRouterKeyAndTopic(rcvr);
|
|
|
//判断是否已经有这条数据
|
|
|
if(list.isEmpty()){
|
|
|
rcvr.setId(IdUtils.generateId());
|
|
|
i += messageRouterReciverMapper.insertSelective(rcvr);
|
|
|
log.info("新增{}的类型{}订阅者{}成功,关联订阅者ID{}",messageRouter.getSndr(),messageRouter.getStype(),rcvr.getRcvrTopic(),rcvr.getId());
|
|
|
|
|
|
};
|
|
|
}
|
|
|
}
|
...
|
...
|
|