package com.ruoyi.web.controller.app; import java.util.HashMap; import java.util.Map; 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.RestController; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.system.service.ISysConfigService; /** * APP配置控制器 * * @author ruoyi */ @RestController @RequestMapping("/app/config") public class AppConfigController extends BaseController { @Autowired private ISysConfigService configService; /** * 获取APP功能开关配置 * 不需要权限校验,所有登录用户都可以访问 */ @GetMapping("/features") public AjaxResult getFeatures() { Map features = new HashMap<>(); // 读取就绪按钮配置 String showAssigneeReadyButton = configService.selectConfigByKey("app.feature.showAssigneeReadyButton"); features.put("showAssigneeReadyButton", "true".equalsIgnoreCase(showAssigneeReadyButton)); // 读取强制完成按钮配置 String showForceCompleteButton = configService.selectConfigByKey("app.feature.showForceCompleteButton"); features.put("showForceCompleteButton", "true".equalsIgnoreCase(showForceCompleteButton)); return success(features); } /** * 获取完整的APP配置 * 包括baseUrl、appInfo、features等 */ @GetMapping("/all") public AjaxResult getAllConfig() { Map config = new HashMap<>(); // 功能开关配置 Map features = new HashMap<>(); String showAssigneeReadyButton = configService.selectConfigByKey("app.feature.showAssigneeReadyButton"); features.put("showAssigneeReadyButton", "true".equalsIgnoreCase(showAssigneeReadyButton)); String showForceCompleteButton = configService.selectConfigByKey("app.feature.showForceCompleteButton"); features.put("showForceCompleteButton", "true".equalsIgnoreCase(showForceCompleteButton)); config.put("features", features); return success(config); } }