微调
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.njcn.cssystem.api;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.cssystem.api.fallback.FeedBackFeignClientFallbackFactory;
|
||||
import com.njcn.cssystem.pojo.param.CsFeedbackQueryParm;
|
||||
import com.njcn.cssystem.pojo.vo.CsFeedbackVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_SYSTEM_BOOT, path = "/feedback", fallbackFactory = FeedBackFeignClientFallbackFactory.class,contextId = "feedback")
|
||||
public interface FeedBackFeignClient {
|
||||
|
||||
|
||||
@PostMapping("/queryFeedBackPage")
|
||||
HttpResult<Page<CsFeedbackVO>> queryFeedBackPage(@Validated @RequestBody CsFeedbackQueryParm csFeedbackQueryParm);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.cssystem.api.fallback;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
|
||||
import com.njcn.cssystem.api.FeedBackFeignClient;
|
||||
import com.njcn.cssystem.pojo.param.CsFeedbackQueryParm;
|
||||
import com.njcn.cssystem.pojo.vo.CsFeedbackVO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class FeedBackFeignClientFallbackFactory implements FallbackFactory<FeedBackFeignClient> {
|
||||
@Override
|
||||
public FeedBackFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new FeedBackFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<Page<CsFeedbackVO>> queryFeedBackPage(CsFeedbackQueryParm csFeedbackQueryParm) {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取反馈接口异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.njcn.cssystem.controller.feedback;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -65,10 +66,10 @@ public class FeedBackController extends BaseController {
|
||||
@PostMapping("/queryFeedBackPage")
|
||||
@ApiOperation("查询反馈列表")
|
||||
@ApiImplicitParam(name = "csFeedbackQueryParm", value = "新增反馈聊天参数", required = true)
|
||||
public HttpResult<IPage<CsFeedbackVO>> queryFeedBackPage(@Validated @RequestBody CsFeedbackQueryParm csFeedbackQueryParm){
|
||||
public HttpResult<Page<CsFeedbackVO>> queryFeedBackPage(@Validated @RequestBody CsFeedbackQueryParm csFeedbackQueryParm){
|
||||
String methodDescribe = getMethodDescribe("queryFeedBackPage");
|
||||
|
||||
IPage<CsFeedbackVO> csFeedbackVOIPage = csFeedbackService.queryFeedBackPage(csFeedbackQueryParm);
|
||||
Page<CsFeedbackVO> csFeedbackVOIPage = csFeedbackService.queryFeedBackPage(csFeedbackQueryParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csFeedbackVOIPage, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.cssystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.cssystem.pojo.param.CsFeedbackAddParm;
|
||||
import com.njcn.cssystem.pojo.param.CsFeedbackAuditParm;
|
||||
@@ -36,7 +37,7 @@ public interface CsFeedbackService extends IService<CsFeedbackPO>{
|
||||
* @Author: clam
|
||||
* @Date: 2023/4/6
|
||||
*/
|
||||
IPage<CsFeedbackVO> queryFeedBackPage(CsFeedbackQueryParm csFeedbackQueryParm);
|
||||
Page<CsFeedbackVO> queryFeedBackPage(CsFeedbackQueryParm csFeedbackQueryParm);
|
||||
/**
|
||||
* @Description: queryFeedBackDetail
|
||||
* @Param: [id]
|
||||
|
||||
@@ -80,7 +80,7 @@ public class CsFeedbackServiceImpl extends ServiceImpl<CsFeedbackMapper, CsFeedb
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<CsFeedbackVO> queryFeedBackPage(CsFeedbackQueryParm csFeedbackQueryParm) {
|
||||
public Page<CsFeedbackVO> queryFeedBackPage(CsFeedbackQueryParm csFeedbackQueryParm) {
|
||||
Page<CsFeedbackPO> page = new Page<> (csFeedbackQueryParm.getPageNum ( ), csFeedbackQueryParm.getPageSize ( ));
|
||||
Page<CsFeedbackVO> returnpage = new Page<> (csFeedbackQueryParm.getPageNum ( ), csFeedbackQueryParm.getPageSize ( ));
|
||||
List<String> data = roleEngineerDevFeignClient.getRoleengineer().getData();
|
||||
|
||||
Reference in New Issue
Block a user