Commit 3b1ac11e by 刘宇峰

任务调度程序

1 parent 60d9ac6b
package cn.com.glsx.scheduler.common.config;
import cn.com.glsx.scrm.shopmall.remote.PlatformGoodsRemote;
import com.glsx.plat.dubbo.factory.ReferenceBuilderFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class DubboConfig {
@Bean
public ReferenceBuilderFactory referenceBuilderFactory() {
return new ReferenceBuilderFactory();
}
@Autowired
protected ReferenceBuilderFactory factory;
protected final boolean check = false;
protected final int timeout = 30000;
@Bean
public PlatformGoodsRemote platformGoodsRemote() {
return factory.builder(PlatformGoodsRemote.class).check(check).timeout(timeout).build();
}
}
...@@ -9,9 +9,7 @@ import cn.com.glsx.scrm.shopmall.remote.PlatformGoodsRemote; ...@@ -9,9 +9,7 @@ import cn.com.glsx.scrm.shopmall.remote.PlatformGoodsRemote;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.dubbo.config.ReferenceConfig;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -21,9 +19,6 @@ import java.util.List; ...@@ -21,9 +19,6 @@ import java.util.List;
@Service @Service
public class ShopmallGoodsDataSyncService { public class ShopmallGoodsDataSyncService {
@Value("${scrm.shopmall.PlatformGoodsRemote}")
private String tempGoodsDubboUrl;
@Lazy @Lazy
@Autowired @Autowired
private ShopmallGoodsApiService shopmallGoodsApiService; private ShopmallGoodsApiService shopmallGoodsApiService;
...@@ -32,16 +27,14 @@ public class ShopmallGoodsDataSyncService { ...@@ -32,16 +27,14 @@ public class ShopmallGoodsDataSyncService {
@Autowired @Autowired
private ShopmallNoticeApiService shopmallNoticeApiService; private ShopmallNoticeApiService shopmallNoticeApiService;
@Autowired
private PlatformGoodsRemote platformGoodsRemote;
public Integer syncGoodsListData() { public Integer syncGoodsListData() {
return shopmallGoodsApiService.syncGoodsListData(); return shopmallGoodsApiService.syncGoodsListData();
} }
public void syncGoodsInfoData() { public void syncGoodsInfoData() {
ReferenceConfig<PlatformGoodsRemote> referenceConfig = new ReferenceConfig<>();
referenceConfig.setInterface(PlatformGoodsRemote.class);
referenceConfig.setUrl(tempGoodsDubboUrl);
PlatformGoodsRemote platformGoodsRemote = referenceConfig.get();
RpcResponse<List<String>> response = platformGoodsRemote.platformGoodsSelectedInventory(""); RpcResponse<List<String>> response = platformGoodsRemote.platformGoodsSelectedInventory("");
List<String> goodsSkuCodes = response.getResult(); List<String> goodsSkuCodes = response.getResult();
if (CollectionUtils.isEmpty(goodsSkuCodes)) { if (CollectionUtils.isEmpty(goodsSkuCodes)) {
...@@ -51,11 +44,6 @@ public class ShopmallGoodsDataSyncService { ...@@ -51,11 +44,6 @@ public class ShopmallGoodsDataSyncService {
} }
public void syncGoodsStatusAndPriceData() { public void syncGoodsStatusAndPriceData() {
ReferenceConfig<PlatformGoodsRemote> referenceConfig = new ReferenceConfig<>();
referenceConfig.setInterface(PlatformGoodsRemote.class);
referenceConfig.setUrl(tempGoodsDubboUrl);
PlatformGoodsRemote platformGoodsRemote = referenceConfig.get();
RpcResponse<List<String>> response = platformGoodsRemote.platformGoodsSelectedInventory(""); RpcResponse<List<String>> response = platformGoodsRemote.platformGoodsSelectedInventory("");
List<String> goodsSkuCodes = response.getResult(); List<String> goodsSkuCodes = response.getResult();
......
package cn.com.glsx;
public class MainTest {
public static void main(String[] args) {
System.out.println(System.currentTimeMillis());
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!