|
|
@ -13,10 +13,8 @@ import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
|
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
@ -26,7 +24,7 @@ import java.util.stream.Collectors;
|
|
|
|
* Created by wangning on 2018/1/2.
|
|
|
|
* Created by wangning on 2018/1/2.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Component
|
|
|
|
@Component
|
|
|
|
@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
|
|
|
|
//@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true")
|
|
|
|
public class PostponeClientTask {
|
|
|
|
public class PostponeClientTask {
|
|
|
|
|
|
|
|
|
|
|
|
Logger logger = LoggerFactory.getLogger(PostponeClientTask.class);
|
|
|
|
Logger logger = LoggerFactory.getLogger(PostponeClientTask.class);
|
|
|
@ -43,34 +41,8 @@ public class PostponeClientTask {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private PaymentApi paymentApi;
|
|
|
|
private PaymentApi paymentApi;
|
|
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 30 8 * * ?")
|
|
|
|
|
|
|
|
public void postponeClient() {
|
|
|
|
|
|
|
|
synchronizedScheduler.executeProcess("manage_task:postPoneClient", 120_000, () -> {
|
|
|
|
|
|
|
|
Date now = new Date();
|
|
|
|
|
|
|
|
Date tomorrow = DateUtils.addDays(now, 1);
|
|
|
|
|
|
|
|
Date yearTomorrow = DateUtils.addYears(tomorrow, 1);
|
|
|
|
|
|
|
|
String expireDate = DateFormatUtils.format(yearTomorrow, "yyyy-MM-dd");
|
|
|
|
|
|
|
|
List<JSONObject> expiryClient = clientRateMapper.getAllExpiry(now);
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(expiryClient)) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (JSONObject client : expiryClient) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
clientManager.postponeClientRate(now, yearTomorrow, expireDate, client);
|
|
|
|
|
|
|
|
sb.append(client.getString("client_moniker"));
|
|
|
|
|
|
|
|
sb.append("、");
|
|
|
|
|
|
|
|
} catch (Exception ignore) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sb.deleteCharAt(sb.length() - 1);
|
|
|
|
|
|
|
|
sendComplianceNotify(sb.toString(), expireDate);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 30 6 * * ?")
|
|
|
|
@Scheduled(cron = "0 30 6 * * ?")
|
|
|
|
private void postponeMerchantRate() {
|
|
|
|
public void postponeMerchantRate() {
|
|
|
|
synchronizedScheduler.executeProcess("manage_task:postponeMerchantRate", 120_000, () -> {
|
|
|
|
synchronizedScheduler.executeProcess("manage_task:postponeMerchantRate", 120_000, () -> {
|
|
|
|
String nextYearExipryDate = DateFormatUtils.format(DateUtils.addYears(new Date(), 1), "yyyy-MM-dd");
|
|
|
|
String nextYearExipryDate = DateFormatUtils.format(DateUtils.addYears(new Date(), 1), "yyyy-MM-dd");
|
|
|
|
List<JSONObject> expiryRateMerchantsChannels = clientRateMapper.getAllClientRateExpiryMerchants();
|
|
|
|
List<JSONObject> expiryRateMerchantsChannels = clientRateMapper.getAllClientRateExpiryMerchants();
|
|
|
|