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
f63468a6
Commit
f63468a6
authored
Nov 04, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产负债
parent
f5832850
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
776 additions
and
103 deletions
+776
-103
SampleJob.java
...ance-sheet/src/main/java/com/bailuntec/job/SampleJob.java
+0
-30
SampleService.java
...rc/main/java/com/bailuntec/job/service/SampleService.java
+0
-21
pom.xml
datacenter-base/base-sync-cashier/pom.xml
+1
-0
CashierJob.java
...c-cashier/src/main/java/com/bailuntec/job/CashierJob.java
+23
-20
SyncCashierService.java
...in/java/com/bailuntec/job/service/SyncCashierService.java
+18
-17
pom.xml
datacenter-base/base-sync-company/pom.xml
+2
-1
Dockerfile
datacenter-base/base-sync-company/src/main/docker/Dockerfile
+8
-0
SyncCompanyJob.java
...mpany/src/main/java/com/bailuntec/job/SyncCompanyJob.java
+4
-0
pom.xml
datacenter-base/base-sync-fee/pom.xml
+1
-0
Dockerfile
datacenter-base/base-sync-fee/src/main/docker/Dockerfile
+1
-1
pom.xml
datacenter-base/pom.xml
+0
-1
pom.xml
datacenter-finance/finance-balance-sheet/pom.xml
+14
-5
Dockerfile
...-finance/finance-balance-sheet/src/main/docker/Dockerfile
+8
-0
BalanceSheetApp.java
...heet/src/main/java/com/bailuntec/job/BalanceSheetApp.java
+2
-2
BalanceSheetJob.java
...heet/src/main/java/com/bailuntec/job/BalanceSheetJob.java
+124
-0
BalanceSheetService.java
...n/java/com/bailuntec/job/service/BalanceSheetService.java
+419
-0
application-prod.yml
...nce-balance-sheet/src/main/resources/application-prod.yml
+32
-0
application-test.yml
...nce-balance-sheet/src/main/resources/application-test.yml
+31
-0
BalanceSheetServiceTest.java
...va/com/bailuntec/job/service/BalanceSheetServiceTest.java
+59
-0
pom.xml
datacenter-finance/pom.xml
+18
-0
Dockerfile
...mid-calculate-turnover-prepare/src/main/docker/Dockerfile
+1
-1
TurnoverPrepareApp.java
...e/src/main/java/com/bailuntec/job/TurnoverPrepareApp.java
+2
-1
TurnoverPrepareJob.java
...e/src/main/java/com/bailuntec/job/TurnoverPrepareJob.java
+1
-1
application-prod.yml
...-turnover-prepare/src/main/resources/application-prod.yml
+4
-2
application-test.yml
...-turnover-prepare/src/main/resources/application-test.yml
+2
-0
pom.xml
pom.xml
+1
-0
No files found.
datacenter-base/base-sync-balance-sheet/src/main/java/com/bailuntec/job/SampleJob.java
deleted
100644 → 0
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
deleted
100644 → 0
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/pom.xml
View file @
f63468a6
...
...
@@ -15,6 +15,7 @@
<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>
<artifactId>
base-sync-cashier
</artifactId>
...
...
datacenter-base/base-sync-cashier/src/main/java/com/bailuntec/job/CashierJob.java
View file @
f63468a6
...
...
@@ -18,21 +18,21 @@ public class CashierJob {
/**
* 每秒同步流水
*/
@Scheduled
(
cron
=
"0
/5 *
* * * ?"
)
@Scheduled
(
cron
=
"0
0/1
* * * ?"
)
public
void
syncCashier
()
{
try
{
log
.
info
(
"每
秒
同步流水 开始"
);
log
.
info
(
"每
分钟
同步流水 开始"
);
syncCashierService
.
syncCashier
();
log
.
info
(
"每
秒
同步流水 结束"
);
log
.
info
(
"每
分钟
同步流水 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每
秒
同步流水 异常:"
,
ex
);
log
.
error
(
"每
分钟
同步流水 异常:"
,
ex
);
}
}
/**
* 每秒同步流水
*/
@Scheduled
(
cron
=
"0
/5 *
* * * ?"
)
@Scheduled
(
cron
=
"0
0/1
* * * ?"
)
public
void
syncWithdraw
()
{
try
{
log
.
info
(
"每秒同步流水详情 开始"
);
...
...
@@ -46,29 +46,32 @@ public class CashierJob {
/**
* 每
天12点同步销售平台流水
* 每
分钟 同步利息支出
*/
@Scheduled
(
cron
=
"0 0 12 * * ?"
)
public
void
syncSalesPlatform
()
{
syncCashierService
.
syncSalesPlatform
();
}
/**
* 每天9,12点同步利息支出
*/
@Scheduled
(
cron
=
"0 0 9,12 * * ?"
)
@Scheduled
(
cron
=
"0 0/1 * * * ?"
)
public
void
syncInterest
()
{
syncCashierService
.
syncInterest
();
try
{
log
.
info
(
"每分钟 同步利息支出 开始"
);
syncCashierService
.
syncInterest
();
log
.
info
(
"每分钟 同步利息支出 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每分钟 同步利息支出 异常:"
,
ex
);
}
}
/**
* 每
两小时同步财务手续费
* 每
分钟 同步利息支出
*/
@Scheduled
(
cron
=
"0 0
0/2
* * ?"
)
@Scheduled
(
cron
=
"0 0
/1 *
* * ?"
)
public
void
syncHandleFee
()
{
syncCashierService
.
syncHandleFee
();
try
{
log
.
info
(
"每分钟 同步流水详情 开始"
);
syncCashierService
.
syncHandleFee
();
log
.
info
(
"每分钟 同步流水详情 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每分钟 同步流水详情 异常:"
,
ex
);
}
}
}
datacenter-base/base-sync-cashier/src/main/java/com/bailuntec/job/service/SyncCashierService.java
View file @
f63468a6
...
...
@@ -3,16 +3,15 @@ package com.bailuntec.job.service;
import
com.bailuntec.api.bailuntec.cw.CwApi
;
import
com.bailuntec.api.bailuntec.cw.response.GetCashiersResp
;
import
com.bailuntec.api.bailuntec.cw.response.GetHandleFeeTradeRecordsResp
;
import
com.bailuntec.api.bailuntec.cw.response.GetRepayPlanDetailsResp
;
import
com.bailuntec.api.bailuntec.cw.response.GetWithdrawDetailPagesResp
;
import
com.bailuntec.application.IDcBaseFinanceCashierService
;
import
com.bailuntec.application.IDcBaseFinanceCashierdetailService
;
import
com.bailuntec.application.IDcBaseFinanceHandlefeeService
;
import
com.bailuntec.application.IDcBaseFinanceInterestService
;
import
com.bailuntec.common.BeanUtils
;
import
com.bailuntec.common.ListUtil
;
import
com.bailuntec.domain.DcBaseFinanceCashier
;
import
com.bailuntec.domain.DcBaseFinanceCashierdetail
;
import
com.bailuntec.domain.DcBaseFinanceHandlefee
;
import
com.bailuntec.domain.DcJobConfig
;
import
com.bailuntec.domain.*
;
import
com.bailuntec.infrastructure.mapper.DcJobConfigMapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -114,33 +113,35 @@ public class SyncCashierService {
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
@Transactional
public
void
syncSalesPlatform
()
{
}
@Resource
IDcBaseFinanceInterestService
dcBaseFinanceInterestService
;
@Transactional
public
void
syncInterest
()
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
baseSyncInterest
);
log
.
info
(
"请求
财务手续费
接口 开始"
);
List
<
Get
HandleFeeTradeRecordsResp
>
resp
=
cwApi
.
getHandleFeeTradeRecord
s
(
dcJobConfig
.
getStartTimeStr
(),
dcJobConfig
.
getEndTimeStr
());
log
.
info
(
"请求
利息支出接口同步百伦
接口 开始"
);
List
<
Get
RepayPlanDetailsResp
>
resp
=
cwApi
.
getRepayPlanDetail
s
(
dcJobConfig
.
getStartTimeStr
(),
dcJobConfig
.
getEndTimeStr
());
resp
.
forEach
(
getHandleFeeTradeRecordsResp
->
{
DcBaseFinanceHandlefee
dcBaseFinanceHandlefee
=
new
DcBaseFinanceHandlefee
();
BeanUtils
.
copyProperties
(
getHandleFeeTradeRecordsResp
,
dcBaseFinanceHandlefee
);
DcBaseFinanceInterest
dcBaseFinanceInterest
=
new
DcBaseFinanceInterest
();
BeanUtils
.
copyProperties
(
getHandleFeeTradeRecordsResp
,
dcBaseFinanceInterest
,
"id"
);
LambdaQueryWrapper
<
DcBaseFinanceInterest
>
updateWrapper
=
new
LambdaQueryWrapper
<
DcBaseFinanceInterest
>()
.
eq
(
DcBaseFinanceInterest:
:
getBorrowId
,
dcBaseFinanceInterest
.
getBorrowId
())
.
eq
(
DcBaseFinanceInterest:
:
getRepayId
,
dcBaseFinanceInterest
.
getRepayId
())
.
eq
(
DcBaseFinanceInterest:
:
getContractNo
,
dcBaseFinanceInterest
.
getContractNo
());
LambdaQueryWrapper
<
DcBaseFinanceHandlefee
>
updateWrapper
=
new
LambdaQueryWrapper
<
DcBaseFinanceHandlefee
>()
.
eq
(
DcBaseFinanceHandlefee:
:
getCwId
,
dcBaseFinanceHandlefee
.
getCwId
());
//更新失败就插入
if
(
dcBaseFinance
HandlefeeService
.
saveOrUpdate
(
dcBaseFinanceHandlefee
,
updateWrapper
))
{
log
.
info
(
"同步一
条财务手续费,财务id:{}"
,
dcBaseFinanceHandlefee
.
getC
wId
());
if
(
dcBaseFinance
InterestService
.
saveOrUpdate
(
dcBaseFinanceInterest
,
updateWrapper
))
{
log
.
info
(
"同步一
利息支出,borrow id:{}"
,
dcBaseFinanceInterest
.
getBorro
wId
());
}
else
{
log
.
error
(
"同步
财务手续费,财务id:{}"
,
dcBaseFinanceHandlefee
.
getC
wId
());
log
.
error
(
"同步
利息支出,borrow id :{}"
,
dcBaseFinanceInterest
.
getBorro
wId
());
}
});
log
.
info
(
"请求
财务手续费
接口 结束"
);
log
.
info
(
"请求
利息支出接口同步百伦
接口 结束"
);
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
...
...
datacenter-base/base-sync-company/pom.xml
View file @
f63468a6
...
...
@@ -27,7 +27,7 @@
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
2.3.3.RELEASE
</version>
<configuration>
<mainClass>
com.bailuntec.job.S
ample
App
</mainClass>
<mainClass>
com.bailuntec.job.S
yncCompany
App
</mainClass>
</configuration>
<executions>
<execution>
...
...
@@ -60,6 +60,7 @@
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.5.1
</version>
<configuration>
<source>
8
</source>
<target>
8
</target>
...
...
datacenter-base/base-sync-company/src/main/docker/Dockerfile
0 → 100644
View file @
f63468a6
FROM
openjdk:8-jdk-alpine
VOLUME
/tmp
ADD
base-sync-company-1.0-SNAPSHOT.jar app.jar
RUN
echo
"Asia/Shanghai"
>
/etc/timezone
ENTRYPOINT
["java","-Xms100m","-Xmx300m","-jar","-Dspring.profiles.active=prod","/app.jar"]
EXPOSE
8080
datacenter-base/base-sync-company/src/main/java/com/bailuntec/job/SyncCompanyJob.java
View file @
f63468a6
...
...
@@ -5,8 +5,10 @@ import com.bailuntec.job.service.CompanyService;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.text.ParseException
;
@Slf4j
@Component
...
...
@@ -27,4 +29,6 @@ public class SyncCompanyJob {
}
}
datacenter-base/base-sync-fee/pom.xml
View file @
f63468a6
...
...
@@ -15,6 +15,7 @@
<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>
<artifactId>
base-sync-fee
</artifactId>
...
...
datacenter-base/base-sync-fee/src/main/docker/Dockerfile
View file @
f63468a6
FROM
openjdk:8-jdk-alpine
VOLUME
/tmp
ADD
base-sync-
cashier
-1.0-SNAPSHOT.jar app.jar
ADD
base-sync-
fee
-1.0-SNAPSHOT.jar app.jar
RUN
echo
"Asia/Shanghai"
>
/etc/timezone
...
...
datacenter-base/pom.xml
View file @
f63468a6
...
...
@@ -18,7 +18,6 @@
<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>
...
...
datacenter-
base/base-sync
-balance-sheet/pom.xml
→
datacenter-
finance/finance
-balance-sheet/pom.xml
View file @
f63468a6
...
...
@@ -3,22 +3,23 @@
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-
bas
e
</artifactId>
<artifactId>
datacenter-
financ
e
</artifactId>
<groupId>
com.bailuntec
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
finance-balance-sheet
</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>
<skipTests>
true
</skipTests>
</properties>
<artifactId>
base-sync-balance-sheet
</artifactId>
<build>
<plugins>
...
...
@@ -44,7 +45,7 @@
<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>
ccr.ccs.tencentyun.com/blt.data.job/base-
finance
-balance-sheet:${maven.build.timestamp}
</imageName>
<dockerDirectory>
src/main/docker
</dockerDirectory>
<resources>
...
...
@@ -57,8 +58,16 @@
<serverId>
bailuntec-docker
</serverId>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.5.1
</version>
<configuration>
<source>
8
</source>
<target>
8
</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
datacenter-finance/finance-balance-sheet/src/main/docker/Dockerfile
0 → 100644
View file @
f63468a6
FROM
openjdk:8-jdk-alpine
VOLUME
/tmp
ADD
finance-balance-sheet-1.0-SNAPSHOT.jar app.jar
RUN
echo
"Asia/Shanghai"
>
/etc/timezone
ENTRYPOINT
["java","-Xms100m","-Xmx300m","-jar","-Dspring.profiles.active=prod","/app.jar"]
EXPOSE
8080
datacenter-
base/base-sync
-balance-sheet/src/main/java/com/bailuntec/job/BalanceSheetApp.java
→
datacenter-
finance/finance
-balance-sheet/src/main/java/com/bailuntec/job/BalanceSheetApp.java
View file @
f63468a6
...
...
@@ -12,15 +12,15 @@ import org.springframework.scheduling.annotation.EnableScheduling;
* </p>
*
* @author robbendev
* @since 2020/10/28 3:1
5
下午
* @since 2020/10/28 3:1
6
下午
*/
@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-finance/finance-balance-sheet/src/main/java/com/bailuntec/job/BalanceSheetJob.java
0 → 100644
View file @
f63468a6
package
com
.
bailuntec
.
job
;
import
com.bailuntec.job.service.BalanceSheetService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
@Slf4j
@Component
public
class
BalanceSheetJob
{
@Resource
BalanceSheetService
balanceSheetService
;
@Scheduled
(
cron
=
"0 0/2 * * * ?"
)
public
void
syncBankAccount
()
{
try
{
log
.
info
(
"每分钟同步 银行帐号信息 开始"
);
balanceSheetService
.
syncBankAccount
();
log
.
info
(
"每分钟同步 银行帐号信息 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每分钟同步 银行帐号信息 异常:"
,
ex
);
}
}
/**
* 同步提现在途
*/
@Scheduled
(
cron
=
"0 0/2 * * * ?"
)
public
void
syncWithdrawOnWaySummary
()
{
try
{
log
.
info
(
"每分钟 同步提现在途 开始"
);
balanceSheetService
.
syncWithdrawOnWaySummary
();
log
.
info
(
"每分钟 同步提现在途 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每分钟 同步提现在途 异常:"
,
ex
);
}
}
/**
* 同步提现在途
*/
@Scheduled
(
cron
=
"0 0/2 * * * ?"
)
public
void
syncPayPal
()
{
try
{
log
.
info
(
"每分钟 同步第三方余额 开始"
);
balanceSheetService
.
syncPayPal
();
log
.
info
(
"每分钟 同步第三方余额 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每分钟 同步第三方余额 异常:"
,
ex
);
}
}
/**
* 同步短期借款余额
*/
@Scheduled
(
cron
=
"0 0/2 * * * ?"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
syncShortBorrowBalance
()
{
try
{
log
.
info
(
"每分钟 同步提现在途 开始"
);
balanceSheetService
.
syncShortBorrowBalance
();
log
.
info
(
"每分钟 同步提现在途 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每分钟 同步提现在途 异常:"
,
ex
);
}
}
/**
* 同步数据中心需要的费用单
*/
@Scheduled
(
cron
=
"0 0/2 * * * ?"
)
public
void
syncCost
()
{
try
{
log
.
info
(
"每分钟 同步数据中心需要的费用单 开始"
);
balanceSheetService
.
syncCost
();
log
.
info
(
"每分钟 同步数据中心需要的费用单 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每分钟 同步数据中心需要的费用单 异常:"
,
ex
);
}
}
/**
* 同步费用系统采购单:固定资产
*/
@Scheduled
(
cron
=
"0 0/2 * * * ?"
)
public
void
syncBuy
()
{
try
{
log
.
info
(
"每分钟 同步费用系统采购单 开始"
);
balanceSheetService
.
syncBuy
();
log
.
info
(
"每分钟 同步费用系统采购单 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每分钟 同步费用系统采购单 异常:"
,
ex
);
}
}
/**
* 每天 生成资产负债表
* companyValue 0
* companyName 百伦供应链
* <p>
* {@link}
* </p>
* 数据来源
*/
@Scheduled
(
cron
=
"0 0/2 * * * ?"
)
public
void
generateBalanceSheet
()
{
try
{
log
.
info
(
"每分钟 生成资产负债表 开始"
);
balanceSheetService
.
generateBalanceSheet
();
log
.
info
(
"每分钟 生成资产负债表 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每分钟 生成资产负债表 异常:"
,
ex
);
}
}
}
datacenter-finance/finance-balance-sheet/src/main/java/com/bailuntec/job/service/BalanceSheetService.java
0 → 100644
View file @
f63468a6
package
com
.
bailuntec
.
job
.
service
;
import
com.bailuntec.api.bailuntec.cw.CwApi
;
import
com.bailuntec.api.bailuntec.cw.response.BankAccountBalanceDTO
;
import
com.bailuntec.api.bailuntec.cw.response.BorrowBalanceDTO
;
import
com.bailuntec.api.bailuntec.cw.response.PayPalBalanceDTO
;
import
com.bailuntec.api.bailuntec.cw.response.WithdrawOnWayDTO
;
import
com.bailuntec.application.*
;
import
com.bailuntec.common.BeanUtils
;
import
com.bailuntec.common.ListUtil
;
import
com.bailuntec.cost.api.BuyApi
;
import
com.bailuntec.cost.api.CostApi
;
import
com.bailuntec.cost.api.domain.BuyDomain
;
import
com.bailuntec.cost.api.dto.CostDto
;
import
com.bailuntec.domain.*
;
import
com.bailuntec.infrastructure.mapper.*
;
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.math.BigDecimal
;
import
java.text.ParseException
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/7 11:38 上午
*/
@Slf4j
@Service
public
class
BalanceSheetService
{
private
static
final
String
financeSyncBankAccount
=
"finance-sync-bank-account"
;
private
static
final
String
financeSyncWithdrawOnWaySummary
=
"finance-sync-withdraw-on-way-summary"
;
private
static
final
String
financeSyncShortBorrowBalance
=
"finance-sync-short-borrow-balance"
;
private
static
final
String
financeSyncCost
=
"finance-sync-cost"
;
private
static
final
String
financeSyncBuy
=
"finance-sync-buy"
;
private
static
final
String
financeGenerateBalanceSheet
=
"finance-generate-balance-sheet"
;
private
static
final
String
financeSyncPayPal
=
"finance-sync-pay-pal"
;
@Resource
DcJobConfigMapper
dcJobConfigMapper
;
@Resource
CwApi
cwApi
;
@Resource
IDcBankAccountBalanceService
dcBankAccountBalanceService
;
@Resource
DcBankAccountBalanceMapper
dcBankAccountBalanceMapper
;
@Resource
IDcWithdrawOnWayService
dcWithdrawOnWayService
;
@Resource
DcWithdrawOnWayMapper
dcWithdrawOnWayMapper
;
/**
* 同步银行余额
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
syncBankAccount
()
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
financeSyncBankAccount
);
LocalDate
date
=
dcJobConfig
.
getStartTime
().
toLocalDate
();
//从财务系统查询银行账户余额
List
<
BankAccountBalanceDTO
>
bankAccountBalanceDTOList
=
cwApi
.
getBankAccountSummary
().
getData
();
//先清空
dcBankAccountBalanceService
.
remove
(
new
LambdaQueryWrapper
<
DcBankAccountBalance
>()
.
eq
(
DcBankAccountBalance:
:
getStatisticalTime
,
date
));
//保存
List
<
DcBankAccountBalance
>
dcBankAccountBalanceList
=
bankAccountBalanceDTOList
.
stream
()
.
map
(
bankAccountBalanceDTO
->
{
DcBankAccountBalance
dcBankAccountBalance
=
new
DcBankAccountBalance
();
BeanUtils
.
copyProperties
(
bankAccountBalanceDTO
,
dcBankAccountBalance
);
dcBankAccountBalance
.
setStatisticalTime
(
date
);
return
dcBankAccountBalance
;
}).
collect
(
Collectors
.
toList
());
dcBankAccountBalanceService
.
saveBatch
(
dcBankAccountBalanceList
);
// 删除需要过滤的数据
dcBankAccountBalanceMapper
.
deleteUnusedData
(
date
);
dcBankAccountBalanceMapper
.
deleteUnusedData1
(
date
);
dcBankAccountBalanceMapper
.
deleteUnusedData2
(
date
);
//更新任务时间
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
/**
* 同步提现在途
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
syncWithdrawOnWaySummary
()
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
financeSyncWithdrawOnWaySummary
);
List
<
WithdrawOnWayDTO
>
withdrawOnWayDTOList
=
cwApi
.
getWithdrawOnWaySummary
().
getData
();
LocalDate
date
=
dcJobConfig
.
getStartTime
().
toLocalDate
();
//清空
dcWithdrawOnWayService
.
remove
(
new
LambdaQueryWrapper
<
DcWithdrawOnWay
>()
.
eq
(
DcWithdrawOnWay:
:
getStatisticalTime
,
date
));
//保存
List
<
DcWithdrawOnWay
>
dcWithdrawOnWayList
=
withdrawOnWayDTOList
.
stream
()
.
map
(
withdrawOnWayDTO
->
{
DcWithdrawOnWay
dcWithdrawOnWay
=
new
DcWithdrawOnWay
();
BeanUtils
.
copyProperties
(
withdrawOnWayDTO
,
dcWithdrawOnWay
);
dcWithdrawOnWay
.
setStatisticalTime
(
LocalDate
.
now
());
return
dcWithdrawOnWay
;
})
.
collect
(
Collectors
.
toList
());
dcWithdrawOnWayService
.
saveBatch
(
dcWithdrawOnWayList
);
// 更新提现在途公司主体value
dcWithdrawOnWayMapper
.
updateWithdrawOnWayCompany
();
//更新任务时间
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
@Resource
DcShortTermBorrowMapper
dcShortTermBorrowMapper
;
@Resource
IDcShortTermBorrowService
dcShortTermBorrowService
;
/**
* 同步短期借款余额
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
syncShortBorrowBalance
()
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
financeSyncShortBorrowBalance
);
//任务时间
LocalDate
date
=
dcJobConfig
.
getStartTime
().
toLocalDate
();
List
<
BorrowBalanceDTO
>
borrowBalanceDTOList
=
cwApi
.
getBorrows
().
getData
();
//清空
dcShortTermBorrowMapper
.
delete
(
new
LambdaQueryWrapper
<
DcShortTermBorrow
>()
.
eq
(
DcShortTermBorrow:
:
getStatisticalTime
,
date
));
//新增
List
<
DcShortTermBorrow
>
dcShortTermBorrowList
=
borrowBalanceDTOList
.
stream
()
.
map
(
borrowBalanceDTO
->
{
DcShortTermBorrow
dcShortTermBorrow
=
new
DcShortTermBorrow
();
BeanUtils
.
copyProperties
(
borrowBalanceDTO
,
dcShortTermBorrow
);
dcShortTermBorrow
.
setStatisticalTime
(
date
);
return
dcShortTermBorrow
;
})
.
collect
(
Collectors
.
toList
());
dcShortTermBorrowService
.
saveBatch
(
dcShortTermBorrowList
);
//更新任务时间
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
@Resource
CostApi
costApi
;
@Resource
DcBaseCostMapper
dcBaseCostMapper
;
@Resource
IDcBaseCostService
dcBaseCostService
;
@Resource
DcOtherCostMapper
dcOtherCostMapper
;
/**
* 同步数据中心需要的费用单
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
syncCost
()
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
financeSyncCost
);
LocalDate
date
=
dcJobConfig
.
getStartTime
().
toLocalDate
();
List
<
CostDto
>
costDtoList
=
costApi
.
balanceSheetCostList
(
dcJobConfig
.
getStartTimeStr
(),
dcJobConfig
.
getEndTimeStr
()).
getData
();
costDtoList
.
forEach
(
costDto
->
{
DcBaseCost
dcBaseCost
=
dcBaseCostMapper
.
selectByCostNo
(
costDto
.
getCostNo
());
if
(
dcBaseCost
==
null
)
{
dcBaseCost
=
new
DcBaseCost
();
}
BeanUtils
.
copyProperties
(
costDto
,
dcBaseCost
,
"id"
);
dcBaseCost
.
setDay
(
dcJobConfig
.
getStartTime
().
toLocalDate
());
if
(
costDto
.
getCostStatus
().
equals
(
4
))
{
dcBaseCost
.
setIsWaitPay
(
0
);
}
else
{
dcBaseCost
.
setIsWaitPay
(
1
);
}
dcBaseCostService
.
saveOrUpdate
(
dcBaseCost
);
});
// 删除要过滤的公司主体数据
dcBaseCostMapper
.
deleteUnusedCost
(
date
);
// 生成一级明细
dcOtherCostMapper
.
clearOneDay
(
date
);
dcOtherCostMapper
.
insertOneDayOtherReceive
(
date
);
dcOtherCostMapper
.
insertOneDayOtherPay
(
date
);
//更新任务时间
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
@Resource
BuyApi
buyApi
;
@Resource
DcBaseBuyMapper
dcBaseBuyMapper
;
@Resource
IDcBaseBuyService
dcBaseBuyService
;
/**
* 同步费用系统采购单:固定资产
*
* @throws ParseException ex
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
syncBuy
()
throws
ParseException
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
financeSyncBuy
);
LocalDate
date
=
dcJobConfig
.
getStartTime
().
toLocalDate
();
List
<
BuyDomain
>
buyList
=
buyApi
.
balanceSheetBuyList
(
dcJobConfig
.
getStartTimeStr
(),
dcJobConfig
.
getEndTimeStr
()).
getData
();
buyList
.
forEach
(
buyDomain
->
{
DcBaseBuy
dcBaseBuy
=
dcBaseBuyMapper
.
selectByBuyNo
(
buyDomain
.
getBuyno
());
if
(
dcBaseBuy
==
null
)
{
dcBaseBuy
=
new
DcBaseBuy
();
}
BeanUtils
.
copyProperties
(
buyDomain
,
dcBaseBuy
,
"id"
);
dcBaseBuy
.
setDay
(
dcJobConfig
.
getStartTime
().
toLocalDate
());
dcBaseBuyService
.
saveOrUpdate
(
dcBaseBuy
);
});
// 生成一级明细
dcFixedAssetsDetailMapper
.
clearFixedAssetsDetail
(
date
);
dcFixedAssetsDetailMapper
.
insertFixedAssetsDetail
(
date
);
//更新任务时间
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
@Resource
IDcPlatformBalanceService
dcPlatformBalanceService
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
syncPayPal
()
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
financeSyncPayPal
);
List
<
PayPalBalanceDTO
>
payPalBalanceDTOList
=
cwApi
.
getPayPalBalance
();
if
(
ListUtil
.
isNotEmpty
(
payPalBalanceDTOList
))
{
List
<
DcPlatformBalance
>
dcPlatformBalanceList
=
payPalBalanceDTOList
.
stream
()
.
map
(
payPalBalanceDTO
->
{
DcPlatformBalance
dcPlatformBalance
=
new
DcPlatformBalance
();
dcPlatformBalance
.
setPaycompanyid
(
2
);
dcPlatformBalance
.
setPlatformcode
(
"Ebay"
);
dcPlatformBalance
.
setPlatformname
(
"Ebay"
);
dcPlatformBalance
.
setAccount
(
payPalBalanceDTO
.
getAccount
());
dcPlatformBalance
.
setCurrency
(
payPalBalanceDTO
.
getCurrencyCode
());
dcPlatformBalance
.
setAmount
(
payPalBalanceDTO
.
getBalance
());
dcPlatformBalance
.
setUserableAmount
(
payPalBalanceDTO
.
getBalance
());
dcPlatformBalance
.
setFreezeAmount
(
BigDecimal
.
ZERO
);
dcPlatformBalance
.
setExchangerate
(
BigDecimal
.
ZERO
);
dcPlatformBalance
.
setAmountRmb
(
BigDecimal
.
ZERO
);
dcPlatformBalance
.
setUserableAmountRmb
(
BigDecimal
.
ZERO
);
dcPlatformBalance
.
setFreezeAmountRmb
(
BigDecimal
.
ZERO
);
dcPlatformBalance
.
setDay
(
dcJobConfig
.
getStartTime
().
toLocalDate
());
dcPlatformBalance
.
setPuttime
(
dcJobConfig
.
getStartTime
());
dcPlatformBalance
.
setDelstatus
(
0
);
dcPlatformBalance
.
setFromsource
(
"PayPal"
);
dcPlatformBalance
.
setCreatetime
(
LocalDateTime
.
now
());
dcPlatformBalance
.
setCreateuserid
(
0
);
dcPlatformBalance
.
setCreateusername
(
"admin"
);
return
dcPlatformBalance
;
})
.
collect
(
Collectors
.
toList
());
dcPlatformBalanceService
.
remove
(
new
LambdaQueryWrapper
<
DcPlatformBalance
>()
.
eq
(
DcPlatformBalance:
:
getDay
,
dcJobConfig
.
getStartTime
().
toLocalDate
()));
dcPlatformBalanceService
.
saveBatch
(
dcPlatformBalanceList
);
dcPlatformBalanceMapper
.
updatePayPalBalance
(
dcJobConfig
.
getStartTime
().
toLocalDate
());
}
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
@Resource
DcBalanceSheetMapper
dcBalanceSheetMapper
;
@Resource
DcPlatformBalanceMapper
dcPlatformBalanceMapper
;
@Resource
DcFixedAssetsDetailMapper
dcFixedAssetsDetailMapper
;
@Resource
IDcBalanceSheetService
dcBalanceSheetService
;
/**
* 每天生成资产负债表
* companyValue 0
* companyName 百伦供应链
*
* <p>
* 字段:银行账户余额汇总 {@link DcBalanceSheet#getBankAccountBalance()}
* 取数 {@link DcBankAccountBalanceMapper#getBalanceSum(LocalDate)}
* 银行账户数据从财务系统同步而来 {@link BalanceSheetService#syncBankAccount()}
* </p>
*
* <p>
* 字段:提现在途金额汇总 {@link DcBalanceSheet#getWithdrawAmount()}
* 取数 {@link DcWithdrawOnWayMapper#getWithdrawOnWaySum(LocalDate)}
* 提现在途数据从财务系统同步而来 {@link BalanceSheetService#syncWithdrawOnWaySummary()}
* </p>
*
* <p>
* 字段:第三方平台余额 {@link DcBalanceSheet#getPlatformBalance()}
* 取数 {@link DcPlatformBalanceMapper#getPlatformBalanceSum(LocalDate)}
* 第三方平台数据从财务系统同步 {@link BalanceSheetService#syncPayPal()} 现在不知道没启动 所以第三方平台余额都是0
* </p>
*
* <p>
* 字段:货币资金 {@link DcBalanceSheet#getMonetaryFund()}
* 取数:货币资金 = 银行账户余额汇总 + 提现在途金额汇总 + 第三方平台余额
* </p>
*
* <p>
* 字段:短期借款 {@link DcBalanceSheet#getShortTermBorrow()}
* 取数: {@link DcShortTermBorrowMapper#getShortTermBorrowBalanceSum(LocalDate)}
* 短期借款数据从财务系统同步过来 {@link BalanceSheetService#syncShortBorrowBalance}
* </p>
*
* <p>
* 字段:借支金额{@link DcBalanceSheet#getAmountBorrowed()}
* 取数: {@link DcBalanceSheetMapper#getAmountBorrowed(LocalDate)}
* 元数据实体 {@link DcDailyFee} 数据来源详见datacenter-sync-fee项目
* </p>
*
* <p>
* 字段:其他应收款{@link DcBalanceSheet#getOtherAccountsReceivable()}
* 取数: {@link DcBalanceSheetMapper#getOtherAccountsReceivableImport(LocalDate)}(导入的其他应收款) + 借支金额
* </p>
*
* <p>
* 字段:固定资产
* 取数: {@link DcBalanceSheetMapper#getFixedAssetsImport(LocalDate)}(导入的固定资产) + {@link DcFixedAssetsDetailMapper#getFixedAssetsSum(LocalDate)} (固定资产统计)
* 固定资产统计 从费用系统采购单同步而来 {@link BalanceSheetService#syncBuy()}
* </p>
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
generateBalanceSheet
()
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
financeGenerateBalanceSheet
);
Integer
companyValue
=
0
;
String
companyName
=
"百伦供应链"
;
LocalDate
date
=
dcJobConfig
.
getStartTime
().
toLocalDate
();
DcBalanceSheet
dcBalanceSheet
=
dcBalanceSheetMapper
.
selectOne
(
new
LambdaQueryWrapper
<
DcBalanceSheet
>()
.
eq
(
DcBalanceSheet:
:
getCompanyValue
,
companyValue
)
.
eq
(
DcBalanceSheet:
:
getCompanyName
,
companyName
)
.
eq
(
DcBalanceSheet:
:
getStatisticalTime
,
dcJobConfig
.
getStartTime
().
toLocalDate
()));
if
(
dcBalanceSheet
==
null
)
{
dcBalanceSheet
=
new
DcBalanceSheet
();
dcBalanceSheet
.
setCompanyValue
(
companyValue
);
dcBalanceSheet
.
setCompanyName
(
companyName
);
dcBalanceSheet
.
setStatisticalTime
(
dcJobConfig
.
getStartTime
().
toLocalDate
());
}
//银行账户余额汇总
BigDecimal
bankAccountBalanceSum
=
dcBankAccountBalanceMapper
.
getBalanceSum
(
date
);
dcBalanceSheet
.
setBankAccountBalance
(
bankAccountBalanceSum
);
// 提现在途金额汇总
BigDecimal
withdrawOnWaySum
=
dcWithdrawOnWayMapper
.
getWithdrawOnWaySum
(
date
);
dcBalanceSheet
.
setWithdrawAmount
(
withdrawOnWaySum
);
// 第三方平台余额
BigDecimal
platformBalanceSum
=
dcPlatformBalanceMapper
.
getPlatformBalanceSum
(
date
);
dcBalanceSheet
.
setPlatformBalance
(
platformBalanceSum
);
// 货币资金 货币资金 = 银行余额 + 提现在途 + 第三方平台余额
dcBalanceSheet
.
setMonetaryFund
(
bankAccountBalanceSum
.
add
(
withdrawOnWaySum
).
add
(
platformBalanceSum
));
// 短期借款
BigDecimal
shortBorrowBalanceSum
=
dcShortTermBorrowMapper
.
getShortTermBorrowBalanceSum
(
date
);
dcBalanceSheet
.
setShortTermBorrow
(
shortBorrowBalanceSum
);
//借支金额(借支单未还金额)
BigDecimal
amountBorrowedSum
=
dcBalanceSheetMapper
.
getAmountBorrowed
(
date
);
dcBalanceSheet
.
setAmountBorrowed
(
amountBorrowedSum
);
// 其他应收款
BigDecimal
otherAccountsReceivableImport
=
dcBalanceSheetMapper
.
getOtherAccountsReceivableImport
(
date
);
dcBalanceSheet
.
setOtherAccountsReceivable
(
amountBorrowedSum
.
add
(
otherAccountsReceivableImport
));
//固定资产
BigDecimal
fixedAssetsSum
=
dcFixedAssetsDetailMapper
.
getFixedAssetsSum
(
date
);
BigDecimal
fixedAssetsImport
=
dcBalanceSheetMapper
.
getFixedAssetsImport
(
date
);
dcBalanceSheet
.
setFixedAssets
(
fixedAssetsSum
.
add
(
fixedAssetsImport
));
dcBalanceSheetService
.
saveOrUpdate
(
dcBalanceSheet
);
//更新任务时间
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
}
datacenter-finance/finance-balance-sheet/src/main/resources/application-prod.yml
0 → 100644
View file @
f63468a6
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-finance/finance-balance-sheet/src/main/resources/application-test.yml
0 → 100644
View file @
f63468a6
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
:
1226
datacenter-finance/finance-balance-sheet/src/test/java/com/bailuntec/job/service/BalanceSheetServiceTest.java
0 → 100644
View file @
f63468a6
package
com
.
bailuntec
.
job
.
service
;
import
com.bailuntec.job.BalanceSheetApp
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.ActiveProfiles
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
javax.annotation.Resource
;
import
java.text.ParseException
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/11/3 5:10 下午
*/
@ActiveProfiles
(
"test"
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
BalanceSheetApp
.
class
)
public
class
BalanceSheetServiceTest
{
@Autowired
private
BalanceSheetService
balanceSheetService
;
@Test
public
void
syncBankAccount
()
{
balanceSheetService
.
syncBankAccount
();
}
@Test
public
void
syncWithdrawOnWaySummary
()
{
balanceSheetService
.
syncWithdrawOnWaySummary
();
}
@Test
public
void
syncShortBorrowBalance
()
{
balanceSheetService
.
syncShortBorrowBalance
();
}
@Test
public
void
syncCost
()
{
balanceSheetService
.
syncCost
();
}
@Test
public
void
syncBuy
()
throws
ParseException
{
balanceSheetService
.
syncBuy
();
}
@Test
public
void
generateBalanceSheet
()
{
balanceSheetService
.
generateBalanceSheet
();
}
}
datacenter-finance/pom.xml
0 → 100644
View file @
f63468a6
<?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>
bailuntec-datacenter-job
</artifactId>
<groupId>
com.bailuntec
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
datacenter-finance
</artifactId>
<packaging>
pom
</packaging>
<modules>
<module>
finance-balance-sheet
</module>
</modules>
</project>
datacenter-mid/mid-calculate-turnover-prepare/src/main/docker/Dockerfile
View file @
f63468a6
...
...
@@ -4,5 +4,5 @@ ADD mid-calculate-turnover-prepare-1.0-SNAPSHOT.jar app.jar
RUN
echo
"Asia/Shanghai"
>
/etc/timezone
ENTRYPOINT
["java","-Xms
50m","-Xmx15
0m","-jar","-Dspring.profiles.active=prod","/app.jar"]
ENTRYPOINT
["java","-Xms
100m","-Xmx30
0m","-jar","-Dspring.profiles.active=prod","/app.jar"]
EXPOSE
8080
datacenter-mid/mid-calculate-turnover-prepare/src/main/java/com/bailuntec/job/TurnoverPrepareApp.java
View file @
f63468a6
...
...
@@ -3,6 +3,7 @@ package com.bailuntec.job;
import
org.mybatis.spring.annotation.MapperScan
;
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.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
...
...
@@ -18,7 +19,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
@ComponentScan
(
"com.bailuntec"
)
@
MapperScan
(
"com.bailuntec"
)
@
EnableFeignClients
(
basePackages
=
{
"com.bailuntec.api"
,
"com.bailuntec.*.api"
}
)
public
class
TurnoverPrepareApp
{
public
static
void
main
(
String
[]
args
)
{
...
...
datacenter-mid/mid-calculate-turnover-prepare/src/main/java/com/bailuntec/job/TurnoverPrepareJob.java
View file @
f63468a6
...
...
@@ -25,7 +25,7 @@ public class TurnoverPrepareJob {
* 到库存表
* </p>
*/
@Scheduled
(
cron
=
"0 0/1
0
* * * ? "
)
@Scheduled
(
cron
=
"0 0/1 * * * ? "
)
public
void
syncBaseStock
()
{
try
{
log
.
info
(
"每10分钟同步oms、在途、采购存在sku但环球库存不存在的库存到库存表 开始"
);
...
...
datacenter-mid/mid-calculate-turnover-prepare/src/main/resources/application-prod.yml
View file @
f63468a6
...
...
@@ -8,13 +8,15 @@ spring:
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
#
configuration:
#
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
feign
:
hystrix
:
...
...
datacenter-mid/mid-calculate-turnover-prepare/src/main/resources/application-test.yml
View file @
f63468a6
...
...
@@ -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 配置
...
...
pom.xml
View file @
f63468a6
...
...
@@ -19,6 +19,7 @@
<module>
datacenter-base
</module>
<module>
datacenter-mid
</module>
<module>
datacenter-show
</module>
<module>
datacenter-finance
</module>
</modules>
...
...
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