大屏对外接口

This commit is contained in:
liuhanqing
2025-06-12 08:58:54 +08:00
parent 51eeb3ee28
commit cbc4889fdb
5 changed files with 69 additions and 10 deletions

View File

@@ -22,7 +22,7 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/api")
public class JobStatisticsController {
@Autowired
private IJobStatisticsService jobStatisticsService;
@Autowired
@@ -59,4 +59,10 @@ public class JobStatisticsController {
return AjaxResult.success(result);
}
}
@GetMapping("/device/info")
public AjaxResult getDeviceInfo() {
// 获取设备信息
return jobStatisticsService.getDeviceInfo();
}
}

View File

@@ -0,0 +1,32 @@
package com.ruoyi.api.controller;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.job.mydojob.domain.MydoJob;
import com.ruoyi.job.mydojob.service.IMydoJobService;
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.RestController;
import java.util.List;
/**
* 作业统计 Controller
*/
@RestController
@RequestMapping("/api2wcs")
public class ToWcsApiController {
@Autowired
private IMydoJobService mydoJobService;
/**
* 获取任务
*/
@GetMapping("/getJob")
public AjaxResult getJob(MydoJob mydoJob)
{
return AjaxResult.success(mydoJobService.selectMydoJobList(mydoJob));
}
}

View File

@@ -7,14 +7,16 @@ import java.util.Map;
* 作业统计 Service 接口
*/
public interface IJobStatisticsService {
/**
* 获取统计数据,包含:
* 1. 当日入库和出库数量统计
* 2. 货位状态统计
* 3. 当前任务列表
*
*
* @return 统计结果
*/
public Map<String, Object> getDailyStatistics();
}
AjaxResult getDeviceInfo();
}

View File

@@ -4,7 +4,12 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.api.service.IJobStatisticsService;
@@ -27,6 +32,8 @@ public class JobStatisticsServiceImpl implements IJobStatisticsService {
@Autowired
private MydoJobMapper mydoJobMapper;
@Value("${api.wcs.device.url}")
private String deviceUrl;
/**
* 获取当日入库和出库数量统计
@@ -35,13 +42,13 @@ public class JobStatisticsServiceImpl implements IJobStatisticsService {
public Map<String, Object> getDailyStatistics() {
// 获取当前日期
String today = DateUtils.getDate();
// 查询当日入库数量
int inCount = jobStatisticsMapper.selectDailyInCount(today);
// 查询当日出库数量
int outCount = jobStatisticsMapper.selectDailyOutCount(today);
// 获取货位状态统计
List<Map<String, Object>> statusCounts = basCargoSpaceMapper.selectStatusCount();
List<Map<String, Object>> cargoSpaceStatus = new ArrayList<>();
@@ -73,7 +80,7 @@ public class JobStatisticsServiceImpl implements IJobStatisticsService {
// 获取当前年月
int year = Integer.parseInt(DateUtils.dateTimeNow("yyyy"));
int month = Integer.parseInt(DateUtils.dateTimeNow("MM"));
// 获取当月每日统计数据
List<Map<String, Object>> dailyStats = jobStatisticsMapper.selectMonthlyStatistics(year, month);
@@ -87,5 +94,12 @@ public class JobStatisticsServiceImpl implements IJobStatisticsService {
return result;
}
@Override
public AjaxResult getDeviceInfo() {
}
String s = HttpUtil.get(deviceUrl);
return JSONUtil.toBean(s, AjaxResult.class);
}
}

View File

@@ -127,3 +127,8 @@ xss:
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
#搭配对外接口
api:
wcs:
device:
url: http://192.168.1.1:8080/api/device