| | |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.topic.IBaseTopic; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.topic.ICustomizeTopic; |
| | | import com.sandu.ximon.admin.manager.iot.rrpc.util.FrameUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | |
| | | import java.util.List; |
| | |
| | | * @author chenjiantian |
| | | * @date 2021/12/2 18:21 |
| | | */ |
| | | @Slf4j |
| | | public abstract class BaseInvokeSyncService implements IInvoke, IBaseTopic, ICustomizeTopic { |
| | | |
| | | /** |
| | |
| | | public <T extends BaseResponseInnerFrame<T>> WrapResponseCommonFrame<T> sendRRPC(String deviceName, IRequestFrame iRequestFrame, Class<T> clz){ |
| | | CommonFrame commonFrame = sendRRPC(deviceName, iRequestFrame); |
| | | if (commonFrame == null) { |
| | | throw new BusinessException("rrpc请求失败"); |
| | | return null; |
| | | } |
| | | WrapResponseCommonFrame<T> responseCommonFrame = new WrapResponseCommonFrame<>(); |
| | | BeanUtils.copyProperties(commonFrame, responseCommonFrame); |
| | |
| | | result = result.replace("\\", ""); |
| | | Map map = JSON.parseObject(result, Map.class); |
| | | result = (String) map.get("msg"); |
| | | CommonFrame connectFrame = FrameUtils.transformMessageToFrame(result); |
| | | return connectFrame; |
| | | return FrameUtils.transformMessageToFrame(result); |
| | | } |
| | | |
| | | /** |
| | |
| | | response = getClient().getAcsResponse(request); |
| | | } catch (ClientException e) { |
| | | e.printStackTrace(); |
| | | throw new BusinessException("硬件请求失败,请检查硬件设备!"); |
| | | } |
| | | if (response == null) { |
| | | throw new BusinessException("调用rrpc失败"); |
| | | throw new BusinessException("调用rrpc失败,响应为空!"); |
| | | } |
| | | if (!response.getSuccess()) { |
| | | throw new BusinessException("调用rrpc失败," + response.getErrorMessage()); |