Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-job-scheduler
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3b1ac11e
authored
Apr 25, 2023
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
任务调度程序
1 parent
60d9ac6b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
15 deletions
src/main/java/cn/com/glsx/scheduler/common/config/DubboConfig.java
src/main/java/cn/com/glsx/scheduler/modules/service/ShopmallGoodsDataSyncService.java
src/test/java/cn/com/glsx/MainTest.java
src/main/java/cn/com/glsx/scheduler/common/config/DubboConfig.java
0 → 100644
View file @
3b1ac11
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
();
}
}
src/main/java/cn/com/glsx/scheduler/modules/service/ShopmallGoodsDataSyncService.java
View file @
3b1ac11
...
@@ -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
();
...
...
src/test/java/cn/com/glsx/MainTest.java
0 → 100644
View file @
3b1ac11
package
cn
.
com
.
glsx
;
public
class
MainTest
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
System
.
currentTimeMillis
());
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment