From fb31cec0f5e78e1896803f583dbe7bee98963799 Mon Sep 17 00:00:00 2001 From: Lu-aiLiang <13208981+Lu-aiLiang@user.noreply.gitee.com> Date: Mon, 4 Dec 2023 14:48:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fivegroup/fence/aop/WebLog.java | 26 ++++ .../com/fivegroup/fence/aop/WebLogAspect.java | 122 ++++++++++++++++++ .../fence/controller/WallController.java | 109 ++++++++++++++++ ...Controller.java => WallTagController.java} | 79 +++++++----- .../java/com/fivegroup/fence/domain/Car.java | 116 +++++++++++++++++ .../com/fivegroup/fence/domain/Fence.java | 43 ------ .../com/fivegroup/fence/domain/FenceTag.java | 20 --- .../com/fivegroup/fence/domain/Point.java | 22 ++++ .../java/com/fivegroup/fence/domain/Wall.java | 61 +++++++++ .../com/fivegroup/fence/domain/WallTag.java | 29 +++++ .../fivegroup/fence/domain/in/FenceIn.java | 34 ----- .../fivegroup/fence/domain/out/CarTag.java | 28 ++++ .../fivegroup/fence/domain/req/AddWall.java | 23 ++++ .../fence/domain/req/AddWallTag.java | 25 ++++ .../fivegroup/fence/mapper/FenceMapper.java | 23 ---- .../fivegroup/fence/mapper/WallMapper.java | 32 +++++ .../fivegroup/fence/mapper/WallTagMapper.java | 27 ++++ .../fivegroup/fence/service/FenceService.java | 22 ---- .../fivegroup/fence/service/WallService.java | 31 +++++ .../fence/service/WallTagService.java | 23 ++++ .../fence/service/impl/FenceServiceImpl.java | 64 --------- .../fence/service/impl/WallServiceImpl.java | 110 ++++++++++++++++ .../service/impl/WallTagServiceImpl.java | 82 ++++++++++++ .../src/main/resources/mapper/FenceMapper.xml | 27 ---- .../src/main/resources/mapper/WallMapper.xml | 42 ++++++ .../main/resources/mapper/WallTagMapper.xml | 29 +++++ .../src/main/resources/bootstrap.yml | 2 +- 27 files changed, 982 insertions(+), 269 deletions(-) create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/aop/WebLog.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/aop/WebLogAspect.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/controller/WallController.java rename fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/controller/{FenceController.java => WallTagController.java} (52%) create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Car.java delete mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Fence.java delete mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/FenceTag.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Point.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Wall.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/WallTag.java delete mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/in/FenceIn.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/out/CarTag.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/req/AddWall.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/req/AddWallTag.java delete mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/mapper/FenceMapper.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/mapper/WallMapper.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/mapper/WallTagMapper.java delete mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/FenceService.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/WallService.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/WallTagService.java delete mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/impl/FenceServiceImpl.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/impl/WallServiceImpl.java create mode 100644 fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/impl/WallTagServiceImpl.java delete mode 100644 fivegroup-modules/fivegroup-wall/src/main/resources/mapper/FenceMapper.xml create mode 100644 fivegroup-modules/fivegroup-wall/src/main/resources/mapper/WallMapper.xml create mode 100644 fivegroup-modules/fivegroup-wall/src/main/resources/mapper/WallTagMapper.xml diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/aop/WebLog.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/aop/WebLog.java new file mode 100644 index 0000000..265da1a --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/aop/WebLog.java @@ -0,0 +1,26 @@ +package com.fivegroup.fence.aop; + +/** + * @program: cloud-server + * @description: + * @author: Mr.Wang + * @create: 2023-11-24 21:59 + **/ + +import java.lang.annotation.*; + +/** + * 切面类 + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +@Documented +public @interface WebLog { + /** + * 日志描述信息 + * @return String 日志描述信息 + **/ + String description() default ""; +} + + diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/aop/WebLogAspect.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/aop/WebLogAspect.java new file mode 100644 index 0000000..05ea931 --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/aop/WebLogAspect.java @@ -0,0 +1,122 @@ +package com.fivegroup.fence.aop; + +/** + * @program: cloud-server + * @description: 切面类 + * @author: Mr.Wang + * @create: 2023-11-24 22:00 + **/ + +import com.alibaba.nacos.shaded.com.google.gson.Gson; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Method; + +/** + * 切面类 + */ + +/** + * Servlet日志切面 + */ +@Aspect +@Component +public class WebLogAspect { + + private final static Logger logger=LoggerFactory.getLogger(WebLogAspect.class); + private static final Gson gson=new Gson(); + private static final String LINE_SEPARATOR=System.lineSeparator(); + + /** + * 通过注解@WebLog标记的方法切点 + */ + @Pointcut("@annotation(com.fivegroup.fence.aop.WebLog)") + public void webLog() {} + + /** + * 请求前的日志方法 + * + * @param joinPoint 方法联结点 + */ + @Before("webLog()") + public void doBefore(JoinPoint joinPoint) { + // 开始打印请求日志 + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + if (attributes != null) { + HttpServletRequest request = attributes.getRequest(); + + // 获取 @WebLog 注解的描述信息 + String methodDescription; + try { + methodDescription = getAspectLogDescription(joinPoint); + } catch (Exception e) { + methodDescription = "无法获取方法描述信息"; + logger.error("获取方法描述信息时发生异常: ", e); + } + + // 打印请求相关参数 + logger.info("========================================== Start =========================================="); + logger.info("URL : {}", request.getRequestURL().toString()); + logger.info("描述信息 : {}", methodDescription); + logger.info("HTTP 方法 : {}", request.getMethod()); + logger.info("类方法 : {}.{}", joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName()); + logger.info("IP : {}", request.getRemoteAddr()); + logger.info("请求参数 : {}", gson.toJson(joinPoint.getArgs())); + } + } + + /** + * 请求后的日志方法 + */ + @After("webLog()") + public void doAfter() { + logger.info("=========================================== End ==========================================={}", LINE_SEPARATOR); + } + + /** + * 前置通知,环绕切面方法 + * + * @param proceedingJoinPoint 方法联结点 + * @throws Throwable 异常 + */ + @Around("webLog()") + public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { + long startTime = System.currentTimeMillis(); + Object result = proceedingJoinPoint.proceed(); + logger.info("响应参数 : {}", gson.toJson(result)); + logger.info("时间消耗 : {} ms", System.currentTimeMillis() - startTime); + return result; + } + + /** + * 获取方法描述信息 + * + * @param joinPoint 方法联结点 + * @return 方法描述信息 + * @throws ClassNotFoundException 类未找到异常 + */ + private String getAspectLogDescription(JoinPoint joinPoint) throws ClassNotFoundException { + String targetName = joinPoint.getTarget().getClass().getName(); + String methodName = joinPoint.getSignature().getName(); + Object[] arguments = joinPoint.getArgs(); + Class targetClass = Class.forName(targetName); + Method[] methods = targetClass.getMethods(); + for (Method method : methods) { + if (method.getName().equals(methodName) && method.getParameterTypes().length == arguments.length) { + WebLog webLog = method.getAnnotation(WebLog.class); + if (webLog != null) { + return webLog.description(); + } + } + } + return ""; + } +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/controller/WallController.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/controller/WallController.java new file mode 100644 index 0000000..862a323 --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/controller/WallController.java @@ -0,0 +1,109 @@ +package com.fivegroup.fence.controller; + +import com.alibaba.fastjson.JSONObject; +import com.fivegroup.common.core.domain.Result; +import com.fivegroup.fence.aop.WebLog; +import com.fivegroup.fence.domain.Wall; +import com.fivegroup.fence.domain.WallTag; +import com.fivegroup.fence.domain.req.AddWall; +import com.fivegroup.fence.service.WallService; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * @author LuHaoXiang + * @version 23.11.30 - 20:24 + */ +@RestController +@ResponseBody +@RequestMapping("/wall") +@Log4j2 +public class WallController { + @Autowired + private WallService wallService; + @Autowired + private HttpServletRequest request; + + ; + + /** + * 功能: 围栏全查询 成 列表 + * + * @param + * @return 结果 + */ + @GetMapping("/list") + @WebLog(description = "请求了查询所有电子围栏请求") + public Result> list() { + Result> result = wallService.list(); + return Result.success(result.getData()); + + } + + /** + * 功能: 新增 + * + * @param addWall + * @return 结果 + */ + @PostMapping("/insert") + @WebLog(description = "请求了添加电子围栏请求") + public Result insert(@RequestBody AddWall addWall) { + Result result = wallService.insert(addWall); + return Result.success(); + } + + @PostMapping("/delete/{id}") + @WebLog(description = "删除电子围栏") + public Result delete(@PathVariable Integer id) { + Result result = wallService.delete(id); + return Result.success(); + } + + @PostMapping("/allWallTag") + @WebLog(description = "获取所有电子围栏标签") + public Result> allWallTag() { + Result> result = wallService.allWallTag(); + return result; + } + + /** + * 功能: XXX + * + * @param id + * @return 结果 + */ + @PostMapping("/findTagId/{id}") + @WebLog(description = "获取对应标签下的电子围栏") + public Result> findTagId(@PathVariable Integer id) { + Result> result = wallService.findTagId(id); + return result; + } + + /** + * 功能: 根据车的vi + * @param vin + * @return 结果 + * */ + @PostMapping("/inWall/{vin}") + @WebLog(description = "根据车的vin找到绑定的电子围栏") + public Result> inWall(@PathVariable String vin){ + Result> result = wallService.inWall(vin); + return result; + } + + @PostMapping("/inRedis/{vin}") + @WebLog(description = "根据 车的vin 存入redis") + public Result inRedis(@PathVariable String vin){ + log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】", + request.getRequestURI(), request.getMethod(), vin); + Result result = wallService.inRedis(vin); + log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】", + request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result)); + return result; + } +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/controller/FenceController.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/controller/WallTagController.java similarity index 52% rename from fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/controller/FenceController.java rename to fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/controller/WallTagController.java index 7c8c417..65a0268 100644 --- a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/controller/FenceController.java +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/controller/WallTagController.java @@ -2,9 +2,9 @@ package com.fivegroup.fence.controller; import com.alibaba.fastjson.JSONObject; import com.fivegroup.common.core.domain.Result; -import com.fivegroup.fence.domain.Fence; -import com.fivegroup.fence.domain.in.FenceIn; -import com.fivegroup.fence.service.FenceService; +import com.fivegroup.fence.aop.WebLog; +import com.fivegroup.fence.domain.WallTag; +import com.fivegroup.fence.service.WallTagService; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -14,63 +14,72 @@ import java.util.List; /** * @author LuHaoXiang - * @version 23.11.29 - 18:32 + * @version 23.12.1 - 21:47 */ + @RestController -@RequestMapping("/fence") +@ResponseBody +@RequestMapping("/walltag") @Log4j2 -public class FenceController { +public class WallTagController { @Autowired - private FenceService fenceService; + private WallTagService wallTagService; @Autowired private HttpServletRequest request; - @PostMapping("/allFence") - public Result> allFence() { - log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】", - request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(null)); - Result> result = fenceService.allFence(); - log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】", - request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result)); - return result; - } - /** - * 功能: XXX + * 功能: * - * @param fenceIn + * @param 无 * @return 结果 */ - @PostMapping("/addFence") - public Result addFence(@RequestBody FenceIn fenceIn) { - log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】", - request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(fenceIn)); - Result result = fenceService.addFence(fenceIn); - log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】", - request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result)); + @PostMapping("/list") + @WebLog(description = "下拉空- 全部的电子围栏标签") + public Result> list() { + Result> result = wallTagService.list(); return result; } /** * 功能: XXX - * @param fence + * @param wallTag * @return 结果 * */ - @PostMapping("/updFence") - public Result updFence(@RequestBody Fence fence){ + @PostMapping("/addwalltag") + @WebLog(description = "添加 - 电子围栏标签") + public Result addWallTag(@RequestBody WallTag wallTag){ + Result result = wallTagService.addWallTag(wallTag); + return result; + } + + @PostMapping("/updwalltag") + @WebLog(description = "修改 - 电子围栏标签") + public Result updwalltag(@RequestBody WallTag wallTag){ log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】", - request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(fence)); - Result result = fenceService.updFence(fence); + request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(wallTag)); + Result result = wallTagService.updwalltag(wallTag); log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】", request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result)); return result; } - @PostMapping("/delFence/{id}") - public Result delFence(@PathVariable String id){ + @PostMapping("/delwalltag/{id}") + @WebLog(description = "删除 - 电子围栏标签") + public Result delwalltag(@PathVariable Integer id){ log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】", - request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(id)); - Result result = fenceService.delFence(id); + request.getRequestURI(), request.getMethod(), id); + Result result = wallTagService.delwalltag(id); + log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】", + request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result)); + return result; + } + + @PostMapping("/inWall/{vin}") + @WebLog(description = "判断-- 车与电子围栏的关系") + public Result inWall(@PathVariable String vin){ + log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】", + request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(vin)); + Result result = wallTagService.inWall(vin); log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】", request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result)); return result; diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Car.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Car.java new file mode 100644 index 0000000..d43a53b --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Car.java @@ -0,0 +1,116 @@ +package com.fivegroup.fence.domain; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 车 + * + * @author LuHaoXiang + * @version 23.12.2 - 20:18 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class Car { + /** + * 表id + * */ + private Integer cerId; + /** + * 车 vin + * */ + private String vin; + /** + * 经度 + * */ + private double lng; + /** + * 维度 + * */ + private double lat; + /** + * 车速 + * */ + private String speed; + /** + * 总里程 + * */ + private String mileage; + /** + * 总电压 + * */ + private String voltage; + /** + * 总电流 + * */ + private String current; + /** + * 绝缘电阻 + * */ + + private String resistance; + + /** + * 档位 + * */ + private String grade; + + /** + * 加速踏板行程 + * */ + private String accelerate; + /** + * 制动踏板行程值 + * */ + private String brake; + /** + * 燃料消耗率 + * */ + private String fuelConsumption; + /*** + * 电机转速 + */ + private String motorSpeed; + /*** + * 电机转矩 + */ + + private String motorTorque; + /** + * 电机温度 + * */ + private String motorTemperature; + /** + * 电机电流 + * */ + private String motorCurrent; + /*** + * 动力电池电压 + */ + private String batteryVoltage; + /** + * 当前状态允许最大放电功率 + * */ + private String maxPower; + /** + * 单体最低温度 + * */ + private String minTemperature; + /** + * 车辆状态 + * */ + private String status; + /** + * 充电状态 + * */ + private String chargeStatus; + /** + * + * */ + + +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Fence.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Fence.java deleted file mode 100644 index 824d500..0000000 --- a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Fence.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.fivegroup.fence.domain; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; - -/** - * @author LuHaoXiang - * @version 23.11.29 - 18:37 - */ - -@Data -@Builder -@AllArgsConstructor -public class Fence { - /** - * 围栏id - * */ - @NotEmpty(message = "不能空") - private Integer fenceId; - /** - * 围栏名称 - * */ - @NotEmpty(message = "不能空") - private String fenceName; - /** - * 围栏经纬度 - * */ - @NotEmpty(message = "不能空") - private String lals; - /** - * 行为 - * */ - @NotEmpty(message = "不能空") - private Integer act; - /** - * 状态 - * */ - @NotEmpty(message = "不能空") - private Integer start; -} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/FenceTag.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/FenceTag.java deleted file mode 100644 index be0890b..0000000 --- a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/FenceTag.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.fivegroup.fence.domain; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * @author LuHaoXiang - * @version 23.11.29 - 19:38 - */ - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class FenceTag { - private Integer fenceTapId; - private String fenceTapName; -} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Point.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Point.java new file mode 100644 index 0000000..6378aaf --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Point.java @@ -0,0 +1,22 @@ +package com.fivegroup.fence.domain; + +import lombok.Data; +import lombok.ToString; + +/** + * 经纬度 + * @author LuHaoXiang + * @version 23.11.30 - 20:15 + */ +@Data +@ToString + +public class Point { + private double lng; + private double lat; + + public Point(double lng, double lat) { + this.lng = lng; + this.lat = lat; + } +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Wall.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Wall.java new file mode 100644 index 0000000..407750d --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/Wall.java @@ -0,0 +1,61 @@ +package com.fivegroup.fence.domain; + +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; + +/** + * 围栏实体类 + * + * @author LuHaoXiang + * @version 23.11.30 - 20:06 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("wall") +public class Wall { + @TableId(type = IdType.AUTO) + private Integer wallId; + /** + * 字段属性:围栏名称 + */ + private String wallName; + /** + * 字段属性:围栏数据 + */ + private String wallData; + /**s + * 字段属性:围栏状态 + */ + private Integer status; + /** + * 字段属性:告警类型 + */ + private Integer alarmType; + /** + * 字段属性:围栏标签id + */ + private Integer wallTagId; +// /** +// * 字段属性:创建人 +// */ +// private String createdBy; +// /** +// * 字段属性:创建时间 +// */ +// private Date createdTime; +// /** +// * 字段属性:更新人 +// */ +// private String updatedBy; +// /** +// * 字段属性:更新时间 +// */ +// private Date updatedTime; +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/WallTag.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/WallTag.java new file mode 100644 index 0000000..2a6007f --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/WallTag.java @@ -0,0 +1,29 @@ +package com.fivegroup.fence.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 围栏标签 + * + * @author LuHaoXiang + * @version 23.11.30 - 20:07 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("wall_tag") +public class WallTag { + /** + * + * */ + private String wallTagId; + /** + * + * */ + private String wallTagName; +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/in/FenceIn.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/in/FenceIn.java deleted file mode 100644 index 82cb32f..0000000 --- a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/in/FenceIn.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.fivegroup.fence.domain.in; - -import lombok.Data; - -import javax.validation.constraints.NotEmpty; - -/** - * @author LuHaoXiang - * @version 23.11.29 - 19:06 - */ - -@Data -public class FenceIn { - /** - * 围栏名称 - * */ - @NotEmpty(message = "不能空") - private String fenceName; - /** - * 围栏信息 - * */ - @NotEmpty(message = "不能空") - private String lals; - /** - * 行为 - * */ - @NotEmpty(message = "不能空") - private Integer act; - /** - * 默认 - * */ - @NotEmpty(message = "不能空") - private Integer start = 1; -} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/out/CarTag.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/out/CarTag.java new file mode 100644 index 0000000..14def48 --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/out/CarTag.java @@ -0,0 +1,28 @@ +package com.fivegroup.fence.domain.out; + +import lombok.Data; + +/** + * @author LuHaoXiang + * @version 23.12.1 - 23:54 + */ +@Data +public class CarTag { + /** + * 车id + * */ + private String vin; + /** + * 围栏信息 + * */ + private String lals; + /** + * 经度 + * */ + private String lng; + /** + * 维度 + * */ + private String lag; + +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/req/AddWall.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/req/AddWall.java new file mode 100644 index 0000000..21b86c4 --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/req/AddWall.java @@ -0,0 +1,23 @@ +package com.fivegroup.fence.domain.req; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 添加围栏 + * + * @author LuHaoXiang + * @version 23.11.30 - 20:10 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class AddWall { + private Integer wallId; + private String wallName; + private String wallData; + private Integer status; + private Integer alarmType; + private Integer wallTagId; +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/req/AddWallTag.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/req/AddWallTag.java new file mode 100644 index 0000000..fbaa4e4 --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/domain/req/AddWallTag.java @@ -0,0 +1,25 @@ +package com.fivegroup.fence.domain.req; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author LuHaoXiang + * @version 23.12.1 - 23:48 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class AddWallTag { + /** + * 围栏生成的id + * */ + private Integer wallTagId; + /** + * 围栏名字 + * */ + private String wallTagName; +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/mapper/FenceMapper.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/mapper/FenceMapper.java deleted file mode 100644 index 03f8e99..0000000 --- a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/mapper/FenceMapper.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.fivegroup.fence.mapper; - -import com.fivegroup.fence.domain.Fence; -import com.fivegroup.fence.domain.in.FenceIn; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * @author LuHaoXiang - * @version 23.11.29 - 18:33 - */ -@Mapper -public interface FenceMapper { - List allFence(); - - int addFence(FenceIn fenceIn); - - int updFence(Fence fence); - - int delFence(@Param("id") String id); -} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/mapper/WallMapper.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/mapper/WallMapper.java new file mode 100644 index 0000000..84c81db --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/mapper/WallMapper.java @@ -0,0 +1,32 @@ +package com.fivegroup.fence.mapper; + +import com.fivegroup.common.core.domain.Result; +import com.fivegroup.fence.domain.Wall; +import com.fivegroup.fence.domain.WallTag; +import com.fivegroup.fence.domain.req.AddWall; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author LuHaoXiang + * @version 23.11.30 - 20:26 + */ + +@Mapper +public interface WallMapper { + List list(); + + int insert(AddWall addWall); + + int delete(@Param("id") Integer id); + + List allWallTag(); + + Result> findTagId(@Param("id") Integer id); + + List carWall(String vin); + + List findVinWall(@Param("vin") String vin); +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/mapper/WallTagMapper.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/mapper/WallTagMapper.java new file mode 100644 index 0000000..bc849bd --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/mapper/WallTagMapper.java @@ -0,0 +1,27 @@ +package com.fivegroup.fence.mapper; + +import com.fivegroup.fence.domain.WallTag; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author LuHaoXiang + * @version 23.12.1 - 21:49 + */ + +@Mapper +public interface WallTagMapper { +// 所有的电子围栏标签 + List list(); +//新增电子围栏 + int addWallTag(WallTag wallTag); +// 修改电子围栏 + int updwalltag(WallTag wallTag); +//删除电子围栏 + int delwalltag(@Param("id") Integer id); + +// 查询车辆绑定的电子围栏标签 + List inWall(@Param("vin") String vin); +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/FenceService.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/FenceService.java deleted file mode 100644 index 45c6bf5..0000000 --- a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/FenceService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.fivegroup.fence.service; - -import com.fivegroup.common.core.domain.Result; -import com.fivegroup.fence.domain.Fence; -import com.fivegroup.fence.domain.in.FenceIn; - -import java.util.List; - -/** - * @author LuHaoXiang - * @version 23.11.29 - 18:33 - */ - -public interface FenceService { - Result> allFence(); - - Result addFence(FenceIn fenceIn); - - Result updFence(Fence fence); - - Result delFence(String id); -} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/WallService.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/WallService.java new file mode 100644 index 0000000..2f4acfd --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/WallService.java @@ -0,0 +1,31 @@ +package com.fivegroup.fence.service; + +import com.fivegroup.common.core.domain.Result; +import com.fivegroup.fence.domain.Wall; +import com.fivegroup.fence.domain.WallTag; +import com.fivegroup.fence.domain.req.AddWall; + +import java.util.List; + +/** + * @author LuHaoXiang + * @version 23.11.30 - 20:25 + */ + +public interface WallService { + + Result> list(); + + Result insert(AddWall addWall); + + Result delete(Integer id); + + Result> allWallTag(); + + Result> findTagId(Integer id); + + Result> inWall(String vin); + + Result inRedis(String vin); + +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/WallTagService.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/WallTagService.java new file mode 100644 index 0000000..3cfba0d --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/WallTagService.java @@ -0,0 +1,23 @@ +package com.fivegroup.fence.service; + +import com.fivegroup.common.core.domain.Result; +import com.fivegroup.fence.domain.WallTag; + +import java.util.List; + +/** + * @author LuHaoXiang + * @version 23.12.1 - 21:48 + */ + +public interface WallTagService { + Result> list(); + + Result addWallTag(WallTag wallTag); + + Result updwalltag(WallTag wallTag); + + Result delwalltag(Integer id); + + Result inWall(String vin); +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/impl/FenceServiceImpl.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/impl/FenceServiceImpl.java deleted file mode 100644 index 311330a..0000000 --- a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/impl/FenceServiceImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.fivegroup.fence.service.impl; - -import com.fivegroup.common.core.domain.Result; -import com.fivegroup.fence.domain.Fence; -import com.fivegroup.fence.domain.in.FenceIn; -import com.fivegroup.fence.mapper.FenceMapper; -import com.fivegroup.fence.service.FenceService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * @author LuHaoXiang - * @version 23.11.29 - 18:33 - */ - -@Service -public class FenceServiceImpl implements FenceService { - @Autowired - private FenceMapper fenceMapper; - - @Override - public Result> allFence() { - List list = fenceMapper.allFence(); - return Result.success(list); - } - - @Override - public Result addFence(FenceIn fenceIn) { - int i = fenceMapper.addFence(fenceIn); - if (i != 1){ - return Result.error(); - } - if (i == 1){ - return Result.success(); - } - return Result.error(); - } - - @Override - public Result updFence(Fence fence) { - int i = fenceMapper.updFence(fence); - if (i != 1){ - return Result.error(); - } - if (i == 1){ - return Result.success(); - } - return Result.error(); - } - - @Override - public Result delFence(String id) { - int i = fenceMapper.delFence(id); - if (i != 1){ - return Result.error(); - } - if (i == 1){ - return Result.success(); - } - return Result.error(); - } -} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/impl/WallServiceImpl.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/impl/WallServiceImpl.java new file mode 100644 index 0000000..eb2f749 --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/impl/WallServiceImpl.java @@ -0,0 +1,110 @@ +package com.fivegroup.fence.service.impl; + +import com.fivegroup.common.core.domain.Result; +import com.fivegroup.fence.domain.Wall; +import com.fivegroup.fence.domain.WallTag; +import com.fivegroup.fence.domain.req.AddWall; +import com.fivegroup.fence.mapper.WallMapper; +import com.fivegroup.fence.service.WallService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author LuHaoXiang + * @version 23.11.30 - 20:26 + */ +@Service + +public class WallServiceImpl implements WallService { + @Autowired + private WallMapper wallMapper; + + /** + * @return + */ + @Override + public Result> list() { + List list = wallMapper.list(); + return Result.success(list); + } + + /** + * @param addWall + * @return + */ + @Override + public Result insert(AddWall addWall) { + int i = wallMapper.insert(addWall); + if (i == 1) { + return Result.success("添加成功"); + }else { + return Result.error(); + } + + } + + /** + * @param id + * @return + */ + @Override + public Result delete(Integer id) { + int i = wallMapper.delete(id); + if ( i == 1){ + return Result.success(); + }else { + return Result.error(); + } + } + + /** + * @return + */ + @Override + public Result> allWallTag() { + List list = wallMapper.allWallTag(); + if (list.size() == 0) { + return Result.error(); + } + return Result.success(list); + } + + /** + * @param id + * @return + */ + @Override + public Result> findTagId(Integer id) { + Result> result = wallMapper.findTagId(id); + return result; + } + + /** + * @param vin + * @return + */ + @Override + public Result> inWall(String vin) { + //获取车绑定的电子围栏 + List list = wallMapper.carWall(vin); + if (list.size()== 0) { + return Result.success(null,"该车没有绑定电子围栏"); + } + //判断 + + return Result.success(list); + } + + /** + * @param vin + * @return + */ + @Override + public Result inRedis(String vin) { + return null; + } + + +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/impl/WallTagServiceImpl.java b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/impl/WallTagServiceImpl.java new file mode 100644 index 0000000..4d3268f --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/java/com/fivegroup/fence/service/impl/WallTagServiceImpl.java @@ -0,0 +1,82 @@ +package com.fivegroup.fence.service.impl; + +import com.fivegroup.common.core.domain.Result; +import com.fivegroup.fence.domain.WallTag; +import com.fivegroup.fence.mapper.WallTagMapper; +import com.fivegroup.fence.service.WallTagService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author LuHaoXiang + * @version 23.12.1 - 21:48 + */ + +@Service +public class WallTagServiceImpl implements WallTagService { + + + @Autowired + private WallTagMapper wallTagMapper; + + /** + * @return + */ + @Override + public Result> list() { + List list = wallTagMapper.list(); + return Result.success(list); + } + + /** + * @param wallTag + * @return + */ + @Override + public Result addWallTag(WallTag wallTag) { + int i = wallTagMapper.addWallTag(wallTag); + if (i != 1){ + return Result.error(); + } + return Result.success(); + } + + /** + * @param wallTag + * @return + */ + @Override + public Result updwalltag(WallTag wallTag) { + int i = wallTagMapper.updwalltag(wallTag); + if(i != 1){ + return Result.error(); + } + return Result.success(); + + } + + /** + * @param id + * @return + */ + @Override + public Result delwalltag(Integer id) { + int i = wallTagMapper.delwalltag(id); + if (i != 1){ + return Result.error(); + } + return Result.success(); + } + + /** + * @param vin + * @return + */ + @Override + public Result inWall(String vin) { + List list = wallTagMapper.inWall(vin); + return null; + } +} diff --git a/fivegroup-modules/fivegroup-wall/src/main/resources/mapper/FenceMapper.xml b/fivegroup-modules/fivegroup-wall/src/main/resources/mapper/FenceMapper.xml deleted file mode 100644 index 4ea18b8..0000000 --- a/fivegroup-modules/fivegroup-wall/src/main/resources/mapper/FenceMapper.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - INSERT INTO `boss`.`fence` ( `fence_id`, `fence_name`, `lals`, `act`, `start` ) - VALUES - ( null, #{fenceName}, #{lals}, #{act}, 1 ); - - - UPDATE `boss`.`fence` - SET `fence_name` = #{fenceName}, - `lals` = #{lals}, - `act` = #{lals}, - `start` = #{start} - WHERE - `fence_id` = #{fenceId} - - - DELETE FROM `boss`.`fence` - WHERE - `fence_id` = #{fenceId} - - - - diff --git a/fivegroup-modules/fivegroup-wall/src/main/resources/mapper/WallMapper.xml b/fivegroup-modules/fivegroup-wall/src/main/resources/mapper/WallMapper.xml new file mode 100644 index 0000000..272e7af --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/resources/mapper/WallMapper.xml @@ -0,0 +1,42 @@ + + + + + INSERT INTO `car`.`t_wall` ( `wall_id`, `wall_name`, `wall_data`, `status`, `alarm_type`, `wall_tag_id` ) + VALUES + ( #{wallId}, #{wallName}, #{wallData}, 1, #{alarmType}, #{wallTagId} ); + + + delete + from t_wall + where wall_id = #{id} + + + + + + + + diff --git a/fivegroup-modules/fivegroup-wall/src/main/resources/mapper/WallTagMapper.xml b/fivegroup-modules/fivegroup-wall/src/main/resources/mapper/WallTagMapper.xml new file mode 100644 index 0000000..6f04b4d --- /dev/null +++ b/fivegroup-modules/fivegroup-wall/src/main/resources/mapper/WallTagMapper.xml @@ -0,0 +1,29 @@ + + + + +insert into t_wall_tag + (wall_tag_id,wall_tag_name) +values + (null,#{wallTagName}) + + + update + t_wall_tag + set wall_tag_name = #{wallTagName} + where + wall_tag_id = #{wallTagId} + + + delete from t_wall_tag + where + wall_tag_id = #{id} + + + + + diff --git a/fivegroup-visual/fivegroup-monitor/src/main/resources/bootstrap.yml b/fivegroup-visual/fivegroup-monitor/src/main/resources/bootstrap.yml index 8aee021..5c3cdae 100644 --- a/fivegroup-visual/fivegroup-monitor/src/main/resources/bootstrap.yml +++ b/fivegroup-visual/fivegroup-monitor/src/main/resources/bootstrap.yml @@ -1,6 +1,6 @@ # Tomcat server: - port: 9100 + port: 9101 # Spring spring: