package com.crm.manager.controller;

import com.crm.manager.service.SelesRewardWorthStatisticsService;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Log4j
@RestController
@RequestMapping("/sales/worth/statistic")
public class SelesRewardWorthStatisticsController {
    @Autowired
    private SelesRewardWorthStatisticsService service;

    @Transactional(rollbackFor = Exception.class)
    @Scheduled(cron = "0 0 1 * * ?")
    //@Scheduled(cron = "0 32 16 * *  ?")
    public void salesDepositStatisticsTask() throws Exception {
        try {
            log.info("销售净出入金任务开始 ---------------");
            service.salesDepositStatisticsTask();
            log.info("销售净出入金任务结束 ---------------");
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            throw e;
        }

    }

}
