liukangdong
2024-12-06 1a3a322d6f55d0f812001984d41010524cda69e0
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/board/PlatformJobRunActController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,150 @@
package com.doumee.cloud.board;
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.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.reqeust.CarsJobAndContractDTO;
import com.doumee.dao.web.response.platformReport.*;
import com.doumee.service.business.third.BoardService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
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/platformJobRunAct")
public class PlatformJobRunActController extends BaseController {
    @Autowired
    private PlatformJobJoinMapper platformJobJoinMapper;
    @Autowired
    private BoardService boardService;
    @LoginNoRequired
    @ApiOperation("查询本月、本年的累计出库量,出入库任务量、出入库作业效率统计数据")
    @GetMapping("/centerData")
    public ApiResponse<PlatformJobRunBoardNewVO> centerData() {
        PlatformJobRunBoardNewVO data = boardService.platformJobCenterData();
        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 = boardService.transportMeasure(queryType);
        return ApiResponse.success(list);
    }
    @LoginNoRequired
    @ApiOperation("汽车状态、经纬度集合数据")
    @GetMapping("/carsList")
    public ApiResponse<BoardCarsListVO> carsList() {
        BoardCarsListVO data = boardService.platformJobCarsList();
        return ApiResponse.success(data);
    }
    @LoginNoRequired
    @ApiOperation("根据车牌号查询作业信息和合同信息集合")
    @PostMapping("/getCarsJobDetails")
    public ApiResponse<CarsJobAndContractVO> getCarsJobDetails(@RequestBody CarsJobAndContractDTO param) {
        CarsJobAndContractVO data = boardService.getCarsJobDetails(param);
        return ApiResponse.success(data);
    }
    @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< BoardStockListVO > stockList() {
         BoardStockListVO list =  boardService.stockList();
        return ApiResponse.success(list);
    }
}