1
3 天以前 70ecc717c746eef0c4503a19031ada582f5e94d1
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
package com.vincent.rsf.openApi.controller;
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.openApi.entity.dto.CommonResponse;
import com.vincent.rsf.openApi.entity.phyz.Task;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
import java.util.Objects;
 
import static com.vincent.rsf.openApi.controller.AuthController.SIMULATED_DATA_ENABLE;
import static com.vincent.rsf.openApi.controller.phyz.ERPController.paramsFormat;
 
@RestController
@Api("任务管理接口")
@Slf4j
public class TaskController {
 
    @ApiOperation("点对点创建AGV搬运任务")
    @PostMapping("/agv/transTask/add")
    public CommonResponse addAgvTask(@RequestBody Object objParams) {
        if (Objects.isNull(objParams)) {
            throw new CoolException("参数不能为空!!");
        }
        // 返回模拟数据
        if (SIMULATED_DATA_ENABLE.equals("1")) {
            return CommonResponse.ok();
        }
 
        JSONArray params = paramsFormat(objParams);
        List<Task> tasks = JSON.parseArray(params.toJSONString(), Task.class);
        // 数据处理,转发server
        return CommonResponse.ok();
    }
 
    @ApiOperation("点对点取消AGV搬运任务")
    @PostMapping("/agv/transTask/cancel")
    public CommonResponse cancelAgvTask(@RequestBody Object objParams) {
        if (Objects.isNull(objParams)) {
            throw new CoolException("参数不能为空!!");
        }
        // 返回模拟数据
        if (SIMULATED_DATA_ENABLE.equals("1")) {
            return CommonResponse.ok();
        }
 
        JSONArray params = paramsFormat(objParams);
        List<Task> tasks = JSON.parseArray(params.toJSONString(), Task.class);
        // 数据处理,转发server
        return CommonResponse.ok();
    }
}