Commit 4f7d1e83 authored by 赵啸非's avatar 赵啸非

添加信息公开平台通知

2 merge requests!2Master,!1WIP: Master
package com.mortals.xhx.feign;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.pdu.DeviceReq;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 设备 Feign接口
*
* @author zxfei
* @date 2023-02-25
*/
@FeignClient(name = "info-publish-manager", path = "/infopublish", fallbackFactory = InfoDeviceFeignFallbackFactory.class)
public interface IInfoPublishDeviceFeign extends IFeign {
/**
* 设备回调
*
* @param deviceReq
* @return
*/
@PostMapping(value = "/api/device/callback")
Rest<String> deviceCall(@RequestBody DeviceReq deviceReq);
}
@Slf4j
@Component
class InfoDeviceFeignFallbackFactory implements FallbackFactory<IInfoPublishDeviceFeign> {
@Override
public IInfoPublishDeviceFeign create(Throwable t) {
return new IInfoPublishDeviceFeign() {
@Override
public Rest<String> deviceCall(DeviceReq deviceReq) {
return Rest.fail();
}
};
}
}
......@@ -23,6 +23,7 @@ import com.mortals.xhx.common.pdu.DeviceReq;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.feign.IFillDeviceFeign;
import com.mortals.xhx.feign.IInfoPublishDeviceFeign;
import com.mortals.xhx.feign.IOfficeDeviceFeign;
import com.mortals.xhx.feign.ISampleDeviceFeign;
import com.mortals.xhx.feign.site.ISiteFeign;
......@@ -92,6 +93,9 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
@Autowired
private IFillDeviceFeign fillDeviceFeign;
@Autowired
private IInfoPublishDeviceFeign infoPublishDeviceFeign;
@Value("${thirdPartyPath:/inter/device/deviceIn}")
private String thirdPartyPath;
......@@ -391,6 +395,14 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
Rest<String> sampleRest = sampleDeviceFeign.deviceCall(deviceReq);
log.info("sample resp ==>{}", JSON.toJSONString(sampleRest));
}
if ("xxgk".equals(platformEntity.getPlatformSn())) {
deviceReq.setReceiveMethod(update.getValue());
//调用样表系统系统
Rest<String> sampleRest = infoPublishDeviceFeign.deviceCall(deviceReq);
log.info("info publish resp ==>{}", JSON.toJSONString(sampleRest));
}
if ("tdxt".equals(platformEntity.getPlatformSn())) {
deviceReq.setReceiveMethod(update.getValue());
//调用样表系统系统
......
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