|
|
|
@ -24,6 +24,7 @@ import lombok.Getter;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.Setter;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
@ -67,6 +68,10 @@ public class SyncTask {
|
|
|
|
|
|
|
|
|
|
private Date lastUpdateTime;
|
|
|
|
|
|
|
|
|
|
@Value("${system.flag}")
|
|
|
|
|
private Boolean flag;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 10分钟定时拉取订单
|
|
|
|
|
*/
|
|
|
|
@ -74,21 +79,23 @@ public class SyncTask {
|
|
|
|
|
@Scheduled(cron = "0 0/10 * * * *")
|
|
|
|
|
// @Scheduled(cron = "0 0/1 * * * *")
|
|
|
|
|
public void pullOrdersRegularly() throws ApiException, SecretException, NoSuchFieldException, IllegalAccessException {
|
|
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
|
|
log.info("====== [ the pull order start the time as {} ] ======", startTime);
|
|
|
|
|
DateTime date = DateUtil.date();
|
|
|
|
|
if (count.get() > DefaultNumberConstants.ZERO_NUMBER) {
|
|
|
|
|
// 超时判断时间
|
|
|
|
|
if (lastUpdateTime != null && DateUtil.offsetMinute
|
|
|
|
|
(date, -DefaultNumberConstants.FIFTEEN_NUMBER).before(lastUpdateTime)) {
|
|
|
|
|
return;
|
|
|
|
|
if (flag != null && flag) {
|
|
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
|
|
log.info("====== [ the pull order start the time as {} ] ======", startTime);
|
|
|
|
|
DateTime date = DateUtil.date();
|
|
|
|
|
if (count.get() > DefaultNumberConstants.ZERO_NUMBER) {
|
|
|
|
|
// 超时判断时间
|
|
|
|
|
if (lastUpdateTime != null && DateUtil.offsetMinute
|
|
|
|
|
(date, -DefaultNumberConstants.FIFTEEN_NUMBER).before(lastUpdateTime)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 初始化参数
|
|
|
|
|
count.addAndGet(DefaultNumberConstants.ZERO_NUMBER);
|
|
|
|
|
}
|
|
|
|
|
// 初始化参数
|
|
|
|
|
count.addAndGet(DefaultNumberConstants.ZERO_NUMBER);
|
|
|
|
|
syncOrder(date);
|
|
|
|
|
long endTime = System.currentTimeMillis();
|
|
|
|
|
log.info("====== [ the pull order end time consuming as {} ] ======", endTime - startTime);
|
|
|
|
|
}
|
|
|
|
|
syncOrder(date);
|
|
|
|
|
long endTime = System.currentTimeMillis();
|
|
|
|
|
log.info("====== [ the pull order end time consuming as {} ] ======", endTime - startTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -145,22 +152,6 @@ public class SyncTask {
|
|
|
|
|
memberService.synMemberByTrade(syncTask);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 修改同步数量
|
|
|
|
|
int messageCount = sellerAccount.getMessageCount() != null ?
|
|
|
|
|
sellerAccount.getMessageCount() : DefaultNumberConstants.ZERO_NUMBER;
|
|
|
|
|
int totalAmount = messageCount + trades.size();
|
|
|
|
|
sellerAccountService.updateMessageCount(sellerAccount.getId(), totalAmount);
|
|
|
|
|
if (sellerAccount.getMassNum() != null
|
|
|
|
|
&& sellerAccount.getMassNum() > DefaultNumberConstants.ZERO_NUMBER
|
|
|
|
|
&& totalAmount > sellerAccount.getMassNum()) {
|
|
|
|
|
log.info("======================== the massNum as {} trades size as {} ==================",
|
|
|
|
|
sellerAccount.getMassNum(), trades.size());
|
|
|
|
|
// 删除数据推送
|
|
|
|
|
taoBaoRdsPushService.deletePushUser(sellerNick);
|
|
|
|
|
// 修改账号状态
|
|
|
|
|
sellerAccountService.updateAccountStatusAndExpiration
|
|
|
|
|
(sellerAccount.getId(), DefaultNumberConstants.MINUS_ONE_NUMBER, DateUtil.date());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|