package com.ruoyi.web.controller.system;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.system.domain.SysImplementationProgress;
import com.ruoyi.system.service.ISysImplementationProgressService;

/**
 * 项目实施进展Controller
 * 
 * @author ruoyi
 * @date 2026-02-26
 */
@Controller
@RequestMapping("/system/implementationProgress")
public class SysImplementationProgressController extends BaseController
{
    private String prefix = "system/implementationProgress";

    @Autowired
    private ISysImplementationProgressService sysImplementationProgressService;

    /**
     * 进入项目实施进展页面
     */
    @GetMapping
    public String implementationProgress(ModelMap mmap)
    {
        // 获取项目实施进展信息
        SysImplementationProgress implementationProgress = sysImplementationProgressService.selectSysImplementationProgress();
        mmap.put("implementationProgress", implementationProgress);
        return prefix + "/implementationProgress";
    }

    /**
     * 获取项目实施进展信息（JSON格式）
     */
    @Anonymous
    @GetMapping("/get")
    @ResponseBody
    public AjaxResult getImplementationProgressInfo()
    {
        // 获取项目实施进展信息
        SysImplementationProgress implementationProgress = sysImplementationProgressService.selectSysImplementationProgress();
        return AjaxResult.success(implementationProgress);
    }

    /**
     * 保存项目实施进展信息
     */
    @PreAuthorize("@ss.hasPermi('system:implementationProgress:edit')")
    @PostMapping("/save")
    @ResponseBody
    public AjaxResult save(@RequestBody SysImplementationProgress implementationProgress)
    {
        implementationProgress.setUpdateBy(getUsername());
        implementationProgress.setUpdateTime(new java.util.Date());
        return toAjax(sysImplementationProgressService.saveSysImplementationProgress(implementationProgress));
    }
}