jinlin
2024-01-23 52a302b11c08cbc564ff3931038ae57a305a95d6
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
/**
 * Copyright (c) 2018 人人开源 All rights reserved.
 * <p>
 * https://www.renren.io
 * <p>
 * 版权所有,侵权必究!
 */
 
package com.zt.modules.sys.controller;
 
import com.alibaba.fastjson.JSONObject;
import com.zt.common.annotation.LogOperation;
import com.zt.common.servlet.Result;
import com.zt.common.utils.CacheUtils;
import com.zt.modules.sys.service.SysParamsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
/**
 * 参数管理
 *
 * @author hehz
 * @since 1.0.0
 */
@RestController
@RequestMapping("sys/common")
@Api(tags = "参数管理")
public class SysCommonController {
    @Autowired
    private SysParamsService sysParamsService;
 
    @GetMapping("stroke")
    @ApiOperation("获取操作进度")
    @LogOperation("获取操作进度")
    public Result<JSONObject> getStroke(String progressId) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("speed", "0");
        try {
            if (CacheUtils.get(progressId, "speed") != null) {
                jsonObject.put("speed", CacheUtils.get(progressId, "speed").toString());
                jsonObject.put("text", CacheUtils.get(progressId, "msg").toString());
                return Result.ok(jsonObject);
            } else {
                return Result.ok(jsonObject);
            }
        } catch (Exception e) {
            return Result.ok(jsonObject);
        }
    }
 
    @GetMapping("heartBeat")
    @ApiOperation("获取操作进度")
    @LogOperation("获取操作进度")
    public Result heartBeat() {
        return Result.ok();
    }
}