package org.jeecg.modules.performance;

import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.performance.service.ISalePerformanceDetailService;
import org.jeecg.modules.performance.service.ICalculatePerformanceService;
import org.jeecg.modules.performance.service.IDesignDetailService;
import org.jeecg.modules.performance.service.IOperateDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class testCtrl {

    @Autowired
    IOperateDetailService operateDetailService;

    @Autowired
    IDesignDetailService designDetailService;

    @Autowired
    ISalePerformanceDetailService  salePerformanceDetailService;

    @Autowired
    ICalculatePerformanceService  calculatePerformanceService;

    @GetMapping("/job/test/operator")
    public String testOperator(){

        Date nowDate= new Date();
        String startStatDate = DateUtils.getQuarterStartDate(nowDate);
        String endStatDate = DateUtils.getQuarterEndDate(nowDate);

        //计算运营消耗
        /*operateDetailService.KsCostCalculateByAccount(startStatDate,endStatDate);
        operateDetailService.(startStatDate,endStatDate);*/
        //计算运营绩效
        //calculatePerformanceService.CalculateOperatePerformance(2020,"Q2",2);
        //计算设计消耗
        //designDetailService.UserCostCalculateByMaterial(startStatDate,endStatDate,1);
        //计算设计绩效
        calculatePerformanceService.CalculateDesignPerformance(2020,"Q2",2);
        //计算销售消耗
        //salePerformanceDetailService.loadSalesPerformance(startStatDate,endStatDate);
        //计算销售绩效
        //calculatePerformanceService.CalculateSalePerformance(2020,"Q2",2);
        return "success";
    }

}
