diff --git a/acs/dummy.ipynb b/acs/dummy.ipynb new file mode 100644 index 0000000..025057d --- /dev/null +++ b/acs/dummy.ipynb @@ -0,0 +1,22 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "vscode": { + "languageId": "javascript" + } + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/acs/nladmin-system/pom.xml b/acs/nladmin-system/pom.xml index 4ce11ae..9e720ef 100644 --- a/acs/nladmin-system/pom.xml +++ b/acs/nladmin-system/pom.xml @@ -349,7 +349,16 @@ mysql-connector-java runtime - + + com.baomidou + mybatis-plus-boot-starter + 3.4.0 + + + com.baomidou + mybatis-plus-generator + 3.4.0 + com.alibaba diff --git a/acs/nladmin-system/src/main/java/org/nl/AppRun.java b/acs/nladmin-system/src/main/java/org/nl/AppRun.java index 2fa3edd..0e1af39 100644 --- a/acs/nladmin-system/src/main/java/org/nl/AppRun.java +++ b/acs/nladmin-system/src/main/java/org/nl/AppRun.java @@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaIgnore; import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation; import com.alicp.jetcache.anno.config.EnableMethodCache; import io.swagger.annotations.Api; +import org.mybatis.spring.annotation.MapperScan; import org.nl.modules.wql.util.SpringContextHolder; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -35,6 +36,7 @@ import org.springframework.web.bind.annotation.RestController; @EnableJpaAuditing(auditorAwareRef = "auditorAware") @EnableMethodCache(basePackages = "org.nl") @EnableCreateCacheAnnotation +@MapperScan("org.nl.**.mapper") public class AppRun { public static void main(String[] args) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java index 562c035..4e23a2e 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java @@ -31,7 +31,7 @@ import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; @Slf4j -@Component +//@Component public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { Socket s; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java index 8e5840d..b77debf 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java @@ -207,7 +207,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme if (StrUtil.equals(inst.getInstruction_status(), "1")) { if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) { vehicle_code = inst.getVehicle_code(); - inst.setExecute_device_code(this.device_code); + inst.setExecute_code(this.device_code); finish_instruction(); logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task); } else { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java index b7f935e..a324f6c 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java @@ -191,7 +191,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl } if (StrUtil.equals(inst.getInstruction_status(), "1")) { if (!StrUtil.equals(inst.getExecute_code(), this.device_code)) { - inst.setExecute_device_code(this.device_code); + inst.setExecute_code(this.device_code); instructionService.update(inst); } } @@ -216,7 +216,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl if (mode == 0) { this.setIsonline(false); message = "未联机"; - + } else { this.setIsonline(true); this.setIserror(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java index fc42549..c92c7b5 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java @@ -140,7 +140,7 @@ public interface InstructionService { * * @param id */ - void finish(String id) throws Exception; + void finish(String id) ; /** * 完成指令 @@ -163,7 +163,9 @@ public interface InstructionService { * * @param id */ - void cancel(String id) throws Exception; + void cancel(String id) ; + void recover(String id) ; + void pause(String id) ; /** * 取消指令 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 3148c6a..b411202 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -227,7 +227,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu } @Override - public List queryAll(String whereJson) { + public List queryAll(String whereJson) { WQLObject wo = WQLObject.getWQLObject("acs_instruction"); JSONArray arr = wo.query(whereJson, "create_time").getResultJSONArray(0); List list = arr.toJavaList(Instruction.class); @@ -844,12 +844,12 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu } @Override - public void cancel(String id) throws Exception { + public void cancel(String id) { // flag= true时取消指令 boolean flag = false; Instruction entity = this.findById(id); if (entity == null) { - throw new BadRequestException("被删除或无权限,操作失败!"); + throw new BadRequestException("指令不存在"); } TaskDto task = taskService.findByCodeFromCache(entity.getTask_code()); if (StrUtil.isEmpty(entity.getRoute_plan_code())) { @@ -1388,4 +1388,14 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu return null; } + + @Override + public void recover(String id) { + + } + + @Override + public void pause(String id) { + + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java index bba9745..30f9457 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java @@ -143,7 +143,7 @@ public interface TaskService { * * @param dto / */ - void create(TaskDto dto) throws Exception; + void create(TaskDto dto); /** * 常规任务保存 @@ -179,6 +179,8 @@ public interface TaskService { * @param ids */ void finish(String ids); + //强制完成任务并调用外部系统 + void forchFinich(String code); /** * 完成任务 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index f38fa16..d205d7b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -430,7 +430,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { @Override @Transactional(rollbackFor = Exception.class) - public void create(TaskDto dto) throws Exception { + public void create(TaskDto dto) { // dto = foramte(dto); if (!StrUtil.isEmpty(dto.getVehicle_code())) { TaskDto vehicle_dto = this.findByContainer(dto.getVehicle_code()); @@ -780,6 +780,21 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { // } // } } + public void forchFinich(String taskCode) { + TaskDto entity = this.findByCode(taskCode); + if (entity == null) throw new BadRequestException("任务不存在"); + String currentUsername = SecurityUtils.getCurrentUsername(); + String now = DateUtil.now(); + entity.setUpdate_time(now); + entity.setUpdate_by(currentUsername); + entity.setTask_status("2"); + WQLObject wo = WQLObject.getWQLObject("acs_task"); + JSONObject json = (JSONObject) JSONObject.toJSON(entity); + wo.update(json); + removeByCodeFromCache(entity.getTask_code()); + // 判断是否为WMS下发的任务,如果是反馈任务状态给WMS + String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); + } @Override diff --git a/acs/nladmin-system/src/main/java/org/nl/common/utils/MapOf.java b/acs/nladmin-system/src/main/java/org/nl/common/utils/MapOf.java new file mode 100644 index 0000000..7107bc7 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/common/utils/MapOf.java @@ -0,0 +1,20 @@ +package org.nl.common.utils; + + +import java.io.Serializable; +import java.util.HashMap; + +/* + * @author ZZQ + * @Date 2022/11/29 2:55 下午 + */ +public class MapOf implements Serializable { + + public static HashMap of(K... key) { + HashMap map = new HashMap<>(); + for (int i = 0; i < (key.length & ~1); i = i + 2) { + map.put(key[i], key[i + 1]); + } + return map; + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/common/utils/TableDataInfo.java b/acs/nladmin-system/src/main/java/org/nl/common/utils/TableDataInfo.java new file mode 100644 index 0000000..55cd73a --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/common/utils/TableDataInfo.java @@ -0,0 +1,80 @@ +package org.nl.common.utils; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.http.HttpStatus; +import com.baomidou.mybatisplus.core.metadata.IPage; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 表格分页数据对象 + * + * @author Lion Li + */ + +@Data +@NoArgsConstructor +public class TableDataInfo implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 列表数据 + */ + /** + * 消息状态码 + */ + private Integer status; + private String timestamp = DateUtil.now(); + /** + * 消息内容 + */ + private String message; + /** + * 反馈数据 + */ + private Object data; + /** + * 分页 + * + * @param list 列表数据 + * @param total 总记录数 + */ + public TableDataInfo(List list, long total) { + this.data = list; + } + + public static TableDataInfo build(IPage page) { + TableDataInfo rspData = new TableDataInfo<>(); + rspData.setStatus(HttpStatus.HTTP_OK); + rspData.setMessage("操作成功"); + rspData.setData(page.getRecords()); + return rspData; + } + + public static TableDataInfo build(List list) { + TableDataInfo rspData = new TableDataInfo<>(); + rspData.setStatus(HttpStatus.HTTP_OK); + rspData.setMessage("操作成功"); + rspData.setData(list); + return rspData; + } + + public static TableDataInfo build() { + TableDataInfo rspData = new TableDataInfo<>(); + rspData.setStatus(HttpStatus.HTTP_OK); + rspData.setMessage("操作成功"); + return rspData; + } + + public static TableDataInfo buildJson(Object result) { + TableDataInfo rspData = new TableDataInfo<>(); + rspData.setStatus(HttpStatus.HTTP_OK); + rspData.setData(result); + rspData.setMessage("操作成功"); + return rspData; + } + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/common/utils/query/BaseQuery.java b/acs/nladmin-system/src/main/java/org/nl/common/utils/query/BaseQuery.java new file mode 100644 index 0000000..9035abb --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/common/utils/query/BaseQuery.java @@ -0,0 +1,89 @@ +package org.nl.common.utils.query; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.LambdaUtils; +import com.baomidou.mybatisplus.core.toolkit.support.ColumnCache; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; +import org.nl.common.utils.MapOf; +import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl; + +import java.lang.reflect.Type; +import java.util.Map; + +/** + * 泛型必须为数据tb对应do:由mybatis管理 + * @author ZZQ + * @Date 2022/12/14 6:33 下午 + */ +@Data +public class BaseQuery { + /** + * 模糊查询 + */ + private String blurry; + /** + * 是否启用 + */ + private String is_used; + /** + * 创建时间范围查询 + */ + private String start_time; + private String end_time; + + + /** + * 字段映射Map:指定字段对应QueryWrapper的查询类型 + * 字段与数据库字段对应,不支持驼峰 + * @see org.nl.common.enums.QueryTEnum + * 通过buid构建 + */ + public Map doP = MapOf.of("blurry", QParam.builder().k(new String[]{"name"}).type(QueryTEnum.LK).build() + ,"startTime", QParam.builder().k(new String[]{"create_time"}).type(QueryTEnum.LT).build() + ,"endTime", QParam.builder().k(new String[]{"create_time"}).type(QueryTEnum.LE).build() + ,"sort", QParam.builder().k(new String[]{"sort"}).type(QueryTEnum.BY).build() + ); + + public QueryWrapper build(){ + this.paramMapping(); + QueryWrapper wrapper = new QueryWrapper<>(); + JSONObject json = (JSONObject)JSONObject.toJSON(this); + Type[] types = ((ParameterizedTypeImpl) this.getClass().getGenericSuperclass()).getActualTypeArguments(); + Map columnMap = LambdaUtils.getColumnMap((Class) types[0]); + + String dopStr = "doP"; + json.forEach((key, vel) -> { + if (vel != null && !key.equals(dopStr)){ + if (vel instanceof String){ + if (StringUtils.isNotEmpty((CharSequence) vel)){ + QParam qParam = doP.get(key); + if (qParam != null){ + QueryTEnum.build(qParam.type,wrapper,qParam.k,vel); + }else { + ColumnCache columnCache = columnMap.get(LambdaUtils.formatKey(key)); + if (columnCache!=null){ + wrapper.eq(columnCache.getColumn(),vel); + } + } + } + }else { + QParam qParam = doP.get(key); + if (qParam != null){ + QueryTEnum.build(qParam.type,wrapper,qParam.k,vel); + }else { + ColumnCache columnCache = columnMap.get(LambdaUtils.formatKey(key)); + if (columnCache!=null){ + wrapper.eq(columnCache.getColumn(),vel); + } + } + } + + } + }); + return wrapper; + } + + public void paramMapping(){}; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/common/utils/query/LConsumer.java b/acs/nladmin-system/src/main/java/org/nl/common/utils/query/LConsumer.java new file mode 100644 index 0000000..e795ada --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/common/utils/query/LConsumer.java @@ -0,0 +1,19 @@ +package org.nl.common.utils.query; + +/** + * s + * @author ZZQ + * @Date 2022/12/14 8:40 下午 + */ +@FunctionalInterface +public interface LConsumer { + + /** + * 切面 + * @param x 、 + * @param y 、 + * @param z 、 + */ + void accept(X x,Y y,Z z); + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/common/utils/query/PageQuery.java b/acs/nladmin-system/src/main/java/org/nl/common/utils/query/PageQuery.java new file mode 100644 index 0000000..fabdb5f --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/common/utils/query/PageQuery.java @@ -0,0 +1,135 @@ +package org.nl.common.utils.query; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.Locale; + +/** + *

+ * 分页参数 + *

+ * + * @author generator + * @since 2023-11-16 + */ +@Data +public class PageQuery implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 分页大小 + */ + private Integer size=100; + + /** + * 当前页数 + */ + private Integer page=0; + + /** + * 排序列menu_sort,desc + */ + private String sort; + + /** + * 排序的方向desc或者asc + */ + private Boolean isAsc; + + /** + * 当前记录起始索引 默认值 + */ + public static final int DEFAULT_PAGE_NUM = 1; + + /** + * 每页显示记录数 默认值 默认查全部 + */ + public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE; + + public Page build() { + Integer pageNum = ObjectUtil.defaultIfNull(getPage(), DEFAULT_PAGE_NUM); + Integer pageSize = ObjectUtil.defaultIfNull(getSize(), DEFAULT_PAGE_SIZE); + if (pageNum <= 0) { + pageNum = DEFAULT_PAGE_NUM; + } + Page page = new Page<>(pageNum, pageSize); + if (StringUtils.isNotEmpty(sort)){ + String[] split = sort.split(","); + for (int i = 0; i < (split.length & ~1); i = i + 2) { + String col = split[i]; + OrderItem item = new OrderItem(); + item.setColumn(col); + item.setAsc(split[i + 1].toLowerCase(Locale.ROOT).equals("asc")); + page.addOrder(item); + } + } + return page; + } + + public static void trimStringFields(Object obj) { + if (obj == null) { + return; + } + Field[] fields = obj.getClass().getDeclaredFields(); + for (Field field : fields) { + if (field.getType() == String.class) { + field.setAccessible(true); + try { + String value = (String) field.get(obj); + if (value != null) { + field.set(obj, value.trim().toUpperCase()); + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + } + } + + public Page build(Class r) { + Integer pageNum = ObjectUtil.defaultIfNull(getPage(), DEFAULT_PAGE_NUM); + Integer pageSize = ObjectUtil.defaultIfNull(getSize(), DEFAULT_PAGE_SIZE); + if (pageNum <= 0) { + pageNum = DEFAULT_PAGE_NUM; + } + Page page = new Page<>(pageNum, pageSize); + if (StringUtils.isNotEmpty(sort)) { + String[] split = sort.split(","); + for (int i = 0; i < (split.length & ~1); i=i+2) { + String col = split[i]; + if ("id".equals(col)){ + String mId = mappingId(r); + col = StringUtils.isNotEmpty(mId)?mId:col; + } + OrderItem item = new OrderItem(); + item.setColumn(col); + item.setAsc(split[i+1].toLowerCase(Locale.ROOT).equals("asc")); + page.addOrder(item); + } + + } + return page; + } + + private String mappingId(R r){ + if (r instanceof Class){ + Field[] fields = ((Class) r).getDeclaredFields(); + for (Field field : fields) { + TableId[] byType = field.getAnnotationsByType(TableId.class); + if (byType !=null && byType.length>0){ + TableId tableId = byType[0]; + return tableId.value(); + } + } + } + return null; + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/common/utils/query/QParam.java b/acs/nladmin-system/src/main/java/org/nl/common/utils/query/QParam.java new file mode 100644 index 0000000..1f32cd5 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/common/utils/query/QParam.java @@ -0,0 +1,14 @@ +package org.nl.common.utils.query; + +import lombok.Builder; + +/** + * s + * @author ZZQ + * @Date 2022/12/15 1:41 下午 + */ +@Builder +public class QParam { + public String[] k; + public QueryTEnum type; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/common/utils/query/QueryTEnum.java b/acs/nladmin-system/src/main/java/org/nl/common/utils/query/QueryTEnum.java new file mode 100644 index 0000000..392cf5b --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/common/utils/query/QueryTEnum.java @@ -0,0 +1,81 @@ +package org.nl.common.utils.query; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.formula.functions.T; + +import java.util.Collection; + +/** + * s + * + * @author ZZQ + * @Date 2022/12/14 8:26 下午 + */ +@Getter +public enum QueryTEnum { + // + EQ((q, k, v) -> { + q.eq(k[0], v); + }), + IN((q, key, o) -> { + if (o instanceof Collection) { + q.in(key[0], (Collection) o); + } + }), + LK((q, keys, o) -> { + for (String key : keys) { + q.like(key, o); + } + }), + ORLK((q, k, o) -> { + q.and(query -> { + QueryWrapper queryWrapper = (QueryWrapper) query; + for (int i = 0; i < k.length; i++) { + queryWrapper.like(k[i], o); + if (i != (k.length - 1)) { + queryWrapper.or(); + } + } + }); + }), + LE((q, k, v) -> { + q.le(k[0], v); + }), + GE((q, k, v) -> { + q.ge(k[0], v); + }), + BY((q, k, v) -> { + q.orderByDesc(k[0], String.valueOf(v)); + }), + NO((q, k, v) -> { + q.isNull(k[0]); + }), + NULL_OR_EMPTY((queryWrapper, k, v) -> { + queryWrapper.nested(a -> a.isNull(k[0]).or().eq(k[0], "")); + }), + LT((q, k, v) -> { + q.lt(k[0], v); + }), + GT((q, k, v) -> { + q.gt(k[0], v); + }), + OREQ((q, k, v) -> { + if (StringUtils.isBlank((String) v)) { + q.isNull(k[0]); + } else { + q.eq(k[0], v); + } + }); + + private LConsumer, String[], Object> doP; + + QueryTEnum(LConsumer, String[], Object> doP) { + this.doP = doP; + } + + public static void build(QueryTEnum type, QueryWrapper q, String[] k, Object v) { + type.getDoP().accept(q, k, v); + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/rest/PadController.java b/acs/nladmin-system/src/main/java/org/nl/hand/rest/PadController.java index 614c107..0cdb820 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/rest/PadController.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/rest/PadController.java @@ -5,7 +5,9 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.common.utils.TableDataInfo; import org.nl.hand.service.PadService; +import org.nl.hand.service.dto.TaskPad; import org.nl.modules.logging.annotation.Log; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -22,43 +24,52 @@ public class PadController { private final PadService padService; - @PostMapping("/tasks") - @Log("任务操作") - @ApiOperation("任务操作") + @PostMapping("/list") + @Log("任务列表") + @ApiOperation("任务列表") @SaIgnore public ResponseEntity tasks(@RequestBody Map whereJson) { return new ResponseEntity<>(padService.tasks(whereJson), HttpStatus.OK); } - @PostMapping("/taskoperation") + @PostMapping("/taskOperation") @Log("任务操作") @ApiOperation("任务操作") @SaIgnore - public ResponseEntity taskoperation(@RequestBody Map whereJson) { + public ResponseEntity taskOperation(@RequestBody Map whereJson) { return new ResponseEntity<>(padService.taskoperation(whereJson), HttpStatus.OK); } - @PostMapping("/insts") + @PostMapping("/queryInst") @Log("查询指令信息") @ApiOperation("查询指令信息") @SaIgnore - public ResponseEntity insts(@RequestBody Map whereJson) { - return new ResponseEntity<>(padService.insts(whereJson), HttpStatus.OK); + public ResponseEntity queryInst(@RequestBody TaskPad taskPad) { + return new ResponseEntity<>(TableDataInfo.build(padService.insts(taskPad)), HttpStatus.OK); } - @PostMapping("/inst") + @PostMapping("/instoperation") @Log("指令操作") @ApiOperation("指令操作") @SaIgnore - public ResponseEntity instoperation(@RequestBody Map whereJson) { - return new ResponseEntity<>(padService.instoperation(whereJson), HttpStatus.OK); + public ResponseEntity instoperation(@RequestBody TaskPad taskPad) { + padService.instoperation(taskPad); + return new ResponseEntity<>(TableDataInfo.build(), HttpStatus.OK); } @PostMapping("/callTask") @Log("定点任务") @ApiOperation("定点任务") @SaIgnore - public ResponseEntity callTask(@RequestBody Map whereJson) { - return new ResponseEntity<>(padService.callTask(whereJson), HttpStatus.OK); + public ResponseEntity callTask(@RequestBody TaskPad taskPad) { + padService.callTask(taskPad); + return new ResponseEntity<>(TableDataInfo.build(), HttpStatus.OK); + } + @PostMapping("/signalInteract") + @Log("信号交互") + @SaIgnore + public ResponseEntity signalInteract(@RequestBody TaskPad taskPad) { + padService.signalInteract(taskPad); + return new ResponseEntity<>(TableDataInfo.build(), HttpStatus.OK); } } diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/service/PadService.java b/acs/nladmin-system/src/main/java/org/nl/hand/service/PadService.java index af5f706..f19d665 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/service/PadService.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/service/PadService.java @@ -1,5 +1,8 @@ package org.nl.hand.service; +import org.nl.hand.service.dto.TaskPad; + +import java.util.List; import java.util.Map; public interface PadService { @@ -26,7 +29,7 @@ public interface PadService { * @param whereJson * @return */ - Map insts(Map whereJson); + List insts(TaskPad pad); /** * 指令操作 @@ -34,7 +37,7 @@ public interface PadService { * @param whereJson * @return */ - Map instoperation(Map whereJson); + void instoperation(TaskPad pad); /** * 定点任务 @@ -42,5 +45,7 @@ public interface PadService { * @param whereJson * @return */ - Map callTask(Map whereJson); + void callTask(TaskPad pad); + + void signalInteract(TaskPad pad); } diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/service/dto/TaskPad.java b/acs/nladmin-system/src/main/java/org/nl/hand/service/dto/TaskPad.java new file mode 100644 index 0000000..161ffca --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/hand/service/dto/TaskPad.java @@ -0,0 +1,46 @@ +package org.nl.hand.service.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TaskPad implements Serializable { +//任务操作页面用 + /** + * 任务操作码:"1"任务取消"2"任务完成"3"任务暂停"4"任务回复 + */ + private String operation; + /** + * 指令id + */ + private String inst_id; +//任务操作页面查询任务用 + /** + * 车辆号 + */ + private String car_no; + /** + * 托盘号 + */ + private String containerCode; + private String vehicle_code; +//任务创建 + /** + * 扫码起点 + */ + private String start; + /** + * 扫码终点 + */ + private String end; +//焊接线安全交互 + /** + * 托盘号 + */ + private String point; + /** + * type:1.请求取货2取货完成3请求放货4放货完成 + */ + private String type; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/service/impl/PadServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/hand/service/impl/PadServiceImpl.java index 766ce0b..4ba4d6f 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/service/impl/PadServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/service/impl/PadServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.opc.Device; @@ -11,6 +12,8 @@ import org.nl.acs.opc.DeviceAppService; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.hand.service.PadService; +import org.nl.hand.service.dto.TaskPad; +import org.nl.modules.common.exception.BadRequestException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -116,126 +119,76 @@ public class PadServiceImpl implements PadService { } @Override - public Map insts(Map whereJson) { - JSONObject resultJson = new JSONObject(); - String car_no = whereJson.get("car_no"); - String device_code = whereJson.get("device_code"); - List instructions = instructionService.findAllInstFromCache(); - List> list = (instructions == null ? Stream.empty() : instructions.stream()) - .filter(instruction -> { - if (StrUtil.isEmpty(car_no)) return true; - String vc = instruction.getCarno(); - return StrUtil.isNotEmpty(vc) && vc.contains(car_no); - }) - .filter(instruction -> { - if (StrUtil.isEmpty(device_code)) return true; - String s = instruction.getStart_device_code(); - String n = instruction.getNext_device_code(); - return (StrUtil.isNotEmpty(s) && s.contains(device_code)) - || (StrUtil.isNotEmpty(n) && n.contains(device_code)); - }) - .map(instruction -> { - Map m = new HashMap<>(); - m.put("inst_id", instruction.getInstruction_id()); - m.put("instruction_code", instruction.getInstruction_code()); - m.put("task_no", instruction.getTask_code()); - m.put("priority", instruction.getPriority()); - m.put("point_code1", instruction.getStart_device_code()); - m.put("point_code2", instruction.getNext_device_code()); - m.put("inst_status", instruction.getInstruction_status()); - m.put("vehicle_code", instruction.getVehicle_code()); - m.put("car_no", instruction.getCarno()); - m.put("create_time", instruction.getCreate_time()); - return m; - }) - .collect(Collectors.toList()); - resultJson.put("data", list); - resultJson.put("code", "1"); - resultJson.put("message", "ok"); - return resultJson; + public Listinsts(TaskPad pad) { + String carNo = pad.getCar_no(); + String containerCode = pad.getVehicle_code(); + String query = "instruction_status < 2 and is_delete = 0 "; + if (StringUtils.isNotEmpty(carNo)){ + query = query+" and carno = '"+carNo+"'"; + } + if (StringUtils.isNotEmpty(containerCode)){ + query = query+" and vehicle_code = '"+containerCode+"'"; + } + List result = instructionService.queryAll(query); + return result; } @Override - public Map instoperation(Map whereJson) { - JSONObject resultJson = new JSONObject(); - String type = whereJson.get("type"); - if (StrUtil.isEmpty(type)) { - resultJson.put("code", "0"); - resultJson.put("message", "操作类型不能为空!"); - return resultJson; - } - String inst_id = whereJson.get("inst_id"); - if (StrUtil.isEmpty(inst_id)) { - resultJson.put("code", "0"); - resultJson.put("message", "指令ID不能为空!"); - return resultJson; - } - if (type.equals("1")) { - try { - instructionService.cancel(inst_id); - } catch (Exception e) { - resultJson.put("code", "0"); - resultJson.put("message", "取消失败, " + e.getMessage()); - return resultJson; - } - } else if (type.equals("2")) { - try { - instructionService.finish(inst_id); - } catch (Exception e) { - resultJson.put("code", "0"); - resultJson.put("message", "完成失败, " + e.getMessage()); - return resultJson; + public void instoperation(TaskPad pad) { + String operation = pad.getOperation(); + //任务操作码:"1"任务取消"2"任务完成"3"车辆暂停"4"车辆恢复 + String instId = pad.getInst_id(); + if (StrUtil.isEmpty(operation)) { + throw new BadRequestException("操作类型不能为空");} + if (StrUtil.isEmpty(instId)) { + throw new BadRequestException("指令ID不能为空");} + if (operation.equals("1")) { + Instruction entity = instructionService.findById(instId); + if (entity == null) { + throw new BadRequestException("指令不存在"); } + instructionService.cancel(instId); + taskService.forchFinich(entity.getTask_code()); + } else if (operation.equals("2")) { + instructionService.finish(instId); + }else if (operation.equals("3")) { + //调用套件 + instructionService.pause(instId); + }else if (operation.equals("4")) { + instructionService.recover(instId); } - resultJson.put("code", "1"); - resultJson.put("message", "操作成功!"); - return resultJson; } @Override - public Map callTask(Map whereJson) { - JSONObject resultJson = new JSONObject(); - String start_device_code = whereJson.get("start_device_code"); - if (StrUtil.isEmpty(start_device_code)) { - resultJson.put("code", "0"); - resultJson.put("message", "起始库位不能为空!"); - return resultJson; + public void callTask(TaskPad pad) { + String start = pad.getStart(); + String end = pad.getEnd(); + if (StringUtils.isEmpty(start) || StringUtils.isEmpty(end)){ + throw new BadRequestException("任务搬运起点或者终点不能为空"); } - Device startDevice = deviceAppService.findDeviceByCode(start_device_code); + Device startDevice = deviceAppService.findDeviceByCode(start); if (startDevice == null) { - resultJson.put("code", "0"); - resultJson.put("message", "起始库位不存在,请添加起始库位!"); - return resultJson; + throw new BadRequestException("起始库位不存在,请添加起始库位!"); } - String next_device_code = whereJson.get("next_device_code"); - if (StrUtil.isEmpty(next_device_code)) { - resultJson.put("code", "0"); - resultJson.put("message", "目的库位不能为空!"); - return resultJson; + Device endDevice = deviceAppService.findDeviceByCode(end); + if (endDevice == null) { + throw new BadRequestException("终点库位不存在,请添加起始库位!"); } - Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); - if (nextDevice == null) { - resultJson.put("code", "0"); - resultJson.put("message", "目的库位不存在,请添加目的库位!"); - return resultJson; - } - TaskDto taskDto = new TaskDto(); - taskDto.setStart_device_code(start_device_code); - taskDto.setStart_point_code(start_device_code); - taskDto.setStart_parent_code(start_device_code); - taskDto.setNext_device_code(next_device_code); - taskDto.setNext_point_code(next_device_code); - taskDto.setNext_parent_code(next_device_code); - try { - taskService.create(taskDto); - } catch (Exception e) { - resultJson.put("code", "0"); - resultJson.put("message", "生成失败, " + e.getMessage()); - return resultJson; + taskDto.setStart_device_code(start); + taskDto.setStart_point_code(start); + taskDto.setStart_parent_code(start); + taskDto.setNext_device_code(end); + taskDto.setNext_point_code(end); + taskDto.setNext_parent_code(end); + if (StringUtils.isNotEmpty(pad.getVehicle_code())){ + taskDto.setVehicle_code(pad.getContainerCode()); } - resultJson.put("code", "1"); - resultJson.put("message", "生成成功!"); - return resultJson; + taskService.create(taskDto); + } + + @Override + public void signalInteract(TaskPad pad) { + //焊接线安全交互 } } diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/controller/AgvCarController.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/controller/AgvCarController.java new file mode 100644 index 0000000..a26294f --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/controller/AgvCarController.java @@ -0,0 +1,83 @@ +package org.nl.modules.layout.car.controller; + +import cn.dev33.satoken.annotation.SaIgnore; +import org.nl.common.utils.query.PageQuery; +import org.nl.modules.layout.car.dao.AgvCarQuery; +import org.nl.modules.layout.car.dto.AgvCarDto; +import org.nl.modules.layout.car.entity.AgvCar; +import org.nl.modules.layout.car.service.AgvCarService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; + +/** + * 车辆信息Controller + */ +@RestController +@RequestMapping("/api/agvCar") +@SaIgnore +public class AgvCarController { + + @Autowired + private AgvCarService agvCarService; + + /** + * 分页查询 + */ + @GetMapping("/list") + public ResponseEntity pageList(AgvCarQuery query, PageQuery pageQuery) { + return new ResponseEntity<>(agvCarService.page(pageQuery.build(), query.build()), HttpStatus.OK); + } + + /** + * 查询所有 + */ + @GetMapping("/all") + @SaIgnore + public ResponseEntity list() { + return new ResponseEntity<>(agvCarService.list(), HttpStatus.OK); + } + + /** + * 根据ID查询 + */ + @GetMapping("/{id}") + public ResponseEntity getById(@PathVariable Integer id) { + return new ResponseEntity<>(agvCarService.getById(id), HttpStatus.OK); + } + + /** + * 新增 + */ + @PostMapping + public ResponseEntity add(@RequestBody AgvCarDto dto) { + AgvCar entity = new AgvCar(); + BeanUtils.copyProperties(dto, entity); + agvCarService.save(entity); + return new ResponseEntity<>(entity, HttpStatus.OK); + } + + /** + * 修改 + */ + @PutMapping + public ResponseEntity update(@RequestBody AgvCarDto dto) { + AgvCar entity = new AgvCar(); + BeanUtils.copyProperties(dto, entity); + agvCarService.updateById(entity); + return new ResponseEntity<>(entity, HttpStatus.OK); + } + + /** + * 删除 + */ + @DeleteMapping + public ResponseEntity delete(@RequestBody Integer[] ids) { + agvCarService.removeByIds(Arrays.asList(ids)); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/dao/AgvCarQuery.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/dao/AgvCarQuery.java new file mode 100644 index 0000000..55a099c --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/dao/AgvCarQuery.java @@ -0,0 +1,41 @@ +package org.nl.modules.layout.car.dao; + +import org.apache.commons.lang3.StringUtils; +import org.nl.common.utils.query.BaseQuery; +import org.nl.modules.layout.car.entity.AgvCar; + +/** + * 车辆信息查询对象 + */ +public class AgvCarQuery extends BaseQuery { + + /** + * 车辆ID + */ + private String carId; + + /** + * 车辆类型 + */ + private String type; + + public String getCarId() { + return carId; + } + + public void setCarId(String carId) { + if (StringUtils.isNotEmpty(carId)){ + this.carId = carId; + } + } + + public String getType() { + return type; + } + + public void setType(String type) { + if (StringUtils.isNotEmpty(type)){ + this.type = type; + } + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/dto/AgvCarDto.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/dto/AgvCarDto.java new file mode 100644 index 0000000..4e1e1ae --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/dto/AgvCarDto.java @@ -0,0 +1,34 @@ +package org.nl.modules.layout.car.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 车辆信息DTO + */ +@Data +public class AgvCarDto implements Serializable { + + private Integer id; + + /** + * 车辆ID + */ + private String carId; + + /** + * 车辆类型 + */ + private String type; + + /** + * 车辆图标地址 + */ + private String icon; + + /** + * 图标文件ID + */ + private String fileId; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/entity/AgvCar.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/entity/AgvCar.java new file mode 100644 index 0000000..13577ab --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/entity/AgvCar.java @@ -0,0 +1,44 @@ +package org.nl.modules.layout.car.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 车辆信息表 + */ +@Data +@TableName("agv_car") +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class AgvCar implements Serializable { + + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 车辆ID + */ + private String carId; + + /** + * 车辆类型 + */ + private String type; + + /** + * 车辆图标地址 + */ + private String icon; + /** + * 车辆图标地址 + */ + private String fileId; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/mapper/AgvCarMapper.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/mapper/AgvCarMapper.java new file mode 100644 index 0000000..b5ecb83 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/mapper/AgvCarMapper.java @@ -0,0 +1,12 @@ +package org.nl.modules.layout.car.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.nl.modules.layout.car.entity.AgvCar; + +/** + * 车辆信息Mapper + */ +@Mapper +public interface AgvCarMapper extends BaseMapper { +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/service/AgvCarService.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/service/AgvCarService.java new file mode 100644 index 0000000..653c57c --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/service/AgvCarService.java @@ -0,0 +1,10 @@ +package org.nl.modules.layout.car.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.nl.modules.layout.car.entity.AgvCar; + +/** + * 车辆信息Service + */ +public interface AgvCarService extends IService { +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/service/impl/AgvCarServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/service/impl/AgvCarServiceImpl.java new file mode 100644 index 0000000..e61aa7d --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/car/service/impl/AgvCarServiceImpl.java @@ -0,0 +1,14 @@ +package org.nl.modules.layout.car.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.nl.modules.layout.car.entity.AgvCar; +import org.nl.modules.layout.car.mapper.AgvCarMapper; +import org.nl.modules.layout.car.service.AgvCarService; +import org.springframework.stereotype.Service; + +/** + * 车辆信息ServiceImpl + */ +@Service +public class AgvCarServiceImpl extends ServiceImpl implements AgvCarService { +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/controller/BaseDataDeviceController.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/controller/BaseDataDeviceController.java new file mode 100644 index 0000000..89b0f11 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/controller/BaseDataDeviceController.java @@ -0,0 +1,82 @@ +package org.nl.modules.layout.device.controller; + +import cn.dev33.satoken.annotation.SaIgnore; +import org.nl.common.utils.query.PageQuery; +import org.nl.modules.layout.device.dao.BaseDataDeviceQuery; +import org.nl.modules.layout.device.dto.BaseDataDeviceDto; +import org.nl.modules.layout.device.entity.BaseDataDevice; +import org.nl.modules.layout.device.service.BaseDataDeviceService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.Date; + +/** + * 设备信息Controller + */ +@RestController +@RequestMapping("/api/baseDevice") +@SaIgnore +public class BaseDataDeviceController { + + @Autowired + private BaseDataDeviceService baseDataDeviceService; + + /** + * 分页查询 + */ + @GetMapping("/list") + public ResponseEntity pageList(BaseDataDeviceQuery query, PageQuery pageQuery) { + return new ResponseEntity<>(baseDataDeviceService.page(pageQuery.build(), query.build()), HttpStatus.OK); + } + @GetMapping("/component") + @SaIgnore + public ResponseEntity List() { + return new ResponseEntity<>(baseDataDeviceService.list(), HttpStatus.OK); + } + + /** + * 根据ID查询 + */ + @GetMapping("/{id}") + public ResponseEntity getById(@PathVariable Integer id) { + return new ResponseEntity<>(baseDataDeviceService.getById(id), HttpStatus.OK); + } + + /** + * 新增 + */ + @PostMapping + public ResponseEntity add(@RequestBody BaseDataDeviceDto dto) { + BaseDataDevice entity = new BaseDataDevice(); + BeanUtils.copyProperties(dto, entity); + entity.setCreateTime(new Date()); + baseDataDeviceService.save(entity); + return new ResponseEntity<>(entity, HttpStatus.OK); + } + + /** + * 修改 + */ + @PutMapping + public ResponseEntity update(@RequestBody BaseDataDeviceDto dto) { + BaseDataDevice entity = new BaseDataDevice(); + BeanUtils.copyProperties(dto, entity); + entity.setUpdateTime(new Date()); + baseDataDeviceService.updateById(entity); + return new ResponseEntity<>(entity, HttpStatus.OK); + } + + /** + * 删除 + */ + @DeleteMapping + public ResponseEntity delete(@RequestBody Integer[] ids) { + baseDataDeviceService.removeByIds(Arrays.asList(ids)); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/dao/BaseDataDeviceQuery.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/dao/BaseDataDeviceQuery.java new file mode 100644 index 0000000..c72080d --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/dao/BaseDataDeviceQuery.java @@ -0,0 +1,56 @@ +package org.nl.modules.layout.device.dao; + +import org.apache.commons.lang3.StringUtils; +import org.nl.common.utils.query.BaseQuery; +import org.nl.modules.layout.device.entity.BaseDataDevice; + +/** + * 设备信息查询对象 + */ +public class BaseDataDeviceQuery extends BaseQuery { + + /** + * 设备编码 + */ + private String code; + + /** + * 设备类型 + */ + private String type; + + /** + * 所属区域 + */ + private String region; + + public String getCode() { + return code; + } + + public void setCode(String code) { + if (StringUtils.isNotEmpty(code)){ + this.code = code; + } + } + + public String getType() { + return type; + } + + public void setType(String type) { + if (StringUtils.isNotEmpty(type)){ + this.type = type; + } + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + if (StringUtils.isNotEmpty(region)){ + this.region = region; + } + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/dto/BaseDataDeviceDto.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/dto/BaseDataDeviceDto.java new file mode 100644 index 0000000..02eee4b --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/dto/BaseDataDeviceDto.java @@ -0,0 +1,100 @@ +package org.nl.modules.layout.device.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 设备信息DTO + */ +@Data +public class BaseDataDeviceDto implements Serializable { + + private Integer id; + + /** + * 编码 + */ + private String code; + + /** + * 设备名称 + */ + private String name; + + /** + * 设备类型 + */ + private String type; + + /** + * 设备描述 + */ + private String description; + + /** + * 设备扩展信息 + */ + private String editParam; + + /** + * 图标地址 + */ + private String icon; + + /** + * 图标文件ID + */ + private String fileId; + + /** + * 所属区域 + */ + private String region; + + /** + * x坐标 + */ + private Integer x; + + /** + * y坐标 + */ + private Integer y; + + /** + * 角度 + */ + private Integer angle; + + /** + * 放大比例 + */ + private Integer size; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 创建用户 + */ + private String createName; + + /** + * 修改时间 + */ + private Date updateTime; + + /** + * 修改用户 + */ + private String updateName; + + /** + * 是否启用 + */ + private Boolean isUsed; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/entity/BaseDataDevice.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/entity/BaseDataDevice.java new file mode 100644 index 0000000..9437bae --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/entity/BaseDataDevice.java @@ -0,0 +1,111 @@ +package org.nl.modules.layout.device.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +/** + * 设备信息表 + */ +@Data +@TableName("base_data_device") +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class BaseDataDevice implements Serializable { + + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 编码 + */ + private String code; + + /** + * 设备名称 + */ + private String name; + + /** + * 设备类型 + */ + private String type; + + /** + * 设备描述 + */ + private String description; + + /** + * 设备扩展信息 + */ + private String editParam; + + /** + * 图标地址 + */ + private String icon; + + /** + * 图标文件ID + */ + private String fileId; + + /** + * 所属区域 + */ + private String region; + + /** + * x坐标 + */ + private Integer x; + + /** + * y坐标 + */ + private Integer y; + + /** + * 角度 + */ + private Integer angle; + + /** + * 放大比例 + */ + private Integer size; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 创建用户 + */ + private String createName; + + /** + * 修改时间 + */ + private Date updateTime; + + /** + * 修改用户 + */ + private String updateName; + + /** + * 是否启用 + */ + private Boolean isUsed; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/mapper/BaseDataDeviceMapper.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/mapper/BaseDataDeviceMapper.java new file mode 100644 index 0000000..c0dec1a --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/mapper/BaseDataDeviceMapper.java @@ -0,0 +1,12 @@ +package org.nl.modules.layout.device.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.nl.modules.layout.device.entity.BaseDataDevice; + +/** + * 设备信息Mapper + */ +@Mapper +public interface BaseDataDeviceMapper extends BaseMapper { +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/service/BaseDataDeviceService.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/service/BaseDataDeviceService.java new file mode 100644 index 0000000..29eac1e --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/service/BaseDataDeviceService.java @@ -0,0 +1,10 @@ +package org.nl.modules.layout.device.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.nl.modules.layout.device.entity.BaseDataDevice; + +/** + * 设备信息Service + */ +public interface BaseDataDeviceService extends IService { +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/service/impl/BaseDataDeviceServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/service/impl/BaseDataDeviceServiceImpl.java new file mode 100644 index 0000000..48cec45 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/device/service/impl/BaseDataDeviceServiceImpl.java @@ -0,0 +1,14 @@ +package org.nl.modules.layout.device.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.nl.modules.layout.device.entity.BaseDataDevice; +import org.nl.modules.layout.device.mapper.BaseDataDeviceMapper; +import org.nl.modules.layout.device.service.BaseDataDeviceService; +import org.springframework.stereotype.Service; + +/** + * 设备信息ServiceImpl + */ +@Service +public class BaseDataDeviceServiceImpl extends ServiceImpl implements BaseDataDeviceService { +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/controller/AgvLayoutDeviceController.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/controller/AgvLayoutDeviceController.java new file mode 100644 index 0000000..e114408 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/controller/AgvLayoutDeviceController.java @@ -0,0 +1,74 @@ +package org.nl.modules.layout.deviceLayout.controller; + +import cn.dev33.satoken.annotation.SaIgnore; +import org.nl.common.utils.query.PageQuery; +import org.nl.modules.layout.deviceLayout.dao.AgvLayoutDeviceQuery; +import org.nl.modules.layout.deviceLayout.dto.AgvLayoutDeviceDto; +import org.nl.modules.layout.deviceLayout.entity.AgvLayoutDevice; +import org.nl.modules.layout.deviceLayout.service.AgvLayoutDeviceService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; + +/** + * 设备布局Controller + */ +@RestController +@RequestMapping("/api/deviceLayout") +@SaIgnore +public class AgvLayoutDeviceController { + + @Autowired + private AgvLayoutDeviceService agvLayoutDeviceService; + + /** + * 分页查询 + */ + @GetMapping("/list") + public ResponseEntity pageList(AgvLayoutDeviceQuery query, PageQuery pageQuery) { + return new ResponseEntity<>(agvLayoutDeviceService.page(pageQuery.build(), query.build()), HttpStatus.OK); + } + + /** + * 根据ID查询 + */ + @GetMapping("/{id}") + public ResponseEntity getById(@PathVariable Integer id) { + return new ResponseEntity<>(agvLayoutDeviceService.getById(id), HttpStatus.OK); + } + + /** + * 新增 + */ + @PostMapping + public ResponseEntity add(@RequestBody AgvLayoutDeviceDto dto) { + AgvLayoutDevice entity = new AgvLayoutDevice(); + BeanUtils.copyProperties(dto, entity); + agvLayoutDeviceService.save(entity); + return new ResponseEntity<>(entity, HttpStatus.OK); + } + + /** + * 修改 + */ + @PutMapping + public ResponseEntity update(@RequestBody AgvLayoutDeviceDto dto) { + AgvLayoutDevice entity = new AgvLayoutDevice(); + BeanUtils.copyProperties(dto, entity); + agvLayoutDeviceService.updateById(entity); + return new ResponseEntity<>(entity, HttpStatus.OK); + } + + /** + * 删除 + */ + @DeleteMapping + public ResponseEntity delete(@RequestBody Integer[] ids) { + agvLayoutDeviceService.removeByIds(Arrays.asList(ids)); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/dao/AgvLayoutDeviceQuery.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/dao/AgvLayoutDeviceQuery.java new file mode 100644 index 0000000..a9a9f11 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/dao/AgvLayoutDeviceQuery.java @@ -0,0 +1,29 @@ +package org.nl.modules.layout.deviceLayout.dao; + +import lombok.Data; +import org.nl.common.utils.query.BaseQuery; +import org.nl.modules.layout.deviceLayout.entity.AgvLayoutDevice; + + +/** + * 设备布局查询对象 + */ +@Data +public class AgvLayoutDeviceQuery extends BaseQuery { + + /** + * 地图布局ID + */ + private Integer mapLayoutId; + + /** + * 设备ID + */ + private Integer deviceId; + + /** + * 类型 + */ + private String type; + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/dto/AgvLayoutDeviceDto.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/dto/AgvLayoutDeviceDto.java new file mode 100644 index 0000000..aba21c1 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/dto/AgvLayoutDeviceDto.java @@ -0,0 +1,65 @@ +package org.nl.modules.layout.deviceLayout.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 设备布局DTO + */ +@Data +public class AgvLayoutDeviceDto implements Serializable { + + private Integer id; + + /** + * 地图布局ID + */ + private Integer mapLayoutId; + + /** + * 设备ID + */ + private Integer deviceId; + + /** + * 编码 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 类型 + */ + private String type; + + /** + * x坐标 + */ + private Integer x; + + /** + * y坐标 + */ + private Integer y; + + /** + * 角度 + */ + private Integer angle; + + /** + * 放大比例 + */ + private Integer size; + + /** + * 图标 + */ + private String icon; + private String fileId; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/entity/AgvLayoutDevice.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/entity/AgvLayoutDevice.java new file mode 100644 index 0000000..6b22efe --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/entity/AgvLayoutDevice.java @@ -0,0 +1,76 @@ +package org.nl.modules.layout.deviceLayout.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 设备布局表 + */ +@Data +@TableName("agv_layout_device") +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class AgvLayoutDevice implements Serializable { + + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 地图布局ID + */ + private Integer mapLayoutId; + + /** + * 设备ID + */ + private Integer deviceId; + + /** + * 编码 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 类型 + */ + private String type; + + /** + * x坐标 + */ + private Integer x; + + /** + * y坐标 + */ + private Integer y; + + /** + * 角度 + */ + private Integer angle; + + /** + * 放大比例 + */ + private Integer size; + + /** + * 图标 + */ + private String icon; + private String fileId; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/mapper/AgvLayoutDeviceMapper.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/mapper/AgvLayoutDeviceMapper.java new file mode 100644 index 0000000..9f3b9f4 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/mapper/AgvLayoutDeviceMapper.java @@ -0,0 +1,12 @@ +package org.nl.modules.layout.deviceLayout.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.nl.modules.layout.deviceLayout.entity.AgvLayoutDevice; + +/** + * 设备布局Mapper + */ +@Mapper +public interface AgvLayoutDeviceMapper extends BaseMapper { +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/service/AgvLayoutDeviceService.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/service/AgvLayoutDeviceService.java new file mode 100644 index 0000000..6b48a45 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/service/AgvLayoutDeviceService.java @@ -0,0 +1,10 @@ +package org.nl.modules.layout.deviceLayout.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.nl.modules.layout.deviceLayout.entity.AgvLayoutDevice; + +/** + * 设备布局Service + */ +public interface AgvLayoutDeviceService extends IService { +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/service/impl/AgvLayoutDeviceServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/service/impl/AgvLayoutDeviceServiceImpl.java new file mode 100644 index 0000000..7ab43bd --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/deviceLayout/service/impl/AgvLayoutDeviceServiceImpl.java @@ -0,0 +1,14 @@ +package org.nl.modules.layout.deviceLayout.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.nl.modules.layout.deviceLayout.entity.AgvLayoutDevice; +import org.nl.modules.layout.deviceLayout.mapper.AgvLayoutDeviceMapper; +import org.nl.modules.layout.deviceLayout.service.AgvLayoutDeviceService; +import org.springframework.stereotype.Service; + +/** + * 设备布局ServiceImpl + */ +@Service +public class AgvLayoutDeviceServiceImpl extends ServiceImpl implements AgvLayoutDeviceService { +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/controller/AgvLayoutMapController.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/controller/AgvLayoutMapController.java new file mode 100644 index 0000000..c0c87cd --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/controller/AgvLayoutMapController.java @@ -0,0 +1,107 @@ +package org.nl.modules.layout.mapLayout.controller; + +import cn.dev33.satoken.annotation.SaIgnore; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.apache.commons.lang3.StringUtils; +import org.nl.common.utils.query.PageQuery; +import org.nl.modules.layout.mapLayout.dao.AgvLayoutMapQuery; +import org.nl.modules.layout.mapLayout.dto.AgvLayoutMapDto; +import org.nl.modules.layout.mapLayout.dto.AgvStatus; +import org.nl.modules.layout.mapLayout.entity.AgvLayoutMap; +import org.nl.modules.layout.mapLayout.service.AgvLayoutMapService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; + +/** + * 地图布局Controller + */ +@RestController +@RequestMapping("/api/mapLayout") +@SaIgnore +public class AgvLayoutMapController { + + @Autowired + private AgvLayoutMapService agvLayoutMapService; + + /** + * 分页查询 + */ + @GetMapping("/list") + @SaIgnore + public ResponseEntity pageList(AgvLayoutMapQuery query, PageQuery pageQuery) { + return new ResponseEntity<>(agvLayoutMapService.page(pageQuery.build(), query.build()), HttpStatus.OK); + } + + /** + * 根据ID查询 + */ + @GetMapping("/{id}") + public ResponseEntity getById(@PathVariable Integer id) { + return new ResponseEntity<>(agvLayoutMapService.getById(id), HttpStatus.OK); + } + + /** + * 新增 + */ + @PostMapping + public ResponseEntity add(@RequestBody AgvLayoutMapDto dto) { + agvLayoutMapService.saveLayout(dto); + return new ResponseEntity<>(HttpStatus.OK); + } + + /** + * 修改 + */ + @PutMapping + public ResponseEntity update(@RequestBody AgvLayoutMapDto dto) { + AgvLayoutMap entity = new AgvLayoutMap(); + BeanUtils.copyProperties(dto, entity); + agvLayoutMapService.updateById(entity); + return new ResponseEntity<>(entity, HttpStatus.OK); + } + + /** + * 删除 + */ + @DeleteMapping + public ResponseEntity delete(@RequestBody Integer[] ids) { + agvLayoutMapService.removeByIds(Arrays.asList(ids)); + return new ResponseEntity<>(HttpStatus.OK); + } + + @GetMapping("initLayout") + @SaIgnore + public ResponseEntity initLayout(Long id) { + AgvLayoutMapDto agvLayoutMapDto = agvLayoutMapService.initLayoutMap(id); + return new ResponseEntity<>(agvLayoutMapDto,HttpStatus.OK); + } + @GetMapping("status") + @SaIgnore + public ResponseEntity status(String carId) { + List list = new ArrayList<>(); + for (int i = 0; i < 4; i++) { + AgvStatus build = AgvStatus.builder() + .status("2") + .carId(String.valueOf(i + 1)) + .action("请求取货") + .actionInfo("申请取货中") + .taskCode("33876") + .icon("/Users/mima0000/Desktop/car.png") + .fileId("3029") + .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 new ResponseEntity<>(list,HttpStatus.OK); + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/dao/AgvLayoutMapQuery.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/dao/AgvLayoutMapQuery.java new file mode 100644 index 0000000..7dfa616 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/dao/AgvLayoutMapQuery.java @@ -0,0 +1,28 @@ +package org.nl.modules.layout.mapLayout.dao; + +import lombok.Data; +import org.nl.common.utils.query.BaseQuery; +import org.nl.modules.layout.mapLayout.entity.AgvLayoutMap; + +/** + * 地图布局查询对象 + */ +@Data +public class AgvLayoutMapQuery extends BaseQuery { + + /** + * 地图ID + */ + private String mapId; + + /** + * 版本 + */ + private String version; + + /** + * 是否启用 + */ + private Boolean enable; + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/dto/AgvLayoutMapDto.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/dto/AgvLayoutMapDto.java new file mode 100644 index 0000000..3597106 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/dto/AgvLayoutMapDto.java @@ -0,0 +1,64 @@ +package org.nl.modules.layout.mapLayout.dto; + +import lombok.Data; +import org.nl.modules.layout.deviceLayout.dto.AgvLayoutDeviceDto; + +import java.io.Serializable; +import java.util.List; + +/** + * 地图布局DTO + */ +@Data +public class AgvLayoutMapDto implements Serializable { + + private Integer id; + + /** + * 地图ID + */ + private String mapId; + + /** + * 地图名称 + */ + private String mapName; + + /** + * 版本 + */ + private String version; + + /** + * 地图URL + */ + private String url; + + /** + * 高度 + */ + private Integer height; + + /** + * 宽度 + */ + private Integer width; + + /** + * x坐标 + */ + private Integer x; + + /** + * y坐标 + */ + private Integer y; + + /** + * 是否启用 + */ + private Boolean enable; + + + private List device; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/dto/AgvStatus.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/dto/AgvStatus.java new file mode 100644 index 0000000..9c529db --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/dto/AgvStatus.java @@ -0,0 +1,65 @@ +package org.nl.modules.layout.mapLayout.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class AgvStatus { + /** + * 车辆ID + */ + private String carId; + /** + * 车辆类型 + */ + private String type; + /** + * 图标地址 + */ + private String icon="/Users/mima0000/Desktop/car.png"; + /** + * 车辆图片地址ID + */ + private String fileId; + /** + * 状态类型:1.休息 2.正常运行 3.异常 + */ + private String status; + /** + * 异常时的异常信息 + */ + private String error; + /** + * 动作状态:请求取货/取货完成/请求放货/放货完成 + */ + private String action; + /** + * 动作交互信息 + */ + private String actionInfo; + /** + * 任务号 + */ + private String taskCode; + /** + * 坐标X + */ + private Integer x; + /** + * 坐标Y + */ + private Integer y; + /** + * 航向角 + */ + private Integer angle; + /** + * 电量 + */ + private Integer power; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/entity/AgvLayoutMap.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/entity/AgvLayoutMap.java new file mode 100644 index 0000000..c6fc830 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/entity/AgvLayoutMap.java @@ -0,0 +1,70 @@ +package org.nl.modules.layout.mapLayout.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 地图布局表 + */ +@Data +@TableName("agv_layout_map") +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class AgvLayoutMap implements Serializable { + + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 地图ID + */ + private String mapId; + + /** + * 地图名称 + */ + private String mapName; + + /** + * 版本 + */ + private String version; + + /** + * 地图URL + */ + private String url; + + /** + * 高度 + */ + private Integer height; + + /** + * 宽度 + */ + private Integer width; + + /** + * x坐标 + */ + private Integer x; + + /** + * y坐标 + */ + private Integer y; + + /** + * 是否启用 + */ + private Boolean enable; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/mapper/AgvLayoutMapMapper.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/mapper/AgvLayoutMapMapper.java new file mode 100644 index 0000000..c0a91a2 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/mapper/AgvLayoutMapMapper.java @@ -0,0 +1,21 @@ +package org.nl.modules.layout.mapLayout.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Options; +import org.nl.modules.layout.mapLayout.dto.AgvLayoutMapDto; +import org.nl.modules.layout.mapLayout.entity.AgvLayoutMap; + +/** + * 地图布局Mapper + */ +@Mapper +public interface AgvLayoutMapMapper extends BaseMapper { + @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); + + AgvLayoutMapDto initLayoutMap(Long id); + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/mapper/mappinng/AgvLayoutMapMapper.xml b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/mapper/mappinng/AgvLayoutMapMapper.xml new file mode 100644 index 0000000..700e231 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/mapper/mappinng/AgvLayoutMapMapper.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/service/AgvLayoutMapService.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/service/AgvLayoutMapService.java new file mode 100644 index 0000000..3e787b5 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/service/AgvLayoutMapService.java @@ -0,0 +1,14 @@ +package org.nl.modules.layout.mapLayout.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.nl.modules.layout.mapLayout.dto.AgvLayoutMapDto; +import org.nl.modules.layout.mapLayout.entity.AgvLayoutMap; + +/** + * 地图布局Service + */ +public interface AgvLayoutMapService extends IService { + void saveLayout(AgvLayoutMapDto dto); + + AgvLayoutMapDto initLayoutMap(Long id); +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/service/impl/AgvLayoutMapServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/service/impl/AgvLayoutMapServiceImpl.java new file mode 100644 index 0000000..d794ea9 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/layout/mapLayout/service/impl/AgvLayoutMapServiceImpl.java @@ -0,0 +1,64 @@ +package org.nl.modules.layout.mapLayout.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.nl.modules.layout.deviceLayout.dto.AgvLayoutDeviceDto; +import org.nl.modules.layout.deviceLayout.entity.AgvLayoutDevice; +import org.nl.modules.layout.deviceLayout.mapper.AgvLayoutDeviceMapper; +import org.nl.modules.layout.mapLayout.dto.AgvLayoutMapDto; +import org.nl.modules.layout.mapLayout.entity.AgvLayoutMap; +import org.nl.modules.layout.mapLayout.mapper.AgvLayoutMapMapper; +import org.nl.modules.layout.mapLayout.service.AgvLayoutMapService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 地图布局ServiceImpl + */ +@Service +public class AgvLayoutMapServiceImpl extends ServiceImpl implements AgvLayoutMapService { + + @Resource + private AgvLayoutDeviceMapper agvLayoutDeviceMapper; + + @Override + @Transactional + public void saveLayout(AgvLayoutMapDto dto) { + AgvLayoutMap layoutMap = AgvLayoutMap.builder() + .mapId(dto.getMapId()) + .mapName(dto.getMapName()) + .url(dto.getUrl()) + .width(dto.getWidth()) + .version("1") + .height(dto.getHeight()) + .x(dto.getX()) + .y(dto.getY()).build(); + this.baseMapper.insertUseGeneratedKeys(layoutMap); + List deviceLayout = dto.getDevice(); + if (!CollectionUtils.isEmpty(deviceLayout)){ + for (AgvLayoutDeviceDto device : deviceLayout) { + AgvLayoutDevice layoutDevice = AgvLayoutDevice.builder() + .deviceId(device.getDeviceId()) + .mapLayoutId(layoutMap.getId()) + .name(device.getName()) + .code(device.getCode()) + .type(device.getType()) + .angle(device.getAngle()) + .x(device.getX()) + .y(device.getY()) + .size(device.getSize()) + .icon(device.getIcon()) + .fileId(device.getFileId()).build(); + agvLayoutDeviceMapper.insert(layoutDevice); + } + } + } + + @Override + public AgvLayoutMapDto initLayoutMap(Long id) { + return this.baseMapper.initLayoutMap(id); + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/controller/LocalStorageController.java b/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/controller/LocalStorageController.java new file mode 100644 index 0000000..2376093 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/controller/LocalStorageController.java @@ -0,0 +1,68 @@ +package org.nl.modules.localStorage.controller; + +import cn.dev33.satoken.annotation.SaIgnore; +import org.apache.commons.lang3.StringUtils; +import org.nl.common.utils.query.PageQuery; +import org.nl.modules.localStorage.service.LocalStorageService; +import org.nl.modules.localStorage.service.dao.LocalStorageQuery; +import org.nl.modules.localStorage.service.entity.LocalStorage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +@RestController +@RequestMapping({"/api/localStorage"}) +@SaIgnore +public class LocalStorageController { + + @Autowired + private LocalStorageService localStorageService; + + @GetMapping("/list") + @SaIgnore + public ResponseEntity pageList(LocalStorageQuery query, PageQuery pageQuery) { + return new ResponseEntity<>(localStorageService.page(pageQuery.build(),query.build()), HttpStatus.OK); + } + + @GetMapping + @SaIgnore + public ResponseEntity query(@RequestParam String annex) { + List list = new ArrayList<>(); + if (StringUtils.isNotEmpty(annex)){ + String[] split = annex.split(","); + list = localStorageService.listByIds(Arrays.asList(split)); + } + return new ResponseEntity<>(list, HttpStatus.OK); + } + @PostMapping({"/upload"}) + + @SaIgnore + public ResponseEntity upload(@RequestParam MultipartFile file) { + LocalStorage localStorage = localStorageService.upload(file); + return new ResponseEntity<>(localStorage, HttpStatus.OK); + } + @GetMapping({"/download"}) + @SaIgnore + public void download(@RequestParam Long storageId , HttpServletResponse response, HttpServletRequest request) throws IOException { + this.localStorageService.downloadFile(this.localStorageService.getById(storageId),request, response); + } + + + @DeleteMapping + @SaIgnore + public ResponseEntity delete(@RequestBody Long[] ids) { + localStorageService.removeByIds(Arrays.asList(ids)); + return new ResponseEntity<>(HttpStatus.OK); + } + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/LocalStorageService.java b/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/LocalStorageService.java new file mode 100644 index 0000000..7c7ea6c --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/LocalStorageService.java @@ -0,0 +1,19 @@ +package org.nl.modules.localStorage.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.nl.modules.localStorage.service.entity.LocalStorage; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +public interface LocalStorageService extends IService { + + LocalStorage upload(MultipartFile file); + List batchUpload(MultipartFile[] file); + + void download(List localStorageDtos, HttpServletResponse response) throws IOException; + void downloadFile(LocalStorage localStorage, HttpServletRequest request, HttpServletResponse response) throws IOException; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/dao/LocalStorageQuery.java b/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/dao/LocalStorageQuery.java new file mode 100644 index 0000000..49d18fa --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/dao/LocalStorageQuery.java @@ -0,0 +1,7 @@ +package org.nl.modules.localStorage.service.dao; + +import org.nl.common.utils.query.BaseQuery; +import org.nl.modules.localStorage.service.entity.LocalStorage; + +public class LocalStorageQuery extends BaseQuery { +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/entity/LocalStorage.java b/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/entity/LocalStorage.java new file mode 100644 index 0000000..36a97d2 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/entity/LocalStorage.java @@ -0,0 +1,34 @@ +package org.nl.modules.localStorage.service.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + + +@Data +@TableName("local_storage") +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class LocalStorage implements Serializable { + + @TableId(type = IdType.AUTO) + private Long id; + private String name; + private String suffix; + private String path; + private String type; + private String size; + private Integer orderCode; + private Date createTime; + private String createName; + private Date updateTime; + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/impl/LocalStorageServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/impl/LocalStorageServiceImpl.java new file mode 100644 index 0000000..b76dcd7 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/impl/LocalStorageServiceImpl.java @@ -0,0 +1,92 @@ +package org.nl.modules.localStorage.service.impl; + +import cn.dev33.satoken.stp.StpUtil; +import org.nl.modules.common.config.FileProperties; +import org.nl.modules.common.utils.FileUtil; +import org.nl.modules.localStorage.service.LocalStorageService; +import org.nl.modules.localStorage.service.entity.LocalStorage; +import org.nl.modules.localStorage.service.mapper.LocalStorageMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.util.*; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + + +@Service +public class LocalStorageServiceImpl extends ServiceImpl implements LocalStorageService { + @Autowired + private FileProperties fileProperties; + + + @Override + public LocalStorage upload(MultipartFile multipartFile) { + String filename = multipartFile.getOriginalFilename(); + String suffix = FileUtil.getExtensionName(filename); + String type = FileUtil.getFileType(suffix); + File file = FileUtil.upload(multipartFile, this.fileProperties.getPath().getPath() + type + File.separator); + LocalStorage storage = LocalStorage.builder().name(filename) + .path(file.getPath()) + .size(FileUtil.getSize(multipartFile.getSize())) + .suffix(type) + .type(type).createTime(new Date()).build(); + this.baseMapper.insertUseGeneratedKeys(storage); + return storage; + } + + @Override + public List batchUpload(MultipartFile[] multipartFile) { + List result = new ArrayList<>(); + if (multipartFile!=null){ + for (MultipartFile item : multipartFile) { + String filename = item.getOriginalFilename(); + String suffix = FileUtil.getExtensionName(filename); + String type = FileUtil.getFileType(suffix); + File file = FileUtil.upload(item, this.fileProperties.getPath().getPath() + type + File.separator); + LocalStorage storage = LocalStorage.builder().name(filename) + .path(file.getPath()) + .size(FileUtil.getSize(item.getSize())) + .suffix(type) + .type(type).createTime(new Date()).build(); + result.add(storage); + } + } + if (!CollectionUtils.isEmpty(result)){ + this.saveBatch(result); + } + return result; + } + @Override + public void download(List queryAll, HttpServletResponse response) throws IOException { + List> list = new ArrayList(); + Iterator var4 = queryAll.iterator(); + + while(var4.hasNext()) { + LocalStorage localStorageDTO = (LocalStorage)var4.next(); + Map map = new LinkedHashMap(); + map.put("文件名", localStorageDTO.getName()); + map.put("备注名", localStorageDTO.getName()); + map.put("文件类型", localStorageDTO.getType()); + map.put("文件大小", localStorageDTO.getSize()); + map.put("创建者", localStorageDTO.getCreateName()); + map.put("创建日期", localStorageDTO.getCreateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public void downloadFile(LocalStorage localStorage, HttpServletRequest request, HttpServletResponse response) throws IOException { + String path = localStorage.getPath(); + File file = new File(path); + FileUtil.downloadFile(request, response,file,false); + + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/mapper/LocalStorageMapper.java b/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/mapper/LocalStorageMapper.java new file mode 100644 index 0000000..28c8800 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/modules/localStorage/service/mapper/LocalStorageMapper.java @@ -0,0 +1,15 @@ +package org.nl.modules.localStorage.service.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Options; +import org.nl.modules.localStorage.service.entity.LocalStorage; + +@Mapper +public interface LocalStorageMapper extends BaseMapper { + + @Insert("INSERT INTO local_storage (name, suffix, path, type, size, order_code, create_time, create_name, update_time) VALUES (#{name}, #{suffix}, #{path}, #{type}, #{size}, #{orderCode}, #{createTime}, #{createName}, #{updateTime})") + @Options(useGeneratedKeys = true, keyProperty = "id") + void insertUseGeneratedKeys(LocalStorage user); +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/tools/config/MultipartConfig.java b/acs/nladmin-system/src/main/java/org/nl/modules/tools/config/MultipartConfig.java deleted file mode 100644 index 853d7f8..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/modules/tools/config/MultipartConfig.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.modules.tools.config; - -import org.springframework.boot.web.servlet.MultipartConfigFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import javax.servlet.MultipartConfigElement; -import java.io.File; - -/** - * @date 2018-12-28 - * @author https://blog.csdn.net/llibin1024530411/article/details/79474953 - */ -@Configuration -public class MultipartConfig { - - /** - * 文件上传临时路径 - */ - @Bean - MultipartConfigElement multipartConfigElement() { - MultipartConfigFactory factory = new MultipartConfigFactory(); - String location = System.getProperty("user.home") + "/.eladmin/file/tmp"; - File tmpFile = new File(location); - if (!tmpFile.exists()) { - if (!tmpFile.mkdirs()) { - System.out.println("create was not successful."); - } - } - factory.setLocation(location); - return factory.createMultipartConfig(); - } -} \ No newline at end of file diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/tools/domain/LocalStorage.java b/acs/nladmin-system/src/main/java/org/nl/modules/tools/domain/LocalStorage.java deleted file mode 100644 index b9e535e..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/modules/tools/domain/LocalStorage.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.modules.tools.domain; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -import io.swagger.annotations.ApiModelProperty; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.nl.modules.common.base.BaseEntity; - -import javax.persistence.*; -import java.io.Serializable; - -/** -* @author Zheng Jie -* @date 2019-09-05 -*/ -@Getter -@Setter -@Entity -@Table(name="tool_local_storage") -@NoArgsConstructor -public class LocalStorage extends BaseEntity implements Serializable { - - @Id - @Column(name = "storage_id") - @ApiModelProperty(value = "ID", hidden = true) - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; - - @ApiModelProperty(value = "真实文件名") - private String realName; - - @ApiModelProperty(value = "文件名") - private String name; - - @ApiModelProperty(value = "后缀") - private String suffix; - - @ApiModelProperty(value = "路径") - private String path; - - @ApiModelProperty(value = "类型") - private String type; - - @ApiModelProperty(value = "大小") - private String size; - - public LocalStorage(String realName,String name, String suffix, String path, String type, String size) { - this.realName = realName; - this.name = name; - this.suffix = suffix; - this.path = path; - this.type = type; - this.size = size; - } - - public void copy(LocalStorage source){ - BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); - } -} \ No newline at end of file diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/tools/repository/LocalStorageRepository.java b/acs/nladmin-system/src/main/java/org/nl/modules/tools/repository/LocalStorageRepository.java deleted file mode 100644 index 3278bdc..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/modules/tools/repository/LocalStorageRepository.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.modules.tools.repository; - -import org.nl.modules.tools.domain.LocalStorage; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -/** -* @author Zheng Jie -* @date 2019-09-05 -*/ -public interface LocalStorageRepository extends JpaRepository, JpaSpecificationExecutor { -} \ No newline at end of file diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/tools/rest/LocalStorageController.java b/acs/nladmin-system/src/main/java/org/nl/modules/tools/rest/LocalStorageController.java deleted file mode 100644 index 8d7d936..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/modules/tools/rest/LocalStorageController.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.modules.tools.rest; - -import cn.dev33.satoken.annotation.SaCheckPermission; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.nl.modules.common.exception.BadRequestException; -import org.nl.modules.common.utils.FileUtil; -import org.nl.modules.logging.annotation.Log; -import org.nl.modules.tools.domain.LocalStorage; -import org.nl.modules.tools.service.LocalStorageService; -import org.nl.modules.tools.service.dto.LocalStorageQueryCriteria; -import org.springframework.data.domain.Pageable; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * @author Zheng Jie - * @date 2019-09-05 - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "工具:本地存储管理") -@RequestMapping("/api/localStorage") -public class LocalStorageController { - - private final LocalStorageService localStorageService; - - @ApiOperation("查询文件") - @GetMapping - @SaCheckPermission("storage:list") - public ResponseEntity query(LocalStorageQueryCriteria criteria, Pageable pageable) { - return new ResponseEntity<>(localStorageService.queryAll(criteria, pageable), HttpStatus.OK); - } - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @SaCheckPermission("storage:list") - public void download(HttpServletResponse response, LocalStorageQueryCriteria criteria) throws IOException { - localStorageService.download(localStorageService.queryAll(criteria), response); - } - - @ApiOperation("上传文件") - @PostMapping - @SaCheckPermission("storage:add") - public ResponseEntity create(@RequestParam String name, @RequestParam("file") MultipartFile file) { - LocalStorage localStorage = localStorageService.create(name, file); - return new ResponseEntity<>(localStorage, HttpStatus.CREATED); - } - - @PostMapping("/pictures") - @ApiOperation("上传图片") - public ResponseEntity upload(@RequestParam MultipartFile file) { - // 判断文件是否为图片 - String suffix = FileUtil.getExtensionName(file.getOriginalFilename()); - if (!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))) { - throw new BadRequestException("只能上传图片"); - } - LocalStorage localStorage = localStorageService.create(null, file); - return new ResponseEntity<>(localStorage, HttpStatus.OK); - } - - @Log("修改文件") - @ApiOperation("修改文件") - @PutMapping - @SaCheckPermission("storage:edit") - public ResponseEntity update(@Validated @RequestBody LocalStorage resources) { - localStorageService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @Log("删除文件") - @DeleteMapping - @ApiOperation("多选删除") - public ResponseEntity delete(@RequestBody Long[] ids) { - localStorageService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } -} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/LocalStorageService.java b/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/LocalStorageService.java deleted file mode 100644 index 63ee0ae..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/LocalStorageService.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.modules.tools.service; - - -import org.nl.modules.tools.domain.LocalStorage; -import org.nl.modules.tools.service.dto.LocalStorageDto; -import org.nl.modules.tools.service.dto.LocalStorageQueryCriteria; -import org.springframework.data.domain.Pageable; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.List; - -/** -* @author Zheng Jie -* @date 2019-09-05 -*/ -public interface LocalStorageService { - - /** - * 分页查询 - * @param criteria 条件 - * @param pageable 分页参数 - * @return / - */ - Object queryAll(LocalStorageQueryCriteria criteria, Pageable pageable); - - /** - * 查询全部数据 - * @param criteria 条件 - * @return / - */ - List queryAll(LocalStorageQueryCriteria criteria); - - /** - * 根据ID查询 - * @param id / - * @return / - */ - LocalStorageDto findById(Long id); - - /** - * 上传 - * @param name 文件名称 - * @param file 文件 - * @return - */ - LocalStorage create(String name, MultipartFile file); - - /** - * 编辑 - * @param resources 文件信息 - */ - void update(LocalStorage resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Long[] ids); - - /** - * 导出数据 - * @param localStorageDtos 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List localStorageDtos, HttpServletResponse response) throws IOException; -} \ No newline at end of file diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/dto/LocalStorageDto.java b/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/dto/LocalStorageDto.java deleted file mode 100644 index 264a284..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/dto/LocalStorageDto.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.modules.tools.service.dto; - -import lombok.Getter; -import lombok.Setter; -import org.nl.modules.common.base.BaseDTO; - -import java.io.Serializable; - -/** -* @author Zheng Jie -* @date 2019-09-05 -*/ -@Getter -@Setter -public class LocalStorageDto extends BaseDTO implements Serializable { - - private Long id; - - private String realName; - - private String name; - - private String suffix; - - private String type; - - private String size; -} \ No newline at end of file diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/dto/LocalStorageQueryCriteria.java b/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/dto/LocalStorageQueryCriteria.java deleted file mode 100644 index 00cc530..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/dto/LocalStorageQueryCriteria.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.modules.tools.service.dto; - -import lombok.Data; -import org.nl.modules.common.annotation.Query; - -import java.sql.Timestamp; -import java.util.List; - - -/** -* @author Zheng Jie -* @date 2019-09-05 -*/ -@Data -public class LocalStorageQueryCriteria{ - - @Query(blurry = "name,suffix,type,createBy,size") - private String blurry; - - @Query(type = Query.Type.BETWEEN) - private List createTime; -} \ No newline at end of file diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/impl/LocalStorageServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/impl/LocalStorageServiceImpl.java deleted file mode 100644 index fdb1cb4..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/impl/LocalStorageServiceImpl.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.modules.tools.service.impl; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import lombok.RequiredArgsConstructor; -import org.nl.modules.common.config.FileProperties; -import org.nl.modules.common.exception.BadRequestException; -import org.nl.modules.common.utils.FileUtil; -import org.nl.modules.common.utils.PageUtil; -import org.nl.modules.common.utils.QueryHelp; -import org.nl.modules.common.utils.ValidationUtil; -import org.nl.modules.tools.domain.LocalStorage; -import org.nl.modules.tools.repository.LocalStorageRepository; -import org.nl.modules.tools.service.LocalStorageService; -import org.nl.modules.tools.service.dto.LocalStorageDto; -import org.nl.modules.tools.service.dto.LocalStorageQueryCriteria; -import org.nl.modules.tools.service.mapstruct.LocalStorageMapper; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** -* @author Zheng Jie -* @date 2019-09-05 -*/ -@Service -@RequiredArgsConstructor -public class LocalStorageServiceImpl implements LocalStorageService { - - private final LocalStorageRepository localStorageRepository; - private final LocalStorageMapper localStorageMapper; - private final FileProperties properties; - - @Override - public Object queryAll(LocalStorageQueryCriteria criteria, Pageable pageable){ - Page page = localStorageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - return PageUtil.toPage(page.map(localStorageMapper::toDto)); - } - - @Override - public List queryAll(LocalStorageQueryCriteria criteria){ - return localStorageMapper.toDto(localStorageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); - } - - @Override - public LocalStorageDto findById(Long id){ - LocalStorage localStorage = localStorageRepository.findById(id).orElseGet(LocalStorage::new); - ValidationUtil.isNull(localStorage.getId(),"LocalStorage","id",id); - return localStorageMapper.toDto(localStorage); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public LocalStorage create(String name, MultipartFile multipartFile) { - FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); - String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); - String type = FileUtil.getFileType(suffix); - File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); - if(ObjectUtil.isNull(file)){ - throw new BadRequestException("上传失败"); - } - try { - name = StrUtil.isEmpty(name) ? FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename()) : name; - LocalStorage localStorage = new LocalStorage( - file.getName(), - name, - suffix, - file.getPath(), - type, - FileUtil.getSize(multipartFile.getSize()) - ); - return localStorageRepository.save(localStorage); - }catch (Exception e){ - FileUtil.del(file); - throw e; - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(LocalStorage resources) { - LocalStorage localStorage = localStorageRepository.findById(resources.getId()).orElseGet(LocalStorage::new); - ValidationUtil.isNull( localStorage.getId(),"LocalStorage","id",resources.getId()); - localStorage.copy(resources); - localStorageRepository.save(localStorage); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteAll(Long[] ids) { - for (Long id : ids) { - LocalStorage storage = localStorageRepository.findById(id).orElseGet(LocalStorage::new); - FileUtil.del(storage.getPath()); - localStorageRepository.delete(storage); - } - } - - @Override - public void download(List queryAll, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (LocalStorageDto localStorageDTO : queryAll) { - Map map = new LinkedHashMap<>(); - map.put("文件名", localStorageDTO.getRealName()); - map.put("备注名", localStorageDTO.getName()); - map.put("文件类型", localStorageDTO.getType()); - map.put("文件大小", localStorageDTO.getSize()); - map.put("创建者", localStorageDTO.getCreateBy()); - map.put("创建日期", localStorageDTO.getCreateTime()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/mapstruct/LocalStorageMapper.java b/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/mapstruct/LocalStorageMapper.java deleted file mode 100644 index f1b3b69..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/modules/tools/service/mapstruct/LocalStorageMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2019-2020 Zheng Jie - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nl.modules.tools.service.mapstruct; - - -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; -import org.nl.modules.common.base.BaseMapper; -import org.nl.modules.tools.domain.LocalStorage; -import org.nl.modules.tools.service.dto.LocalStorageDto; - -/** -* @author Zheng Jie -* @date 2019-09-05 -*/ -@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface LocalStorageMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/acs/nladmin-system/src/main/resources/config/application.yml b/acs/nladmin-system/src/main/resources/config/application.yml index a4d00ab..9ad5ac6 100644 --- a/acs/nladmin-system/src/main/resources/config/application.yml +++ b/acs/nladmin-system/src/main/resources/config/application.yml @@ -9,7 +9,12 @@ spring: redis: repositories: enabled: false - + main: + allow-circular-references: true + servlet: + multipart: + max-request-size: 100MB + max-file-size: 100MB #配置 Jpa jpa: hibernate: @@ -78,3 +83,8 @@ security: - /api/localStorage/pictures # 参数 - /api/param/getValueByCode +mybatis-plus: + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + mapper-locations: + - classpath:/org/nl/**/mapper/**/*.xml diff --git a/acs/nladmin-ui/src/api/layout/car.js b/acs/nladmin-ui/src/api/layout/car.js new file mode 100644 index 0000000..d9da44c --- /dev/null +++ b/acs/nladmin-ui/src/api/layout/car.js @@ -0,0 +1,42 @@ +import request from '@/utils/request' + +export function query(params) { + return request({ + url: 'api/agvCar/list', + method: 'get', + params + }) +} + +export function getById(id) { + return request({ + url: `api/agvCar/${id}`, + method: 'get' + }) +} + +export function add(data) { + return request({ + url: 'api/agvCar', + method: 'post', + data + }) +} + +export function edit(data) { + return request({ + url: 'api/agvCar', + method: 'put', + data + }) +} + +export function del(ids) { + return request({ + url: 'api/agvCar', + method: 'delete', + data: ids + }) +} + +export default { query, getById, add, edit, del } diff --git a/acs/nladmin-ui/src/api/layout/device.js b/acs/nladmin-ui/src/api/layout/device.js new file mode 100644 index 0000000..3df8912 --- /dev/null +++ b/acs/nladmin-ui/src/api/layout/device.js @@ -0,0 +1,42 @@ +import request from '@/utils/request' + +export function query(params) { + return request({ + url: 'api/baseDevice/list', + method: 'get', + params + }) +} + +export function getById(id) { + return request({ + url: `api/baseDevice/${id}`, + method: 'get' + }) +} + +export function add(data) { + return request({ + url: 'api/baseDevice', + method: 'post', + data + }) +} + +export function edit(data) { + return request({ + url: 'api/baseDevice', + method: 'put', + data + }) +} + +export function del(ids) { + return request({ + url: 'api/baseDevice', + method: 'delete', + data: ids + }) +} + +export default { query, getById, add, edit, del } diff --git a/acs/nladmin-ui/src/api/layout/map.js b/acs/nladmin-ui/src/api/layout/map.js new file mode 100644 index 0000000..3ba2fce --- /dev/null +++ b/acs/nladmin-ui/src/api/layout/map.js @@ -0,0 +1,42 @@ +import request from '@/utils/request' + +export function getComponentList() { + return request({ + url: '/api/baseDevice/component', + method: 'get', + }) +} + +export function saveMapLayout(data) { + return request({ + url: 'api/mapLayout', + method: 'post', + data + }) +} + +export function saveDeviceLayout(data) { + return request({ + url: 'api/deviceLayout', + method: 'post', + data + }) +} + +export function getMapLayoutList(params) { + return request({ + url: 'api/mapLayout/list', + method: 'get', + params + }) +} + +export function getDeviceLayoutList(params) { + return request({ + url: 'api/deviceLayout/list', + method: 'get', + params + }) +} + +export default { getComponentList, saveMapLayout, saveDeviceLayout, getMapLayoutList, getDeviceLayoutList } diff --git a/acs/nladmin-ui/src/api/layout/mapManage.js b/acs/nladmin-ui/src/api/layout/mapManage.js new file mode 100644 index 0000000..018b9b6 --- /dev/null +++ b/acs/nladmin-ui/src/api/layout/mapManage.js @@ -0,0 +1,27 @@ +import request from '@/utils/request' + +export function getMapList(params) { + return request({ + url: 'api/mapLayout/list', + method: 'get', + params + }) +} + +export function getMapDetail(id) { + return request({ + url: 'api/mapLayout/initLayout', + method: 'get', + params: { id } + }) +} + +export function deleteMap(ids) { + return request({ + url: 'api/mapLayout', + method: 'delete', + data: ids + }) +} + +export default { getMapList, getMapDetail, deleteMap } diff --git a/acs/nladmin-ui/src/api/layout/screen.js b/acs/nladmin-ui/src/api/layout/screen.js new file mode 100644 index 0000000..e2ca05e --- /dev/null +++ b/acs/nladmin-ui/src/api/layout/screen.js @@ -0,0 +1,18 @@ +import request from '@/utils/request' + +export function getMapDetail(id) { + return request({ + url: 'api/mapLayout/initLayout', + method: 'get', + params: { id } + }) +} + +export function getAgvStatus() { + return request({ + url: 'api/mapLayout/status', + method: 'get' + }) +} + +export default { getMapDetail, getAgvStatus } diff --git a/acs/nladmin-ui/src/api/localStorage.js b/acs/nladmin-ui/src/api/localStorage.js new file mode 100644 index 0000000..7cd7928 --- /dev/null +++ b/acs/nladmin-ui/src/api/localStorage.js @@ -0,0 +1,39 @@ +import request from '@/utils/request' + +export function query(params) { + return request({ + url: 'api/localStorage/list', + method: 'get', + params + }) +} + +export function upload(data) { + return request({ + url: 'api/localStorage/upload', + method: 'post', + headers: { + 'Content-Type': 'multipart/form-data' + }, + data + }) +} + +export function download(storageId) { + return request({ + url: 'api/localStorage/download', + method: 'get', + params: { storageId }, + responseType: 'blob' + }) +} + +export function del(ids) { + return request({ + url: 'api/localStorage', + method: 'delete', + data: ids + }) +} + +export default { query, upload, download, del } diff --git a/acs/nladmin-ui/src/views/layout/car/index.vue b/acs/nladmin-ui/src/views/layout/car/index.vue new file mode 100644 index 0000000..8ca67f3 --- /dev/null +++ b/acs/nladmin-ui/src/views/layout/car/index.vue @@ -0,0 +1,407 @@ + + + + + diff --git a/acs/nladmin-ui/src/views/layout/device/index.vue b/acs/nladmin-ui/src/views/layout/device/index.vue new file mode 100644 index 0000000..e0c39a3 --- /dev/null +++ b/acs/nladmin-ui/src/views/layout/device/index.vue @@ -0,0 +1,536 @@ + + + + + diff --git a/acs/nladmin-ui/src/views/layout/map/index.vue b/acs/nladmin-ui/src/views/layout/map/index.vue new file mode 100644 index 0000000..347fd28 --- /dev/null +++ b/acs/nladmin-ui/src/views/layout/map/index.vue @@ -0,0 +1,675 @@ + + + + + diff --git a/acs/nladmin-ui/src/views/layout/mapManage/index.vue b/acs/nladmin-ui/src/views/layout/mapManage/index.vue new file mode 100644 index 0000000..66cf007 --- /dev/null +++ b/acs/nladmin-ui/src/views/layout/mapManage/index.vue @@ -0,0 +1,423 @@ + + + + + diff --git a/acs/nladmin-ui/src/views/layout/screen/index.vue b/acs/nladmin-ui/src/views/layout/screen/index.vue new file mode 100644 index 0000000..2534086 --- /dev/null +++ b/acs/nladmin-ui/src/views/layout/screen/index.vue @@ -0,0 +1,969 @@ + + + + + diff --git a/acs/nladmin-ui/src/views/localStorage/index.vue b/acs/nladmin-ui/src/views/localStorage/index.vue new file mode 100644 index 0000000..07d19c0 --- /dev/null +++ b/acs/nladmin-ui/src/views/localStorage/index.vue @@ -0,0 +1,286 @@ + + + + +