add:增加AGV看板
This commit is contained in:
@@ -13,8 +13,10 @@
|
||||
package org.nl.agv.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.agv.service.AgvCarService;
|
||||
import org.nl.agv.service.entity.AgvCar;
|
||||
import org.nl.agv.service.query.AgvCarQuery;
|
||||
@@ -23,9 +25,7 @@ import org.nl.common.pojo.CommonResult;
|
||||
import org.nl.agv.service.dto.AgvStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -43,19 +43,42 @@ public class AgvCarController {
|
||||
private AgvCarService agvCarService;
|
||||
|
||||
@GetMapping("status")
|
||||
public CommonResult<List> status() {
|
||||
public CommonResult<List> status(String carId) {
|
||||
List<AgvStatus> list = new ArrayList<>();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (StringUtils.isNotEmpty(carId)){
|
||||
AgvCar car = agvCarService.getOne(new LambdaQueryWrapper<AgvCar>().eq(AgvCar::getCarId, carId));
|
||||
AgvStatus build = AgvStatus.builder().status(2)
|
||||
.carId(String.valueOf(i + 1))
|
||||
.statusInfo("运行中").type("1")
|
||||
.carId(car.getCarId())
|
||||
.icon(car.getIcon())
|
||||
.type(car.getType())
|
||||
.statusInfo("运行中")
|
||||
.action("请求取货")
|
||||
.icon("/Users/mima0000/Desktop/car.png")
|
||||
.actionInfo("申请取货")
|
||||
.x(String.valueOf(new Random().nextInt(1189) + 100))
|
||||
.y(String.valueOf(new Random().nextInt(889) + 100)).power("67")
|
||||
.angle("180").build();
|
||||
.actionInfo("申请取货中")
|
||||
.status(2)
|
||||
.statusInfo("运行中")
|
||||
.taskCode("33876")
|
||||
.x(new Random().nextInt(1189) + 100)
|
||||
.y(new Random().nextInt(1189) + 100)
|
||||
.power(66)
|
||||
.angle(new Random().nextInt(160) + 10).build();
|
||||
list.add(build);
|
||||
}else {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
AgvStatus build = AgvStatus.builder().status(2)
|
||||
.carId(String.valueOf(i + 1))
|
||||
.statusInfo("运行中").type("1")
|
||||
.action("请求取货")
|
||||
.actionInfo("申请取货中")
|
||||
.status(2)
|
||||
.statusInfo("运行中")
|
||||
.taskCode("33876")
|
||||
.icon("/Users/mima0000/Desktop/car.png")
|
||||
.x(new Random().nextInt(1189) + 100)
|
||||
.y(new Random().nextInt(1189) + 100)
|
||||
.power(66)
|
||||
.angle(new Random().nextInt(160) + 10).build();
|
||||
list.add(build);
|
||||
}
|
||||
}
|
||||
return CommonResult.data(list);
|
||||
}
|
||||
@@ -73,8 +96,8 @@ public class AgvCarController {
|
||||
* agv列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("save")
|
||||
public CommonResult save(AgvCar car) {
|
||||
@PostMapping("save")
|
||||
public CommonResult save(@RequestBody AgvCar car) {
|
||||
agvCarService.save(car);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
@@ -83,7 +106,7 @@ public class AgvCarController {
|
||||
* 车俩基础信息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("agvCar")
|
||||
@GetMapping("detail")
|
||||
public CommonResult<AgvCar> agvCar(String carId) {
|
||||
AgvCar car = agvCarService.getOne(new LambdaQueryWrapper<AgvCar>().eq(AgvCar::getCarId, carId));
|
||||
return CommonResult.data(car);
|
||||
|
||||
@@ -22,10 +22,7 @@ public class AgvStatus {
|
||||
* 图标地址
|
||||
*/
|
||||
private String icon="/Users/mima0000/Desktop/car.png";
|
||||
/**
|
||||
* 电量
|
||||
*/
|
||||
private String power;
|
||||
|
||||
/**
|
||||
* AGV状态未知
|
||||
* 待机中
|
||||
@@ -57,13 +54,17 @@ public class AgvStatus {
|
||||
/**
|
||||
* 坐标X
|
||||
*/
|
||||
private String x;
|
||||
private Integer x;
|
||||
/**
|
||||
* 坐标Y
|
||||
*/
|
||||
private String y;
|
||||
private Integer y;
|
||||
/**
|
||||
* 航向角
|
||||
*/
|
||||
private String angle;
|
||||
private Integer angle;
|
||||
/**
|
||||
* 电量
|
||||
*/
|
||||
private Integer power;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class AgvCar implements Serializable {
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 车辆图片
|
||||
* 车辆图片ID
|
||||
*/
|
||||
private String icon;
|
||||
}
|
||||
|
||||
@@ -5,4 +5,8 @@ import org.nl.common.page.BaseQuery;
|
||||
import org.nl.layout.service.entity.AgvLayoutMap;
|
||||
|
||||
public class AgvCarQuery extends BaseQuery<AgvCar> {
|
||||
@Override
|
||||
protected Class<AgvCar> getEntityClass() {
|
||||
return AgvCar.class;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,22 +47,6 @@ public class AgvLayoutController {
|
||||
@Autowired
|
||||
private AgvLayoutService agvLayoutService;
|
||||
|
||||
@GetMapping("status")
|
||||
public CommonResult<List> status() {
|
||||
List<AgvStatus> list = new ArrayList<>();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
AgvStatus build = AgvStatus.builder().status(2)
|
||||
.carId(String.valueOf(i + 1))
|
||||
.statusInfo("运行中").type("1")
|
||||
.action("请求取货")
|
||||
.actionInfo("申请取货")
|
||||
.x(String.valueOf(new Random().nextInt(1189) + 100))
|
||||
.y(String.valueOf(new Random().nextInt(889) + 100)).power("67")
|
||||
.angle("180").build();
|
||||
list.add(build);
|
||||
}
|
||||
return CommonResult.data(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图列表
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.nl.layout.service.entity.AgvLayoutMap;
|
||||
@Mapper
|
||||
public interface AgvLayoutMapMapper extends BaseMapper<AgvLayoutMap> {
|
||||
|
||||
@Insert("INSERT INTO agv_layout_map (mapId, url, height, width, x, y) VALUES (#{mapId}, #{url}, #{height}, #{width}, #{x}, #{y})")
|
||||
@Insert("INSERT INTO agv_layout_map (map_id,map_name, url, height, width, x, y) VALUES (#{mapId},#{mapName}, #{url}, #{height}, #{width}, #{x}, #{y})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||
void insertUseGeneratedKeys(AgvLayoutMap map);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
<resultMap id="mapLayoutResultMap" type="org.nl.layout.service.dto.MapLayout">
|
||||
<result property="mapId" column="mapId"/>
|
||||
<result property="mapId" column="map_id"/>
|
||||
<result property="width" column="width"/>
|
||||
<result property="height" column="height"/>
|
||||
<result property="url" column="url"/>
|
||||
@@ -28,7 +28,7 @@
|
||||
</resultMap>
|
||||
<select id="initLayoutMap" resultMap="mapLayoutResultMap">
|
||||
SELECT
|
||||
m.map_id as mapId,
|
||||
m.map_id ,
|
||||
m.width,
|
||||
m.height,
|
||||
m.url,
|
||||
|
||||
@@ -4,4 +4,8 @@ import org.nl.common.page.BaseQuery;
|
||||
import org.nl.layout.service.entity.AgvLayoutMap;
|
||||
|
||||
public class MapLayoutQuery extends BaseQuery<AgvLayoutMap> {
|
||||
@Override
|
||||
protected Class<AgvLayoutMap> getEntityClass() {
|
||||
return AgvLayoutMap.class;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user