12 changed files with 242 additions and 131 deletions
@ -0,0 +1,68 @@ |
|||||
|
package com.ccsens.cloudutil.feign; |
||||
|
|
||||
|
import com.ccsens.cloudutil.bean.QueryParam; |
||||
|
import com.ccsens.cloudutil.bean.tall.dto.LogDto; |
||||
|
import com.ccsens.cloudutil.bean.tall.dto.MemberRoleDto; |
||||
|
import com.ccsens.cloudutil.bean.tall.dto.UserDto; |
||||
|
import com.ccsens.cloudutil.bean.tall.vo.MemberVo; |
||||
|
import com.ccsens.cloudutil.bean.tall.vo.PluginVo; |
||||
|
import com.ccsens.cloudutil.bean.tall.vo.TaskVo; |
||||
|
import com.ccsens.util.JsonResponse; |
||||
|
import feign.hystrix.FallbackFactory; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.List; |
||||
|
|
||||
|
@FeignClient(name = "mt", path = "", fallbackFactory = MtFeignClientFallBack.class) |
||||
|
public interface MtFeignClient { |
||||
|
/** |
||||
|
* 普通成员获取自己对任务的评分 |
||||
|
* @param taskId |
||||
|
* @param userId |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("plugins/memberScore") |
||||
|
BigDecimal getMemberScore(@RequestParam(name = "taskId")Long taskId, @RequestParam(name = "userId")Long userId); |
||||
|
|
||||
|
/** |
||||
|
* 项目经理获取任务的平均分 |
||||
|
* @param projectId |
||||
|
* @param taskId |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("plugins/adminScore") |
||||
|
BigDecimal getAdminScore(@RequestParam(name = "projectId")Long projectId, @RequestParam(name = "taskId")Long taskId); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Slf4j |
||||
|
@Component |
||||
|
class MtFeignClientFallBack implements FallbackFactory<MtFeignClient> { |
||||
|
@Override |
||||
|
public MtFeignClient create(Throwable throwable) { |
||||
|
String msg = throwable == null ? "" : throwable.getMessage(); |
||||
|
if (!StringUtils.isEmpty(msg)) { |
||||
|
log.error(msg); |
||||
|
} |
||||
|
return new MtFeignClient() { |
||||
|
@Override |
||||
|
public BigDecimal getMemberScore(Long taskId,Long userId) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public BigDecimal getAdminScore(Long projectId,Long taskId) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
}; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue