初始化
parent
2716e42716
commit
fb31cec0f5
|
@ -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 "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 "";
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<Wall>> list() {
|
||||||
|
Result<List<Wall>> result = wallService.list();
|
||||||
|
return Result.success(result.getData());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能: 新增
|
||||||
|
*
|
||||||
|
* @param addWall
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/insert")
|
||||||
|
@WebLog(description = "请求了添加电子围栏请求")
|
||||||
|
public Result<String> insert(@RequestBody AddWall addWall) {
|
||||||
|
Result<String> result = wallService.insert(addWall);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/delete/{id}")
|
||||||
|
@WebLog(description = "删除电子围栏")
|
||||||
|
public Result<String> delete(@PathVariable Integer id) {
|
||||||
|
Result<String> result = wallService.delete(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/allWallTag")
|
||||||
|
@WebLog(description = "获取所有电子围栏标签")
|
||||||
|
public Result<List<WallTag>> allWallTag() {
|
||||||
|
Result<List<WallTag>> result = wallService.allWallTag();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能: XXX
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/findTagId/{id}")
|
||||||
|
@WebLog(description = "获取对应标签下的电子围栏")
|
||||||
|
public Result<List<Wall>> findTagId(@PathVariable Integer id) {
|
||||||
|
Result<List<Wall>> result = wallService.findTagId(id);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能: 根据车的vi
|
||||||
|
* @param vin
|
||||||
|
* @return 结果
|
||||||
|
* */
|
||||||
|
@PostMapping("/inWall/{vin}")
|
||||||
|
@WebLog(description = "根据车的vin找到绑定的电子围栏")
|
||||||
|
public Result<List<Wall>> inWall(@PathVariable String vin){
|
||||||
|
Result<List<Wall>> result = wallService.inWall(vin);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/inRedis/{vin}")
|
||||||
|
@WebLog(description = "根据 车的vin 存入redis")
|
||||||
|
public Result<String> inRedis(@PathVariable String vin){
|
||||||
|
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】",
|
||||||
|
request.getRequestURI(), request.getMethod(), vin);
|
||||||
|
Result<String> result = wallService.inRedis(vin);
|
||||||
|
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】",
|
||||||
|
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,9 +2,9 @@ package com.fivegroup.fence.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.fivegroup.common.core.domain.Result;
|
import com.fivegroup.common.core.domain.Result;
|
||||||
import com.fivegroup.fence.domain.Fence;
|
import com.fivegroup.fence.aop.WebLog;
|
||||||
import com.fivegroup.fence.domain.in.FenceIn;
|
import com.fivegroup.fence.domain.WallTag;
|
||||||
import com.fivegroup.fence.service.FenceService;
|
import com.fivegroup.fence.service.WallTagService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -14,63 +14,72 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author LuHaoXiang
|
* @author LuHaoXiang
|
||||||
* @version 23.11.29 - 18:32
|
* @version 23.12.1 - 21:47
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/fence")
|
@ResponseBody
|
||||||
|
@RequestMapping("/walltag")
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class FenceController {
|
public class WallTagController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private FenceService fenceService;
|
private WallTagService wallTagService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private HttpServletRequest request;
|
private HttpServletRequest request;
|
||||||
|
|
||||||
@PostMapping("/allFence")
|
|
||||||
public Result<List<Fence>> allFence() {
|
|
||||||
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】",
|
|
||||||
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(null));
|
|
||||||
Result<List<Fence>> result = fenceService.allFence();
|
|
||||||
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】",
|
|
||||||
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能: XXX
|
* 功能:
|
||||||
*
|
*
|
||||||
* @param fenceIn
|
* @param 无
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/addFence")
|
@PostMapping("/list")
|
||||||
public Result<String> addFence(@RequestBody FenceIn fenceIn) {
|
@WebLog(description = "下拉空- 全部的电子围栏标签")
|
||||||
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】",
|
public Result<List<WallTag>> list() {
|
||||||
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(fenceIn));
|
Result<List<WallTag>> result = wallTagService.list();
|
||||||
Result<String> result = fenceService.addFence(fenceIn);
|
|
||||||
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】",
|
|
||||||
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result));
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能: XXX
|
* 功能: XXX
|
||||||
* @param fence
|
* @param wallTag
|
||||||
* @return 结果
|
* @return 结果
|
||||||
* */
|
* */
|
||||||
@PostMapping("/updFence")
|
@PostMapping("/addwalltag")
|
||||||
public Result<String> updFence(@RequestBody Fence fence){
|
@WebLog(description = "添加 - 电子围栏标签")
|
||||||
|
public Result<String> addWallTag(@RequestBody WallTag wallTag){
|
||||||
|
Result<String> result = wallTagService.addWallTag(wallTag);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/updwalltag")
|
||||||
|
@WebLog(description = "修改 - 电子围栏标签")
|
||||||
|
public Result<String> updwalltag(@RequestBody WallTag wallTag){
|
||||||
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】",
|
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】",
|
||||||
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(fence));
|
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(wallTag));
|
||||||
Result<String> result = fenceService.updFence(fence);
|
Result<String> result = wallTagService.updwalltag(wallTag);
|
||||||
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】",
|
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】",
|
||||||
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result));
|
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/delFence/{id}")
|
@PostMapping("/delwalltag/{id}")
|
||||||
public Result<String> delFence(@PathVariable String id){
|
@WebLog(description = "删除 - 电子围栏标签")
|
||||||
|
public Result<String> delwalltag(@PathVariable Integer id){
|
||||||
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】",
|
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】",
|
||||||
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(id));
|
request.getRequestURI(), request.getMethod(), id);
|
||||||
Result<String> result = fenceService.delFence(id);
|
Result<String> result = wallTagService.delwalltag(id);
|
||||||
|
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】",
|
||||||
|
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/inWall/{vin}")
|
||||||
|
@WebLog(description = "判断-- 车与电子围栏的关系")
|
||||||
|
public Result<String> inWall(@PathVariable String vin){
|
||||||
|
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,请求参数:【{}】",
|
||||||
|
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(vin));
|
||||||
|
Result<String> result = wallTagService.inWall(vin);
|
||||||
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】",
|
log.info("功能:XXX,请求URI:【{}】,请求方式:【{}】,响应结果:【{}】",
|
||||||
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result));
|
request.getRequestURI(), request.getMethod(), JSONObject.toJSONString(result));
|
||||||
return result;
|
return result;
|
|
@ -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;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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<Fence> allFence();
|
|
||||||
|
|
||||||
int addFence(FenceIn fenceIn);
|
|
||||||
|
|
||||||
int updFence(Fence fence);
|
|
||||||
|
|
||||||
int delFence(@Param("id") String id);
|
|
||||||
}
|
|
|
@ -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<Wall> list();
|
||||||
|
|
||||||
|
int insert(AddWall addWall);
|
||||||
|
|
||||||
|
int delete(@Param("id") Integer id);
|
||||||
|
|
||||||
|
List<WallTag> allWallTag();
|
||||||
|
|
||||||
|
Result<List<Wall>> findTagId(@Param("id") Integer id);
|
||||||
|
|
||||||
|
List<Wall> carWall(String vin);
|
||||||
|
|
||||||
|
List<Wall> findVinWall(@Param("vin") String vin);
|
||||||
|
}
|
|
@ -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<WallTag> list();
|
||||||
|
//新增电子围栏
|
||||||
|
int addWallTag(WallTag wallTag);
|
||||||
|
// 修改电子围栏
|
||||||
|
int updwalltag(WallTag wallTag);
|
||||||
|
//删除电子围栏
|
||||||
|
int delwalltag(@Param("id") Integer id);
|
||||||
|
|
||||||
|
// 查询车辆绑定的电子围栏标签
|
||||||
|
List<WallTag> inWall(@Param("vin") String vin);
|
||||||
|
}
|
|
@ -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<List<Fence>> allFence();
|
|
||||||
|
|
||||||
Result<String> addFence(FenceIn fenceIn);
|
|
||||||
|
|
||||||
Result<String> updFence(Fence fence);
|
|
||||||
|
|
||||||
Result<String> delFence(String id);
|
|
||||||
}
|
|
|
@ -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<Wall>> list();
|
||||||
|
|
||||||
|
Result<String> insert(AddWall addWall);
|
||||||
|
|
||||||
|
Result<String> delete(Integer id);
|
||||||
|
|
||||||
|
Result<List<WallTag>> allWallTag();
|
||||||
|
|
||||||
|
Result<List<Wall>> findTagId(Integer id);
|
||||||
|
|
||||||
|
Result<List<Wall>> inWall(String vin);
|
||||||
|
|
||||||
|
Result<String> inRedis(String vin);
|
||||||
|
|
||||||
|
}
|
|
@ -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<WallTag>> list();
|
||||||
|
|
||||||
|
Result<String> addWallTag(WallTag wallTag);
|
||||||
|
|
||||||
|
Result<String> updwalltag(WallTag wallTag);
|
||||||
|
|
||||||
|
Result<String> delwalltag(Integer id);
|
||||||
|
|
||||||
|
Result<String> inWall(String vin);
|
||||||
|
}
|
|
@ -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<List<Fence>> allFence() {
|
|
||||||
List<Fence> list = fenceMapper.allFence();
|
|
||||||
return Result.success(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<String> 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<String> 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<String> delFence(String id) {
|
|
||||||
int i = fenceMapper.delFence(id);
|
|
||||||
if (i != 1){
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
if (i == 1){
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
return Result.error();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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<Wall>> list() {
|
||||||
|
List<Wall> list = wallMapper.list();
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param addWall
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<String> insert(AddWall addWall) {
|
||||||
|
int i = wallMapper.insert(addWall);
|
||||||
|
if (i == 1) {
|
||||||
|
return Result.success("添加成功");
|
||||||
|
}else {
|
||||||
|
return Result.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<String> delete(Integer id) {
|
||||||
|
int i = wallMapper.delete(id);
|
||||||
|
if ( i == 1){
|
||||||
|
return Result.success();
|
||||||
|
}else {
|
||||||
|
return Result.error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<List<WallTag>> allWallTag() {
|
||||||
|
List<WallTag> list = wallMapper.allWallTag();
|
||||||
|
if (list.size() == 0) {
|
||||||
|
return Result.error();
|
||||||
|
}
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<List<Wall>> findTagId(Integer id) {
|
||||||
|
Result<List<Wall>> result = wallMapper.findTagId(id);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param vin
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<List<Wall>> inWall(String vin) {
|
||||||
|
//获取车绑定的电子围栏
|
||||||
|
List<Wall> list = wallMapper.carWall(vin);
|
||||||
|
if (list.size()== 0) {
|
||||||
|
return Result.success(null,"该车没有绑定电子围栏");
|
||||||
|
}
|
||||||
|
//判断
|
||||||
|
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param vin
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<String> inRedis(String vin) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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<WallTag>> list() {
|
||||||
|
List<WallTag> list = wallTagMapper.list();
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param wallTag
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<String> addWallTag(WallTag wallTag) {
|
||||||
|
int i = wallTagMapper.addWallTag(wallTag);
|
||||||
|
if (i != 1){
|
||||||
|
return Result.error();
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param wallTag
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<String> updwalltag(WallTag wallTag) {
|
||||||
|
int i = wallTagMapper.updwalltag(wallTag);
|
||||||
|
if(i != 1){
|
||||||
|
return Result.error();
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<String> delwalltag(Integer id) {
|
||||||
|
int i = wallTagMapper.delwalltag(id);
|
||||||
|
if (i != 1){
|
||||||
|
return Result.error();
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param vin
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<String> inWall(String vin) {
|
||||||
|
List<WallTag> list = wallTagMapper.inWall(vin);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,27 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.fivegroup.fence.mapper.FenceMapper">
|
|
||||||
<insert id="addFence">
|
|
||||||
INSERT INTO `boss`.`fence` ( `fence_id`, `fence_name`, `lals`, `act`, `start` )
|
|
||||||
VALUES
|
|
||||||
( null, #{fenceName}, #{lals}, #{act}, 1 );
|
|
||||||
</insert>
|
|
||||||
<update id="updFence">
|
|
||||||
UPDATE `boss`.`fence`
|
|
||||||
SET `fence_name` = #{fenceName},
|
|
||||||
`lals` = #{lals},
|
|
||||||
`act` = #{lals},
|
|
||||||
`start` = #{start}
|
|
||||||
WHERE
|
|
||||||
`fence_id` = #{fenceId}
|
|
||||||
</update>
|
|
||||||
<delete id="delFence">
|
|
||||||
DELETE FROM `boss`.`fence`
|
|
||||||
WHERE
|
|
||||||
`fence_id` = #{fenceId}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<select id="allFence" resultType="com.fivegroup.fence.domain.Fence">
|
|
||||||
SELECT * FROM fence
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.fivegroup.fence.mapper.WallMapper">
|
||||||
|
<insert id="insert">
|
||||||
|
INSERT INTO `car`.`t_wall` ( `wall_id`, `wall_name`, `wall_data`, `status`, `alarm_type`, `wall_tag_id` )
|
||||||
|
VALUES
|
||||||
|
( #{wallId}, #{wallName}, #{wallData}, 1, #{alarmType}, #{wallTagId} );
|
||||||
|
</insert>
|
||||||
|
<delete id="delete">
|
||||||
|
delete
|
||||||
|
from t_wall
|
||||||
|
where wall_id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="list" resultType="com.fivegroup.fence.domain.Wall">
|
||||||
|
SELECT * FROM t_wall
|
||||||
|
</select>
|
||||||
|
<select id="allWallTag" resultType="com.fivegroup.fence.domain.WallTag">
|
||||||
|
SELECT * FROM t_wall_tag
|
||||||
|
</select>
|
||||||
|
<select id="findTagId" resultType="java.util.List">
|
||||||
|
SELECT
|
||||||
|
w.*
|
||||||
|
FROM
|
||||||
|
t_wall_and_tag wat
|
||||||
|
left join t_wall w on wat.wall_id = w.wall_id
|
||||||
|
where
|
||||||
|
wat.tag_id = #{id}
|
||||||
|
</select>
|
||||||
|
<select id="carWall" resultType="com.fivegroup.fence.domain.Wall">
|
||||||
|
SELECT
|
||||||
|
w.*
|
||||||
|
FROM
|
||||||
|
t_tag_car tc
|
||||||
|
LEFT JOIN t_wall_and_tag wat ON tc.tag_id = wat.tag_id
|
||||||
|
LEFT JOIN t_wall w ON w.wall_id = wat.wall_id
|
||||||
|
where tc.car_id = #{vin}
|
||||||
|
</select>
|
||||||
|
<select id="findVinWall" resultType="com.fivegroup.fence.domain.Wall">
|
||||||
|
select * from t_tag_wall where car_id = #{vin}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.fivegroup.fence.mapper.WallTagMapper">
|
||||||
|
<insert id="addWallTag">
|
||||||
|
insert into t_wall_tag
|
||||||
|
(wall_tag_id,wall_tag_name)
|
||||||
|
values
|
||||||
|
(null,#{wallTagName})
|
||||||
|
</insert>
|
||||||
|
<update id="updwalltag">
|
||||||
|
update
|
||||||
|
t_wall_tag
|
||||||
|
set wall_tag_name = #{wallTagName}
|
||||||
|
where
|
||||||
|
wall_tag_id = #{wallTagId}
|
||||||
|
</update>
|
||||||
|
<delete id="delwalltag">
|
||||||
|
delete from t_wall_tag
|
||||||
|
where
|
||||||
|
wall_tag_id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="list" resultType="com.fivegroup.fence.domain.WallTag">
|
||||||
|
SELECT * FROM t_wall
|
||||||
|
</select>
|
||||||
|
<select id="inWall" resultType="com.fivegroup.fence.domain.WallTag">
|
||||||
|
SELECT
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 9100
|
port: 9101
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
Loading…
Reference in New Issue