Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bailuntec-datacenter
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huluobin
bailuntec-datacenter
Commits
b2f302b1
Commit
b2f302b1
authored
Jan 20, 2021
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
# update
parent
318de9d8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
14 deletions
+28
-14
EbayItemReader.java
...-ebay/src/main/java/com/bailuntec/job/EbayItemReader.java
+13
-2
EbayJobListener.java
...ebay/src/main/java/com/bailuntec/job/EbayJobListener.java
+9
-8
JobConfiguration.java
...bay/src/main/java/com/bailuntec/job/JobConfiguration.java
+3
-3
application-prod.yml
...se/base-sync-ebay/src/main/resources/application-prod.yml
+2
-0
pom.xml
datacenter-job/datacenter-finance/pom.xml
+1
-1
No files found.
datacenter-job/datacenter-base/base-sync-ebay/src/main/java/com/bailuntec/job/EbayItemReader.java
View file @
b2f302b1
package
com
.
bailuntec
.
job
;
import
com.bailuntec.application.IDcBaseFinanceEbayService
;
import
com.bailuntec.common.JsonUtilByFsJson
;
import
com.bailuntec.common.ListUtil
;
import
com.bailuntec.domain.DcBaseCompanyAccount
;
import
com.bailuntec.domain.DcBaseFinanceEbay
;
import
com.bailuntec.domain.DcJobConfig
;
import
com.bailuntec.infrastructure.mapper.DcBaseCompanyAccountMapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.ebay.sdk.ApiContext
;
import
com.ebay.sdk.ApiCredential
;
import
com.ebay.sdk.TimeFilter
;
...
...
@@ -48,20 +51,23 @@ public class EbayItemReader implements ItemReader<EbayItem> {
private
DcJobConfig
dcJobConfig
;
private
final
DcBaseCompanyAccountMapper
dcBaseCompanyAccountMapper
;
private
final
IDcBaseFinanceEbayService
dcBaseFinanceEbayService
;
@SneakyThrows
public
EbayItemReader
(
DcBaseCompanyAccountMapper
dcBaseCompanyAccountMapper
,
DcJobConfig
dcJobConfig
)
{
DcJobConfig
dcJobConfig
,
IDcBaseFinanceEbayService
dcBaseFinanceEbayService
)
{
this
.
dcBaseCompanyAccountMapper
=
dcBaseCompanyAccountMapper
;
this
.
dcJobConfig
=
dcJobConfig
;
this
.
dcBaseFinanceEbayService
=
dcBaseFinanceEbayService
;
this
.
init
();
}
private
void
init
()
{
log
.
info
(
"初始化reader 开始.."
);
dcBaseCompanyAccountList
=
dcBaseCompanyAccountMapper
.
queryPageEbay
();
this
.
pageNum
=
dcJobConfig
.
getPageNum
();
this
.
nextAccount
();
log
.
info
(
"初始化reader 结束"
);
}
...
...
@@ -104,6 +110,11 @@ public class EbayItemReader implements ItemReader<EbayItem> {
log
.
info
(
"切换账号 切换后当前账号:{},剩余待跑账号数量:{}"
,
dcBaseCompanyAccount
.
getAccountName
(),
dcBaseCompanyAccountList
.
size
());
this
.
refreshAccountCall
();
this
.
refreshPage
();
//切换账号后 抓取广告费用前 前先清除已经抓取的数据
dcBaseFinanceEbayService
.
remove
(
new
LambdaQueryWrapper
<
DcBaseFinanceEbay
>()
.
between
(
DcBaseFinanceEbay:
:
getBjDate
,
dcJobConfig
.
getStartTime
(),
dcJobConfig
.
getEndTime
())
.
eq
(
DcBaseFinanceEbay:
:
getAccountId
,
dcBaseCompanyAccount
.
getAccountId
()));
}
if
(
ListUtil
.
isEmpty
(
accountEntryTypeList
)
&&
ListUtil
.
isNotEmpty
(
dcBaseCompanyAccountList
))
{
this
.
nextAccount
();
...
...
datacenter-job/datacenter-base/base-sync-ebay/src/main/java/com/bailuntec/job/EbayJobListener.java
View file @
b2f302b1
...
...
@@ -32,15 +32,8 @@ public class EbayJobListener extends JobExecutionListenerSupport {
@Override
public
void
afterJob
(
JobExecution
jobExecution
)
{
DcJobConfig
dcJobConfig
=
jobConfiguration
.
getDcJobConfig
();
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
@Override
public
void
beforeJob
(
JobExecution
jobExecution
)
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
"base-sync-finance-ebay-ad"
);
jobConfiguration
.
setDcJobConfig
(
dcJobConfig
);
DcJobConfig
dcJobConfig
=
jobConfiguration
.
getDcJobConfig
();
if
(
jobExecution
.
getStatus
()
==
BatchStatus
.
COMPLETED
)
{
log
.
info
(
"!!! JOB FINISHED! Time to verify the results"
);
...
...
@@ -50,5 +43,13 @@ public class EbayJobListener extends JobExecutionListenerSupport {
//todo 任务失败提醒推送
log
.
error
(
"!!! JOB FAILED"
);
}
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
@Override
public
void
beforeJob
(
JobExecution
jobExecution
)
{
}
}
datacenter-job/datacenter-base/base-sync-ebay/src/main/java/com/bailuntec/job/JobConfiguration.java
View file @
b2f302b1
...
...
@@ -49,13 +49,13 @@ public class JobConfiguration {
this
.
dcBaseCompanyAccountMapper
=
dcBaseCompanyAccountMapper
;
this
.
dcBaseFinanceEbayService
=
dcBaseFinanceEbayService
;
this
.
oaApi
=
oaApi
;
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
"base-sync-finance-ebay-ad"
);
}
@Bean
EbayItemReader
reader
()
{
return
new
EbayItemReader
(
dcBaseCompanyAccountMapper
,
dcJobConfig
);
return
new
EbayItemReader
(
dcBaseCompanyAccountMapper
,
dcJobConfig
,
dcBaseFinanceEbayService
);
}
@Bean
...
...
datacenter-job/datacenter-base/base-sync-ebay/src/main/resources/application-prod.yml
View file @
b2f302b1
...
...
@@ -10,6 +10,8 @@ spring:
driver-class-name
:
com.mysql.jdbc.Driver
main
:
allow-bean-definition-overriding
:
true
batch
:
initialize-schema
:
always
#mybatis plus 配置
mybatis-plus
:
...
...
datacenter-job/datacenter-finance/pom.xml
View file @
b2f302b1
...
...
@@ -12,7 +12,7 @@
<artifactId>
datacenter-finance
</artifactId>
<packaging>
pom
</packaging>
<modules>
<module>
finance-balance-sheet
</module
>
<!-- <module>finance-balance-sheet</module>--
>
</modules>
</project>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment