package com.doumee.cloud.board; 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.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 { @ApiModelProperty private PlatformJobJoinMapper platformJobJoinMapper; @LoginNoRequired @ApiOperation("中心数据") @GetMapping("/centerData") public ApiResponse 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))); return ApiResponse.success(data); } @LoginNoRequired @ApiOperation("运输任务分析") @GetMapping("/transportMeasure") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "queryType", value = "查询类型:0=周;1=月;2=年;", required = true), }) public ApiResponse> transportMeasure(@RequestParam Integer queryType) { List list = new ArrayList<>(); Random random = new Random(); List 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.setPlanTimes(str); 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> platformJobList() { List list = platformJobJoinMapper.selectJoinList(PlatformJob.class, new MPJLambdaWrapper() .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 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> totalInList() { List 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> stockList() { List 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); } }