|
@ -4,7 +4,9 @@ package com.yihu.wlyy.controller.redis;
|
|
import com.yihu.wlyy.common.constants.ApiVersion;
|
|
import com.yihu.wlyy.common.constants.ApiVersion;
|
|
import com.yihu.wlyy.common.constants.ServiceApi;
|
|
import com.yihu.wlyy.common.constants.ServiceApi;
|
|
import com.yihu.wlyy.common.controller.EnvelopRestEndPoint;
|
|
import com.yihu.wlyy.common.controller.EnvelopRestEndPoint;
|
|
|
|
import com.yihu.wlyy.common.vo.MRedisCacheCategory;
|
|
import com.yihu.wlyy.common.vo.MRedisMqSubscriber;
|
|
import com.yihu.wlyy.common.vo.MRedisMqSubscriber;
|
|
|
|
import com.yihu.wlyy.entity.User;
|
|
import com.yihu.wlyy.entity.redis.RedisMqSubscriber;
|
|
import com.yihu.wlyy.entity.redis.RedisMqSubscriber;
|
|
import com.yihu.wlyy.service.redis.pubsub.RedisMqChannelService;
|
|
import com.yihu.wlyy.service.redis.pubsub.RedisMqChannelService;
|
|
import com.yihu.wlyy.service.redis.pubsub.RedisMqSubscriberService;
|
|
import com.yihu.wlyy.service.redis.pubsub.RedisMqSubscriberService;
|
|
@ -19,6 +21,7 @@ import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -41,22 +44,23 @@ public class RedisMqSubscriberEndPoint extends EnvelopRestEndPoint {
|
|
|
|
|
|
@ApiOperation("根据ID获取消息订阅者")
|
|
@ApiOperation("根据ID获取消息订阅者")
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.GetById, method = RequestMethod.GET)
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.GetById, method = RequestMethod.GET)
|
|
public Envelop getById(Model model, Long id) {
|
|
|
|
Envelop envelop = new Envelop();
|
|
|
|
envelop.setSuccessFlg(false);
|
|
|
|
|
|
public String getById(Model model, Long id) {
|
|
try {
|
|
try {
|
|
MRedisMqSubscriber mRedisMqSubscriber = convertToModel(redisMqSubscriberService.getById(id), MRedisMqSubscriber.class);
|
|
|
|
envelop.setObj(mRedisMqSubscriber);
|
|
|
|
envelop.setSuccessFlg(true);
|
|
|
|
envelop.setErrorMsg("成功获取消息订阅者。");
|
|
|
|
|
|
if(id!=null){
|
|
|
|
MRedisMqSubscriber mRedisMqSubscriber = convertToModel(redisMqSubscriberService.getById(id), MRedisMqSubscriber.class);
|
|
|
|
model.addAttribute("detailModel", toJson(mRedisMqSubscriber));
|
|
|
|
}else {
|
|
|
|
Object detailModel = new MRedisCacheCategory();
|
|
|
|
model.addAttribute("detailModel", toJson(detailModel));
|
|
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
envelop.setErrorMsg("获取消息订阅者发生异常:" + e.getMessage());
|
|
|
|
}
|
|
}
|
|
return envelop;
|
|
|
|
|
|
return "/redis/mq/subscriber/detail";
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "根据条件获取消息订阅者")
|
|
@ApiOperation(value = "根据条件获取消息订阅者")
|
|
|
|
@ResponseBody
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.Search, method = RequestMethod.GET)
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.Search, method = RequestMethod.GET)
|
|
public Envelop search(
|
|
public Envelop search(
|
|
@ApiParam(name = "fields", value = "返回的字段,为空则返回全部字段")
|
|
@ApiParam(name = "fields", value = "返回的字段,为空则返回全部字段")
|
|
@ -86,14 +90,18 @@ public class RedisMqSubscriberEndPoint extends EnvelopRestEndPoint {
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation("新增消息订阅者")
|
|
@ApiOperation("新增消息订阅者")
|
|
|
|
@ResponseBody
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.Save, method = RequestMethod.POST)
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.Save, method = RequestMethod.POST)
|
|
public Envelop add(
|
|
|
|
@ApiParam(value = "消息订阅者JSON", required = true)
|
|
|
|
@RequestBody String entityJson) {
|
|
|
|
|
|
public Envelop add(String data) {
|
|
Envelop envelop = new Envelop();
|
|
Envelop envelop = new Envelop();
|
|
envelop.setSuccessFlg(false);
|
|
envelop.setSuccessFlg(false);
|
|
try {
|
|
try {
|
|
RedisMqSubscriber newEntity = objectMapper.readValue(entityJson, RedisMqSubscriber.class);
|
|
|
|
|
|
RedisMqSubscriber newEntity = objectMapper.readValue(data, RedisMqSubscriber.class);
|
|
|
|
User currentUser = (User) request.getSession().getAttribute("current_user");
|
|
|
|
newEntity.setCreator(currentUser.getCode());
|
|
|
|
newEntity.setCreateDate(new Date());
|
|
|
|
newEntity.setModifyDate(new Date());
|
|
|
|
newEntity.setModifier(currentUser.getCode());
|
|
newEntity = redisMqSubscriberService.save(newEntity);
|
|
newEntity = redisMqSubscriberService.save(newEntity);
|
|
|
|
|
|
MRedisMqSubscriber mRedisMqSubscriber = convertToModel(newEntity, MRedisMqSubscriber.class);
|
|
MRedisMqSubscriber mRedisMqSubscriber = convertToModel(newEntity, MRedisMqSubscriber.class);
|
|
@ -108,14 +116,16 @@ public class RedisMqSubscriberEndPoint extends EnvelopRestEndPoint {
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation("更新消息订阅者")
|
|
@ApiOperation("更新消息订阅者")
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.Save, method = RequestMethod.PUT)
|
|
|
|
public Envelop update(
|
|
|
|
@ApiParam(value = "消息订阅者JSON", required = true)
|
|
|
|
@RequestBody String entityJson) {
|
|
|
|
|
|
@ResponseBody
|
|
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.Update, method = RequestMethod.POST)
|
|
|
|
public Envelop update(String data) {
|
|
Envelop envelop = new Envelop();
|
|
Envelop envelop = new Envelop();
|
|
envelop.setSuccessFlg(false);
|
|
envelop.setSuccessFlg(false);
|
|
try {
|
|
try {
|
|
RedisMqSubscriber updateEntity = objectMapper.readValue(entityJson, RedisMqSubscriber.class);
|
|
|
|
|
|
RedisMqSubscriber updateEntity = objectMapper.readValue(data, RedisMqSubscriber.class);
|
|
|
|
User currentUser = (User) request.getSession().getAttribute("current_user");
|
|
|
|
updateEntity.setModifyDate(new Date());
|
|
|
|
updateEntity.setModifier(currentUser.getCode());
|
|
updateEntity = redisMqSubscriberService.save(updateEntity);
|
|
updateEntity = redisMqSubscriberService.save(updateEntity);
|
|
|
|
|
|
MRedisMqSubscriber mRedisMqSubscriber = convertToModel(updateEntity, MRedisMqSubscriber.class);
|
|
MRedisMqSubscriber mRedisMqSubscriber = convertToModel(updateEntity, MRedisMqSubscriber.class);
|
|
@ -130,7 +140,8 @@ public class RedisMqSubscriberEndPoint extends EnvelopRestEndPoint {
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation("删除消息订阅者")
|
|
@ApiOperation("删除消息订阅者")
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.Delete, method = RequestMethod.DELETE)
|
|
|
|
|
|
@ResponseBody
|
|
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.Delete, method = RequestMethod.POST)
|
|
public Envelop delete(
|
|
public Envelop delete(
|
|
@ApiParam(name = "id", value = "消息订阅者ID", required = true)
|
|
@ApiParam(name = "id", value = "消息订阅者ID", required = true)
|
|
@RequestParam(value = "id") Integer id) {
|
|
@RequestParam(value = "id") Integer id) {
|
|
@ -149,6 +160,7 @@ public class RedisMqSubscriberEndPoint extends EnvelopRestEndPoint {
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation("验证指定消息队列中订阅者应用ID是否唯一")
|
|
@ApiOperation("验证指定消息队列中订阅者应用ID是否唯一")
|
|
|
|
@ResponseBody
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.IsUniqueAppId, method = RequestMethod.GET)
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.IsUniqueAppId, method = RequestMethod.GET)
|
|
public Envelop isUniqueAppId(
|
|
public Envelop isUniqueAppId(
|
|
@ApiParam(name = "id", value = "消息订阅者ID", required = true)
|
|
@ApiParam(name = "id", value = "消息订阅者ID", required = true)
|
|
@ -173,6 +185,7 @@ public class RedisMqSubscriberEndPoint extends EnvelopRestEndPoint {
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation("验证指定消息队列中订阅者服务地址是否唯一")
|
|
@ApiOperation("验证指定消息队列中订阅者服务地址是否唯一")
|
|
|
|
@ResponseBody
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.IsUniqueSubscribedUrl, method = RequestMethod.GET)
|
|
@RequestMapping(value = ServiceApi.Redis.MqSubscriber.IsUniqueSubscribedUrl, method = RequestMethod.GET)
|
|
public Envelop isUniqueSubscribedUrl(
|
|
public Envelop isUniqueSubscribedUrl(
|
|
@ApiParam(name = "id", value = "消息订阅者ID", required = true)
|
|
@ApiParam(name = "id", value = "消息订阅者ID", required = true)
|