jiangping
2024-11-18 422b8f74f9a602484cce319e302bf9baf127087d
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
173
174
175
176
177
178
179
180
181
182
183
184
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.annotation.excel.ExcelColumn;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.DateUtil;
import com.doumee.dao.business.PlatformJobMapper;
import com.doumee.dao.business.join.PlatformJobJoinMapper;
import com.doumee.dao.business.model.Platform;
import com.doumee.dao.business.model.PlatformBooks;
import com.doumee.dao.business.model.PlatformJob;
import com.doumee.dao.business.model.PlatformWmsJob;
import com.doumee.dao.web.response.platformReport.*;
import com.doumee.service.business.PlatformJobService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
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.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
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/platformJobRun")
public class PlatformJobRunController extends BaseController {
 
    @Autowired
    private PlatformJobJoinMapper platformJobJoinMapper;
 
    @LoginNoRequired
    @ApiOperation("中心数据")
    @GetMapping("/centerData")
    public ApiResponse<PlatformJobRunBoardVO> centerData() {
        PlatformJobRunBoardVO data = new PlatformJobRunBoardVO();
        Random random = new Random();
        data.setMonthOutTotal(BigDecimal.valueOf(random.nextInt(100)).multiply(new BigDecimal(10000)));
        data.setMonthOutTotalOnYear(BigDecimal.valueOf(random.nextInt(10)));
        data.setMonthOutTimes(random.nextInt(1000));
        data.setYearOutTotal(data.getMonthOutTotal().multiply(new BigDecimal(11)));
        data.setYearOutTotalOnYear(BigDecimal.valueOf(random.nextInt(10)));
        data.setYearOutTimes(random.nextInt(1000) * 11);
 
        data.setTodayInRata(new BigDecimal(random.nextInt(100)));
        data.setMonthInRata(data.getTodayInRata().multiply(new BigDecimal(30)));
 
        data.setTodayOutRata(new BigDecimal(random.nextInt(100)));
        data.setMonthOutRata(data.getTodayOutRata().multiply(new BigDecimal(30)));
 
        data.setStockMax(new BigDecimal(random.nextInt(1000)));
        data.setStockTotal(new BigDecimal(data.getStockMax().intValue()));
        return ApiResponse.success(data);
    }
 
 
    @LoginNoRequired
    @ApiOperation("运输任务分析")
    @GetMapping("/transportMeasure")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "queryType", value = "查询类型:0=周;1=月;2=年;", required = true),
    })
    public ApiResponse<List<TransportMeasureVO>> transportMeasure(@RequestParam Integer queryType) {
        List<TransportMeasureVO> list = new ArrayList<>();
        Random random = new Random();
        List<String> dayList = DateUtil.getBeforDays(new Date(),7);
        if(Constants.equalsInteger(queryType,Constants.ONE)){
            dayList = DateUtil.getBeforDays(new Date(),30);
        }else if(Constants.equalsInteger(queryType,Constants.TWO)){
            dayList = DateUtil.getBeforMonth(new Date(),12);
        }
        for (String str:dayList) {
            TransportMeasureVO data = new TransportMeasureVO();
            data.setPlanDate(str);
            data.setPlanTimes(random.nextInt(200));
            data.setPlanTaskNum(new BigDecimal(random.nextInt(1000)));
            data.setFinishTaskNum(new BigDecimal(data.getPlanTaskNum().intValue()));
            list.add(data);
        }
        return ApiResponse.success(list);
    }
 
 
 
 
 
    @LoginNoRequired
    @ApiOperation("当日运输任务")
    @GetMapping("/platformJobList")
    public ApiResponse<List<PlatformJob>> platformJobList() {
        List<PlatformJob> list =  platformJobJoinMapper.selectJoinList(PlatformJob.class,
                new MPJLambdaWrapper<PlatformJob>()
                        .selectAll(PlatformJob.class)
                        .selectAs(PlatformBooks::getId,PlatformJob::getBookId)
                        .selectAs(Platform::getName,PlatformJob::getPlatformName)
                        .selectAs(Platform::getWorkRate,PlatformJob::getWorkRate)
                        .selectAs(PlatformWmsJob::getCarrierName,PlatformJob::getCarrierName)
                        .selectAs(PlatformWmsJob::getRepertotyAddress,PlatformJob::getRepertotyAddress)
                        .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
                        .leftJoin(PlatformWmsJob.class,PlatformWmsJob::getCarryBillCode,PlatformJob::getBillCode)
                        .leftJoin(PlatformBooks.class,PlatformBooks::getJobId,PlatformJob::getId)
                        .eq(PlatformJob::getIsdeleted,Constants.ZERO)
                        .in(PlatformJob::getStatus
                                ,Constants.PlatformJobStatus.WAIT_CALL.getKey()
                                ,Constants.PlatformJobStatus.CALLED.getKey()
                                ,Constants.PlatformJobStatus.IN_WAIT.getKey()
                                ,Constants.PlatformJobStatus.WORKING.getKey()
                                ,Constants.PlatformJobStatus.TRANSFERING.getKey()
                                ,Constants.PlatformJobStatus.EXCEPTION.getKey()
                                ,Constants.PlatformJobStatus.DONE.getKey()
                        )
                        .orderByDesc(PlatformJob::getSignNum)
                        .last(" limit 20 ")
        );
        return ApiResponse.success(list);
    }
 
 
 
    @LoginNoRequired
    @ApiOperation("出入库任务量")
    @GetMapping("/jobData")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "queryType", value = "查询类型:0=出库;1=入库;", required = true),
    })
    public ApiResponse<JobDataVO> jobData(@RequestParam Integer queryType) {
        Random random = new Random();
        JobDataVO jobDataVO = new JobDataVO();
        jobDataVO.setPlanTaskNum(BigDecimal.valueOf(random.nextInt(1000)));
        jobDataVO.setFinishTaskNum(BigDecimal.valueOf(jobDataVO.getPlanTaskNum().intValue()));
        return ApiResponse.success(jobDataVO);
    }
 
    @LoginNoRequired
    @ApiOperation("今日入库量统计")
    @GetMapping("/totalInList")
    public ApiResponse<List<GeneralVO>> totalInList() {
        List<GeneralVO> list = new ArrayList<>();
        for (int i = 1; i < 4; i++) {
            Random random = new Random();
            GeneralVO data = new GeneralVO();
            data.setName("厂区名称_"+i);
            data.setNum(BigDecimal.valueOf(random.nextInt(1000)));
            list.add(data);
        }
        return ApiResponse.success(list);
    }
 
 
 
    @LoginNoRequired
    @ApiOperation("库存情况")
    @GetMapping("/stockList")
    public ApiResponse<List<GeneralVO>> stockList() {
        List<GeneralVO> list = new ArrayList<>();
        for (int i = 1; i < 10; i++) {
            Random random = new Random();
            GeneralVO data = new GeneralVO();
            data.setName("名称"+i);
            data.setNum(BigDecimal.valueOf(random.nextInt(1000)));
            list.add(data);
        }
        return ApiResponse.success(list);
    }
 
 
}