Commit 5b7bd970 by liyanlin

fix

parent 726d2afe
......@@ -10,7 +10,7 @@
#{item.paymentsEntity},#{item.payoutId},#{item.referencesJson},#{item.itemId},#{item.salesRecordReference},
#{item.transactionDate},#{item.transactionDateShort},#{item.transactionId},#{item.transactionMemo},
#{item.transactionStatus},#{item.transactionType},#{item.accountId},#{item.transactionDateBj},#{item.exchangeRate},
,#{item.exchangeRateUsd})
#{item.exchangeRateUsd})
</foreach>
</insert>
</mapper>
\ No newline at end of file
......@@ -110,7 +110,7 @@
sum(t2.`count`) purchase_inbound_count
from dc_base_purchase t1
left join dc_base_purchase_inbound t2 on t1.bailun_sku = t2.bailun_sku and t1.parent_id = t2.parent_id
where t1.buy_status in (0, 1, 2, 3, 9)
where t1.buy_status in (0, 1, 2, 3, 7, 9)
and t1.has_delete = 0
and t1.`count` &gt; 0
and (t1.`count` &gt; t2.`count` or t2.`count` is null)
......
......@@ -18,7 +18,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
......@@ -42,8 +41,8 @@ public class SyncEbayFeeServiceImpl implements SyncEbayFeeService {
private DcBaseEbayTransactionMapper dcBaseEbayTransactionMapper;
//当前需要跑的账号
private final static String[] RUN_ACCOUNT = new String[]{"ottlueilwitz3","jalenhe","uha4mmada","rownmelody5",
"nthonyp6ecket","rayallen9","barbara_spence95","nbrysonhall","credit4free","barbara_spence95"};
private final static String[] RUN_ACCOUNT = new String[]{"ottlueilwitz3", "jalenhe", "uha4mmada", "rownmelody5",
"nthonyp6ecket", "rayallen9", "barbara_spence95", "nbrysonhall", "credit4free", "barbara_spence95"};
@Resource
private EbayTransactionApi ebayTransactionApi;
......@@ -54,24 +53,24 @@ public class SyncEbayFeeServiceImpl implements SyncEbayFeeService {
@Override
public void SyncEbayTransaction() {
//获取未跑或失败的任务
/*List<EbayAccountReportTask> ebayAccountReportTaskList = ebayAccountReportTaskService.list(
List<EbayAccountReportTask> ebayAccountReportTaskList = ebayAccountReportTaskService.list(
new LambdaQueryWrapper<EbayAccountReportTask>()
.ne(EbayAccountReportTask::getStatus, 1)
);*/
List<EbayAccountReportTask> ebayAccountReportTaskList = ebayAccountReportTaskService.list(new LambdaQueryWrapper<EbayAccountReportTask>()
.ne(EbayAccountReportTask::getStatus, 1)
);
/*List<EbayAccountReportTask> ebayAccountReportTaskList = ebayAccountReportTaskService.list(new LambdaQueryWrapper<EbayAccountReportTask>()
.ge(EbayAccountReportTask::getStartTime, LocalDateTime.of(2021, 5, 4, 0, 0, 0))
.lt(EbayAccountReportTask::getStartTime, LocalDateTime.of(2021, 5, 27, 0, 0, 0)));
.lt(EbayAccountReportTask::getStartTime, LocalDateTime.of(2021, 5, 27, 0, 0, 0)));*/
//获取账号信息
List<Integer> accountIdList = ebayAccountReportTaskList.stream().map(x -> x.getAccountId()).distinct().collect(Collectors.toList());
List<DcBaseCompanyAccount> accountList = dcBaseCompanyAccountService.list(
new LambdaQueryWrapper<DcBaseCompanyAccount>()
.in(DcBaseCompanyAccount::getAccountId, accountIdList)
.in(DcBaseCompanyAccount::getAccountName,RUN_ACCOUNT)
.in(DcBaseCompanyAccount::getAccountName, RUN_ACCOUNT)
);
//循环跑任务
List<EbayAccountReportTask> needUpdateEbayAccountReportTaskList = new ArrayList<>();
ebayAccountReportTaskList.forEach(x -> {
if(accountList.stream().noneMatch(a -> a.getAccountId().equals(x.getAccountId()))){
if (accountList.stream().noneMatch(a -> a.getAccountId().equals(x.getAccountId()))) {
return;
}
//获取token
......@@ -80,7 +79,7 @@ public class SyncEbayFeeServiceImpl implements SyncEbayFeeService {
DcBaseCompanyAccount currentAccount = accountList.stream().filter(account -> account.getAccountId().equals(x.getAccountId())).findFirst().get();
try {
//禁用账号直接跳过
if(!currentAccount.getStatus()){
if (!currentAccount.getStatus()) {
x.setStatus(2);
x.setErrorMsg("当前账号被禁用");
needUpdateEbayAccountReportTaskList.add(x);
......@@ -103,7 +102,7 @@ public class SyncEbayFeeServiceImpl implements SyncEbayFeeService {
boolean isSuccess = doGet(accessToken.toString(), filter, 1000, pageNum, transactions);
if (isSuccess) {
x.setStatus(1);
save(transactions,currentAccount.getAccountId());
save(transactions, currentAccount.getAccountId());
} else {
String msg = String.format("请求ebay广告服务异常,当前账号:%s,当前页码:%s", currentAccount.getAccountName(), pageNum);
log.error(msg);
......@@ -135,7 +134,7 @@ public class SyncEbayFeeServiceImpl implements SyncEbayFeeService {
return true;
}
private void save(List<Transaction> transactions,Integer accountId) {
private void save(List<Transaction> transactions, Integer accountId) {
if (transactions == null || transactions.isEmpty()) {
return;
}
......@@ -165,8 +164,7 @@ public class SyncEbayFeeServiceImpl implements SyncEbayFeeService {
try {
x.setExchangeRate(oaApi.getExchangeRateByCurAndDate(x.getCurrency(), "CNY", x.getTransactionDateBj().toLocalDate()).getRate());
x.setExchangeRateUsd(oaApi.getExchangeRateByCurAndDate(x.getCurrency(), "USD", x.getTransactionDateBj().toLocalDate()).getRate());
}
catch (Exception ex){
} catch (Exception ex) {
log.info(ex.toString());
}
});
......
......@@ -77,8 +77,8 @@ public class SyncFeeService {
BeanUtils.copyProperties(costDto, dcBaseFinanceFee);
dcBaseFinanceFee.setCreateTime(LocalDateTime.ofInstant(costDto.getCreateTime().toInstant(), ZoneId.systemDefault()));
if (costDto.getPayTime() != null) {
dcBaseFinanceFee.setPayTime(LocalDateTime.ofInstant(costDto.getPayTime().toInstant(), ZoneId.systemDefault()));
if (costDto.getActualTime() != null) {
dcBaseFinanceFee.setPayTime(LocalDateTime.ofInstant(costDto.getActualTime().toInstant(), ZoneId.systemDefault()));
}
if (costDto.getAuditTime() != null) {
dcBaseFinanceFee.setAuditTime(LocalDateTime.ofInstant(costDto.getAuditTime().toInstant(), ZoneId.systemDefault()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment