Commit 255cd917 authored by 赵啸非's avatar 赵啸非

修改部分一键部署功能

parent 97d932eb
package com.mortals.xhx.feign.bill.smartoffice;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.feign.IFeign;
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;
/**
* 服务系统 Feign接口
*
* @author zxfei
* @date 2022-10-26
*/
@FeignClient(name = "bill-manager", path = "/bill", fallbackFactory = BillFeignFallbackFactory.class)
public interface IBillFeign extends IFeign {
/**
* 用户刷新通知
*
* @param
* @return
*/
@PostMapping(value = "/user/refreshUser")
Rest<Void> refreshUser();
}
@Slf4j
@Component
class BillFeignFallbackFactory implements FallbackFactory<IBillFeign> {
@Override
public IBillFeign create(Throwable t) {
return new IBillFeign() {
/**
* @return
*/
@Override
public Rest<Void> refreshUser() {
return Rest.fail("暂时无法通知设备,请稍后再试!");
}
};
}
}
package com.mortals.xhx.common.utils;
import com.mortals.xhx.feign.area.IApiAreaFeign;
import com.mortals.xhx.feign.bill.smartoffice.IBillFeign;
import com.mortals.xhx.feign.device.IDeviceFeign;
import com.mortals.xhx.feign.selfsystem.ISelfSystemFeign;
import com.mortals.xhx.feign.skin.ISkinFillFeign;
......@@ -26,6 +27,7 @@ public class SendSubSystemTask implements Runnable {
private ISkinFillFeign skinFillFeign;
private ISelfSystemFeign selfSystemFeign;
private ISmartSystemFeign smartSystemFeign;
private IBillFeign billFeign;
public SendSubSystemTask() {
apiAreaFeign = SpringUtils.getBean(IApiAreaFeign.class);
......@@ -34,11 +36,13 @@ public class SendSubSystemTask implements Runnable {
skinFillFeign = SpringUtils.getBean(ISkinFillFeign.class);
selfSystemFeign = SpringUtils.getBean(ISelfSystemFeign.class);
smartSystemFeign = SpringUtils.getBean(ISmartSystemFeign.class);
billFeign = SpringUtils.getBean(IBillFeign.class);
}
@Override
public void run() {
try {
log.info("开始通知子系统");
Thread.sleep(2000);
apiAreaFeign.refreshUser();
Thread.sleep(2000);
......@@ -51,6 +55,9 @@ public class SendSubSystemTask implements Runnable {
selfSystemFeign.refreshUser();
Thread.sleep(2000);
smartSystemFeign.refreshUser();
Thread.sleep(2000);
billFeign.refreshUser();
log.info("子系统通知完成");
} catch (Exception e) {
log.error("通知异常:", e);
}
......
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