gmt-3-test
gmt-3
This commit is contained in:
@@ -6,12 +6,18 @@ import com.accompany.business.service.guild.AgencyMonthSettleService;
|
||||
import com.accompany.business.service.guild.GuildSalaryBillDateCycleService;
|
||||
import com.accompany.business.util.GuildTimeUtil;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.core.enumeration.PartitionEnum;
|
||||
import com.accompany.core.model.PartitionInfo;
|
||||
import com.accompany.core.service.partition.PartitionInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@@ -20,12 +26,14 @@ public class GuildSettleTask {
|
||||
private AgencyMonthSettleService agencyMonthSettleService;
|
||||
@Autowired
|
||||
private GuildSalaryBillDateCycleService guildSalaryBillDateCycleService ;
|
||||
|
||||
@Autowired
|
||||
private PartitionInfoService partitionInfoService;
|
||||
private static final DateTimeFormatter dateFormatters = DateTimeFormatter.ofPattern(DateTimeUtil.DEFAULT_DATETIME_PATTERN);
|
||||
/**
|
||||
* 公会月结算
|
||||
* 每月16号凌晨0点10分执行
|
||||
*/
|
||||
@Scheduled(cron = "0 10 0 16 * ?")
|
||||
@Scheduled(cron = "0 10 0 16 * ?", zone = "GMT-3")
|
||||
public void monthRankTaskAll1() {
|
||||
Date date = new Date();
|
||||
DateTime beginTime = DateUtil.beginOfMonth(date);
|
||||
@@ -42,7 +50,7 @@ public class GuildSettleTask {
|
||||
* 公户月结算,用户明细
|
||||
* 每月1号凌晨0点10分执行
|
||||
*/
|
||||
@Scheduled(cron = "0 10 0 1 * ?")
|
||||
@Scheduled(cron = "0 10 0 1 * ?", zone = "GMT-3")
|
||||
public void monthRankTaskAll2() {
|
||||
Date date = new Date();
|
||||
DateTime lastMonth = DateUtil.offsetMonth(date, -1);
|
||||
@@ -50,7 +58,7 @@ public class GuildSettleTask {
|
||||
DateTime endTime = DateUtil.beginOfDay(date);
|
||||
log.info("=-=monthRankTaskAll2=-=:beginTime:{},endTime:{}", DateUtil.formatDateTime(beginTime) , DateUtil.formatDateTime(endTime));
|
||||
agencyMonthSettleService.monthRankTaskAll(beginTime, endTime);
|
||||
log.info("=-=monthRankTaskAll2=-= end", DateUtil.formatDateTime(date));
|
||||
log.info("=-=monthRankTaskAll2=-= end");
|
||||
log.info("=-=monthRankTaskDetail2=-=:beginTime:{},endTime:{}", DateUtil.formatDateTime(beginTime) , DateUtil.formatDateTime(endTime));
|
||||
agencyMonthSettleService.monthRankTaskDetail(beginTime, endTime);
|
||||
log.info("=-=monthRankTaskDetail2=-= end");
|
||||
@@ -59,7 +67,7 @@ public class GuildSettleTask {
|
||||
/**
|
||||
* 主播薪资操作记录结算
|
||||
*/
|
||||
@Scheduled(cron = "0 10 0 * * ?")
|
||||
@Scheduled(cron = "0 10 0 * * ?", zone = "GMT-3")
|
||||
public void settleAnchorBill() {
|
||||
//发放奖励逻辑:每月1号/16号为结算日沙特时间00:10(次月1号结算上月16号-月结束的奖励,每月16号结算本月1-15号的奖励)
|
||||
Date date = new Date();
|
||||
@@ -70,4 +78,35 @@ public class GuildSettleTask {
|
||||
guildSalaryBillDateCycleService.settleAnchorBill(DateTimeUtil.convertDate(DateTimeUtil.addDays(date,-1)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* test
|
||||
*/
|
||||
@Scheduled(cron = "0 50 12 28 * ?", zone = "Asia/Riyadh")
|
||||
public void test2() {
|
||||
PartitionInfo byId = partitionInfoService.getById(PartitionEnum.ARAB.getId());
|
||||
ZonedDateTime zonedDateTime = DateTimeUtil.convertWithZoneId(new Date(), byId.getZoneId());
|
||||
log.info("=======东三区时间执行test2=======,date:" + zonedDateTime.format(dateFormatters));
|
||||
}
|
||||
|
||||
/**
|
||||
* test
|
||||
*/
|
||||
@Scheduled(cron = "0 50 12 28 * ?", zone = "Etc/GMT-3")
|
||||
public void test3() {
|
||||
PartitionInfo byId = partitionInfoService.getById(PartitionEnum.ARAB.getId());
|
||||
ZonedDateTime zonedDateTime = DateTimeUtil.convertWithZoneId(new Date(), byId.getZoneId());
|
||||
log.info("=======东三区时间执行test3=======,date:" + zonedDateTime.format(dateFormatters));
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// public static void main(String[] args) {
|
||||
// String[] availableIDs = TimeZone.getAvailableIDs();
|
||||
// for (String availableID : availableIDs) {
|
||||
// System.out.println(availableID);
|
||||
// }
|
||||
// System.out.println(DateTimeUtil.getDateTimeByZoneId("Etc/GMT-3").format(dateFormatters));
|
||||
// System.out.println(DateTimeUtil.getDateTimeByZoneId("Etc/GMT-8").format(dateFormatters));
|
||||
// }
|
||||
}
|
||||
|
Reference in New Issue
Block a user