Commit 60fdc43a by yangll

添加路径参数

1 parent 341ffb82
package cn.com.glsx.admin.api; package cn.com.glsx.admin.notify.api;
import cn.com.glsx.admin.services.notifyservice.model.MailTemplateMessageDTO; import cn.com.glsx.admin.notify.dto.MailTemplateMessageDTO;
import cn.com.glsx.admin.services.notifyservice.model.PCTemplateMessageDTO; import cn.com.glsx.admin.notify.dto.PCTemplateMessageDTO;
import cn.com.glsx.admin.services.notifyservice.model.SmsTemplateMessageDTO; import cn.com.glsx.admin.notify.dto.SmsTemplateMessageDTO;
import cn.com.glsx.admin.services.notifyservice.model.WechatTemplateMessageDTO; import cn.com.glsx.admin.notify.dto.WechatTemplateMessageDTO;
import com.glsx.plat.core.web.R; import com.glsx.plat.core.web.R;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@FeignClient(name = "ne-shield-notifycenter", contextId = "notifycenter", path = "/api/notify/", decode404 = true) @FeignClient(name = "ne-shield-notifycenter", contextId = "notifycenter", path = "/notifycenter/api/notify/", decode404 = true)
public interface NotifyCenterFeignClient { public interface NotifyCenterFeignClient {
@PostMapping(value = "/sendSms") @PostMapping(value = "/sendSms")
......
package cn.com.glsx.admin.services.notifyservice.model; package cn.com.glsx.admin.notify.dto;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
......
package cn.com.glsx.admin.services.notifyservice.model; package cn.com.glsx.admin.notify.dto;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
......
package cn.com.glsx.admin.services.notifyservice.model; package cn.com.glsx.admin.notify.dto;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
......
package cn.com.glsx.admin.services.notifyservice.model; package cn.com.glsx.admin.notify.dto;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
......
package cn.com.glsx.admin.notify.factory;
import cn.com.glsx.admin.notify.api.NotifyCenterFeignClient;
import cn.com.glsx.admin.notify.fallback.NotifyCenterFeignFallbackImpl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
/**
* 项目名:ne-shield-notifycenter-api
* 包名: cn.com.glsx.insurance.factory
* 作者: Yanglinlong
* 日期: 2021/7/5 16:15
*/
@Component
public class NotifyCenterFeignFallbackFactory implements FallbackFactory<NotifyCenterFeignClient> {
@Override
public NotifyCenterFeignClient create(Throwable throwable) {
NotifyCenterFeignFallbackImpl fallback = new NotifyCenterFeignFallbackImpl();
fallback.setCause(throwable);
return fallback;
}
}
package cn.com.glsx.admin.notify.fallback;
import cn.com.glsx.admin.notify.api.NotifyCenterFeignClient;
import cn.com.glsx.admin.notify.dto.MailTemplateMessageDTO;
import cn.com.glsx.admin.notify.dto.PCTemplateMessageDTO;
import cn.com.glsx.admin.notify.dto.SmsTemplateMessageDTO;
import cn.com.glsx.admin.notify.dto.WechatTemplateMessageDTO;
import com.glsx.plat.core.web.R;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 项目名:ne-shield-insurancenter-api
* 包名: cn.com.glsx.insurance.fallback
* 作者: Yanglinlong
* 日期: 2021/7/5 16:16
*/
@Slf4j
@Component
public class NotifyCenterFeignFallbackImpl implements NotifyCenterFeignClient {
@Setter
private Throwable cause;
@Override
public R sendSms(SmsTemplateMessageDTO messageDTO) {
log.warn("sendSms 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
@Override
public R sendMail(MailTemplateMessageDTO messageDTO) {
log.warn("sendMail 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
@Override
public R sendPC(PCTemplateMessageDTO messageDTO) {
log.warn("sendPC 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
@Override
public R sendWechat(WechatTemplateMessageDTO messageDTO) {
log.warn("sendWechat 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
@Override
public R sendMailOnlyContent(MailTemplateMessageDTO messageDTO) {
log.warn("sendMailOnlyContent 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!