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
80e4a984
Commit
80e4a984
authored
Jan 18, 2021
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
# 费用系统之屑
parent
180a01f4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
47 deletions
+18
-47
FeeJob.java
...base-sync-fee/src/main/java/com/bailuntec/job/FeeJob.java
+11
-11
SyncFeeService.java
...c/main/java/com/bailuntec/job/service/SyncFeeService.java
+7
-36
No files found.
datacenter-job/datacenter-base/base-sync-fee/src/main/java/com/bailuntec/job/FeeJob.java
View file @
80e4a984
...
...
@@ -26,17 +26,17 @@ public class FeeJob {
}
}
@Scheduled
(
cron
=
"0/10 * * * * ?"
)
public
void
syncLogistics
()
{
try
{
log
.
info
(
"每分钟同步物流费用 开始"
);
syncFeeService
.
syncLogistics
();
log
.
info
(
"每分钟同步物流费用 结束"
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"每分钟同步物流费用 异常:"
,
ex
);
}
}
//
//
@Scheduled(cron = "0/10 * * * * ?")
//
public void syncLogistics() {
//
try {
//
log.info("每分钟同步物流费用 开始");
//
syncFeeService.syncLogistics();
//
log.info("每分钟同步物流费用 结束");
//
} catch (Exception ex) {
//
log.error("每分钟同步物流费用 异常:", ex);
//
}
//
}
@Scheduled
(
cron
=
"0/10 * * * * ?"
)
public
void
syncManageCost
()
{
...
...
datacenter-job/datacenter-base/base-sync-fee/src/main/java/com/bailuntec/job/service/SyncFeeService.java
View file @
80e4a984
...
...
@@ -5,9 +5,9 @@ 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.request.ManageCostListReq
;
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
;
...
...
@@ -98,46 +98,17 @@ public class SyncFeeService {
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
@Transactional
public
void
syncLogistics
()
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
baseSyncLogistics
);
CostResult
<
List
<
ManageCostDto
>>
result
=
costApi
.
logisticsCostList
(
dcJobConfig
.
getStartTimeStr
(),
dcJobConfig
.
getEndTimeStr
(),
null
,
null
,
null
,
null
,
null
,
null
,
null
);
//重跑的时候clear保证方法幂等
dcBaseFinanceLogisticsMapper
.
delete
(
new
LambdaQueryWrapper
<
DcBaseFinanceLogistics
>()
.
gt
(
DcBaseFinanceLogistics:
:
getPayTime
,
dcJobConfig
.
getStartTime
())
.
lt
(
DcBaseFinanceLogistics:
:
getPayTime
,
dcJobConfig
.
getEndTime
()));
result
.
getData
().
forEach
(
manageCostDto
->
{
DcBaseFinanceLogistics
dcBaseFinanceLogistics
=
new
DcBaseFinanceLogistics
();
BeanUtils
.
copyProperties
(
manageCostDto
,
dcBaseFinanceLogistics
,
"id"
);
dcBaseFinanceLogistics
.
setGmtModified
(
LocalDateTime
.
now
());
dcBaseFinanceLogistics
.
setPayTime
(
manageCostDto
.
getPayTime
().
toInstant
().
atZone
(
ZoneId
.
systemDefault
()).
toLocalDateTime
());
int
update
=
dcBaseFinanceLogisticsMapper
.
update
(
dcBaseFinanceLogistics
,
new
LambdaQueryWrapper
<
DcBaseFinanceLogistics
>()
.
eq
(
DcBaseFinanceLogistics:
:
getNo
,
dcBaseFinanceLogistics
.
getNo
())
.
eq
(
DcBaseFinanceLogistics:
:
getCostId1
,
dcBaseFinanceLogistics
.
getCostId1
())
.
eq
(
DcBaseFinanceLogistics:
:
getCostId
,
dcBaseFinanceLogistics
.
getCostId
()));
if
(
update
==
0
)
{
dcBaseFinanceLogisticsMapper
.
insert
(
dcBaseFinanceLogistics
);
}
});
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
@Transactional
public
void
syncManageCost
()
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
baseSyncManageCost
);
CostResult
<
List
<
ManageCostDto
>>
result
=
costApi
.
manageCostList
(
dcJobConfig
.
getStartTimeStr
(),
dcJobConfig
.
getEndTimeStr
(),
null
,
null
,
null
,
null
,
null
,
null
,
null
);
ManageCostListReq
req
=
new
ManageCostListReq
();
req
.
setStartDateStr
(
dcJobConfig
.
getStartTimeStr
());
req
.
setEndDateStr
(
dcJobConfig
.
getEndTimeStr
());
CostResult
<
List
<
ManageCostDto
>>
result
=
costApi
.
manageCostList
(
req
);
//重跑的时候clear保证方法幂等
dcBaseFinanceManagecostMapper
.
delete
(
new
LambdaQueryWrapper
<
DcBaseFinanceManagecost
>()
...
...
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