fix():重构电子围栏以及围栏组
parent
b66e38d021
commit
0619a5102c
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.53.251:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: four
|
||||
namespace: lgy
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.53.251:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: four
|
||||
namespace: lgy
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.53.251:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: four
|
||||
namespace: lgy
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.53.251:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: four
|
||||
namespace: lgy
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.muyu.fence;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 系统模块
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
//@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class CloudElectronicFenceApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(CloudElectronicFenceApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
package com.muyu.fence.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.fence.domain.database.ElectronicFence;
|
||||
import com.muyu.fence.domain.database.ElectronicFenceGroup;
|
||||
import com.muyu.fence.domain.req.FenceWayReq;
|
||||
import com.muyu.fence.domain.req.ElectroicFenceAddReq;
|
||||
import com.muyu.fence.domain.req.ElectroicFenceListReq;
|
||||
import com.muyu.fence.domain.req.ElectroicFenceUpdReq;
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceResp;
|
||||
import com.muyu.fence.service.ElectronicFenceService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.controller
|
||||
* @Project:cloud-server
|
||||
* @name:FenceEtlController
|
||||
* @Date:2024/9/17 16:28
|
||||
*/
|
||||
@Log4j2
|
||||
@Tag(name = "电子围栏")
|
||||
@RestController
|
||||
@RequestMapping("/fence")
|
||||
@RequiredArgsConstructor
|
||||
public class ElectronicFenceController {
|
||||
|
||||
@Autowired
|
||||
private ElectronicFenceService electronicFenceService;
|
||||
|
||||
|
||||
@PostMapping("/fenceArray")
|
||||
@Operation(description = "查询所有可用的围栏")
|
||||
public Result<List<ElectronicFenceResp>> fenceArray() {
|
||||
System.out.println("=====>" + "hgfvhgjy");
|
||||
return Result.success(electronicFenceService.fenceArray());
|
||||
}
|
||||
|
||||
@PostMapping("/fenceselectList")
|
||||
@Operation(description = "列表")
|
||||
public Result<List<ElectronicFenceResp>> fenceselectList(@RequestBody ElectroicFenceListReq electroicFenceListReq) {
|
||||
System.out.println("=====>" + "hgfvhgjy");
|
||||
return Result.success(electronicFenceService.fenceselectList(electroicFenceListReq));
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(description = "添加")
|
||||
public Result AddFence(@RequestBody ElectroicFenceAddReq electroicFenceAddReq) {
|
||||
|
||||
electronicFenceService.unquireFence(electroicFenceAddReq.getName());
|
||||
electronicFenceService.AddFence(electroicFenceAddReq);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/upd/{id}")
|
||||
@Operation(description = "修改")
|
||||
public Result UpdFence(@PathVariable("id") Long id, @RequestBody ElectroicFenceUpdReq electroicFenceUpdReq) {
|
||||
|
||||
electronicFenceService.updateById(ElectronicFence.buildByElectronicUpd(electroicFenceUpdReq, () -> id));
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/findElectronicByid/{id}")
|
||||
@Operation(description = "通过id回显围栏信息")
|
||||
public Result<ElectronicFence> findElectronicByid(@PathVariable("id") Long id) {
|
||||
|
||||
ElectronicFence electronicFence= electronicFenceService.findElectronicByid(id);
|
||||
return Result.success(electronicFence);
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/delElectronById/{id}")
|
||||
@Operation(description = "通过id删除围栏")
|
||||
public Result delElectronById(@PathVariable("id") Long id) {
|
||||
|
||||
electronicFenceService.delElectronById(id);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/open/{id}")
|
||||
@Operation(description = "开启围栏")
|
||||
public Result openFence(@PathVariable("id") Long id) {
|
||||
|
||||
electronicFenceService.openFence(id);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/close/{id}")
|
||||
@Operation(description = "关闭围栏")
|
||||
public Result closeFence(@PathVariable("id") Long id) {
|
||||
|
||||
electronicFenceService.closeFence(id);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/setFenceWay")
|
||||
@Operation(description = "设置电子围栏的位置")
|
||||
public Result setFenceWay(@RequestBody FenceWayReq fenceWayReq) {
|
||||
|
||||
Long id = fenceWayReq.getId();
|
||||
|
||||
String longitudeLatitude = fenceWayReq.getLongitudeLatitude();
|
||||
|
||||
log.info("接收到的数据,:{}" + id + "====" + longitudeLatitude);
|
||||
|
||||
electronicFenceService.setFenceWay(id, longitudeLatitude);
|
||||
|
||||
return Result.success();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package com.muyu.fence.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.fence.domain.database.ElectronicFence;
|
||||
import com.muyu.fence.domain.database.ElectronicFenceGroup;
|
||||
import com.muyu.fence.domain.req.*;
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceGroupResp;
|
||||
import com.muyu.fence.domain.resp.GroupFenceListresp;
|
||||
import com.muyu.fence.service.ElectronicFenceGroupService;
|
||||
import com.muyu.fence.service.FenceGroupMidService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.controller
|
||||
* @Project:cloud-server
|
||||
* @name:FenceGroupController
|
||||
* @Date:2024/9/18 15:15
|
||||
*/
|
||||
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/group")
|
||||
@Tag(name = "围栏组")
|
||||
public class ElectronicFenceGroupController {
|
||||
|
||||
@Autowired
|
||||
private ElectronicFenceGroupService electronicFenceGroupService;
|
||||
|
||||
@Autowired
|
||||
private FenceGroupMidService fenceGroupMidService;
|
||||
|
||||
|
||||
@PostMapping("/selectGroupList")
|
||||
public Result<List<GroupFenceListresp>> selectGroupList(@RequestBody ElectronicFenceGroupListReq req) {
|
||||
//查询所有的围栏组
|
||||
List<ElectronicFenceGroup> fenceListList = electronicFenceGroupService.selectGroupList(req);
|
||||
|
||||
List<GroupFenceListresp> list = fenceListList.stream().map(ElectronicFenceGroup::buildGroupFence).toList();
|
||||
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@PostMapping("/addGroup")
|
||||
public Result addGroup(@RequestBody ElectronicFenceGroupAddReq addReq) {
|
||||
|
||||
ElectronicFenceGroup electronicFenceGroup = ElectronicFenceGroup.buildByAdd(addReq);
|
||||
//添加围栏组返回添加后的主键自增id
|
||||
electronicFenceGroupService.save(electronicFenceGroup);
|
||||
Long id = electronicFenceGroup.getId();
|
||||
//添加中间表
|
||||
fenceGroupMidService.addGroupAndFenceMid(id, addReq.getElectronicFenceRespList());
|
||||
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/findGroupByid/{id}")
|
||||
@Operation(description = "通过id回显围栏组信息")
|
||||
public Result<ElectronicFenceGroupResp> findGroupByid(@PathVariable("id") Long id) {
|
||||
|
||||
ElectronicFenceGroupResp fenceGroupResp = electronicFenceGroupService.findGroupByid(id);
|
||||
return Result.success(fenceGroupResp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
@PostMapping("/updGroup/{id}")
|
||||
@Operation(description = "修改")
|
||||
public Result UpdFence(@PathVariable("id") Long id, @RequestBody ElectronicFenceGroupUpdReq req) {
|
||||
|
||||
electronicFenceGroupService.updateById(ElectronicFenceGroup.buildByUpd(req, () -> id));
|
||||
|
||||
if (!CollectionUtils.isEmpty(req.getElectronicFenceRespList())) {
|
||||
//删除中间表
|
||||
fenceGroupMidService.deliteMid(id);
|
||||
//增加中间表
|
||||
fenceGroupMidService.addGroupAndFenceMid(id, req.getElectronicFenceRespList());
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
package com.muyu.fence.domain.database;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.fence.domain.req.ElectroicFenceAddReq;
|
||||
import com.muyu.fence.domain.req.ElectroicFenceUpdReq;
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceResp;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain
|
||||
* @Project:cloud-server
|
||||
* @name:ElectronicFence
|
||||
* @Date:2024/9/17 16:34
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@SuperBuilder
|
||||
@TableName(value = "electronic_fence",autoResultMap = true)
|
||||
public class ElectronicFence extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 围栏类型
|
||||
*/
|
||||
|
||||
private String fenceType;
|
||||
|
||||
/**
|
||||
*经纬度信息
|
||||
*/
|
||||
|
||||
private String longitudeLatitude;
|
||||
|
||||
/**
|
||||
* 电子围栏状态(正常,停用)
|
||||
*/
|
||||
|
||||
private String status;
|
||||
|
||||
// /**
|
||||
// * 电子围栏的开始时间
|
||||
// */
|
||||
//
|
||||
// private Date startTime;
|
||||
// /**
|
||||
// * 电子围栏的结束时间
|
||||
// */
|
||||
// private Date endTime;
|
||||
|
||||
/**
|
||||
* 描述信息
|
||||
*/
|
||||
|
||||
private String fenceDesc;
|
||||
|
||||
public static ElectronicFenceResp bullerResp(ElectronicFence electronicFence){
|
||||
|
||||
return ElectronicFenceResp.builder()
|
||||
.id(electronicFence.getId())
|
||||
.name(electronicFence.getName())
|
||||
.status(electronicFence.getStatus())
|
||||
.fenceType(electronicFence.getFenceType())
|
||||
.longitudeLatitude(electronicFence.getLongitudeLatitude())
|
||||
.desc(electronicFence.getFenceDesc())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
public static ElectronicFence buildElectroicAdd(ElectroicFenceAddReq electroicFenceAddReq){
|
||||
|
||||
return ElectronicFence.builder()
|
||||
.name(electroicFenceAddReq.getName())
|
||||
.fenceDesc(electroicFenceAddReq.getFenceDesc())
|
||||
.status(electroicFenceAddReq.getStatus())
|
||||
.longitudeLatitude(electroicFenceAddReq.getLongitudeLatitude())
|
||||
.fenceType(electroicFenceAddReq.getFenceType())
|
||||
.build();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static ElectronicFence buildByElectronicUpd(ElectroicFenceUpdReq electroicFenceUpdReq, Supplier<Long> longSupplier){
|
||||
|
||||
return ElectronicFence.builder()
|
||||
.id(longSupplier.get())
|
||||
.name(electroicFenceUpdReq.getName())
|
||||
.status(electroicFenceUpdReq.getStatus())
|
||||
.fenceDesc(electroicFenceUpdReq.getFenceDesc())
|
||||
.longitudeLatitude(electroicFenceUpdReq.getLongitudeLatitude())
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
package com.muyu.fence.domain.database;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.fence.domain.req.ElectronicFenceGroupAddReq;
|
||||
import com.muyu.fence.domain.req.ElectronicFenceGroupUpdReq;
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceGroupResp;
|
||||
import com.muyu.fence.domain.resp.GroupFenceListresp;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain
|
||||
* @Project:cloud-server
|
||||
* @name:ElectronicFenceGroup
|
||||
* @Date:2024/9/18 11:14
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@TableName(value = "electronic_fence_group",autoResultMap = true)
|
||||
public class ElectronicFenceGroup extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 围栏组优先级
|
||||
*/
|
||||
private Integer priority;
|
||||
/**
|
||||
* 围栏组名称
|
||||
*/
|
||||
private String groupName;
|
||||
/**
|
||||
* 围栏组类型
|
||||
*/
|
||||
private String groupType;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
public static GroupFenceListresp buildGroupFence(ElectronicFenceGroup electronicFenceGroup){
|
||||
|
||||
return GroupFenceListresp.builder()
|
||||
.id(electronicFenceGroup.getId())
|
||||
.groupName(electronicFenceGroup.groupName)
|
||||
.priority(electronicFenceGroup.getPriority())
|
||||
.status(electronicFenceGroup.getStatus())
|
||||
.groupType(electronicFenceGroup.groupType)
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static ElectronicFenceGroupResp buildElectronicFenceGroupResp (ElectronicFenceGroup electronicFenceGroup){
|
||||
|
||||
return ElectronicFenceGroupResp.builder()
|
||||
.id(electronicFenceGroup.getId())
|
||||
.groupName(electronicFenceGroup.groupName)
|
||||
.priority(electronicFenceGroup.getPriority())
|
||||
.status(electronicFenceGroup.getStatus())
|
||||
.groupType(electronicFenceGroup.groupType)
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
public static ElectronicFenceGroup buildByAdd(ElectronicFenceGroupAddReq addReq){
|
||||
|
||||
|
||||
return ElectronicFenceGroup.builder()
|
||||
.groupName(addReq.getGroupName())
|
||||
.groupType(addReq.getGroupType())
|
||||
.status(addReq.getStatus())
|
||||
.priority(addReq.getPriority())
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
public static ElectronicFenceGroup buildByUpd(ElectronicFenceGroupUpdReq updReq, Supplier<Long> ids){
|
||||
|
||||
|
||||
return ElectronicFenceGroup.builder()
|
||||
.id(ids.get())
|
||||
.groupName(updReq.getGroupName())
|
||||
.groupType(updReq.getGroupType())
|
||||
.status(updReq.getStatus())
|
||||
.priority(updReq.getPriority())
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.fence.domain.database;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain
|
||||
* @Project:cloud-server
|
||||
* @name:FenceGroupMid
|
||||
* @Date:2024/9/19 21:01
|
||||
*/
|
||||
@Tag(name = "围栏组连接表")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "fence_group_mid",autoResultMap = true)
|
||||
public class FenceGroupMid {
|
||||
|
||||
/**
|
||||
* 中间表的自增
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
private Long groupId;
|
||||
private Long fenceId;
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package com.muyu.fence.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain.req
|
||||
* @Project:cloud-server
|
||||
* @name:ElectroicAdd
|
||||
* @Date:2024/9/17 20:53
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ElectroicFenceAddReq {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 围栏类型(驶入,驶出)
|
||||
*/
|
||||
|
||||
private String fenceType;
|
||||
|
||||
/**
|
||||
*经纬度信息
|
||||
*/
|
||||
|
||||
private String longitudeLatitude;
|
||||
|
||||
/**
|
||||
* 电子围栏状态(正常,停用)
|
||||
*/
|
||||
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 描述信息
|
||||
*/
|
||||
|
||||
private String fenceDesc;
|
||||
|
||||
/**
|
||||
* 电子围栏的开始时间
|
||||
*/
|
||||
|
||||
private Date startTime;
|
||||
/**
|
||||
* 电子围栏的结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.muyu.fence.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain.req
|
||||
* @Project:cloud-server
|
||||
* @name:ElectroicFenceReq
|
||||
* @Date:2024/9/17 20:04
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ElectroicFenceListReq {
|
||||
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 围栏类型(驶入,驶出)
|
||||
*/
|
||||
|
||||
private String fenceType;
|
||||
|
||||
/**
|
||||
*经纬度信息
|
||||
*/
|
||||
|
||||
private String longitudeLatitude;
|
||||
|
||||
/**
|
||||
* 电子围栏状态(正常,停用)
|
||||
*/
|
||||
|
||||
private String status;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 电子围栏的开始时间
|
||||
*/
|
||||
|
||||
private Date startTime;
|
||||
/**
|
||||
* 电子围栏的结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.muyu.fence.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain.req
|
||||
* @Project:cloud-server
|
||||
* @name:ElectroicFenceUpdReq
|
||||
* @Date:2024/9/17 21:03
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ElectroicFenceUpdReq {
|
||||
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 围栏类型(驶入,驶出)
|
||||
*/
|
||||
|
||||
private String fenceType;
|
||||
|
||||
/**
|
||||
*经纬度信息
|
||||
*/
|
||||
|
||||
private String longitudeLatitude;
|
||||
|
||||
/**
|
||||
* 电子围栏状态(正常,停用)
|
||||
*/
|
||||
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 描述信息
|
||||
*/
|
||||
|
||||
private String fenceDesc;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.muyu.fence.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceResp;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain.req
|
||||
* @Project:cloud-server
|
||||
* @name:ElectronicFenceGroupAddReq
|
||||
* @Date:2024/9/20 19:14
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ElectronicFenceGroupAddReq {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 围栏组优先级
|
||||
*/
|
||||
private Integer priority;
|
||||
/**
|
||||
* 围栏组名称
|
||||
*/
|
||||
private String groupName;
|
||||
/**
|
||||
* 围栏组类型
|
||||
*/
|
||||
private String groupType;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 选中围栏
|
||||
*/
|
||||
|
||||
List<ElectronicFenceResp> electronicFenceRespList;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.muyu.fence.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain.req
|
||||
* @Project:cloud-server
|
||||
* @name:ElectronicFenceGroupListReq
|
||||
* @Date:2024/9/20 16:06
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ElectronicFenceGroupListReq {
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 围栏组优先级
|
||||
*/
|
||||
private Integer priority;
|
||||
/**
|
||||
* 围栏组名称
|
||||
*/
|
||||
private String groupName;
|
||||
/**
|
||||
* 围栏组类型
|
||||
*/
|
||||
private String groupType;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.muyu.fence.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceResp;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain.req
|
||||
* @Project:cloud-server
|
||||
* @name:ElectronicFenceGroupAddReq
|
||||
* @Date:2024/9/20 19:14
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ElectronicFenceGroupUpdReq {
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 围栏组优先级
|
||||
*/
|
||||
private Integer priority;
|
||||
/**
|
||||
* 围栏组名称
|
||||
*/
|
||||
private String groupName;
|
||||
/**
|
||||
* 围栏组类型
|
||||
*/
|
||||
private String groupType;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
/**
|
||||
* 选中围栏
|
||||
*/
|
||||
List<ElectronicFenceResp> electronicFenceRespList;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.fence.domain.req;
|
||||
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceResp;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain.req
|
||||
* @Project:cloud-server
|
||||
* @name:FenceAndGroupBoundReq
|
||||
* @Date:2024/9/21 9:05
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "用于绑定围栏和围栏组的请求")
|
||||
public class FenceAndGroupBoundReq {
|
||||
/**
|
||||
* 围栏组的主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 选中的围栏
|
||||
*/
|
||||
|
||||
private List<ElectronicFenceResp> electronicFenceRespList;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.fence.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain
|
||||
* @Project:cloud-server
|
||||
* @name:FenceWay
|
||||
* @Date:2024/9/20 9:27
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FenceWayReq {
|
||||
private Long id;
|
||||
private String longitudeLatitude;
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.muyu.fence.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain.resp
|
||||
* @Project:cloud-server
|
||||
* @name:ElectronicFenceGroupResp
|
||||
* @Date:2024/9/22 10:22
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Tag(name = "回显围栏组及绑定的电子围栏")
|
||||
public class ElectronicFenceGroupResp {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 围栏组优先级
|
||||
*/
|
||||
private Integer priority;
|
||||
/**
|
||||
* 围栏组名称
|
||||
*/
|
||||
private String groupName;
|
||||
/**
|
||||
* 围栏组类型
|
||||
*/
|
||||
private String groupType;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
/**
|
||||
* 绑定的电子围栏
|
||||
*/
|
||||
List<ElectronicFenceResp> electronicFenceRespList;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.muyu.fence.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain
|
||||
* @Project:cloud-server
|
||||
* @name:ElectronicFence
|
||||
* @Date:2024/9/17 16:34
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ElectronicFenceResp {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 围栏类型(驶入,驶出)
|
||||
*/
|
||||
|
||||
private String fenceType;
|
||||
|
||||
/**
|
||||
*经纬度信息
|
||||
*/
|
||||
|
||||
private String longitudeLatitude;
|
||||
|
||||
/**
|
||||
* 电子围栏状态(正常,停用)
|
||||
*/
|
||||
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 描述信息
|
||||
*/
|
||||
|
||||
private String desc;
|
||||
|
||||
//private String groupType;
|
||||
//
|
||||
//private int priority;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.muyu.fence.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain.req
|
||||
* @Project:cloud-server
|
||||
* @name:GroupFenceListresp
|
||||
* @Date:2024/9/20 9:04
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Tag(name = "围栏组列表")
|
||||
public class GroupFenceListresp {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 围栏组优先级
|
||||
*/
|
||||
private Integer priority;
|
||||
/**
|
||||
* 围栏组名称
|
||||
*/
|
||||
private String groupName;
|
||||
/**
|
||||
* 围栏组类型
|
||||
*/
|
||||
private String groupType;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package com.muyu.fence.domain.utils;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain
|
||||
* @Project:cloud-server
|
||||
* @name:ElectricFenceModel
|
||||
* @Date:2024/9/17 17:27
|
||||
*/
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 电子围栏规则计算模型
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ElectricFenceModel implements Comparable<ElectricFenceModel> {
|
||||
//车架号
|
||||
private String vin = "";
|
||||
//电子围栏结果表UUID
|
||||
private Long uuid = -999999L;
|
||||
//上次状态 0 里面 1 外面
|
||||
private int lastStatus = -999999;
|
||||
//当前状态 0 里面 1 外面
|
||||
private int nowStatus = -999999;
|
||||
//位置时间 yyyy-MM-dd HH:mm:ss
|
||||
private String gpsTime = "";
|
||||
//位置纬度--
|
||||
private Double lat = -999999D;
|
||||
//位置经度--
|
||||
private Double lng = -999999D;
|
||||
//电子围栏ID
|
||||
private int eleId = -999999;
|
||||
//电子围栏名称
|
||||
private String eleName = "";
|
||||
//中心点地址
|
||||
private String address = "";
|
||||
//中心点纬度
|
||||
private Double latitude;
|
||||
//中心点经度
|
||||
private Double longitude = -999999D;
|
||||
//电子围栏半径
|
||||
private Float radius = -999999F;
|
||||
//出围栏时间
|
||||
private String outEleTime = null;
|
||||
//进围栏时间
|
||||
private String inEleTime = null;
|
||||
//是否在mysql结果表中
|
||||
private Boolean inMysql = false;
|
||||
//状态报警 0:出围栏 1:进围栏
|
||||
private int statusAlarm = -999999;
|
||||
//报警信息
|
||||
private String statusAlarmMsg = "";
|
||||
//终端时间
|
||||
private String terminalTime = "";
|
||||
// 扩展字段 终端时间
|
||||
private Long terminalTimestamp = -999999L;
|
||||
|
||||
@Override
|
||||
public int compareTo(ElectricFenceModel o) {
|
||||
if(this.getTerminalTimestamp() > o.getTerminalTimestamp()){
|
||||
return 1;
|
||||
}
|
||||
else if(this.getTerminalTimestamp() < o.getTerminalTimestamp()){
|
||||
return -1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.muyu.fence.domain.utils;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain
|
||||
* @Project:cloud-server
|
||||
* @name:ElectricFenceResultTmp
|
||||
* @Date:2024/9/17 17:57
|
||||
*/
|
||||
/**
|
||||
* 电子围栏转换临时对象
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ElectricFenceResultTmp {
|
||||
//电子围栏id
|
||||
private int id;
|
||||
//电子围栏名称
|
||||
private String name;
|
||||
//电子围栏中心地址
|
||||
private String address;
|
||||
//电子围栏半径
|
||||
private float radius;
|
||||
//电子围栏中心点的经度
|
||||
private double longitude;
|
||||
//电子围栏中心点的维度
|
||||
private double latitude;
|
||||
//电子围栏的开始时间
|
||||
private Date startTime;
|
||||
//电子围栏的结束时间
|
||||
private Date endTime;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ElectricFenceResultTmp{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", address='" + address + '\'' +
|
||||
", radius=" + radius +
|
||||
", longitude=" + longitude +
|
||||
", latitude=" + latitude +
|
||||
", startTime=" + startTime +
|
||||
", endTime=" + endTime +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.muyu.fence.domain.utils;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain
|
||||
* @Project:cloud-server
|
||||
* @name:ElectronicFenceResult
|
||||
* @Date:2024/9/17 17:43
|
||||
*/
|
||||
|
||||
/**
|
||||
* 电子围栏分析结果数据结构
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ElectronicFenceResult {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 车辆唯一标识
|
||||
*/
|
||||
private String vin;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String inTime;
|
||||
private String outTime;
|
||||
/**
|
||||
* gps定位时间
|
||||
*/
|
||||
private Date gpsTime;
|
||||
|
||||
private Double lat;
|
||||
private Double lng;
|
||||
private Integer eleId;
|
||||
private String eleName;
|
||||
private String address;
|
||||
private Double latitude;
|
||||
private Double longitude;
|
||||
private Double radius;
|
||||
private String terminalTime;
|
||||
private Date processTime;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.muyu.fence.domain.utils;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.domain
|
||||
* @Project:cloud-server
|
||||
* @name:ElectronicFenceSetting
|
||||
* @Date:2024/9/17 16:47
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "electronic_fence_setting",autoResultMap = true)
|
||||
public class ElectronicFenceSetting {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private String id;
|
||||
/**
|
||||
* 电子围栏名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 电子围栏中心地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 电子围栏半径
|
||||
*/
|
||||
private String radius;
|
||||
/**
|
||||
* 电子围栏中心点经度
|
||||
*/
|
||||
private String longitude;
|
||||
/**
|
||||
* 电子围栏围栏中心点维度
|
||||
*/
|
||||
private String latitude;
|
||||
/**
|
||||
* 电子围栏的开始时间
|
||||
*/
|
||||
private String startTime;
|
||||
/**
|
||||
* 电子围栏的结束时间
|
||||
*/
|
||||
private String endTime;
|
||||
/**
|
||||
* 电子围栏的状态(开启,关闭)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.fence.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.fence.domain.database.ElectronicFenceGroup;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.mapper
|
||||
* @Project:cloud-server
|
||||
* @name:FenceGroupMapper
|
||||
* @Date:2024/9/18 15:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface ElectronicFenceGroupMapper extends BaseMapper<ElectronicFenceGroup> {
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.fence.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.fence.domain.database.ElectronicFence;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.mapper
|
||||
* @Project:cloud-server
|
||||
* @name:ElectronicFenceMapper
|
||||
* @Date:2024/9/17 19:29
|
||||
*/
|
||||
@Mapper
|
||||
public interface ElectronicFenceMapper extends BaseMapper<ElectronicFence> {
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.fence.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.fence.domain.database.FenceGroupMid;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.mapper
|
||||
* @Project:cloud-server
|
||||
* @name:FenceGroupMidMapper
|
||||
* @Date:2024/9/20 11:35
|
||||
*/
|
||||
@Mapper
|
||||
public interface FenceGroupMidMapper extends BaseMapper<FenceGroupMid> {
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.muyu.fence.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.fence.domain.database.ElectronicFence;
|
||||
import com.muyu.fence.domain.database.ElectronicFenceGroup;
|
||||
import com.muyu.fence.domain.req.ElectronicFenceGroupAddReq;
|
||||
import com.muyu.fence.domain.req.ElectronicFenceGroupListReq;
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceGroupResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.service
|
||||
* @Project:cloud-server
|
||||
* @name:FenceGroupController
|
||||
* @Date:2024/9/18 15:16
|
||||
*/
|
||||
|
||||
public interface ElectronicFenceGroupService extends IService<ElectronicFenceGroup> {
|
||||
|
||||
|
||||
List<ElectronicFenceGroup> selectGroupList(ElectronicFenceGroupListReq req);
|
||||
|
||||
|
||||
ElectronicFenceGroupResp findGroupByid(Long id);
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.muyu.fence.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.fence.domain.database.ElectronicFence;
|
||||
import com.muyu.fence.domain.req.ElectroicFenceAddReq;
|
||||
import com.muyu.fence.domain.req.ElectroicFenceListReq;
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.service
|
||||
* @Project:cloud-server
|
||||
* @name:ElectronicFenceService
|
||||
* @Date:2024/9/17 19:29
|
||||
*/
|
||||
|
||||
public interface ElectronicFenceService extends IService<ElectronicFence> {
|
||||
/**
|
||||
* 围栏列表
|
||||
* @param electroicFenceListReq
|
||||
* @return
|
||||
*/
|
||||
List<ElectronicFenceResp> fenceselectList(ElectroicFenceListReq electroicFenceListReq);
|
||||
|
||||
/**
|
||||
* 添加围栏
|
||||
* @param electroicFenceAddReq
|
||||
*/
|
||||
void AddFence(ElectroicFenceAddReq electroicFenceAddReq);
|
||||
|
||||
/**
|
||||
* 根据id回显围栏
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ElectronicFence findElectronicByid(Long id);
|
||||
|
||||
/**
|
||||
* 根据id删除围栏围栏
|
||||
* @param id
|
||||
*/
|
||||
void delElectronById(Long id);
|
||||
|
||||
/**
|
||||
* 开启围栏
|
||||
* @param id
|
||||
*/
|
||||
void openFence(Long id);
|
||||
|
||||
/**
|
||||
* 关闭围栏
|
||||
* @param id
|
||||
*/
|
||||
void closeFence(Long id);
|
||||
|
||||
/**
|
||||
* 根据id设置围栏的经纬度
|
||||
* @param id
|
||||
* @param longitudeLatitude
|
||||
*/
|
||||
void setFenceWay(Long id, String longitudeLatitude);
|
||||
|
||||
/**
|
||||
* 获取所有可用围栏
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
List<ElectronicFenceResp> fenceArray();
|
||||
|
||||
void unquireFence(String name);
|
||||
|
||||
List<ElectronicFenceResp> selectListByIds(List<Long> ids);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.muyu.fence.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.fence.domain.database.FenceGroupMid;
|
||||
import com.muyu.fence.domain.req.ElectronicFenceGroupUpdReq;
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.service
|
||||
* @Project:cloud-server
|
||||
* @name:FenceGroupMidService
|
||||
* @Date:2024/9/20 11:33
|
||||
*/
|
||||
public interface FenceGroupMidService extends IService<FenceGroupMid> {
|
||||
|
||||
|
||||
void addGroupAndFenceMid(Long id, List<ElectronicFenceResp> electronicFenceRespList);
|
||||
|
||||
List<FenceGroupMid> selectFenceGroupMidListById(Long id);
|
||||
|
||||
|
||||
void deliteMid(Long id);
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package com.muyu.fence.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.fence.domain.database.ElectronicFenceGroup;
|
||||
import com.muyu.fence.domain.database.FenceGroupMid;
|
||||
import com.muyu.fence.domain.req.ElectronicFenceGroupListReq;
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceGroupResp;
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceResp;
|
||||
import com.muyu.fence.mapper.ElectronicFenceGroupMapper;
|
||||
import com.muyu.fence.service.ElectronicFenceGroupService;
|
||||
import com.muyu.fence.service.ElectronicFenceService;
|
||||
import com.muyu.fence.service.FenceGroupMidService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.service.impl
|
||||
* @Project:cloud-server
|
||||
* @name:FenceGroupServiceImpl
|
||||
* @Date:2024/9/18 15:17
|
||||
*/
|
||||
@Log4j2
|
||||
@Service
|
||||
public class ElectronicFenceGroupServiceImpl extends ServiceImpl<ElectronicFenceGroupMapper, ElectronicFenceGroup> implements ElectronicFenceGroupService {
|
||||
|
||||
@Autowired
|
||||
private ElectronicFenceGroupMapper electronicFenceGroupMapper;
|
||||
|
||||
@Autowired
|
||||
private ElectronicFenceService electronicFenceService;
|
||||
|
||||
@Autowired
|
||||
private FenceGroupMidService fenceGroupMidService;
|
||||
|
||||
@Override
|
||||
public List<ElectronicFenceGroup> selectGroupList(ElectronicFenceGroupListReq req) {
|
||||
|
||||
LambdaQueryWrapper<ElectronicFenceGroup> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotNull(req.getGroupName()),ElectronicFenceGroup::getGroupName,req.getGroupName()
|
||||
);
|
||||
|
||||
queryWrapper.eq(
|
||||
StringUtils.isNotEmpty(req.getGroupType()),ElectronicFenceGroup::getGroupType,req.getGroupType()
|
||||
);
|
||||
queryWrapper.eq(
|
||||
StringUtils.isNotEmpty(req.getStatus()),ElectronicFenceGroup::getStatus, req.getStatus()
|
||||
);
|
||||
List<ElectronicFenceGroup> list = this.list(queryWrapper);
|
||||
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ElectronicFenceGroupResp findGroupByid(Long id) {
|
||||
|
||||
ElectronicFenceGroup electronicFenceGroup = this.getById(id);
|
||||
|
||||
ElectronicFenceGroupResp electronicFenceGroupResp = ElectronicFenceGroup.buildElectronicFenceGroupResp(electronicFenceGroup);
|
||||
|
||||
|
||||
List<FenceGroupMid> fenceGroupMidList = fenceGroupMidService.selectFenceGroupMidListById(id);
|
||||
|
||||
if (0<fenceGroupMidList.size()){
|
||||
List<Long> ids = fenceGroupMidList.stream().map(FenceGroupMid::getFenceId).toList();
|
||||
|
||||
List<ElectronicFenceResp> electronicFenceRespList= electronicFenceService.selectListByIds(ids);
|
||||
|
||||
electronicFenceGroupResp.setElectronicFenceRespList(electronicFenceRespList);
|
||||
}
|
||||
|
||||
|
||||
return electronicFenceGroupResp;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
package com.muyu.fence.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.fence.domain.database.ElectronicFence;
|
||||
import com.muyu.fence.domain.req.ElectroicFenceAddReq;
|
||||
import com.muyu.fence.domain.req.ElectroicFenceListReq;
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceResp;
|
||||
import com.muyu.fence.mapper.ElectronicFenceMapper;
|
||||
import com.muyu.fence.service.ElectronicFenceService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.service.impl
|
||||
* @Project:cloud-server
|
||||
* @name:ElectronicFenceServiceImpl
|
||||
* @Date:2024/9/17 19:31
|
||||
*/
|
||||
@Log4j2
|
||||
@Service
|
||||
public class ElectronicFenceServiceImpl extends ServiceImpl<ElectronicFenceMapper, ElectronicFence> implements ElectronicFenceService {
|
||||
|
||||
@Autowired
|
||||
private ElectronicFenceMapper electronicFenceMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<ElectronicFenceResp> fenceselectList(ElectroicFenceListReq electroicFenceListReq) {
|
||||
|
||||
LambdaQueryWrapper<ElectronicFence> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotNull(electroicFenceListReq.getName()),ElectronicFence::getName, electroicFenceListReq.getName()
|
||||
);
|
||||
queryWrapper.eq(
|
||||
StringUtils.isNotEmpty(electroicFenceListReq.getFenceType()),ElectronicFence::getFenceType, electroicFenceListReq.getFenceType()
|
||||
);
|
||||
queryWrapper.eq(
|
||||
StringUtils.isNotEmpty(electroicFenceListReq.getStatus()),ElectronicFence::getStatus, electroicFenceListReq.getStatus()
|
||||
);
|
||||
List<ElectronicFence> list = this.list(queryWrapper);
|
||||
|
||||
return list.stream().map(ElectronicFence::bullerResp).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void AddFence(ElectroicFenceAddReq electroicFenceAddReq) {
|
||||
|
||||
|
||||
|
||||
electronicFenceMapper.insert(ElectronicFence.buildElectroicAdd(electroicFenceAddReq));
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ElectronicFence findElectronicByid(Long id) {
|
||||
|
||||
ElectronicFence electronicFence = electronicFenceMapper.selectById(id);
|
||||
return electronicFence;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delElectronById(Long id) {
|
||||
electronicFenceMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void openFence(Long id) {
|
||||
|
||||
updateStatus(id,0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeFence(Long id) {
|
||||
updateStatus(id,1);
|
||||
}
|
||||
|
||||
public void updateStatus (Long id,int status){
|
||||
UpdateWrapper<ElectronicFence> updateWrapper = new UpdateWrapper<>();
|
||||
|
||||
updateWrapper.eq("id",id).set("status",status);
|
||||
|
||||
this.update(updateWrapper);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setFenceWay(Long id, String longitudeLatitude) {
|
||||
|
||||
UpdateWrapper<ElectronicFence> updateWrapper = new UpdateWrapper<>();
|
||||
|
||||
updateWrapper.eq("id",id).set("longitude_latitude",longitudeLatitude);
|
||||
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ElectronicFenceResp> fenceArray() {
|
||||
|
||||
LambdaQueryWrapper<ElectronicFence> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
LambdaQueryWrapper<ElectronicFence> wrapper = queryWrapper.eq(ElectronicFence::getStatus, 0);
|
||||
|
||||
List<ElectronicFence> list = this.list(wrapper);
|
||||
|
||||
return list.stream().map(ElectronicFence::bullerResp).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unquireFence(String name) {
|
||||
LambdaQueryWrapper<ElectronicFence> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
queryWrapper.eq(ElectronicFence::getName,name);
|
||||
|
||||
List<ElectronicFence> fenceList = this.list(queryWrapper);
|
||||
|
||||
if (fenceList.size()>0){
|
||||
throw new RuntimeException("电子围栏名不能重复");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ElectronicFenceResp> selectListByIds(List<Long> ids) {
|
||||
|
||||
List<ElectronicFence> electronicFenceList = this.list(Wrappers.<ElectronicFence>lambdaQuery().in(ElectronicFence::getId, ids));
|
||||
|
||||
|
||||
return electronicFenceList.stream().map(ElectronicFence::bullerResp).toList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.muyu.fence.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.fence.domain.database.ElectronicFenceGroup;
|
||||
import com.muyu.fence.domain.database.FenceGroupMid;
|
||||
import com.muyu.fence.domain.req.ElectronicFenceGroupUpdReq;
|
||||
import com.muyu.fence.domain.resp.ElectronicFenceResp;
|
||||
import com.muyu.fence.mapper.FenceGroupMidMapper;
|
||||
import com.muyu.fence.service.FenceGroupMidService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:张承志
|
||||
* @Package:com.muyu.fence.service.impl
|
||||
* @Project:cloud-server
|
||||
* @name:FenceGroupMidServiceImpl
|
||||
* @Date:2024/9/20 11:34
|
||||
*/
|
||||
@Service
|
||||
public class FenceGroupMidServiceImpl extends ServiceImpl<FenceGroupMidMapper, FenceGroupMid> implements FenceGroupMidService {
|
||||
|
||||
@Autowired
|
||||
private FenceGroupMidMapper fenceGroupMidMapper;
|
||||
|
||||
@Override
|
||||
public void addGroupAndFenceMid(Long id, List<ElectronicFenceResp> electronicFenceRespList) {
|
||||
for (ElectronicFenceResp electronicFenceResp : electronicFenceRespList) {
|
||||
fenceGroupMidMapper.insert(new FenceGroupMid(null,id,electronicFenceResp.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FenceGroupMid> selectFenceGroupMidListById(Long groupId) {
|
||||
|
||||
LambdaQueryWrapper<FenceGroupMid> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
queryWrapper.eq(FenceGroupMid::getGroupId,groupId);
|
||||
|
||||
this.list(queryWrapper);
|
||||
|
||||
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deliteMid(Long id) {
|
||||
LambdaQueryWrapper<FenceGroupMid> wrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
wrapper.eq(FenceGroupMid::getGroupId,id);
|
||||
|
||||
this.remove(wrapper);
|
||||
}
|
||||
|
||||
}
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.53.251:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: four
|
||||
namespace: lgy
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.53.251:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: four
|
||||
namespace: lgy
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.53.251:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: four
|
||||
namespace: lgy
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.53.251:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: four
|
||||
namespace: lgy
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -6,7 +6,7 @@ nacos:
|
|||
addr: 47.101.53.251:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: four
|
||||
namespace: lgy
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.53.251:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: four
|
||||
namespace: lgy
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
Loading…
Reference in New Issue