package com.rongwei.savecheck.controller;


import com.rongwei.rwcommon.base.R;
import com.rongwei.rwcommon.utils.StringUtils;
import com.rongwei.sfcommon.sys.service.AspSafetyProductObjectiveService;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 安全生产目标
 *
 * @author sc
 * @date 2023-12-07
 */
@RestController
@RequestMapping("aspSafetyProductObjective")
@Slf4j
public class AspSafetyProductObjectiveController {
    @Autowired
    private AspSafetyProductObjectiveService aspSafetyProductObjectiveService;

    /**
     * 安全生产目标定时任务（按季度生成指标的考核结果模板）
     * @return
     */
    @PostMapping("/safetyResult")
    public R safetyResult (){
        try{
            aspSafetyProductObjectiveService.safetyResult();
            return R.ok();
        }catch (Exception e){
            e.printStackTrace();
            log.error(StringUtils.spliceErrorMsg(e), e.fillInStackTrace());
            return R.error();
        }
    }

}
