Browse Source

项目跟踪服务添加调用消息服务feign模板

master
sunyuchao 5 years ago
parent
commit
b318d28446
  1. 2
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java
  2. 6
      epmet-module/gov-project/gov-project-server/pom.xml
  3. 29
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/MessageFeignClient.java
  4. 23
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/MessageFeignClientFallback.java

2
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java

@ -26,7 +26,7 @@ public class TickStaffFormDTO implements Serializable {
*/
private String gridId="";
@NotBlank(message = "内部备注不能为空")
@NotBlank(message = "工作人员Id不能为空")
private String staffId;
}

6
epmet-module/gov-project/gov-project-server/pom.xml

@ -84,6 +84,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-message-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

29
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/MessageFeignClient.java

@ -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);
}

23
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/MessageFeignClientFallback.java

@ -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…
Cancel
Save