刘帅
2026-09-29 8a89ba02db5c19db669a5cf9bb7d443223bdfb71
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TStoredValueConfigController.java
@@ -26,39 +26,40 @@
@Controller
@RequestMapping("/storeValueConfig")
public class TStoredValueConfigController {
    private String PREFIX = "/system/storeValueConfig/";
    @Autowired
    private StoreValueConfigClient storeValueConfigClient;
    /**
     * 跳转储值管理页面
    /*
     * 储值管理功能已下线,保留原实现以便后续恢复。
     *
     * @RequestMapping("")
     * public String index(Model model) {
     *     StoredValueConfig storeValueConfig = storeValueConfigClient.getStoreValueConfig();
     *     model.addAttribute("description", storeValueConfig.getDescription());
     *     JSONObject jsonObject = new JSONObject(storeValueConfig.getContent());
     *     JSONArray timeRulesArray = jsonObject.getJSONArray("time_rules");
     *     model.addAttribute("content", jsonObject.toString());
     *     if (timeRulesArray.length() > 0) {
     *         JSONObject timeRule = timeRulesArray.getJSONObject(0);
     *         model.addAttribute("time", timeRule.getString("startTime") + " - " + timeRule.getString("endTime"));
     *     } else {
     *         model.addAttribute("time", "");
     *     }
     *     return PREFIX + "StoreValueConfig.html";
     * }
     *
     * @ResponseBody
     * @RequestMapping(value = "/addStoreValueConfig")
     * public ResultUtil addStoreValueConfig(@RequestBody StoredValueConfig storedValueConfig) {
     *     storeValueConfigClient.addStoreValueConfig(storedValueConfig);
     *     return ResultUtil.success();
     * }
     */
    @RequestMapping("")
    public String index(Model model) {
        StoredValueConfig storeValueConfig = storeValueConfigClient.getStoreValueConfig();
        model.addAttribute("description",storeValueConfig.getDescription());
        // 解析json串 获取时间
        JSONObject jsonObject = new JSONObject(storeValueConfig.getContent());
        JSONArray timeRulesArray = jsonObject.getJSONArray("time_rules");
        model.addAttribute("content",jsonObject.toString());
        if (timeRulesArray.length() > 0) {
            JSONObject timeRule = timeRulesArray.getJSONObject(0);
            String startTime = timeRule.getString("startTime");
            String endTime = timeRule.getString("endTime");
            model.addAttribute("time",startTime+" - " + endTime);
            System.out.println("StartTime: " + startTime);
            System.out.println("EndTime: " + endTime);
        }
        return PREFIX + "StoreValueConfig.html";
    }
    /**
     *  添加储值规则
     */
    /** 储值管理功能已下线,避免通过历史菜单或直接 URL 继续访问。 */
    @ResponseBody
    @RequestMapping(value = "/addStoreValueConfig")
    public ResultUtil addStoreValueConfig(@RequestBody StoredValueConfig storedValueConfig) {
        storeValueConfigClient.addStoreValueConfig(storedValueConfig);
        return  ResultUtil.success();
    @RequestMapping({"", "/addStoreValueConfig"})
    public ResultUtil storeValueConfigUnavailable() {
        return ResultUtil.error("储值管理功能暂不提供");
    }
}