opt:1.增加AGV运行轨迹
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
package org.nl.system.controller.trajectory;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.system.service.trajectory.TrajectoryBackgroundService;
|
||||
import org.nl.system.service.trajectory.dto.TrajectoryBackground;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/6/19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/trajectoryBackground")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class TrajectoryBackgroundController {
|
||||
|
||||
@Resource
|
||||
private TrajectoryBackgroundService trajectoryBackgroundService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询轨迹背景图")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(trajectoryBackgroundService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增轨迹背景图")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody TrajectoryBackground trajectoryBackground) {
|
||||
trajectoryBackgroundService.create(trajectoryBackground);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改轨迹背景图")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody TrajectoryBackground entity) {
|
||||
trajectoryBackgroundService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除轨迹背景图")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
trajectoryBackgroundService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryAllEnable")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryAllEnable() {
|
||||
return new ResponseEntity<>(TableDataInfo.build(trajectoryBackgroundService.queryAllEnable()), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.nl.system.controller.trajectory;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.system.service.trajectory.TrajectoryConfigurationService;
|
||||
import org.nl.system.service.trajectory.dto.TrajectoryConfiguration;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/6/19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/trajectoryConfiguration")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class TrajectoryConfigurationController {
|
||||
|
||||
@Resource
|
||||
private TrajectoryConfigurationService trajectoryConfigurationService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询轨迹设备配置")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(trajectoryConfigurationService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增轨迹设备配置")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody TrajectoryConfiguration trajectoryConfiguration) {
|
||||
trajectoryConfigurationService.create(trajectoryConfiguration);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改轨迹设备配置")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody TrajectoryConfiguration entity) {
|
||||
trajectoryConfigurationService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除轨迹设备配置")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
trajectoryConfigurationService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryAllEnable")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryAllEnable() {
|
||||
return new ResponseEntity<>(TableDataInfo.build(trajectoryConfigurationService.queryAllEnable()), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.nl.system.controller.trajectory;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.system.service.trajectory.TrajectoryService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/6/19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/trajectory")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class TrajectoryController {
|
||||
|
||||
@Resource
|
||||
private TrajectoryService trajectoryService;
|
||||
|
||||
@PostMapping("/queryDevice")
|
||||
@Log(value = "查询设备状态")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryDevice(@RequestBody String whereJson) throws Exception {
|
||||
return new ResponseEntity<>(trajectoryService.queryDevice(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.nl.system.service.trajectory;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.acs.common.base.CommonService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.trajectory.dto.TrajectoryBackground;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/6/19
|
||||
*/
|
||||
public interface TrajectoryBackgroundService extends CommonService<TrajectoryBackground> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
* @param whereJson
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
IPage<TrajectoryBackground> queryAll(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity
|
||||
*/
|
||||
void create(TrajectoryBackground entity);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param entity
|
||||
*/
|
||||
void update(TrajectoryBackground entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param ids
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 查询所有已启用的配置设备
|
||||
* @return List<TrajectoryConfiguration>
|
||||
*/
|
||||
List<TrajectoryBackground> queryAllEnable();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.nl.system.service.trajectory;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.acs.common.base.CommonService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.trajectory.dto.TrajectoryConfiguration;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/6/19
|
||||
*/
|
||||
public interface TrajectoryConfigurationService extends CommonService<TrajectoryConfiguration> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
* @param whereJson
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
IPage<TrajectoryConfiguration> queryAll(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity
|
||||
*/
|
||||
void create(TrajectoryConfiguration entity);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param entity
|
||||
*/
|
||||
void update(TrajectoryConfiguration entity);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param ids
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 查询所有已启用的配置设备
|
||||
* @return List<TrajectoryConfiguration>
|
||||
*/
|
||||
List<TrajectoryConfiguration> queryAllEnable();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.system.service.trajectory;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/6/19
|
||||
*/
|
||||
public interface TrajectoryService {
|
||||
|
||||
/**
|
||||
* 查询设备状态
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryDevice(String jsonObject) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package org.nl.system.service.trajectory.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author liejiu
|
||||
*/
|
||||
@Data
|
||||
@TableName("trajectory_background")
|
||||
public class TrajectoryBackground implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 背景图标识
|
||||
*/
|
||||
@TableId
|
||||
private String background_uuid;
|
||||
|
||||
/**
|
||||
* 背景图名称
|
||||
*/
|
||||
private String background_code;
|
||||
|
||||
/**
|
||||
* 背景图片编码
|
||||
*/
|
||||
private String image_code;
|
||||
|
||||
/**
|
||||
* 背景图片地址
|
||||
*/
|
||||
private String image_name;
|
||||
|
||||
/**
|
||||
* 缩放比例(0-1之间 百分比)
|
||||
*/
|
||||
private String zoom_ratio;
|
||||
|
||||
/**
|
||||
* 坐标原点(1左上 2左下 3右上 4右下)
|
||||
*/
|
||||
private String coordinate_origin;
|
||||
|
||||
/**
|
||||
* X坐标最大值
|
||||
*/
|
||||
private String max_x;
|
||||
|
||||
|
||||
/**
|
||||
* Y坐标最大值
|
||||
*/
|
||||
private String max_y;
|
||||
|
||||
/**
|
||||
* 刷新时间(秒)
|
||||
*/
|
||||
private Integer refresh_time;
|
||||
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String create_id;
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改者
|
||||
*/
|
||||
private String update_id;
|
||||
private String update_name;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package org.nl.system.service.trajectory.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author liejiu
|
||||
*/
|
||||
@Data
|
||||
@TableName("trajectory_configuration")
|
||||
public class TrajectoryConfiguration implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 配置标识
|
||||
*/
|
||||
@TableId
|
||||
private String configuration_uuid;
|
||||
|
||||
/**
|
||||
* 配置名称
|
||||
*/
|
||||
private String configuration_code;
|
||||
|
||||
/**
|
||||
* 图标编码
|
||||
*/
|
||||
private String image_code;
|
||||
|
||||
/**
|
||||
* 图标名称
|
||||
*/
|
||||
private String image_name;
|
||||
|
||||
/**
|
||||
* 图标高度
|
||||
*/
|
||||
private String image_height;
|
||||
|
||||
/**
|
||||
* 图标宽度
|
||||
*/
|
||||
private String image_width;
|
||||
|
||||
/**
|
||||
* 绑定设备编码
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String create_id;
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改者
|
||||
*/
|
||||
private String update_id;
|
||||
private String update_name;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package org.nl.system.service.trajectory.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.nl.acs.common.base.impl.CommonServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.trajectory.TrajectoryBackgroundService;
|
||||
import org.nl.system.service.trajectory.dto.TrajectoryBackground;
|
||||
import org.nl.system.service.trajectory.mapper.TrajectoryBackgroundMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/6/19
|
||||
*/
|
||||
@Service
|
||||
public class TrajectoryBackgroundImpl extends CommonServiceImpl<TrajectoryBackgroundMapper, TrajectoryBackground> implements TrajectoryBackgroundService {
|
||||
|
||||
@Resource
|
||||
private TrajectoryBackgroundMapper trajectoryBackgroundMapper;
|
||||
|
||||
@Override
|
||||
public IPage<TrajectoryBackground> queryAll(Map whereJson, PageQuery page) {
|
||||
LambdaQueryWrapper<TrajectoryBackground> lam = new LambdaQueryWrapper<>();
|
||||
IPage<TrajectoryBackground> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
trajectoryBackgroundMapper.selectPage(pages,lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(TrajectoryBackground entity) {
|
||||
TrajectoryBackground stage = trajectoryBackgroundMapper.selectOne(new LambdaQueryWrapper<TrajectoryBackground>().eq(TrajectoryBackground::getBackground_code, entity.getBackground_code()));
|
||||
if (ObjectUtil.isNotEmpty(stage)) {
|
||||
throw new BadRequestException("背景图名称[" + entity.getBackground_code() + "]已存在");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
entity.setIs_active("1");
|
||||
entity.setIs_delete("0");
|
||||
entity.setBackground_uuid(IdUtil.simpleUUID());
|
||||
entity.setCreate_id(currentUserId);
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
trajectoryBackgroundMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(TrajectoryBackground entity) {
|
||||
TrajectoryBackground trajectoryBackground = trajectoryBackgroundMapper.selectOne(new LambdaQueryWrapper<TrajectoryBackground>().eq(TrajectoryBackground::getBackground_uuid, entity.getBackground_uuid()));
|
||||
if (trajectoryBackground == null) {
|
||||
throw new BadRequestException("未找到这条数据");
|
||||
}
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentNickName();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(currentUsername);
|
||||
trajectoryBackgroundMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
trajectoryBackgroundMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TrajectoryBackground> queryAllEnable() {
|
||||
return new LambdaQueryChainWrapper<>(trajectoryBackgroundMapper)
|
||||
.apply("is_delete= '0' AND is_active= '1'")
|
||||
.orderByAsc(TrajectoryBackground::getBackground_uuid)
|
||||
.list();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package org.nl.system.service.trajectory.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.nl.acs.common.base.impl.CommonServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.trajectory.TrajectoryConfigurationService;
|
||||
import org.nl.system.service.trajectory.dto.TrajectoryConfiguration;
|
||||
import org.nl.system.service.trajectory.mapper.TrajectoryConfigurationMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/6/19
|
||||
*/
|
||||
@Service
|
||||
public class TrajectoryConfigurationImpl extends CommonServiceImpl<TrajectoryConfigurationMapper, TrajectoryConfiguration> implements TrajectoryConfigurationService {
|
||||
|
||||
@Resource
|
||||
private TrajectoryConfigurationMapper trajectoryConfigurationMapper;
|
||||
|
||||
@Override
|
||||
public IPage<TrajectoryConfiguration> queryAll(Map whereJson, PageQuery page) {
|
||||
LambdaQueryWrapper<TrajectoryConfiguration> lam = new LambdaQueryWrapper<>();
|
||||
IPage<TrajectoryConfiguration> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
trajectoryConfigurationMapper.selectPage(pages,lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(TrajectoryConfiguration entity) {
|
||||
TrajectoryConfiguration stage = trajectoryConfigurationMapper.selectOne(new LambdaQueryWrapper<TrajectoryConfiguration>().eq(TrajectoryConfiguration::getConfiguration_code, entity.getConfiguration_code()));
|
||||
if (ObjectUtil.isNotEmpty(stage)) {
|
||||
throw new BadRequestException("轨迹图配置编码[" + entity.getConfiguration_code() + "]已存在");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
entity.setIs_delete("0");
|
||||
entity.setConfiguration_uuid(IdUtil.simpleUUID());
|
||||
entity.setCreate_id(currentUserId);
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
trajectoryConfigurationMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(TrajectoryConfiguration entity) {
|
||||
TrajectoryConfiguration trajectoryBackground = trajectoryConfigurationMapper.selectOne(new LambdaQueryWrapper<TrajectoryConfiguration>().eq(TrajectoryConfiguration::getConfiguration_uuid, entity.getConfiguration_uuid()));
|
||||
if (trajectoryBackground == null) {
|
||||
throw new BadRequestException("未找到这条数据");
|
||||
}
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentNickName();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(currentUsername);
|
||||
trajectoryConfigurationMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
trajectoryConfigurationMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TrajectoryConfiguration> queryAllEnable() {
|
||||
return new LambdaQueryChainWrapper<>(trajectoryConfigurationMapper)
|
||||
.apply("is_delete= '0' AND is_active= '1'")
|
||||
.orderByAsc(TrajectoryConfiguration::getConfiguration_uuid)
|
||||
.list();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package org.nl.system.service.trajectory.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.trajectory.TrajectoryService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
* 2025/6/19
|
||||
*/
|
||||
@Service
|
||||
public class TrajectoryImpl implements TrajectoryService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDevice(String jsonObject) throws Exception {
|
||||
JSONArray backja = new JSONArray();
|
||||
JSONArray datas = JSONArray.parseArray(jsonObject);
|
||||
//agv
|
||||
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver;
|
||||
|
||||
if (datas.size() == 0) {
|
||||
throw new BadRequestException("缺少输入参数!");
|
||||
}
|
||||
|
||||
// for (int i = 0; i < datas.size(); i++) {
|
||||
// JSONObject jo = new JSONObject();
|
||||
// JSONObject ja = new JSONObject();
|
||||
// JSONObject data = datas.getJSONObject(i);
|
||||
// String device_code = data.getString("device_code");
|
||||
// Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
// if (ObjectUtil.isEmpty(device)) {
|
||||
// throw new Exception("未找到对应设备:" + device_code);
|
||||
// }
|
||||
// if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
// agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
|
||||
// jo.put("device_code", agvNdcOneDeviceDriver.getDevice().getDevice_code());
|
||||
// jo.put("x", agvNdcOneDeviceDriver.getX());
|
||||
// jo.put("y", agvNdcOneDeviceDriver.getY());
|
||||
// jo.put("angle", agvNdcOneDeviceDriver.getAngle());
|
||||
// ja.put(agvNdcOneDeviceDriver.getDevice().getDevice_code(),jo);
|
||||
// }
|
||||
// backja.add(ja);
|
||||
// }
|
||||
// JSONObject resultJson = new JSONObject();
|
||||
// resultJson.put("status", HttpStatus.OK.value());
|
||||
// resultJson.put("message", "操作成功");
|
||||
// resultJson.put("data", backja);
|
||||
// return resultJson;
|
||||
JSONObject resultJson = new JSONObject();
|
||||
Random rand = new Random();
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONObject data = datas.getJSONObject(i);
|
||||
String device_code = data.getString("device_code");
|
||||
jo.put("x", rand.nextInt(1001));
|
||||
jo.put("y", rand.nextInt(1001));
|
||||
jo.put("angle", rand.nextInt(361));
|
||||
jo.put("device_code", device_code);
|
||||
backja.add(jo);
|
||||
}
|
||||
resultJson.put("status", HttpStatus.OK.value());
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", backja);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.system.service.trajectory.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.nl.system.service.trajectory.dto.TrajectoryBackground;
|
||||
|
||||
/**
|
||||
* @author liejiu
|
||||
*/
|
||||
@Mapper
|
||||
public interface TrajectoryBackgroundMapper extends BaseMapper<TrajectoryBackground> {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.nl.system.service.trajectory.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.system.service.trajectory.dto.TrajectoryConfiguration;
|
||||
|
||||
/**
|
||||
* @author liejiu
|
||||
*/
|
||||
public interface TrajectoryConfigurationMapper extends BaseMapper<TrajectoryConfiguration> {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user