Commit b337f055 by 杨林龙

添加不在店统计并插入数据库定时任务执行逻辑

1 parent bd2ae128
...@@ -21,7 +21,4 @@ public interface ElectricFenceClient { ...@@ -21,7 +21,4 @@ public interface ElectricFenceClient {
@PostMapping(value = "/insertfencedrive") @PostMapping(value = "/insertfencedrive")
R insertFenceDrive(@RequestBody ElectricFenceDto fenceDrive); R insertFenceDrive(@RequestBody ElectricFenceDto fenceDrive);
@GetMapping(value = "/getvdidbysn")
R getVdIdbySn(@RequestParam String sn);
} }
package cn.com.glsx.stdinterface.api;
import cn.com.glsx.stdinterface.factory.StatisticsInStoreFallbackFactory;
import com.glsx.plat.core.web.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
/**
* @author zhouhaibao
* @date 2021/5/24 9:49
*/
@FeignClient(name = "ne-shield-standard-interfaces", path = "/stdinterface/statisticsinstore", fallbackFactory = StatisticsInStoreFallbackFactory.class, decode404 = true)
public interface StatisticsInStoreClient {
/**
* 获取数据并插入数据
*
* @return R
*/
@GetMapping(value = "/statisticsandinsertinstoredatalist")
R<Integer> statisticsAndInsertInStoreDataEveryDay();
}
package cn.com.glsx.stdinterface.factory;
import cn.com.glsx.stdinterface.api.StatisticsInStoreClient;
import cn.com.glsx.stdinterface.fallback.StatisticsInStoreFallbackImpl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
/**
* 项目名:ne-shield-insurancenter-api
* 包名: cn.com.glsx.insurance.factory
* 作者: Yanglinlong
* 日期: 2021/7/5 16:15
*/
@Component
public class StatisticsInStoreFallbackFactory implements FallbackFactory<StatisticsInStoreClient> {
@Override
public StatisticsInStoreClient create(Throwable throwable) {
StatisticsInStoreFallbackImpl fallback = new StatisticsInStoreFallbackImpl();
fallback.setCause(throwable);
return fallback;
}
}
...@@ -32,10 +32,4 @@ public class ElectricFenceFallbackImpl implements ElectricFenceClient { ...@@ -32,10 +32,4 @@ public class ElectricFenceFallbackImpl implements ElectricFenceClient {
log.warn("insertFenceDrive 熔断啦 {}", cause.getMessage()); log.warn("insertFenceDrive 熔断啦 {}", cause.getMessage());
return R.ok("服务异常"); return R.ok("服务异常");
} }
@Override
public R getVdIdbySn(String sn) {
log.warn("getVdIdbySn 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
} }
package cn.com.glsx.stdinterface.fallback;
import cn.com.glsx.stdinterface.api.StatisticsInStoreClient;
import com.glsx.plat.core.web.R;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 项目名:ne-shield-insurancenter-api
* 包名: cn.com.glsx.insurance.fallback
* 作者: Yanglinlong
* 日期: 2021/7/5 16:16
*/
@Slf4j
@Component
public class StatisticsInStoreFallbackImpl implements StatisticsInStoreClient {
@Setter
private Throwable cause;
@Override
public R statisticsAndInsertInStoreDataEveryDay() {
log.warn("statisticsAndInsertInStoreDataEveryDay 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
}
...@@ -7,4 +7,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ ...@@ -7,4 +7,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.com.glsx.stdinterface.fallback.ElectricFenceFallbackImpl,\ cn.com.glsx.stdinterface.fallback.ElectricFenceFallbackImpl,\
cn.com.glsx.stdinterface.factory.ElectricInStoreFallbackFactory,\ cn.com.glsx.stdinterface.factory.ElectricInStoreFallbackFactory,\
cn.com.glsx.stdinterface.fallback.ElectricInStoreFallbackImpl,\ cn.com.glsx.stdinterface.fallback.ElectricInStoreFallbackImpl,\
cn.com.glsx.stdinterface.fallback.RouteOilMileageFallbackImpl cn.com.glsx.stdinterface.fallback.RouteOilMileageFallbackImpl,\
cn.com.glsx.stdinterface.fallback.StatisticsInStoreFallbackImpl
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!