2021与蓝度共同重构项目,服务端
liuhaonan
2022-08-25 41feaf34a801b9fafee93317f96337b01f763be7
ximon-admin/src/main/java/com/sandu/ximon/admin/manager/iot/rrpc/BaseInvokeSyncService.java
@@ -14,6 +14,7 @@
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;
@@ -23,6 +24,7 @@
 * @author chenjiantian
 * @date 2021/12/2 18:21
 */
@Slf4j
public abstract class BaseInvokeSyncService implements IInvoke, IBaseTopic, ICustomizeTopic {
    /**
@@ -36,7 +38,7 @@
    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);
@@ -61,8 +63,7 @@
        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);
    }
    /**
@@ -176,9 +177,10 @@
            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());