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.UtilsClient;
|
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 UtilsClientImpl {
|
|
private UtilsClient utilsClient;
|
|
@Autowired
|
public UtilsClientImpl(UtilsClient utilsClient) {
|
this.utilsClient = utilsClient;
|
}
|
|
/**
|
* 公共id-获取时间Id,后四位常量
|
* @url {ctx}/api/client/dispUtils/getNewTimeId
|
* @return Object
|
*/
|
public String getNewTimeId(){
|
try{
|
ReturnBO returnBo = utilsClient.getNewTimeId();
|
if (ReturnConsts.OK == returnBo.getCode()){
|
String id = (String) returnBo.getData();
|
return id;
|
}else{
|
log.error("Client外服务接口[UtilsClientImpl.getNewTimeId]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
|
throw new ClientException("UtilsClientImpl.getNewTimeId", returnBo.getMsg());
|
}
|
}catch (Exception e){
|
log.error("service方法[UtilsClientImpl.getNewTimeId]请求成功,处理异常:"+e, e);
|
throw new ServiceException("UtilsClientImpl.getNewTimeId", e);
|
}
|
}
|
|
}
|