wlzboy
2026-03-31 61c4c3f45e4257e2e7662f033e2719e62366c632
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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<String, Object> 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<String, Object> config = new HashMap<>();
        
        // 功能开关配置
        Map<String, Object> 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);
    }
}