/*
 *    Copyright (c) 2018-2025, hnqz All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: hnqz
 */

package com.qunzhixinxi.hnqz.daemon.quartz.task;

import com.qunzhixinxi.hnqz.daemon.quartz.constants.HnqzQuartzEnum;
import com.qunzhixinxi.hnqz.daemon.quartz.entity.WmTaskType;
import com.qunzhixinxi.hnqz.daemon.quartz.service.*;
import com.qunzhixinxi.hnqz.daemon.quartz.zhuqu.ZhuaquTest;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;

import java.time.LocalDateTime;

/**
 * @author 郑健楠
 */
@Slf4j
@Component("demo")
@AllArgsConstructor
public class SpringBeanTaskDemo {
	private final WmScorePackageStatusService wmScorePackageStatusService;
	private final WmScorePackageService wmScorePackageService;
	private final ZhuaquTest zhuaquTest;
	private final WmTaskTypeService wmTaskTypeService;
	private final WmTaskService wmTaskService;
	private final WmWkArticleService wmWkArticleService;
	private final WmStatisticsService wmStatisticsService;

//	/**
//	 * 测试Spring Bean的演示方法
//	 */
//	@SneakyThrows
//	public String demoMethod(String para) {
//		log.info("测试于:{}，输入参数{}", LocalDateTime.now(), para);
//		wmScorePackageStatusService.changePackageStatus();
//		return HnqzQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
//	}

	@SneakyThrows
	public String changePackageStatusTask(String para) {
		log.info("测试于:{}，输入参数{}", LocalDateTime.now(), para);
		wmScorePackageStatusService.changePackageStatus();
		return HnqzQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
	}


	@SneakyThrows
	public String getArtileTask(String para) {
		log.info("测试于:{}，输入参数{}", LocalDateTime.now(), para);
		zhuaquTest.init_main(para);
		return HnqzQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
	}

	@SneakyThrows
	public String changeTaskRule(String para) {
		log.info("测试于:{}，输入参数{}", LocalDateTime.now(), para);
		wmTaskTypeService.changeTaskTypeInfo();
		return HnqzQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
	}

	@SneakyThrows
	public String buildTaskImg(String para) {
		log.info("测试于:{}，输入参数{}", LocalDateTime.now(), para);
		wmTaskService.buildTaskImg(para);
		return HnqzQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
	}

	/**
	 * 每日GMVs统计
	 * @param para
	 * @return
	 */
	@SneakyThrows
	public String dailyGMVsStatistic(String para) {
		log.info("dailyGMVsStatistic开始于:{}，输入参数{}", LocalDateTime.now(), para);
		wmStatisticsService.dailyGMVsStatistics(para);
		return HnqzQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
	}

	@SneakyThrows
	public String setHotArtileTask(String para) {
		log.info("setHotArtileTask开始于:{}，输入参数{}", LocalDateTime.now(), para);
		wmWkArticleService.setHotArtileTask(para);
		return HnqzQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
	}




}
