jiangping
2024-11-04 2b4ecab8cb9d048f0ef64e48ac3ff7da6a56d8c8
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
package com.doumee.cloud.board;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.doumee.api.BaseController;
import com.doumee.config.annotation.LoginNoRequired;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.utils.Constants;
import com.doumee.dao.business.PlatformLogMapper;
import com.doumee.dao.business.model.PlatformLog;
import com.doumee.dao.web.response.platformReport.*;
import com.doumee.service.business.third.BoardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
 
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2024/10/28 13:42
 */
 
@Api(tags = "场内调度看板")
@RestController
@Slf4j
@RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/board/api/onSitDispatch")
public class OnSitDispatchController extends BaseController {
 
    @Autowired
    private PlatformLogMapper platformLogMapper;
    @Autowired
    private BoardService boardService;
 
 
 
    @LoginNoRequired
    @ApiOperation("中心数据")
    @GetMapping("/centerData")
    public ApiResponse<OnSitDispatchBoardVO> centerData() {
        OnSitDispatchBoardVO data = boardService.getCnddCenterData();
        if(data == null){
            data = new OnSitDispatchBoardVO();
            data.setPlatformTotal(100);
            data.setFreePlatform(8);
            data.setReservationCar(97);
            data.setWorkingCar(56);
            data.setLineUpCar(35);
        }
        return ApiResponse.success(data);
    }
 
 
    @LoginNoRequired
    @ApiOperation("今日月台完成订单统计")
    @GetMapping("/platformGroupFinish")
    public ApiResponse<List<PlatformGroupFinishVO>> platformGroupFinish() {
        List<PlatformGroupFinishVO> platformGroupFinishVOList = new ArrayList<>();
        Random random = new Random();
        for (int i = 0; i < 3; i++) {
            PlatformGroupFinishVO platformGroupFinishVO = new PlatformGroupFinishVO();
            platformGroupFinishVO.setPlatformGroupName(i+"_月台组名称");
            platformGroupFinishVO.setPlatformId(i);
            platformGroupFinishVO.setFinishData(300+random.nextInt(100));
            platformGroupFinishVOList.add(platformGroupFinishVO);
        }
        return ApiResponse.success(platformGroupFinishVOList);
    }
 
 
    @LoginNoRequired
    @ApiOperation("今日月台工作时长趋势")
    @GetMapping("/platformDuration")
    public ApiResponse<List<PlatformDurationVO>> platformDuration() {
        List<PlatformDurationVO> platformDurationList = new ArrayList<>();
        Random random = new Random();
        for (int i = 0; i < 3; i++) {
            PlatformDurationVO platformDurationVO = new PlatformDurationVO();
            platformDurationVO.setPlatformName(i+"_月台名称");
            platformDurationVO.setPlatformId(i);
            platformDurationVO.setWorkTotalTime(100+random.nextInt(100));
            platformDurationVO.setOpenTotalTime(200+random.nextInt(100));
            platformDurationList.add(platformDurationVO);
        }
        return ApiResponse.success(platformDurationList);
    }
 
 
    @LoginNoRequired
    @ApiOperation("今日月台工作时长趋势")
    @GetMapping("/workEfficiency")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "查询类型:0=入库;1=出库", required = true),
    })
    public ApiResponse<List<WorkEfficiencyVO>> workEfficiency(@RequestParam Integer type) {
        List<WorkEfficiencyVO> workEfficiencyVOList = new ArrayList<>();
        Random random = new Random();
        Integer totalWorkNum = 0;
        for (int i = 8; i <= 20; i++) {
            if(i%2==0){
                WorkEfficiencyVO workEfficiencyVO = new WorkEfficiencyVO();
                workEfficiencyVO.setWorkNum(200+random.nextInt(100));
                totalWorkNum = totalWorkNum + workEfficiencyVO.getWorkNum();
                workEfficiencyVO.setTotalWorkNum(totalWorkNum);
                workEfficiencyVO.setWorkTime(StringUtils.leftPad(i+"",2,"0") +":00");
                workEfficiencyVOList.add(workEfficiencyVO);
            }
        }
        return ApiResponse.success(workEfficiencyVOList);
    }
 
 
    @LoginNoRequired
    @ApiOperation("今日车辆作业情况")
    @GetMapping("/carWorkSituation")
    public ApiResponse<CarWorkSituationVO> carWorkSituation() {
 
        Random random = new Random();
        CarWorkSituationVO carWorkSituationVO = new CarWorkSituationVO();
        carWorkSituationVO.setCallNum(200+random.nextInt(100));
        carWorkSituationVO.setFinishNum(100+random.nextInt(100));
        carWorkSituationVO.setCallNum(100+random.nextInt(100));
        carWorkSituationVO.setWorkingNum(100+random.nextInt(100));
        carWorkSituationVO.setFinishNum(100+random.nextInt(100));
        carWorkSituationVO.setInNum(100+random.nextInt(100));
        List<PlatformLog> platformLogList = platformLogMapper.selectList(new QueryWrapper<PlatformLog>().lambda()
                .orderByDesc(PlatformLog::getCreateDate)
                .last(" limit 7 ")
        );
        carWorkSituationVO.setPlatformLogList(platformLogList);
        return ApiResponse.success(carWorkSituationVO);
    }
 
 
 
    @LoginNoRequired
    @ApiOperation("实时月台作业信息")
    @GetMapping("/platformWorkData")
    public ApiResponse<List<PlatformWorkDataVO>> platformWorkData() {
        List<PlatformWorkDataVO> platformWorkDataVOList = new ArrayList<>();
        Random random = new Random();
        for (int i = 0; i < 3; i++) {
            PlatformWorkDataVO platformDurationVO = new PlatformWorkDataVO();
            platformDurationVO.setPlatformName(i+"_月台名称");
            platformDurationVO.setCarNo("皖A8" + random.nextInt(9) + random.nextInt(9) + random.nextInt(9) + random.nextInt(9));
            platformDurationVO.setWorkType(random.nextInt(1));
            platformDurationVO.setWorkNum(100+random.nextInt(100));
            platformDurationVO.setFinishTime(Long.valueOf(System.currentTimeMillis()/1000 + 200+random.nextInt(100)));
            platformDurationVO.setStatus(random.nextInt(2));
            platformWorkDataVOList.add(platformDurationVO);
        }
        return ApiResponse.success(platformWorkDataVOList);
    }
 
 
 
 
 
 
 
}