fix:listDept feign调用接口
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.sdm.common.entity.req.system;
|
||||
|
||||
import com.sdm.common.entity.BaseReq;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DeptQueryReq extends BaseReq {
|
||||
|
||||
@Schema(description = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.sdm.common.feign.impl.system;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.system.DeptQueryReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.system.SysDeptUserResp;
|
||||
import com.sdm.common.feign.inter.system.ISysDeptFeignClient;
|
||||
import com.sdm.common.feign.inter.system.ISysLogFeignClient;
|
||||
import com.sdm.common.log.dto.SysLogDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SysDeptFeignClientImpl implements ISysDeptFeignClient {
|
||||
|
||||
@Autowired
|
||||
private ISysDeptFeignClient sysDeptFeignClient;
|
||||
|
||||
@Override
|
||||
public SdmResponse<PageDataResp<List<SysDeptUserResp>>> listDept(DeptQueryReq req) {
|
||||
SdmResponse response=null ;
|
||||
try {
|
||||
response = sysDeptFeignClient.listDept(req);
|
||||
if(response==null || !response.isSuccess()){
|
||||
log.error("listDept failed response:{}", JSONObject.toJSONString(Optional.ofNullable(response)));
|
||||
return SdmResponse.failed("查询部门负责人失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("listDept error response:{}", JSONObject.toJSONString(Optional.ofNullable(response)));
|
||||
return SdmResponse.failed("查询部门负责人失败");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.sdm.common.feign.inter.system;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.system.DeptQueryReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.system.SysDeptUserResp;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.cloud.openfeign.SpringQueryMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@FeignClient(name = "system",contextId = "systemDeptClient")
|
||||
public interface ISysDeptFeignClient {
|
||||
|
||||
@GetMapping("/dept/listDept")
|
||||
SdmResponse<PageDataResp<List<SysDeptUserResp>>> listDept(@SpringQueryMap DeptQueryReq req);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user