package cn.cecep.talroad.controller;

import cn.cecep.talroad.common.core.utils.DateUtils;
import cn.cecep.talroad.common.core.web.domain.AjaxResults;
import cn.cecep.talroad.common.log.annotation.Log;
import cn.cecep.talroad.common.log.enums.BusinessType;
import cn.cecep.talroad.service.EnvironmentalCodingService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @className: ElectricityMeterController
 * @description: 唐山市企业环保码赋码体系及规则定时任务
 * @author: Mr.Yanghongtao
 * @date: 2023/03/30 5:21 PM
 * @Company: Copyright© [2023/03/30 5:21 PM] by [Mr.Yanghongtao]
 **/
@RestController
@RequestMapping("environmentalCodingController")
@Slf4j
public class EnvironmentalCodingController {
    @Autowired
    EnvironmentalCodingService electricityMeterServiceImpl;

    /**
     * @Author: Mr.Yanghongtao
     * @data: 2023/4/2 6:32 PM
     * @Deseription: 每日执行一次，计算企业评分
     * @Params: dateTime  yyyy-MM-dd
     * @Return: cn.cecep.talroad.common.core.web.domain.AjaxResults
     * @Throws:
     */
    @ApiOperation(value = "每日执行一次，计算企业评分")
    @GetMapping("/scanYesterdayDeductionPoints")
    @Log(title = "计算企业评分-每日一次", businessType = BusinessType.UPDATE)
    public AjaxResults scanYesterdayDeductionPoints(@RequestParam(name = "dateTime",required = false) String dateTime) {
        try {
            electricityMeterServiceImpl.scanYesterdayDeductionPoints(dateTime);
        } catch (Exception e) {
            log.error("计算企业评分-每日一次执行失败,异常日志：{}",e);
        }
        return AjaxResults.success();
    }

}
