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
f5832850
Commit
f5832850
authored
Oct 29, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
012b2246
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
680 additions
and
44 deletions
+680
-44
pom.xml
datacenter-base/base-sync-amazon-ad/pom.xml
+1
-1
AmazonApp.java
...-amazon-ad/src/main/java/com.bailuntec.job/AmazonApp.java
+2
-2
application-prod.yml
...se-sync-amazon-ad/src/main/resources/application-prod.yml
+4
-0
application-test.yml
...se-sync-amazon-ad/src/main/resources/application-test.yml
+4
-0
pom.xml
datacenter-base/base-sync-balance-sheet/pom.xml
+64
-0
BalanceSheetApp.java
...heet/src/main/java/com/bailuntec/job/BalanceSheetApp.java
+26
-0
SampleJob.java
...ance-sheet/src/main/java/com/bailuntec/job/SampleJob.java
+30
-0
SampleService.java
...rc/main/java/com/bailuntec/job/service/SampleService.java
+21
-0
application-prod.yml
...base-sync-cashier/src/main/resources/application-prod.yml
+4
-0
application-test.yml
...base-sync-cashier/src/main/resources/application-test.yml
+4
-1
pom.xml
datacenter-base/base-sync-company/pom.xml
+72
-0
SyncCompanyApp.java
...mpany/src/main/java/com/bailuntec/job/SyncCompanyApp.java
+27
-0
SyncCompanyJob.java
...mpany/src/main/java/com/bailuntec/job/SyncCompanyJob.java
+30
-0
CompanyService.java
...c/main/java/com/bailuntec/job/service/CompanyService.java
+70
-0
application-prod.yml
...base-sync-company/src/main/resources/application-prod.yml
+35
-0
application-test.yml
...base-sync-company/src/main/resources/application-test.yml
+34
-0
pom.xml
datacenter-base/base-sync-fee/pom.xml
+1
-1
FeeJob.java
...base-sync-fee/src/main/java/com/bailuntec/job/FeeJob.java
+1
-1
SyncFeeApp.java
...-sync-fee/src/main/java/com/bailuntec/job/SyncFeeApp.java
+1
-1
SyncFeeService.java
...c/main/java/com/bailuntec/job/service/SyncFeeService.java
+15
-24
application-prod.yml
...ase/base-sync-fee/src/main/resources/application-prod.yml
+2
-0
application-test.yml
...ase/base-sync-fee/src/main/resources/application-test.yml
+2
-2
pom.xml
datacenter-base/base-sync-sample/pom.xml
+64
-0
SampleApp.java
...ync-sample/src/main/java/com/bailuntec/job/SampleApp.java
+26
-0
SampleJob.java
...ync-sample/src/main/java/com/bailuntec/job/SampleJob.java
+30
-0
SampleService.java
...rc/main/java/com/bailuntec/job/service/SampleService.java
+42
-0
application-prod.yml
.../base-sync-sample/src/main/resources/application-prod.yml
+32
-0
application-test.yml
.../base-sync-sample/src/main/resources/application-test.yml
+31
-0
pom.xml
datacenter-base/pom.xml
+3
-1
TurnoverPrepareJob.java
...e/src/main/java/com/bailuntec/job/TurnoverPrepareJob.java
+1
-1
TurnoverPrepareService.java
...ava/com/bailuntec/job/service/TurnoverPrepareService.java
+1
-0
pom.xml
pom.xml
+0
-9
No files found.
datacenter-base/base-sync-amazon-ad/pom.xml
View file @
f5832850
...
...
@@ -31,7 +31,7 @@
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
2.3.3.RELEASE
</version>
<configuration>
<mainClass>
com.bailuntec.job.App
</mainClass>
<mainClass>
com.bailuntec.job.A
mazonA
pp
</mainClass>
</configuration>
<executions>
<execution>
...
...
datacenter-base/base-sync-amazon-ad/src/main/java/com.bailuntec.job/App.java
→
datacenter-base/base-sync-amazon-ad/src/main/java/com.bailuntec.job/A
mazonA
pp.java
View file @
f5832850
...
...
@@ -20,10 +20,10 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@ComponentScan
(
"com.bailuntec"
)
@EnableAsync
@EnableFeignClients
public
class
App
{
public
class
A
mazonA
pp
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
App
.
class
,
args
);
SpringApplication
.
run
(
A
mazonA
pp
.
class
,
args
);
}
}
datacenter-base/base-sync-amazon-ad/src/main/resources/application-prod.yml
View file @
f5832850
...
...
@@ -8,6 +8,8 @@ spring:
username
:
root
password
:
'
#7kfnymAM$Y9-Ntf'
driver-class-name
:
com.mysql.jdbc.Driver
main
:
allow-bean-definition-overriding
:
true
#mybatis plus 配置
mybatis-plus
:
...
...
@@ -29,3 +31,5 @@ feign:
default
:
connectTimeout
:
30000
readTimeout
:
30000
server
:
port
:
8080
datacenter-base/base-sync-amazon-ad/src/main/resources/application-test.yml
View file @
f5832850
...
...
@@ -8,6 +8,8 @@ spring:
username
:
root
password
:
'
#7kfnymAM$Y9-Ntf'
driver-class-name
:
com.mysql.jdbc.Driver
main
:
allow-bean-definition-overriding
:
true
#mybatis plus 配置
mybatis-plus
:
...
...
@@ -28,3 +30,5 @@ feign:
default
:
connectTimeout
:
30000
readTimeout
:
30000
server
:
port
:
1223
datacenter-base/base-sync-balance-sheet/pom.xml
0 → 100644
View file @
f5832850
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
datacenter-base
</artifactId>
<groupId>
com.bailuntec
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<properties>
<maven.compiler.target>
1.8
</maven.compiler.target>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.encoding>
UTF-8
</maven.compiler.encoding>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven-surefire-plugin.version>
2.18.1
</maven-surefire-plugin.version>
</properties>
<artifactId>
base-sync-balance-sheet
</artifactId>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
2.3.3.RELEASE
</version>
<configuration>
<mainClass>
com.bailuntec.job.BalanceSheetApp
</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
com.spotify
</groupId>
<artifactId>
docker-maven-plugin
</artifactId>
<version>
1.0.0
</version>
<configuration>
<skipDockerBuild>
false
</skipDockerBuild>
<imageName>
ccr.ccs.tencentyun.com/blt.data.job/base-sync-balance-sheet:${maven.build.timestamp}
</imageName>
<dockerDirectory>
src/main/docker
</dockerDirectory>
<resources>
<resource>
<targetPath>
/
</targetPath>
<directory>
${project.build.directory}
</directory>
<include>
${project.build.finalName}.jar
</include>
</resource>
</resources>
<serverId>
bailuntec-docker
</serverId>
</configuration>
</plugin>
</plugins>
</build>
</project>
datacenter-base/base-sync-balance-sheet/src/main/java/com/bailuntec/job/BalanceSheetApp.java
0 → 100644
View file @
f5832850
package
com
.
bailuntec
.
job
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/28 3:15 下午
*/
@SpringBootApplication
@EnableScheduling
@ComponentScan
(
"com.bailuntec"
)
@EnableFeignClients
(
basePackages
=
{
"com.bailuntec.api"
,
"com.bailuntec.*.api"
})
public
class
BalanceSheetApp
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
BalanceSheetApp
.
class
,
args
);
}
}
datacenter-base/base-sync-balance-sheet/src/main/java/com/bailuntec/job/SampleJob.java
0 → 100644
View file @
f5832850
package
com
.
bailuntec
.
job
;
import
com.bailuntec.job.service.SampleService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
@Slf4j
@Component
public
class
SampleJob
{
@Resource
SampleService
sampleService
;
@Scheduled
(
cron
=
"0 0/1 * * * ?"
)
public
void
baseSyncFinanceFee
()
{
try
{
log
.
info
(
"每分钟同步费用单 开始"
);
sampleService
.
sync
();
log
.
info
(
"每分钟同步费用单 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每分钟同步费用单 异常:"
,
ex
);
}
}
}
datacenter-base/base-sync-balance-sheet/src/main/java/com/bailuntec/job/service/SampleService.java
0 → 100644
View file @
f5832850
package
com
.
bailuntec
.
job
.
service
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/7 11:38 上午
*/
@Slf4j
@Service
public
class
SampleService
{
public
void
sync
()
{
}
}
datacenter-base/base-sync-cashier/src/main/resources/application-prod.yml
View file @
f5832850
...
...
@@ -8,6 +8,8 @@ spring:
username
:
root
password
:
'
#7kfnymAM$Y9-Ntf'
driver-class-name
:
com.mysql.jdbc.Driver
main
:
allow-bean-definition-overriding
:
true
#mybatis plus 配置
mybatis-plus
:
...
...
@@ -26,3 +28,5 @@ feign:
default
:
connectTimeout
:
30000
readTimeout
:
30000
server
:
port
:
8080
datacenter-base/base-sync-cashier/src/main/resources/application-test.yml
View file @
f5832850
...
...
@@ -8,6 +8,8 @@ spring:
username
:
root
password
:
'
#7kfnymAM$Y9-Ntf'
driver-class-name
:
com.mysql.jdbc.Driver
main
:
allow-bean-definition-overriding
:
true
#mybatis plus 配置
mybatis-plus
:
...
...
@@ -27,4 +29,5 @@ feign:
connectTimeout
:
30000
readTimeout
:
30000
server
:
port
:
1222
datacenter-base/base-sync-company/pom.xml
0 → 100644
View file @
f5832850
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
datacenter-base
</artifactId>
<groupId>
com.bailuntec
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
base-sync-company
</artifactId>
<properties>
<maven.compiler.target>
1.8
</maven.compiler.target>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.encoding>
UTF-8
</maven.compiler.encoding>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven-surefire-plugin.version>
2.18.1
</maven-surefire-plugin.version>
<maven.build.timestamp.format>
yyyyMMddHHmm
</maven.build.timestamp.format>
</properties>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
2.3.3.RELEASE
</version>
<configuration>
<mainClass>
com.bailuntec.job.SampleApp
</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
com.spotify
</groupId>
<artifactId>
docker-maven-plugin
</artifactId>
<version>
1.0.0
</version>
<configuration>
<skipDockerBuild>
false
</skipDockerBuild>
<imageName>
ccr.ccs.tencentyun.com/blt.data.job/base-sync-company:${maven.build.timestamp}
</imageName>
<dockerDirectory>
src/main/docker
</dockerDirectory>
<resources>
<resource>
<targetPath>
/
</targetPath>
<directory>
${project.build.directory}
</directory>
<include>
${project.build.finalName}.jar
</include>
</resource>
</resources>
<serverId>
bailuntec-docker
</serverId>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
8
</source>
<target>
8
</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
datacenter-base/base-sync-company/src/main/java/com/bailuntec/job/SyncCompanyApp.java
0 → 100644
View file @
f5832850
package
com
.
bailuntec
.
job
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/28 3:16 下午
*/
@SpringBootApplication
@EnableScheduling
@ComponentScan
(
"com.bailuntec"
)
@EnableFeignClients
(
basePackages
=
{
"com.bailuntec.api"
,
"com.bailuntec.*.api"
})
public
class
SyncCompanyApp
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SyncCompanyApp
.
class
,
args
);
}
}
datacenter-base/base-sync-company/src/main/java/com/bailuntec/job/SyncCompanyJob.java
0 → 100644
View file @
f5832850
package
com
.
bailuntec
.
job
;
import
com.bailuntec.job.service.CompanyService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
@Slf4j
@Component
public
class
SyncCompanyJob
{
@Resource
CompanyService
companyService
;
@Scheduled
(
cron
=
"0 0/1 * * * ?"
)
public
void
baseSyncFinanceFee
()
{
try
{
log
.
info
(
"每分钟同步百伦公司帐号 开始"
);
companyService
.
syncCompanyAccount
();
log
.
info
(
"每分钟同步百伦公司帐号 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每分钟同步百伦公司帐号 异常:"
,
ex
);
}
}
}
datacenter-base/base-sync-company/src/main/java/com/bailuntec/job/service/CompanyService.java
0 → 100644
View file @
f5832850
package
com
.
bailuntec
.
job
.
service
;
import
com.alibaba.fastjson.JSON
;
import
com.bailuntec.api.bailuntec.pams.PamsApi
;
import
com.bailuntec.api.bailuntec.pams.response.GetAccountTokenResp
;
import
com.bailuntec.api.bailuntec.pams.response.PamsResult
;
import
com.bailuntec.common.BeanUtils
;
import
com.bailuntec.domain.DcBaseCompanyAccount
;
import
com.bailuntec.domain.DcJobConfig
;
import
com.bailuntec.infrastructure.mapper.DcBaseCompanyAccountMapper
;
import
com.bailuntec.infrastructure.mapper.DcJobConfigMapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/7 11:38 上午
*/
@Slf4j
@Service
public
class
CompanyService
{
@Resource
DcJobConfigMapper
dcJobConfigMapper
;
@Resource
PamsApi
pamsApi
;
@Resource
DcBaseCompanyAccountMapper
dcBaseCompanyAccountMapper
;
private
static
final
String
baseSyncCompany
=
"base-sync-company"
;
@Transactional
public
void
syncCompanyAccount
()
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
baseSyncCompany
);
PamsResult
<
List
<
GetAccountTokenResp
>>
result
=
pamsApi
.
getAccountToken
();
/*同步前禁用所有帐号*/
dcBaseCompanyAccountMapper
.
updateSetStatusOff
();
result
.
getData
().
forEach
(
item
->
{
DcBaseCompanyAccount
dcBaseCompanyAccount
=
new
DcBaseCompanyAccount
();
BeanUtils
.
copyProperties
(
item
,
dcBaseCompanyAccount
,
"id"
);
dcBaseCompanyAccount
.
setBjCreate
(
LocalDateTime
.
now
());
dcBaseCompanyAccount
.
setBjModified
(
LocalDateTime
.
now
());
int
update
=
dcBaseCompanyAccountMapper
.
update
(
dcBaseCompanyAccount
,
new
LambdaQueryWrapper
<
DcBaseCompanyAccount
>()
.
eq
(
DcBaseCompanyAccount:
:
getAccountId
,
item
.
getAccountId
())
.
eq
(
DcBaseCompanyAccount:
:
getCompanyId
,
item
.
getCompanyId
()));
if
(
update
==
0
)
{
dcBaseCompanyAccountMapper
.
insert
(
dcBaseCompanyAccount
);
}
log
.
info
(
"同步百伦帐号信息成功:{}"
,
JSON
.
toJSONString
(
dcBaseCompanyAccount
));
});
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
}
datacenter-base/base-sync-company/src/main/resources/application-prod.yml
0 → 100644
View file @
f5832850
spring
:
# 服务名称
application
:
name
:
base-sync-company
# 数据配置
datasource
:
url
:
jdbc:mysql://10.0.8.15:3306/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8
username
:
root
password
:
'
#7kfnymAM$Y9-Ntf'
driver-class-name
:
com.mysql.jdbc.Driver
main
:
allow-bean-definition-overriding
:
true
#mybatis plus 配置
mybatis-plus
:
mapper-locations
:
-
classpath*:com/bailuntec/mapper/*.xml
# configuration:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
metrics
:
campaignName,campaignId,impressions,clicks,cost,currency,attributedConversions1d,attributedConversions7d,attributedConversions14d,attributedConversions30d,attributedConversions1dSameSKU,attributedConversions7dSameSKU,attributedConversions14dSameSKU,attributedConversions30dSameSKU,attributedUnitsOrdered1d,attributedUnitsOrdered7d,attributedUnitsOrdered14d,attributedUnitsOrdered30d,attributedSales1d,attributedSales7d,attributedSales14d,attributedSales30d,attributedSales1dSameSKU,attributedSales7dSameSKU,attributedSales14dSameSKU,attributedSales30dSameSKU,attributedUnitsOrdered1dSameSKU,attributedUnitsOrdered7dSameSKU,attributedUnitsOrdered14dSameSKU,attributedUnitsOrdered30dSameSKU
feign
:
hystrix
:
enabled
:
false
client
:
config
:
default
:
connectTimeout
:
30000
readTimeout
:
30000
server
:
port
:
8080
datacenter-base/base-sync-company/src/main/resources/application-test.yml
0 → 100644
View file @
f5832850
spring
:
# 服务名称
application
:
name
:
base-sync-company
# 数据配置
datasource
:
url
:
jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8
username
:
root
password
:
'
#7kfnymAM$Y9-Ntf'
driver-class-name
:
com.mysql.jdbc.Driver
main
:
allow-bean-definition-overriding
:
true
#mybatis plus 配置
mybatis-plus
:
mapper-locations
:
-
classpath*:com/bailuntec/mapper/*.xml
# configuration:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
metrics
:
campaignName,campaignId,impressions,clicks,cost,currency,attributedConversions1d,attributedConversions7d,attributedConversions14d,attributedConversions30d,attributedConversions1dSameSKU,attributedConversions7dSameSKU,attributedConversions14dSameSKU,attributedConversions30dSameSKU,attributedUnitsOrdered1d,attributedUnitsOrdered7d,attributedUnitsOrdered14d,attributedUnitsOrdered30d,attributedSales1d,attributedSales7d,attributedSales14d,attributedSales30d,attributedSales1dSameSKU,attributedSales7dSameSKU,attributedSales14dSameSKU,attributedSales30dSameSKU,attributedUnitsOrdered1dSameSKU,attributedUnitsOrdered7dSameSKU,attributedUnitsOrdered14dSameSKU,attributedUnitsOrdered30dSameSKU
feign
:
hystrix
:
enabled
:
false
client
:
config
:
default
:
connectTimeout
:
30000
readTimeout
:
30000
server
:
port
:
1225
datacenter-base/base-sync-fee/pom.xml
View file @
f5832850
...
...
@@ -28,7 +28,7 @@
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
2.3.3.RELEASE
</version>
<configuration>
<mainClass>
com.bailuntec.job.Sync
Cashier
App
</mainClass>
<mainClass>
com.bailuntec.job.Sync
Fee
App
</mainClass>
</configuration>
<executions>
<execution>
...
...
datacenter-base/base-sync-fee/src/main/java/com/bailuntec/job/FeeJob.java
View file @
f5832850
...
...
@@ -27,7 +27,6 @@ public class FeeJob {
}
@Scheduled
(
cron
=
"0 0/1 * * * ?"
)
public
void
syncLogistics
()
{
try
{
log
.
info
(
"每分钟同步物流费用 开始"
);
...
...
@@ -49,6 +48,7 @@ public class FeeJob {
}
}
@Scheduled
(
cron
=
"0 0/1 * * * ?"
)
public
void
syncDailyFee
()
{
try
{
...
...
datacenter-base/base-sync-fee/src/main/java/com/bailuntec/job/SyncFeeApp.java
View file @
f5832850
...
...
@@ -17,7 +17,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
@ComponentScan
(
"com.bailuntec"
)
@EnableFeignClients
(
basePackages
=
{
"com.bailuntec.api"
})
@EnableFeignClients
(
basePackages
=
{
"com.bailuntec.api"
,
"com.bailuntec.*.api"
})
public
class
SyncFeeApp
{
public
static
void
main
(
String
[]
args
)
{
...
...
datacenter-base/base-sync-fee/src/main/java/com/bailuntec/job/service/SyncFeeService.java
View file @
f5832850
package
com
.
bailuntec
.
job
.
service
;
import
com.bailuntec.common.BeanUtils
;
import
com.bailuntec.common.ListUtil
;
import
com.bailuntec.cost.api.CostApi
;
import
com.bailuntec.cost.api.dto.CostDto
;
import
com.bailuntec.cost.api.dto.ManageCostDto
;
...
...
@@ -15,7 +14,6 @@ import com.bailuntec.infrastructure.mapper.DcBaseFinanceLogisticsMapper;
import
com.bailuntec.infrastructure.mapper.DcBaseFinanceManagecostMapper
;
import
com.bailuntec.infrastructure.mapper.DcJobConfigMapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.github.pagehelper.PageInfo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -57,29 +55,22 @@ public class SyncFeeService {
@Transactional
public
void
syncFinanceFee
()
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
baseSyncFinanceFee
);
Integer
pageSize
=
100
;
Integer
pageNum
=
1
;
for
(;
;
)
{
CostResult
<
PageInfo
<
CostDto
>>
result
=
costApi
.
getCostList
(
dcJobConfig
.
getStartTimeStr
(),
dcJobConfig
.
getEndTimeStr
(),
pageNum
,
pageSize
);
if
(
ListUtil
.
isEmpty
(
result
.
getData
().
getList
()))
{
break
;
CostResult
<
List
<
CostDto
>>
result
=
costApi
.
getCostList
(
dcJobConfig
.
getStartTimeStr
(),
dcJobConfig
.
getEndTimeStr
());
result
.
getData
().
forEach
(
costDto
->
{
DcBaseFinanceFee
dcBaseFinanceFee
=
new
DcBaseFinanceFee
();
BeanUtils
.
copyProperties
(
costDto
,
dcBaseFinanceFee
,
"id"
);
//更新
int
update
=
dcBaseFinanceFeeMapper
.
update
(
dcBaseFinanceFee
,
new
LambdaQueryWrapper
<
DcBaseFinanceFee
>()
.
eq
(
DcBaseFinanceFee:
:
getCostNo
,
dcBaseFinanceFee
.
getCostNo
()));
//插入
if
(
update
==
0
)
{
dcBaseFinanceFeeMapper
.
insert
(
dcBaseFinanceFee
);
}
result
.
getData
().
getList
().
forEach
(
costDto
->
{
DcBaseFinanceFee
dcBaseFinanceFee
=
new
DcBaseFinanceFee
();
BeanUtils
.
copyProperties
(
costDto
,
dcBaseFinanceFee
,
"id"
);
//更新
int
update
=
dcBaseFinanceFeeMapper
.
update
(
dcBaseFinanceFee
,
new
LambdaQueryWrapper
<
DcBaseFinanceFee
>()
.
eq
(
DcBaseFinanceFee:
:
getCostNo
,
dcBaseFinanceFee
.
getCostNo
()));
//插入
if
(
update
==
0
)
{
dcBaseFinanceFeeMapper
.
insert
(
dcBaseFinanceFee
);
}
});
pageNum
++;
}
log
.
info
(
"同步一条费用单,costNo:{}"
,
costDto
.
getCostNo
());
});
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
...
...
datacenter-base/base-sync-fee/src/main/resources/application-prod.yml
View file @
f5832850
...
...
@@ -8,6 +8,8 @@ spring:
username
:
root
password
:
'
#7kfnymAM$Y9-Ntf'
driver-class-name
:
com.mysql.jdbc.Driver
main
:
allow-bean-definition-overriding
:
true
#mybatis plus 配置
mybatis-plus
:
...
...
datacenter-base/base-sync-fee/src/main/resources/application-test.yml
View file @
f5832850
...
...
@@ -8,6 +8,8 @@ spring:
username
:
root
password
:
'
#7kfnymAM$Y9-Ntf'
driver-class-name
:
com.mysql.jdbc.Driver
main
:
allow-bean-definition-overriding
:
true
#mybatis plus 配置
mybatis-plus
:
...
...
@@ -26,5 +28,3 @@ feign:
default
:
connectTimeout
:
30000
readTimeout
:
30000
datacenter-base/base-sync-sample/pom.xml
0 → 100644
View file @
f5832850
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
datacenter-base
</artifactId>
<groupId>
com.bailuntec
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
base-sync-sample
</artifactId>
<properties>
<maven.compiler.target>
1.8
</maven.compiler.target>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.encoding>
UTF-8
</maven.compiler.encoding>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven-surefire-plugin.version>
2.18.1
</maven-surefire-plugin.version>
<maven.build.timestamp.format>
yyyyMMddHHmm
</maven.build.timestamp.format>
</properties>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
2.3.3.RELEASE
</version>
<configuration>
<mainClass>
com.bailuntec.job.SampleApp
</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
com.spotify
</groupId>
<artifactId>
docker-maven-plugin
</artifactId>
<version>
1.0.0
</version>
<configuration>
<skipDockerBuild>
false
</skipDockerBuild>
<imageName>
ccr.ccs.tencentyun.com/blt.data.job/base-sync-sample:${maven.build.timestamp}
</imageName>
<dockerDirectory>
src/main/docker
</dockerDirectory>
<resources>
<resource>
<targetPath>
/
</targetPath>
<directory>
${project.build.directory}
</directory>
<include>
${project.build.finalName}.jar
</include>
</resource>
</resources>
<serverId>
bailuntec-docker
</serverId>
</configuration>
</plugin>
</plugins>
</build>
</project>
datacenter-base/base-sync-sample/src/main/java/com/bailuntec/job/SampleApp.java
0 → 100644
View file @
f5832850
package
com
.
bailuntec
.
job
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/28 3:16 下午
*/
@SpringBootApplication
@EnableScheduling
@ComponentScan
(
"com.bailuntec"
)
@EnableFeignClients
(
basePackages
=
{
"com.bailuntec.api"
,
"com.bailuntec.*.api"
})
public
class
SampleApp
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SampleApp
.
class
,
args
);
}
}
datacenter-base/base-sync-sample/src/main/java/com/bailuntec/job/SampleJob.java
0 → 100644
View file @
f5832850
package
com
.
bailuntec
.
job
;
import
com.bailuntec.job.service.SampleService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
@Slf4j
@Component
public
class
SampleJob
{
@Resource
SampleService
sampleService
;
@Scheduled
(
cron
=
"0 0/1 * * * ?"
)
public
void
baseSyncFinanceFee
()
{
try
{
log
.
info
(
"每分钟同步费用单 开始"
);
sampleService
.
sync
();
log
.
info
(
"每分钟同步费用单 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每分钟同步费用单 异常:"
,
ex
);
}
}
}
datacenter-base/base-sync-sample/src/main/java/com/bailuntec/job/service/SampleService.java
0 → 100644
View file @
f5832850
package
com
.
bailuntec
.
job
.
service
;
import
com.bailuntec.common.BeanUtils
;
import
com.bailuntec.common.ListUtil
;
import
com.bailuntec.cost.api.CostApi
;
import
com.bailuntec.cost.api.dto.CostDto
;
import
com.bailuntec.cost.api.dto.ManageCostDto
;
import
com.bailuntec.cost.api.response.CostResult
;
import
com.bailuntec.domain.DcBaseFinanceFee
;
import
com.bailuntec.domain.DcBaseFinanceLogistics
;
import
com.bailuntec.domain.DcBaseFinanceManagecost
;
import
com.bailuntec.domain.DcJobConfig
;
import
com.bailuntec.infrastructure.mapper.DcBaseFinanceFeeMapper
;
import
com.bailuntec.infrastructure.mapper.DcBaseFinanceLogisticsMapper
;
import
com.bailuntec.infrastructure.mapper.DcBaseFinanceManagecostMapper
;
import
com.bailuntec.infrastructure.mapper.DcJobConfigMapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.github.pagehelper.PageInfo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/7 11:38 上午
*/
@Slf4j
@Service
public
class
SampleService
{
public
void
sync
()
{
}
}
datacenter-base/base-sync-sample/src/main/resources/application-prod.yml
0 → 100644
View file @
f5832850
spring
:
# 服务名称
application
:
name
:
base-sync-sample
# 数据配置
datasource
:
url
:
jdbc:mysql://10.0.8.15:3306/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8
username
:
root
password
:
'
#7kfnymAM$Y9-Ntf'
driver-class-name
:
com.mysql.jdbc.Driver
main
:
allow-bean-definition-overriding
:
true
#mybatis plus 配置
mybatis-plus
:
mapper-locations
:
-
classpath*:com/bailuntec/mapper/*.xml
# configuration:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
feign
:
hystrix
:
enabled
:
false
client
:
config
:
default
:
connectTimeout
:
30000
readTimeout
:
30000
server
:
port
:
8080
datacenter-base/base-sync-sample/src/main/resources/application-test.yml
0 → 100644
View file @
f5832850
spring
:
# 服务名称
application
:
name
:
base-sync-sample
# 数据配置
datasource
:
url
:
jdbc:mysql://gz-cdb-kp7s5i79.sql.tencentcdb.com:61691/bailun_datacenter?serverTimezone=GMT%2B8&characterEncoding=utf-8
username
:
root
password
:
'
#7kfnymAM$Y9-Ntf'
driver-class-name
:
com.mysql.jdbc.Driver
main
:
allow-bean-definition-overriding
:
true
#mybatis plus 配置
mybatis-plus
:
mapper-locations
:
-
classpath*:com/bailuntec/mapper/*.xml
# configuration:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
feign
:
hystrix
:
enabled
:
false
client
:
config
:
default
:
connectTimeout
:
30000
readTimeout
:
30000
server
:
port
:
1224
datacenter-base/pom.xml
View file @
f5832850
...
...
@@ -18,7 +18,9 @@
<module>
base-sync-amazon-ad
</module>
<module>
base-sync-cashier
</module>
<module>
base-sync-fee
</module>
<module>
base-sync-balance-sheet
</module>
<module>
base-sync-sample
</module>
<module>
base-sync-company
</module>
</modules>
</project>
datacenter-mid/mid-calculate-turnover-prepare/src/main/java/com/bailuntec/job/TurnoverPrepareJob.java
View file @
f5832850
...
...
@@ -32,7 +32,7 @@ public class TurnoverPrepareJob {
turnoverPrepareService
.
syncBaseStock
();
log
.
info
(
"每10分钟同步oms、在途、采购存在sku但环球库存不存在的库存到库存表 结束"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"每10分钟同步oms、在途、采购存在sku但环球库存不存在的库存到库存表 失败"
);
log
.
error
(
"每10分钟同步oms、在途、采购存在sku但环球库存不存在的库存到库存表 失败"
,
e
);
}
}
...
...
datacenter-mid/mid-calculate-turnover-prepare/src/main/java/com/bailuntec/job/service/TurnoverPrepareService.java
View file @
f5832850
...
...
@@ -30,6 +30,7 @@ public class TurnoverPrepareService {
@Transactional
public
void
syncBaseStock
()
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
midAutoTurnoverPrepare
);
dcBaseStockMapper
.
supplementOrderSku
();
dcBaseStockMapper
.
supplementPurchaseSku
();
dcBaseStockMapper
.
supplementTransitSku
();
...
...
pom.xml
View file @
f5832850
...
...
@@ -28,15 +28,6 @@
<artifactId>
bailuntec-datacenter
</artifactId>
</dependency>
<dependency>
<groupId>
com.bailuntec
</groupId>
<artifactId>
bailuntec-api
</artifactId>
</dependency>
<dependency>
<groupId>
com.bailuntec
</groupId>
<artifactId>
bailuntec-cost-api
</artifactId>
</dependency>
</dependencies>
</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