Commit 698a3421 by kenzo

对接个人信息接口

parent cb112b06
......@@ -5,13 +5,15 @@ import okhttp3.OkHttpClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import java.util.concurrent.TimeUnit;
@Configuration
public class RetrofitConfiguration {
@Profile("dev")
public class RetrofitDevConfiguration {
/**
* 专家服务
......@@ -21,7 +23,7 @@ public class RetrofitConfiguration {
@Bean("retrofitExpert")
@Primary
public Retrofit RetrofitExpert(Gson gson) {
return createRetrofit("https://randomuser.me/", gson);
return createRetrofit("https://dev.randomuser.me/", gson);
}
/**
......@@ -31,7 +33,7 @@ public class RetrofitConfiguration {
*/
@Bean("retrofitWorkflow")
public Retrofit RetrofitWorkflow(Gson gson) {
return createRetrofit("https://randomuser.com/", gson);
return createRetrofit("https://dev.randomuser.com/", gson);
}
/**
......@@ -41,7 +43,17 @@ public class RetrofitConfiguration {
*/
@Bean("retrofitPortal")
public Retrofit RetrofitPortal(Gson gson) {
return createRetrofit("https://randomuser.cn/", gson);
return createRetrofit("https://dev.randomuser.cn/", gson);
}
/**
* 主体服务
* @param gson
* @return
*/
@Bean("retrofitSubject")
public Retrofit RetrofitSubject(Gson gson) {
return createRetrofit("https://dev.randomuser.cn.com/", gson);
}
private Retrofit createRetrofit(String baseUrl, Gson gson) {
......
package com.cnooc.expert.config;
import com.google.gson.Gson;
import okhttp3.OkHttpClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import java.util.concurrent.TimeUnit;
@Configuration
@Profile("prod")
public class RetrofitProdConfiguration {
/**
* 专家服务
* @param gson
* @return
*/
@Bean("retrofitExpert")
@Primary
public Retrofit RetrofitExpert(Gson gson) {
return createRetrofit("https://prod.randomuser.me/", gson);
}
/**
* 工作流服务
* @param gson
* @return
*/
@Bean("retrofitWorkflow")
public Retrofit RetrofitWorkflow(Gson gson) {
return createRetrofit("https://prod.randomuser.com/", gson);
}
/**
* 平台服务
* @param gson
* @return
*/
@Bean("retrofitPortal")
public Retrofit RetrofitPortal(Gson gson) {
return createRetrofit("https://prod.randomuser.cn/", gson);
}
/**
* 主体服务
* @param gson
* @return
*/
@Bean("retrofitSubject")
public Retrofit RetrofitSubject(Gson gson) {
return createRetrofit("https://prod.randomuser.cn.com/", gson);
}
private Retrofit createRetrofit(String baseUrl, Gson gson) {
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.connectTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.build();
return new Retrofit.Builder()
.baseUrl(baseUrl)
.client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
}
}
package com.cnooc.expert.config;
import com.google.gson.Gson;
import okhttp3.OkHttpClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import java.util.concurrent.TimeUnit;
@Configuration
@Profile("test")
public class RetrofitTestConfiguration {
/**
* 专家服务
* @param gson
* @return
*/
@Bean("retrofitExpert")
@Primary
public Retrofit RetrofitExpert(Gson gson) {
return createRetrofit("https://test.randomuser.me/", gson);
}
/**
* 工作流服务
* @param gson
* @return
*/
@Bean("retrofitWorkflow")
public Retrofit RetrofitWorkflow(Gson gson) {
return createRetrofit("https://test.randomuser.com/", gson);
}
/**
* 平台服务
* @param gson
* @return
*/
@Bean("retrofitPortal")
public Retrofit RetrofitPortal(Gson gson) {
return createRetrofit("https://test.randomuser.cn/", gson);
}
/**
* 主体服务
* @param gson
* @return
*/
@Bean("retrofitSubject")
public Retrofit RetrofitSubject(Gson gson) {
return createRetrofit("https://test.randomuser.cn.com/", gson);
}
private Retrofit createRetrofit(String baseUrl, Gson gson) {
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.connectTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.build();
return new Retrofit.Builder()
.baseUrl(baseUrl)
.client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
}
}
package com.cnooc.expert.controller.common;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
public abstract class AbstractBaseController {
@Autowired
public ObjectMapper objectMapper;
}
......@@ -2,6 +2,7 @@ package com.cnooc.expert.controller.expert;
import com.cnooc.expert.common.response.ApiResult;
import com.cnooc.expert.common.response.BasePageResp;
import com.cnooc.expert.controller.common.AbstractBaseController;
import com.cnooc.expert.controller.expert.model.request.*;
import com.cnooc.expert.controller.expert.model.response.*;
import com.cnooc.expert.service.ExpertService;
......@@ -19,13 +20,13 @@ import java.util.List;
@AllArgsConstructor
@RestController
@RequestMapping("/expert")
public class ExpertController {
public class ExpertController extends AbstractBaseController {
private final ExpertService expertService;
@GetMapping("/get")
public String expertGet() throws JsonProcessingException {
return expertService.getExpertDetail(1);
@PostMapping("/approve/getBusinessId")
public ApiResult<ApproveBusinessIdGetResp> approveBusinessIdGet() {
return ApiResult.successWithResult(expertService.getApproveBusinessId());
}
// *** 数据字典 ***
......@@ -81,7 +82,6 @@ public class ExpertController {
return ApiResult.successWithResult(expertService.listDict5());
}
/**
* 学位列表
*
......@@ -113,7 +113,7 @@ public class ExpertController {
}
/**
* 评标专业
* 评标专业
*
* @return
*/
......@@ -123,6 +123,16 @@ public class ExpertController {
}
/**
* 省市区树
*
* @return
*/
@PostMapping("/city/tree")
public ApiResult<List<CityTreeNodeResp>> CityTree() {
return ApiResult.successWithResult(expertService.treeCity());
}
/**
* 公司列表
*
* @return
......@@ -193,7 +203,6 @@ public class ExpertController {
return ApiResult.successWithResult(expertService.pagePingBiaoXiangmuByOwner(req));
}
/**
* 专家个人的申请列表
* @param req
......@@ -204,8 +213,6 @@ public class ExpertController {
return ApiResult.successWithResult(expertService.pageZhuanJiaShenQingJiLu(req));
}
// *** 违规信息/冻结信息 ***
// 专家冻结信息分页列表
......
package com.cnooc.expert.controller.expert.model.response;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class ApproveBusinessIdGetResp {
private String businessId;
}
package com.cnooc.expert.controller.expert.model.response;
import lombok.Builder;
import lombok.Data;
import java.util.List;
@Data
@Builder
public class CityTreeNodeResp {
private String dictGuid;
private String value;
private String parentGuid;
private List<CityTreeNodeResp> childrenDicts;
}
......@@ -2,11 +2,15 @@ package com.cnooc.expert.controller.portal;
import com.cnooc.expert.common.response.ApiResult;
import com.cnooc.expert.common.response.BasePageResp;
import com.cnooc.expert.controller.common.AbstractBaseController;
import com.cnooc.expert.controller.portal.model.request.AgentNumReq;
import com.cnooc.expert.controller.portal.model.request.AgentPageReq;
import com.cnooc.expert.controller.portal.model.request.MessagePageReq;
import com.cnooc.expert.controller.portal.model.response.AgentNumResp;
import com.cnooc.expert.controller.portal.model.response.MessageNumResp;
import com.cnooc.expert.service.PortalService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -17,20 +21,25 @@ import org.springframework.web.bind.annotation.RestController;
@AllArgsConstructor
@RestController
@RequestMapping("/portal")
public class PortalController {
public class PortalController extends AbstractBaseController {
private final PortalService portalService;
// *** 业务待办 ***
@PostMapping("/agent/num/test")
public String agentNumTest(AgentNumReq req) throws JsonProcessingException {
return objectMapper.writeValueAsString(portalService.getAgentNum(req));
}
/**
* 已办待办数量
*
* @return
*/
@PostMapping("/agent/num")
public ApiResult<AgentNumResp> agentNum() {
return ApiResult.successWithResult(portalService.getAgentNum(null));
public ApiResult<AgentNumResp> agentNum(AgentNumReq req) {
return ApiResult.successWithResult(portalService.getAgentNum(req));
}
/**
......
......@@ -5,6 +5,6 @@ import lombok.Data;
@Data
public class AgentNumReq {
private Integer status;
private String title; // 标题模糊查询
}
......@@ -8,6 +8,8 @@ import lombok.EqualsAndHashCode;
@Data
public class AgentPageReq extends BasePageRequest {
private Integer status; // 状态 1:待办 2:已办
private Integer status; // 1:待办; 2:已办
private String title; // 标题模糊查询
}
......@@ -2,6 +2,7 @@ package com.cnooc.expert.controller.workflow;
import com.cnooc.expert.common.response.ApiResult;
import com.cnooc.expert.common.response.BasePageResp;
import com.cnooc.expert.controller.common.AbstractBaseController;
import com.cnooc.expert.controller.workflow.model.request.ApprovePathSettingPageReq;
import com.cnooc.expert.controller.workflow.model.response.ApprovePathSettingPageResp;
import com.cnooc.expert.service.WorkflowService;
......@@ -15,7 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
@AllArgsConstructor
@RestController
@RequestMapping("/workflow")
public class WorkflowController {
public class WorkflowController extends AbstractBaseController {
private final WorkflowService workflowService;
......
......@@ -4,11 +4,13 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import retrofit2.Call;
import retrofit2.Response;
import java.io.IOException;
import java.util.Map;
@Slf4j
public abstract class AbstractRetrofitManager {
......@@ -43,4 +45,11 @@ public abstract class AbstractRetrofitManager {
}
}
protected Map<String, Object> getHeaders() {
Map<String, Object> headers = Maps.newHashMap();
headers.put("key", "XXXXX");
return headers;
}
}
package com.cnooc.expert.external.common.model.request;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class AgentNumApiGetReq {
private Integer status; // 1:待办; 2:已办
private String title; // 标题模糊查询
}
package com.cnooc.expert.external.common.model.response;
import lombok.Builder;
import lombok.Data;
import java.util.List;
@Data
@Builder
public class ApiBasePageResp<T> {
private Integer total;
private Integer pages;
private Integer current;
private List<T> data;
}
package com.cnooc.expert.external.common.model.response;
import com.cnooc.expert.common.exception.GlobalErrorCodeConstants;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Setter
@Getter
public class ApiBaseResult<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 响应码
*/
private Integer httpCode;
/**
* 响应消息
*/
private String message;
/**
* 响应数据
*/
private T result;
public ApiBaseResult(int httpCode, String message, T result) {
this.httpCode = httpCode;
this.message = message;
this.result = result;
}
/**
* 成功返回结果
*/
public static <T> ApiBaseResult<T> successWithResult(T result) {
return new ApiBaseResult<>(GlobalErrorCodeConstants.SUCCESS.getCode(), GlobalErrorCodeConstants.SUCCESS.getMsg(), result);
}
/**
* 成功返回结果
*/
public static <T> ApiBaseResult<T> success() {
return new ApiBaseResult<>(GlobalErrorCodeConstants.SUCCESS.getCode(), GlobalErrorCodeConstants.SUCCESS.getMsg(), null);
}
public static <T> ApiBaseResult<T> success(String message) {
return new ApiBaseResult<>(GlobalErrorCodeConstants.SUCCESS.getCode(), message, null);
}
/**
* 失败返回结果
*/
public static <T> ApiBaseResult<T> error(String message) {
return new ApiBaseResult<>(GlobalErrorCodeConstants.SYSTEM_ERROR.getCode(), message, null);
}
/**
* 失败返回结果
*/
public static <T> ApiBaseResult<T> error(int httpCode, String message) {
return new ApiBaseResult<>(httpCode, message, null);
}
/**
* 失败返回结果,并带有数据
*/
public static <T> ApiBaseResult<T> errorWithResult(int httpCode, String message, T result) {
return new ApiBaseResult<>(httpCode, message, result);
}
// Getters and Setters
}
package com.cnooc.expert.external.expert.api;
import com.cnooc.expert.external.expert.model.request.ExpertInfoGetReq;
import com.cnooc.expert.external.expert.model.response.ExpertInfoGetTestResp;
import com.cnooc.expert.external.common.model.response.ApiBaseResult;
import com.cnooc.expert.external.expert.model.request.CityTreeApiReq;
import com.cnooc.expert.external.expert.model.request.CommonJiTuanErJiDanWeiListApiReq;
import com.cnooc.expert.external.expert.model.request.CommonNofilterEnumGetApiReq;
import com.cnooc.expert.external.expert.model.request.DictByParentListApiReq;
import com.cnooc.expert.external.expert.model.request.ExpertInfoGetApiReq;
import com.cnooc.expert.external.expert.model.response.CityTreeApiResp;
import com.cnooc.expert.external.expert.model.response.CommonJiTuanErJiDanWeiListApiResp;
import com.cnooc.expert.external.expert.model.response.CommonNofilterEnumGetApiResp;
import com.cnooc.expert.external.expert.model.response.DictByParentListApiResp;
import com.cnooc.expert.external.expert.model.response.ExpertInfoGetApiResp;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.HeaderMap;
import retrofit2.http.POST;
import java.util.List;
import java.util.Map;
public interface ExpertServiceApi {
@GET("/api")
Call<ExpertInfoGetTestResp> expertDetailGet(@HeaderMap Map<String, Object> headers);
@POST("/api/mini/zjfw/zggrxxgl/queryInfoForEdit")
Call<ApiBaseResult<ExpertInfoGetApiResp>> getExpertInfo(@HeaderMap Map<String, Object> headers, @Body ExpertInfoGetApiReq req);
@POST("/")
Call<ExpertInfoGetTestResp> expertDetailUpDate(@HeaderMap Map<String, Object> headers, @Body ExpertInfoGetReq user);
/* 字典、枚举 */
@POST("/api/mini/common/nofilter/getEnum")
Call<ApiBaseResult<List<CommonNofilterEnumGetApiResp>>> getCommonNofilterEnum(@HeaderMap Map<String, Object> headers, @Body CommonNofilterEnumGetApiReq req);
/* 字典、枚举 */
@POST("/api/mini/common/listJiTuanErJiDanWei")
Call<ApiBaseResult<List<CommonJiTuanErJiDanWeiListApiResp>>> listCommonJiTuanErJiDanWei(@HeaderMap Map<String, Object> headers, @Body CommonJiTuanErJiDanWeiListApiReq req);
// 3职称 4职业资格信息 11 语种 12 熟练程度
@POST("/api/mini/zjcq/ChouQuShenQing/queryDictByParent")
Call<ApiBaseResult<List<DictByParentListApiResp>>> listDictByParent(@HeaderMap Map<String, Object> headers, @Body DictByParentListApiReq req);
// 5学历 6学位
@POST("/api/mini/xitongguanli/queryDictsByParentGuid")
Call<ApiBaseResult<List<DictByParentListApiResp>>> listDictByParentGuid(@HeaderMap Map<String, Object> headers, @Body DictByParentListApiReq req);
@POST("/api/mini/zjcq/ChouQuShenQing/queryCityTreeContainPartArea")
Call<ApiBaseResult<List<CityTreeApiResp>>> cityTree(@HeaderMap Map<String, Object> headers, @Body CityTreeApiReq req);
}
package com.cnooc.expert.external.expert.model.request;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class CityTreeApiReq {
private Integer professionLevel;
}
package com.cnooc.expert.external.expert.model.request;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class CommonJiTuanErJiDanWeiListApiReq {
private String danWeiName;
private Integer tenantId;
}
package com.cnooc.expert.external.expert.model.request;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class CommonNofilterEnumGetApiReq {
private String name;
}
package com.cnooc.expert.external.expert.model.request;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class DictByParentListApiReq {
private Integer parentGuid;
}
package com.cnooc.expert.external.expert.model.request;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class ExpertInfoGetApiReq {
}
package com.cnooc.expert.external.expert.model.response;
import lombok.Builder;
import lombok.Data;
import java.util.List;
@Data
@Builder
public class CityTreeApiResp {
private String dictGuid;//主键
private String typeName;//字典类型的名称
private String key;//暂未使用
private String value;//名称
private Integer sequence;//暂未使用
private Short isQiYong;//是否启用。1是启用 0是未启用
private String parentGuid;//父guid,保存父级别的dictGuid
private Long createTime;//创建时间
private String creatorGuid;//创建人Guid
private String creatorName;//创建人名称
private Long modifyTime;//修改时间
private String modifierGuid;//修改人Guid
private String modifierName;//修改人名称
private Boolean checked; // 选中或者不选中
private String state; // easyui treegrid用 开启还是关闭 两个值 open closed
private List<CityTreeApiResp> childrenDicts;
private String parentName; // 父级名称+子级名称
}
package com.cnooc.expert.external.expert.model.response;
import lombok.Data;
@Data
public class CommonJiTuanErJiDanWeiListApiResp {
private String code;
private String name;
}
package com.cnooc.expert.external.expert.model.response;
import lombok.Data;
@Data
public class CommonNofilterEnumGetApiResp {
private String id;
private String text;
}
package com.cnooc.expert.external.expert.model.response;
import lombok.Data;
@Data
public class DictByParentListApiResp {
private String dictGuid;
private String typeName;
private String key;
private String value;
}
package com.cnooc.expert.external.expert.service;
import com.cnooc.expert.external.common.AbstractRetrofitManager;
import com.cnooc.expert.external.common.model.response.ApiBaseResult;
import com.cnooc.expert.external.expert.api.ExpertServiceApi;
import com.cnooc.expert.external.expert.model.response.ExpertInfoGetTestResp;
import com.google.common.collect.Maps;
import com.cnooc.expert.external.expert.model.request.CityTreeApiReq;
import com.cnooc.expert.external.expert.model.request.CommonJiTuanErJiDanWeiListApiReq;
import com.cnooc.expert.external.expert.model.request.CommonNofilterEnumGetApiReq;
import com.cnooc.expert.external.expert.model.request.DictByParentListApiReq;
import com.cnooc.expert.external.expert.model.request.ExpertInfoGetApiReq;
import com.cnooc.expert.external.expert.model.response.CityTreeApiResp;
import com.cnooc.expert.external.expert.model.response.CommonJiTuanErJiDanWeiListApiResp;
import com.cnooc.expert.external.expert.model.response.CommonNofilterEnumGetApiResp;
import com.cnooc.expert.external.expert.model.response.DictByParentListApiResp;
import com.cnooc.expert.external.expert.model.response.ExpertInfoGetApiResp;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import retrofit2.Call;
import retrofit2.Retrofit;
import java.util.List;
import java.util.Map;
@Service
......@@ -20,10 +30,39 @@ public class ExpertServiceClient extends AbstractRetrofitManager {
this.expertServiceApi = retrofit.create(ExpertServiceApi.class);
}
public ExpertInfoGetTestResp getExpertInfo(long id) {
Map<String, Object> headers = Maps.newHashMap();
Call<ExpertInfoGetTestResp> call = expertServiceApi.expertDetailGet(headers);
public ApiBaseResult<ExpertInfoGetApiResp> getExpertInfo(ExpertInfoGetApiReq req) {
Map<String, Object> headers = super.getHeaders();
Call<ApiBaseResult<ExpertInfoGetApiResp>> call = expertServiceApi.getExpertInfo(headers, req);
return this.getResponseBody(call, "getExpertInfo");
}
public ApiBaseResult<List<CommonNofilterEnumGetApiResp>> getCommonNofilterEnum(CommonNofilterEnumGetApiReq req) {
Map<String, Object> headers = super.getHeaders();
Call<ApiBaseResult<List<CommonNofilterEnumGetApiResp>>> call = expertServiceApi.getCommonNofilterEnum(headers, req);
return this.getResponseBody(call, "getCommonNofilterEnum");
}
public ApiBaseResult<List<CommonJiTuanErJiDanWeiListApiResp>> listCommonJiTuanErJiDanWei(CommonJiTuanErJiDanWeiListApiReq req) {
Map<String, Object> headers = super.getHeaders();
Call<ApiBaseResult<List<CommonJiTuanErJiDanWeiListApiResp>>> call = expertServiceApi.listCommonJiTuanErJiDanWei(headers, req);
return this.getResponseBody(call, "listCommonJiTuanErJiDanWei");
}
public ApiBaseResult<List<DictByParentListApiResp>> listDictByParent(DictByParentListApiReq req) {
Map<String, Object> headers = super.getHeaders();
Call<ApiBaseResult<List<DictByParentListApiResp>>> call = expertServiceApi.listDictByParent(headers, req);
return this.getResponseBody(call, "listDictByParent");
}
public ApiBaseResult<List<DictByParentListApiResp>> listDictByParentGuid(DictByParentListApiReq req) {
Map<String, Object> headers = super.getHeaders();
Call<ApiBaseResult<List<DictByParentListApiResp>>> call = expertServiceApi.listDictByParentGuid(headers, req);
return this.getResponseBody(call, "listDictByParentGuid");
}
public ApiBaseResult<List<CityTreeApiResp>> treeCity(CityTreeApiReq req) {
Map<String, Object> headers = super.getHeaders();
Call<ApiBaseResult<List<CityTreeApiResp>>> call = expertServiceApi.cityTree(headers, req);
return this.getResponseBody(call, "treeCity");
}
}
package com.cnooc.expert.external.portal.api;
import com.cnooc.expert.external.expert.model.request.ExpertInfoAppReq;
import com.cnooc.expert.external.expert.model.response.ExpertInfoAppResp;
import com.cnooc.expert.external.common.model.response.ApiBasePageResp;
import com.cnooc.expert.external.common.model.response.ApiBaseResult;
import com.cnooc.expert.external.portal.model.request.AgentNumGetApiReq;
import com.cnooc.expert.external.portal.model.request.AgentNumPageApiReq;
import com.cnooc.expert.external.portal.model.request.MessageNumGetApiReq;
import com.cnooc.expert.external.portal.model.request.MessageNumPageApiReq;
import com.cnooc.expert.external.portal.model.response.AgentNumGetApiResp;
import com.cnooc.expert.external.portal.model.response.AgentNumPageApiResp;
import com.cnooc.expert.external.portal.model.response.MessageNumGetApiResp;
import com.cnooc.expert.external.portal.model.response.MessageNumPageApiResp;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.HeaderMap;
......@@ -11,7 +19,16 @@ import java.util.Map;
public interface PortalServiceApi {
@POST("")
Call<ExpertInfoAppResp> getZhuanJiaInfoAppById(@HeaderMap Map<String, Object> headers, @Body ExpertInfoAppReq expertInfoAppReq);
@POST("/api/mini/specialist/business/agent/expert/num")
Call<ApiBaseResult<AgentNumGetApiResp>> agentNumGetApi(@HeaderMap Map<String, Object> headers, @Body AgentNumGetApiReq req);
@POST("/api/mini/specialist/business/agent/expert/selectByPage")
Call<ApiBaseResult<ApiBasePageResp<AgentNumPageApiResp>>> agentNumPageApi(@HeaderMap Map<String, Object> headers, @Body AgentNumPageApiReq req);
@POST("/api/mini/specialist/v1/business/message/selectMessage")
Call<ApiBaseResult<MessageNumGetApiResp>> messageNumGetApi(@HeaderMap Map<String, Object> headers, @Body MessageNumGetApiReq req);
@POST("/api/mini/specialist/v1/business/message/selectPageByExpert")
Call<ApiBaseResult<ApiBasePageResp<MessageNumPageApiResp>>> messageNumPageApi(@HeaderMap Map<String, Object> headers, @Body MessageNumPageApiReq req);
}
package com.cnooc.expert.external.portal.model.request;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class AgentNumGetApiReq {
private String account;
private String title; // 标题模糊查询
}
package com.cnooc.expert.external.portal.model.request;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class AgentNumPageApiReq {
private Integer pageNum;
private Integer pageSize;
private String account;
private Integer status; // 1:待办; 2:已办
private String title; // 标题模糊查询
}
package com.cnooc.expert.external.portal.model.request;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class MessageNumGetApiReq {
private String receivers;
}
package com.cnooc.expert.external.portal.model.request;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class MessageNumPageApiReq {
private Integer pageNum;
private Integer pageSize;
private String receivers;
private Integer status; //状态 1:待阅 2:已阅
private Integer messageHeader;
private Integer messageContent;
}
package com.cnooc.expert.external.portal.model.response;
import lombok.Data;
@Data
public class AgentNumGetApiResp {
private Integer backlogNum;
private Integer doneNum;
}
package com.cnooc.expert.external.portal.model.response;
import lombok.Data;
@Data
public class AgentNumPageApiResp {
private Integer id;
private String account;
private String agentType;
private String content;
private String createName;
private String createTime;
private String createdTime;
private String infoId;
private String modifyName;
private Integer pushType;
private String redirectUrl;
private Boolean status;
private String title;
private String type;
private String updatedTime;
}
package com.cnooc.expert.external.portal.model.response;
import lombok.Data;
@Data
public class MessageNumGetApiResp {
private Integer read;
private Integer unRead;
}
package com.cnooc.expert.external.portal.model.response;
import lombok.Data;
@Data
public class MessageNumPageApiResp {
private Integer id;
private String contentId;
private String createBy;
private String createName;
private String createTime;
private String endTime;
private String infoId;
private String messageContent;
private String messageHeader;
private String modifyBy;
private String modifyName;
private String orgId;
private String receiver;
private String receivers;
private String redirectUrl;
private String startTime;
private Integer status;
private String updatedTime;
private String visiblePosition;
}
package com.cnooc.expert.external.portal.service;
import com.cnooc.expert.external.common.AbstractRetrofitManager;
import com.cnooc.expert.external.common.model.response.ApiBasePageResp;
import com.cnooc.expert.external.common.model.response.ApiBaseResult;
import com.cnooc.expert.external.portal.api.PortalServiceApi;
import com.cnooc.expert.external.portal.model.request.AgentNumPageApiReq;
import com.cnooc.expert.external.portal.model.request.AgentNumGetApiReq;
import com.cnooc.expert.external.portal.model.request.MessageNumGetApiReq;
import com.cnooc.expert.external.portal.model.request.MessageNumPageApiReq;
import com.cnooc.expert.external.portal.model.response.AgentNumPageApiResp;
import com.cnooc.expert.external.portal.model.response.AgentNumGetApiResp;
import com.cnooc.expert.external.portal.model.response.MessageNumGetApiResp;
import com.cnooc.expert.external.portal.model.response.MessageNumPageApiResp;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import retrofit2.Call;
import retrofit2.Retrofit;
import java.util.Map;
@Service
public class PortalServiceClient extends AbstractRetrofitManager {
......@@ -15,4 +28,30 @@ public class PortalServiceClient extends AbstractRetrofitManager {
this.portalServiceApi = retrofit.create(PortalServiceApi.class);
}
public ApiBaseResult<AgentNumGetApiResp> getAgentNumApi(AgentNumGetApiReq req) {
Map<String, Object> headers = super.getHeaders();
Call<ApiBaseResult<AgentNumGetApiResp>> call = portalServiceApi.agentNumGetApi(headers, req);
return super.getResponseBody(call, "getAgentNumApi");
}
public ApiBaseResult<ApiBasePageResp<AgentNumPageApiResp>> pageAgentNumApi(AgentNumPageApiReq req) {
Map<String, Object> headers = super.getHeaders();
Call<ApiBaseResult<ApiBasePageResp<AgentNumPageApiResp>>> call = portalServiceApi.agentNumPageApi(headers, req);
return super.getResponseBody(call, "pageAgentNumApi");
}
public ApiBaseResult<MessageNumGetApiResp> getMessageNumApi(MessageNumGetApiReq req) {
Map<String, Object> headers = super.getHeaders();
Call<ApiBaseResult<MessageNumGetApiResp>> call = portalServiceApi.messageNumGetApi(headers, req);
return super.getResponseBody(call, "getMessageNumApi");
}
public ApiBaseResult<ApiBasePageResp<MessageNumPageApiResp>> pageMessageNumApi(MessageNumPageApiReq req) {
Map<String, Object> headers = super.getHeaders();
Call<ApiBaseResult<ApiBasePageResp<MessageNumPageApiResp>>> call = portalServiceApi.messageNumPageApi(headers, req);
return super.getResponseBody(call, "pageMessageNumApi");
}
}
package com.cnooc.expert.external.subject.api;
public interface SubjectServiceApi {
}
package com.cnooc.expert.external.subject.service;
import com.cnooc.expert.external.common.AbstractRetrofitManager;
import com.cnooc.expert.external.subject.api.SubjectServiceApi;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import retrofit2.Retrofit;
@Service
public class SubjectServiceClient extends AbstractRetrofitManager {
private final SubjectServiceApi subjectServiceApi;
public SubjectServiceClient(@Qualifier("retrofitSubject") Retrofit retrofit) {
this.subjectServiceApi = retrofit.create(SubjectServiceApi.class);
}
}
......@@ -9,7 +9,19 @@ import com.cnooc.expert.controller.portal.model.response.AgentNumResp;
import com.cnooc.expert.controller.portal.model.response.AgentPageResp;
import com.cnooc.expert.controller.portal.model.response.MessageNumResp;
import com.cnooc.expert.controller.portal.model.response.MessagePageResp;
import com.cnooc.expert.external.common.model.response.ApiBasePageResp;
import com.cnooc.expert.external.common.model.response.ApiBaseResult;
import com.cnooc.expert.external.portal.model.request.AgentNumGetApiReq;
import com.cnooc.expert.external.portal.model.request.AgentNumPageApiReq;
import com.cnooc.expert.external.portal.model.request.MessageNumGetApiReq;
import com.cnooc.expert.external.portal.model.request.MessageNumPageApiReq;
import com.cnooc.expert.external.portal.model.response.AgentNumGetApiResp;
import com.cnooc.expert.external.portal.model.response.AgentNumPageApiResp;
import com.cnooc.expert.external.portal.model.response.MessageNumGetApiResp;
import com.cnooc.expert.external.portal.model.response.MessageNumPageApiResp;
import com.cnooc.expert.external.portal.service.PortalServiceClient;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
......@@ -22,8 +34,19 @@ public class PortalService {
private final PortalServiceClient portalServiceClient;
private String getCurUserAccount() {
return "ex_zhanglh15";
}
public AgentNumResp getAgentNum(AgentNumReq req) {
// AgentNumGetApiReq apiReq = AgentNumGetApiReq.builder()
// .account(this.getCurUserAccount())
// .title(req.getTitle())
// .build();
// ApiBaseResult<AgentNumGetApiResp> apiResp = portalServiceClient.getAgentNumApi(apiReq);
// return apiResp;
AgentNumResp result = AgentNumResp.builder()
.backlogNum(0)
.doneNum(3)
......@@ -34,6 +57,15 @@ public class PortalService {
public BasePageResp<Object> pageAgentNum(AgentPageReq req) {
// AgentNumPageApiReq apiReq = AgentNumPageApiReq.builder()
// .pageNum(req.getPageNo())
// .pageSize(req.getPageSize())
// .account(this.getCurUserAccount())
// .status(req.getStatus())
// .title(req.getTitle())
// .build();
// ApiBaseResult<ApiBasePageResp<AgentNumPageApiResp>> apiResp = portalServiceClient.pageAgentNumApi(apiReq);
List<Object> data = Lists.newArrayList(
AgentPageResp.builder()
.id(182182)
......@@ -95,6 +127,12 @@ public class PortalService {
public MessageNumResp getMessageNum(MessageNumReq req) {
// MessageNumGetApiReq apiReq = MessageNumGetApiReq.builder()
// .receivers(this.getCurUserAccount())
// .build();
// ApiBaseResult<MessageNumGetApiResp> apiResp = portalServiceClient.getMessageNumApi(apiReq);
// return apiResp;
MessageNumResp result = MessageNumResp.builder()
.read(1)
.unRead(1)
......@@ -105,6 +143,15 @@ public class PortalService {
public BasePageResp<Object> pageMessageNum(MessagePageReq req) {
// MessageNumPageApiReq apiReq = MessageNumPageApiReq.builder()
// .pageNum(req.getPageNo())
// .pageSize(req.getPageSize())
// .receivers(this.getCurUserAccount())
// .status(req.getStatus())
// .build();
// ApiBaseResult<ApiBasePageResp<MessageNumPageApiResp>> apiResp = portalServiceClient.pageMessageNumApi(apiReq);
// return apiResp;
List<Object> data = Lists.newArrayList(
MessagePageResp.builder()
.id(182182)
......
spring:
profiles:
active: dev
redis:
host: 39.105.210.213
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment