package cn.huge.module.client.api.impl;
|
|
import cn.huge.base.common.bo.ReturnBO;
|
import cn.huge.base.common.constant.ReturnConsts;
|
import cn.huge.base.common.exception.ClientException;
|
import cn.huge.base.common.exception.ServiceException;
|
import cn.huge.module.client.api.CustClient;
|
|
import cn.huge.module.client.api.MediateClient;
|
import cn.huge.module.cust.dto.CtUserDTO;
|
import cn.huge.module.grid.domain.dto.RegisterSaveDTO;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* @title: 客户用户中心微服务调用接口实现
|
* @description: 客户用户中心微服务调用接口实现
|
* @company: hugeinfo
|
* @author: liyj
|
* @time: 2021-11-05 16:51:48
|
* @version: 1.0.0
|
*/
|
@Slf4j
|
@Component
|
public class MediateClientImpl {
|
|
private MediateClient mediateClient;
|
|
@Autowired
|
public MediateClientImpl(MediateClient mediateClient) {
|
this.mediateClient = mediateClient;
|
}
|
|
/**
|
* ObjectMapper工具类
|
*/
|
private ObjectMapper objectMapper = new ObjectMapper();
|
|
/**
|
* 协同推送-网格推送案件入库
|
* @param registerSaveDTO 案件登记对象
|
* @return CtUserDTO
|
*/
|
public String gridCaseRegister(RegisterSaveDTO registerSaveDTO){
|
try{
|
ReturnBO returnBo = mediateClient.gridCaseRegister(registerSaveDTO);
|
if (ReturnConsts.OK == returnBo.getCode()){
|
String id = (String) returnBo.getData();
|
return id;
|
}else {
|
log.error("Client外服务接口[CustClientImpl.gridCaseRegister]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
|
throw new ClientException("CustClientImpl.gridCaseRegister", returnBo.getMsg());
|
}
|
}catch (Exception e){
|
log.error("service方法[CustClientImpl.gridCaseRegister]调用异常:"+e, e);
|
throw new ServiceException("CustClientImpl.gridCaseRegister", e);
|
}
|
}
|
|
}
|