#
vincent
2020-06-02 03ac47becf21a56071fd97bc9f7599eef2ca90da
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
package com.zy.client.controller;
 
import com.core.annotations.ManagerAuth;
import com.core.common.R;
import com.zy.client.domain.PlcErrorTable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
 
/**
 * 输送设备接口
 * Created by vincent on 2020-06-01
 */
@RestController
@RequestMapping("/site")
public class SiteController {
 
    @PostMapping("/table/site")
    @ManagerAuth(memo = "站点信息表")
    public R siteTable(){
 
 
 
        return R.ok();
    }
 
    @PostMapping("/table/plc/errors")
    @ManagerAuth(memo = "输送设备plc异常信息表")
    public R plcErrorTable(){
        List<PlcErrorTable> list = new ArrayList<>();
        for (int i = 0; i<new Random().nextInt(13); i++){
            PlcErrorTable table = new PlcErrorTable();
            table.setNo(String.valueOf(i));
            table.setError("异常信息");
            table.setPlcDesc("plc异常描述");
            list.add(table);
        }
        list.sort((o1, o2) -> {
            if (o1.getNo().compareTo(o2.getNo()) > 0){
                return 1;
            }else if (o1.getNo().compareTo(o2.getNo()) < 0){
                return 0;
            }else{
                return -1;
            }
 
        });
        return R.ok().add(list);
    }
 
}