4 changed files with 59 additions and 1 deletions
@ -0,0 +1,29 @@ |
|||
package com.epmet.feign; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.UserMessageFormDTO; |
|||
import com.epmet.feign.fallback.MessageFeignClientFallback; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description 调用epmet-message服务 |
|||
* @Author sun |
|||
* , url = "localhost:8085" |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.EPMET_MESSAGE_SERVER, fallback = MessageFeignClientFallback.class) |
|||
public interface MessageFeignClient { |
|||
|
|||
/** |
|||
* @param msgList |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @Author sun |
|||
* @Description 批量推送消息 |
|||
**/ |
|||
@PostMapping(value = "message/usermessage/saveusermessagelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) |
|||
Result saveUserMessageList(List<UserMessageFormDTO> msgList); |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.feign.fallback; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.ModuleUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.UserMessageFormDTO; |
|||
import com.epmet.feign.MessageFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description 调用epmet-message服务 |
|||
* @Author sun |
|||
*/ |
|||
@Component |
|||
public class MessageFeignClientFallback implements MessageFeignClient { |
|||
|
|||
@Override |
|||
public Result saveUserMessageList(List<UserMessageFormDTO> msgList) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessageList", msgList); |
|||
} |
|||
} |
Loading…
Reference in new issue