段飞宇
1 year ago
5 changed files with 147 additions and 1 deletions
@ -0,0 +1,55 @@
|
||||
package com.hnac.hzims.ticket.twoTicket.scheduled; |
||||
|
||||
import com.hnac.hzims.ticket.twoTicket.service.TicketCountService; |
||||
import com.xxl.job.core.biz.model.ReturnT; |
||||
import com.xxl.job.core.handler.annotation.XxlJob; |
||||
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.time.Duration; |
||||
import java.time.Instant; |
||||
import java.time.YearMonth; |
||||
import java.time.format.DateTimeFormatter; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/7/17 17:19 |
||||
*/ |
||||
@Slf4j |
||||
@Component |
||||
@RequiredArgsConstructor |
||||
public class TicketCountScheduled { |
||||
|
||||
private final TicketCountService ticketCountService; |
||||
|
||||
|
||||
|
||||
/** |
||||
* 集中监控数据处理 |
||||
* |
||||
* @return ReturnT<String> |
||||
*/ |
||||
@XxlJob("getTicketCount") |
||||
public ReturnT<String> getTicketCount(String param) { |
||||
Instant start = Instant.now(); |
||||
if (Func.isBlank(param)) { |
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
||||
YearMonth yearMonth = YearMonth.now(); |
||||
YearMonth newYearMonth = yearMonth.minusMonths(1); |
||||
param = newYearMonth.format(dateTimeFormatter); |
||||
} |
||||
ticketCountService.allLoadMonthReport(param); |
||||
|
||||
Duration between = Duration.between(start, Instant.now()); |
||||
log.info("================================================================"); |
||||
log.info("耗时: " + (between.getSeconds()) + "秒"); |
||||
log.info("耗时: " + (between.toMillis()) + "毫秒"); |
||||
log.info("================================================================"); |
||||
log.info("两票生成月报统计成功"); |
||||
return new ReturnT<>("SUCCESS"); |
||||
} |
||||
} |
Loading…
Reference in new issue