Merge remote-tracking branch 'origin/dev.vehicles' into dev
# Conflicts: # cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarMessageController.javadev.eventProcess
commit
51cfc6ab2d
|
@ -6,7 +6,7 @@ nacos:
|
||||||
addr: 106.15.136.7:8848
|
addr: 106.15.136.7:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: dev
|
namespace: lqs
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
|
|
|
@ -6,7 +6,7 @@ nacos:
|
||||||
addr: 106.15.136.7:8848
|
addr: 106.15.136.7:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: dev
|
namespace: lqs
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -29,5 +29,17 @@
|
||||||
<groupId>io.swagger.core.v3</groupId>
|
<groupId>io.swagger.core.v3</groupId>
|
||||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--mqttv3依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.paho</groupId>
|
||||||
|
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||||
|
<version>1.2.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!--mqtt依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.integration</groupId>
|
||||||
|
<artifactId>spring-integration-mqtt</artifactId>
|
||||||
|
<version>6.2.5</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.muyu.enterprise.domain.car;
|
||||||
|
|
||||||
|
|
||||||
|
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.enterprise.domain.req.car.MessageTemplateAddReq;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版实体类
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageTemplate
|
||||||
|
* @Date:2024/9/26 20:27
|
||||||
|
* @Description: 报文模版
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName(value = "message_template", autoResultMap = true)
|
||||||
|
public class MessageTemplate extends BaseEntity
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 报文模版主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "message_template_id", type = IdType.AUTO)
|
||||||
|
private String messageTemplateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版名称
|
||||||
|
*/
|
||||||
|
private String messageTemplateName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版描述
|
||||||
|
*/
|
||||||
|
private String messageTemplateDescribe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版添加数据转换
|
||||||
|
* @param messageTemplateAddReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static MessageTemplate addBuild(MessageTemplateAddReq messageTemplateAddReq){
|
||||||
|
return MessageTemplate.builder()
|
||||||
|
.messageTemplateName(messageTemplateAddReq.getMessageTemplateName())
|
||||||
|
.messageTemplateDescribe(messageTemplateAddReq.getMessageTemplateDescribe())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
package com.muyu.enterprise.domain.car;
|
||||||
|
|
||||||
|
|
||||||
|
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.enterprise.domain.req.car.MessageValueAddReq;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageValue
|
||||||
|
* @Date:2024/9/26 20:29
|
||||||
|
*
|
||||||
|
* 报文类型对象 message_type
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文类型实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName(value = "message_value", autoResultMap = true)
|
||||||
|
public class MessageValue extends BaseEntity
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 报文数据主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "message_id", type = IdType.AUTO)
|
||||||
|
private Long messageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模版主键
|
||||||
|
*/
|
||||||
|
private Long templateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文类别
|
||||||
|
*/
|
||||||
|
private String messageType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文编码
|
||||||
|
*/
|
||||||
|
private String messageCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文标签
|
||||||
|
*/
|
||||||
|
private String messageLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始下标
|
||||||
|
*/
|
||||||
|
private Integer messageStartIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终止下标
|
||||||
|
*/
|
||||||
|
private Integer messageEndIndex;
|
||||||
|
|
||||||
|
public static MessageValue addBuild(MessageValueAddReq messageValueAddReq){
|
||||||
|
return MessageValue.builder()
|
||||||
|
.templateId(messageValueAddReq.getTemplateId())
|
||||||
|
.messageType(messageValueAddReq.getMessageType())
|
||||||
|
.messageCode(messageValueAddReq.getMessageCode())
|
||||||
|
.messageLabel(messageValueAddReq.getMessageLabel())
|
||||||
|
.messageStartIndex(messageValueAddReq.getMessageStartIndex())
|
||||||
|
.messageEndIndex(messageValueAddReq.getMessageEndIndex())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
package com.muyu.enterprise.domain.car;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.annotation.Excel.ColumnType;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import com.muyu.enterprise.domain.req.car.VehicleAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.car.VehicleUpdReq;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆信息实体类
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:Vehicle
|
||||||
|
* @Date:2024/9/26 20:30
|
||||||
|
* @Description: 车辆信息实体类
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName(value = "vehicle", autoResultMap = true)
|
||||||
|
public class Vehicle extends BaseEntity
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 车辆主键
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆主键", cellType = ColumnType.NUMERIC)
|
||||||
|
@TableId(value = "vehicle_id", type = IdType.AUTO)
|
||||||
|
private Long vehicleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车牌号
|
||||||
|
*/
|
||||||
|
@Excel(name = "车牌号")
|
||||||
|
private String licenceNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆颜色
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆颜色")
|
||||||
|
private String vehicleColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆VIN
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆VIN")
|
||||||
|
private String vehicleVin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型外键
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆类型外键")
|
||||||
|
private Long vehicleTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆品牌
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆品牌")
|
||||||
|
private String vehicleBrand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆型号
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆型号")
|
||||||
|
private String vehicleModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆行驶证
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆行驶证")
|
||||||
|
private String vehicleLicense;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行驶证到期日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date vehicleLicenseDueDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆状态
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆状态")
|
||||||
|
private String vehicleStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆所属企业外键
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏外键
|
||||||
|
*/
|
||||||
|
private Integer fenceGroupId;
|
||||||
|
|
||||||
|
public static Vehicle addBuild(VehicleAddReq vehicleAddReq){
|
||||||
|
return Vehicle.builder()
|
||||||
|
.licenceNumber(vehicleAddReq.getLicenceNumber())
|
||||||
|
.vehicleColor(vehicleAddReq.getVehicleColor())
|
||||||
|
.vehicleVin(vehicleAddReq.getVehicleVin())
|
||||||
|
.vehicleTypeId(vehicleAddReq.getVehicleTypeId())
|
||||||
|
.vehicleBrand(vehicleAddReq.getVehicleBrand())
|
||||||
|
.vehicleModel(vehicleAddReq.getVehicleModel())
|
||||||
|
.vehicleLicense(vehicleAddReq.getVehicleLicense())
|
||||||
|
.vehicleLicenseDueDate(vehicleAddReq.getVehicleLicenseDueDate())
|
||||||
|
.vehicleStatus(vehicleAddReq.getVehicleStatus())
|
||||||
|
.companyId(vehicleAddReq.getCompanyId())
|
||||||
|
.fenceGroupId(vehicleAddReq.getFenceGroupId())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vehicle updBuild(VehicleUpdReq vehicleUpdReq, Supplier<Long> idSupplier){
|
||||||
|
return Vehicle.builder()
|
||||||
|
.vehicleId(idSupplier.get())
|
||||||
|
.licenceNumber(vehicleUpdReq.getLicenceNumber())
|
||||||
|
.vehicleColor(vehicleUpdReq.getVehicleColor())
|
||||||
|
.vehicleVin(vehicleUpdReq.getVehicleVin())
|
||||||
|
.vehicleTypeId(vehicleUpdReq.getVehicleTypeId())
|
||||||
|
.vehicleBrand(vehicleUpdReq.getVehicleBrand())
|
||||||
|
.vehicleModel(vehicleUpdReq.getVehicleModel())
|
||||||
|
.vehicleLicense(vehicleUpdReq.getVehicleLicense())
|
||||||
|
.vehicleLicenseDueDate(vehicleUpdReq.getVehicleLicenseDueDate())
|
||||||
|
.vehicleStatus(vehicleUpdReq.getVehicleStatus())
|
||||||
|
.companyId(vehicleUpdReq.getCompanyId())
|
||||||
|
.fenceGroupId(vehicleUpdReq.getFenceGroupId())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.muyu.enterprise.domain.car;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.annotation.Excel.ColumnType;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型实体类
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleType
|
||||||
|
* @Date:2024/9/26 20:31
|
||||||
|
* @Description: 车辆类型实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName(value = "vehicle_type", autoResultMap = true)
|
||||||
|
public class VehicleType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 车辆类型主键
|
||||||
|
*/
|
||||||
|
|
||||||
|
@TableId(value = "vehicle_type_id", type = IdType.AUTO)
|
||||||
|
private Long vehicleTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型名称
|
||||||
|
*/
|
||||||
|
private String vehicleTypeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版外键
|
||||||
|
*/
|
||||||
|
private Long messageTemplateId;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
package com.muyu.enterprise.domain.dateBase;
|
||||||
|
|
||||||
|
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.enterprise.domain.req.ElectroicFenceAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectroicFenceUpdReq;
|
||||||
|
import com.muyu.enterprise.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,118 @@
|
||||||
|
package com.muyu.enterprise.domain.dateBase;
|
||||||
|
|
||||||
|
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.enterprise.domain.req.ElectronicFenceGroupAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectronicFenceGroupUpdReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.ElectronicFenceGroupResp;
|
||||||
|
import com.muyu.enterprise.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,36 @@
|
||||||
|
package com.muyu.enterprise.domain.dateBase;
|
||||||
|
|
||||||
|
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,78 @@
|
||||||
|
package com.muyu.enterprise.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,68 @@
|
||||||
|
package com.muyu.enterprise.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,73 @@
|
||||||
|
package com.muyu.enterprise.domain.req;
|
||||||
|
|
||||||
|
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,64 @@
|
||||||
|
package com.muyu.enterprise.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.enterprise.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,59 @@
|
||||||
|
package com.muyu.enterprise.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,69 @@
|
||||||
|
package com.muyu.enterprise.domain.req;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.muyu.enterprise.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,39 @@
|
||||||
|
package com.muyu.enterprise.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.enterprise.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,24 @@
|
||||||
|
package com.muyu.enterprise.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,35 @@
|
||||||
|
package com.muyu.enterprise.domain.req.car;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版添加参数请求对象
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain.req
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageTemplateAddReq
|
||||||
|
* @Date:2024/9/26 20:34
|
||||||
|
* @Description: 报文模版添加参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name = "新增报文模版请求参数", description = "根据入参进行报文模版的添加")
|
||||||
|
public class MessageTemplateAddReq
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 报文模版名称
|
||||||
|
*/
|
||||||
|
private String messageTemplateName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版描述
|
||||||
|
*/
|
||||||
|
private String messageTemplateDescribe;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.muyu.enterprise.domain.req.car;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文类型参数添加请求对象
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain.req
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageValueAddReq
|
||||||
|
* @Date:2024/9/26 20:35
|
||||||
|
* @Description: 报文类型参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name = "新增报文数据请求参数", description = "根据入参进行报文数据的添加")
|
||||||
|
public class MessageValueAddReq
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 模版主键
|
||||||
|
*/
|
||||||
|
private Long templateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文类别
|
||||||
|
*/
|
||||||
|
private String messageType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文编码
|
||||||
|
*/
|
||||||
|
private String messageCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文标签
|
||||||
|
*/
|
||||||
|
private String messageLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始下标
|
||||||
|
*/
|
||||||
|
private Integer messageStartIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终止下标
|
||||||
|
*/
|
||||||
|
private Integer messageEndIndex;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.muyu.enterprise.domain.req.car;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文类型列表参数请求对象
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain.req
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageValueReq
|
||||||
|
* @Date:2024/9/26 20:39
|
||||||
|
* @Description: 报文类型列表参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name = "报文数据请求参数", description = "根据入参进行报文数据的查询")
|
||||||
|
public class MessageValueReq
|
||||||
|
{
|
||||||
|
/** 报文模版主键 */
|
||||||
|
@Schema(title = "报文模版主键", type = "Long", defaultValue = "1", description = "报文模版主键")
|
||||||
|
private Long messageTemplateId;
|
||||||
|
|
||||||
|
/** 报文分类 */
|
||||||
|
@Schema(title = "报文分类", type = "String", defaultValue = "basics", description = "报文分类")
|
||||||
|
private String messageType;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,101 @@
|
||||||
|
package com.muyu.enterprise.domain.req.car;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆参数请求对象
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain.req
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleAddReq
|
||||||
|
* @Date:2024/9/26 20:39
|
||||||
|
* @Description: 新增车辆参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name = "录入车辆请求参数", description = "根据入参进行车辆管理的添加")
|
||||||
|
public class VehicleAddReq
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 车牌号
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "车牌号不可为空")
|
||||||
|
@Schema(title = "车牌号", type = "String", defaultValue = "冀A93827", description = "车牌号")
|
||||||
|
private String licenceNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆颜色
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆颜色", type = "String", defaultValue = "RED", description = "车牌颜色")
|
||||||
|
private String vehicleColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆VIN
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆VIN", type = "String", defaultValue = "LDC913L2240606423", description = "车辆VIN")
|
||||||
|
private String vehicleVin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型外键
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆类型", type = "BigInt", defaultValue = "1", description = "车辆类型")
|
||||||
|
private Long vehicleTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆品牌
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆品牌", type = "String", defaultValue = "1", description = "车辆品牌")
|
||||||
|
private String vehicleBrand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆型号
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆型号", type = "String", defaultValue = "1", description = "车辆型号")
|
||||||
|
private String vehicleModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆行驶证
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆行驶证", type = "String", defaultValue = "111111", description = "车辆行驶证")
|
||||||
|
private String vehicleLicense;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行驶证到期日期
|
||||||
|
*/
|
||||||
|
@Schema(title = "行驶证到期日期", type = "Date", defaultValue = "2024-01-01 00:00:00", description = "行驶证到期日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date vehicleLicenseDueDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆状态
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆状态", type = "String", defaultValue = "OFFLINE", description = "车辆状态")
|
||||||
|
private String vehicleStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆所属企业外键
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆所属企业外键", type = "BigInt", defaultValue = "1", description = "车辆所属企业外键")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏外键
|
||||||
|
*/
|
||||||
|
@Schema(title = "电子围栏外键", type = "Integer", defaultValue = "1", description = "电子围栏外键")
|
||||||
|
private Integer fenceGroupId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.muyu.enterprise.domain.req.car;
|
||||||
|
|
||||||
|
//import com.muyu.common.core.domain.req.PageReq;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆管理查询条件请求对象
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain.req
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleManageReq
|
||||||
|
* @Date:2024/9/26 20:41
|
||||||
|
* @Description: 车辆管理查询条件实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name = "车辆管理查询条件", description = "负责车辆查询条件的实体类")
|
||||||
|
public class VehicleManageReq
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 车牌号
|
||||||
|
*/
|
||||||
|
@Schema(type = "String", defaultValue = "冀A93827", description = "车牌号")
|
||||||
|
private String licenceNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆VIN
|
||||||
|
*/
|
||||||
|
@Schema(type = "String", defaultValue = "LDC913L2240606423", description = "车辆VIN")
|
||||||
|
private String vehicleVin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆状态
|
||||||
|
*/
|
||||||
|
@Schema(type = "String", defaultValue = "", description = "车辆状态")
|
||||||
|
private String vehicleStatus;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.muyu.enterprise.domain.req.car;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车辆信息参数请求对象
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain.req
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleUpdReq
|
||||||
|
* @Date:2024/9/26 20:57
|
||||||
|
* @Description: 修改车辆信息参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name = "修改车辆信息参数", description = "根据入参信息修改车辆信息")
|
||||||
|
public class VehicleUpdReq
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 车牌号
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "车牌号不可为空")
|
||||||
|
@Schema(title = "车牌号", type = "String", defaultValue = "冀A93827", description = "车牌号")
|
||||||
|
private String licenceNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆颜色
|
||||||
|
*/
|
||||||
|
@Schema(title = "车牌颜色", type = "String", defaultValue = "RED", description = "车牌颜色")
|
||||||
|
private String vehicleColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆VIN
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆VIN", type = "String", defaultValue = "LDC913L2240606423", description = "车辆VIN")
|
||||||
|
private String vehicleVin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型外键
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆类型", type = "BigInt", defaultValue = "1", description = "车辆类型")
|
||||||
|
private Long vehicleTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆品牌
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆品牌", type = "String", defaultValue = "1", description = "车辆品牌")
|
||||||
|
private String vehicleBrand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆型号
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆型号", type = "String", defaultValue = "1", description = "车辆型号")
|
||||||
|
private String vehicleModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆行驶证
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆行驶证", type = "String", defaultValue = "111111", description = "车辆行驶证")
|
||||||
|
private String vehicleLicense;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行驶证到期日期
|
||||||
|
*/
|
||||||
|
@Schema(title = "行驶证到期日期", type = "Date", defaultValue = "2024-01-01 00:00:00", description = "行驶证到期日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date vehicleLicenseDueDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆状态
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆状态", type = "String", defaultValue = "OFFLINE", description = "车辆状态")
|
||||||
|
private String vehicleStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆所属企业外键
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆所属企业外键", type = "BigInt", defaultValue = "1", description = "车辆所属企业外键")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏外键
|
||||||
|
*/
|
||||||
|
@Schema(title = "电子围栏外键", type = "Integer", defaultValue = "1", description = "电子围栏外键")
|
||||||
|
private Integer fenceGroupId;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.muyu.enterprise.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,71 @@
|
||||||
|
package com.muyu.enterprise.domain.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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,57 @@
|
||||||
|
package com.muyu.enterprise.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,56 @@
|
||||||
|
package com.muyu.enterprise.domain.resp.car;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.enterprise.domain.car.MessageTemplate;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版响应数据响应对象
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain.resp
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageTemplateListResp
|
||||||
|
* @Date:2024/9/26 20:32
|
||||||
|
* @Description: 报文模版响应数据
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name = "报文模版列表", description = "负责报文模版管理列表的相应数据")
|
||||||
|
public class MessageTemplateListResp
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 报文模版主键
|
||||||
|
*/
|
||||||
|
private String messageTemplateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版名称
|
||||||
|
*/
|
||||||
|
private String messageTemplateName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版描述
|
||||||
|
*/
|
||||||
|
private String messageTemplateDescribe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库对象构建为返回结果对象
|
||||||
|
* @param messageTemplate
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static MessageTemplateListResp messageTemplateBuild(MessageTemplate messageTemplate) {
|
||||||
|
return MessageTemplateListResp.builder()
|
||||||
|
.messageTemplateId(messageTemplate.getMessageTemplateId())
|
||||||
|
.messageTemplateName(messageTemplate.getMessageTemplateName())
|
||||||
|
.messageTemplateDescribe(messageTemplate.getMessageTemplateDescribe())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.muyu.enterprise.domain.resp.car;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.enterprise.domain.car.MessageValue;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文数据响应数据响应对象
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain.resp
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageValueListResp
|
||||||
|
* @Date:2024/9/26 20:33
|
||||||
|
* @Description: 报文数据响应数据
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name = "报文数据列表", description = "负责报文数据管理列表的相应数据")
|
||||||
|
public class MessageValueListResp
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 报文数据主键
|
||||||
|
*/
|
||||||
|
private Long messageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文类别
|
||||||
|
*/
|
||||||
|
private String messageType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文编码
|
||||||
|
*/
|
||||||
|
private String messageCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文标签
|
||||||
|
*/
|
||||||
|
private String messageLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始下标
|
||||||
|
*/
|
||||||
|
private Integer messageStartIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终止下标
|
||||||
|
*/
|
||||||
|
private Integer messageEndIndex;
|
||||||
|
|
||||||
|
public static MessageValueListResp valueBuild(MessageValue messageValue){
|
||||||
|
return MessageValueListResp.builder()
|
||||||
|
.messageId(messageValue.getMessageId())
|
||||||
|
.messageType(messageValue.getMessageType())
|
||||||
|
.messageCode(messageValue.getMessageCode())
|
||||||
|
.messageLabel(messageValue.getMessageLabel())
|
||||||
|
.messageStartIndex(messageValue.getMessageStartIndex())
|
||||||
|
.messageEndIndex(messageValue.getMessageEndIndex())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.muyu.enterprise.domain.resp.car;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆管理列表响应对象
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain.resp
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleManageResp
|
||||||
|
* @Date:2024/9/26 20:33
|
||||||
|
* 车辆管理列表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Tag(name = "车辆管理列表",description = "负责车辆管理列表的相应数据")
|
||||||
|
public class VehicleManageResp
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 车辆主键
|
||||||
|
*/
|
||||||
|
@Schema(type = "Long",defaultValue = "1",description = "车辆主键")
|
||||||
|
private Long vehicleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车牌号
|
||||||
|
*/
|
||||||
|
@Schema(type = "String", defaultValue = "冀A93827", description = "车牌号")
|
||||||
|
private String licenceNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆颜色
|
||||||
|
*/
|
||||||
|
@Schema(type = "String", defaultValue = "", description = "车辆颜色")
|
||||||
|
private String vehicleColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆VIN
|
||||||
|
*/
|
||||||
|
@Schema(type = "String", defaultValue = "LDC913L2240606423", description = "车辆VIN")
|
||||||
|
private String vehicleVin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型
|
||||||
|
*/
|
||||||
|
@Schema(type = "Long", defaultValue = "新能源", description = "车辆类型")
|
||||||
|
private String vehicleTypeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆品牌
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆品牌", type = "String", defaultValue = "1", description = "车辆品牌")
|
||||||
|
private String vehicleBrand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆型号
|
||||||
|
*/
|
||||||
|
@Schema(title = "车辆型号", type = "String", defaultValue = "1", description = "车辆型号")
|
||||||
|
private String vehicleModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆状态
|
||||||
|
*/
|
||||||
|
@Schema(type = "String", defaultValue = "", description = "车辆状态")
|
||||||
|
private String vehicleStatus;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.muyu.enterprise.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.enterprise.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,54 @@
|
||||||
|
package com.muyu.enterprise.domain.utils;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
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.enterprise.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.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,28 @@
|
||||||
|
package com.muyu.enterprise.domain.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文分割工具类
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.utils
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleConstant
|
||||||
|
* @Date:2024/9/26 20:26
|
||||||
|
*/
|
||||||
|
public class VehicleConstant
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 分包符
|
||||||
|
*/
|
||||||
|
public static final String DATA_PACK_SEPARATOR = "#$&";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文起始位
|
||||||
|
*/
|
||||||
|
public static final String MSG_START = "7E";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文结束位
|
||||||
|
*/
|
||||||
|
public static final String MSG_END = "7E";
|
||||||
|
|
||||||
|
}
|
|
@ -22,6 +22,11 @@
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.yulichang</groupId>
|
||||||
|
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||||
|
<version>1.4.11</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -16,5 +16,26 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
public class CloudEnterpriseApplication {
|
public class CloudEnterpriseApplication {
|
||||||
public static void main (String[] args) {
|
public static void main (String[] args) {
|
||||||
SpringApplication.run(CloudEnterpriseApplication.class, args);
|
SpringApplication.run(CloudEnterpriseApplication.class, args);
|
||||||
|
System.out.println(" _ooOoo_\n" +
|
||||||
|
" o8888888o\n" +
|
||||||
|
" 88\" . \"88\n" +
|
||||||
|
" (| -_- |)\n" +
|
||||||
|
" O\\ = /O\n" +
|
||||||
|
" ____/`---'\\____\n" +
|
||||||
|
" .' \\\\| |// `.\n" +
|
||||||
|
" / \\\\||| : |||// \\\n" +
|
||||||
|
" / _||||| -:- |||||- \\\n" +
|
||||||
|
" | | \\\\\\ - /// | |\n" +
|
||||||
|
" | \\_| ''\\---/'' | |\n" +
|
||||||
|
" \\ .-\\__ `-` ___/-. /\n" +
|
||||||
|
" ___`. .' /--.--\\ `. . __\n" +
|
||||||
|
" .\"\" '< `.___\\_<|>_/___.' >'\"\".\n" +
|
||||||
|
" | | : `- \\`.;`\\ _ /`;.`/ - ` : | |\n" +
|
||||||
|
" \\ \\ `-. \\_ __\\ /__ _/ .-` / /\n" +
|
||||||
|
" ======`-.____`-.___\\_____/___.-`____.-'======\n" +
|
||||||
|
" `=---='\n" +
|
||||||
|
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
|
||||||
|
" // 佛祖保佑 永不宕机 永无BUG //");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.muyu.enterprise.MQTT;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.api.remote.PushCallBack;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttTopic;
|
||||||
|
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模拟一个客户端接收消息
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.enterprise.MQTT
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:ClientMQTT
|
||||||
|
* @Date:2024/9/28 12:11
|
||||||
|
*/
|
||||||
|
public class ClientMQTT {
|
||||||
|
//String topic = "vehicle";
|
||||||
|
// String content = "Message from MqttPublishSample";
|
||||||
|
// int qos = 2;
|
||||||
|
// String broker = "tcp://106.15.136.7:1883";
|
||||||
|
// String clientId = "JavaSample";
|
||||||
|
//MQTT代理服务器地址
|
||||||
|
public static final String HOST="tcp://106.15.136.7:1883";
|
||||||
|
public static final String TOPIC1="pos_message_all";
|
||||||
|
private static final String clientId="12345678";
|
||||||
|
private MqttClient client;
|
||||||
|
private MqttConnectOptions options;
|
||||||
|
private String userName="mqtt"; //非必须
|
||||||
|
private String passWord="mqtt"; //非必须
|
||||||
|
|
||||||
|
private void start(){
|
||||||
|
try{
|
||||||
|
// host为主机名,clientid即连接MQTT的客户端ID,一般以唯一标识符表示,MemoryPersistence设置clientid的保存形式,默认为以内存保存
|
||||||
|
client= new MqttClient(HOST,clientId,new MemoryPersistence());
|
||||||
|
// MQTT的连接设置
|
||||||
|
options=new MqttConnectOptions();
|
||||||
|
// 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,设置为true表示每次连接到服务器都以新的身份连接
|
||||||
|
options.setCleanSession(false);
|
||||||
|
// 设置连接的用户名
|
||||||
|
options.setUserName(userName);
|
||||||
|
// 设置连接的密码
|
||||||
|
options.setPassword(passWord.toCharArray());
|
||||||
|
// 设置超时时间 单位为秒
|
||||||
|
options.setConnectionTimeout(10);
|
||||||
|
// 设置会话心跳时间 单位为秒 服务器会每隔1.5*20秒的时间向客户端发送个消息判断客户端是否在线,但这个方法并没有重连的机制
|
||||||
|
options.setKeepAliveInterval(20);
|
||||||
|
//设置断开后重新连接
|
||||||
|
options.setAutomaticReconnect(true);
|
||||||
|
// 设置回调
|
||||||
|
client.setCallback(new PushCallback());
|
||||||
|
MqttTopic topic = client.getTopic(TOPIC1);
|
||||||
|
//setWill方法,如果项目中需要知道客户端是否掉线可以调用该方法。设置最终端口的通知消息
|
||||||
|
//遗嘱
|
||||||
|
options.setWill(topic,"close".getBytes(),1,true);
|
||||||
|
client.connect(options);
|
||||||
|
//订阅消息
|
||||||
|
int[] Qos = {1} ; //0:最多一次 、1:最少一次 、2:只有一次
|
||||||
|
String[] topics1 = {TOPIC1};
|
||||||
|
client.subscribe(topics1,Qos);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
ClientMQTT clientMQTT = new ClientMQTT();
|
||||||
|
clientMQTT.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.muyu.enterprise.MQTT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.enterprise.MQTT
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MQTTReceiveCallback
|
||||||
|
* @Date:2024/9/27 22:21
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttCallback;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布消息的回调类
|
||||||
|
*
|
||||||
|
* 必须实现MqttCallback的接口并实现对应的相关接口方法CallBack 类将实现 MqttCallBack。
|
||||||
|
* 每个客户机标识都需要一个回调实例。在此示例中,构造函数传递客户机标识以另存为实例数据。
|
||||||
|
* 在回调中,将它用来标识已经启动了该回调的哪个实例。
|
||||||
|
* 必须在回调类中实现三个方法:
|
||||||
|
*
|
||||||
|
* (1):public void messageArrived(MqttTopic topic, MqttMessage message)接收已经预订的发布。
|
||||||
|
*
|
||||||
|
* (2):public void connectionLost(Throwable cause)在断开连接时调用。
|
||||||
|
*
|
||||||
|
* (3):public void deliveryComplete(MqttDeliveryToken token))
|
||||||
|
* 接收到已经发布的 QoS 1 或 QoS 2 消息的传递令牌时调用。
|
||||||
|
* 由 MqttClient.connect 激活此回调。
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MQTTReceiveCallback implements MqttCallback {
|
||||||
|
// @Override
|
||||||
|
// public void connectionLost(Throwable throwable) {
|
||||||
|
// //连接丢失后,一般在这里面进行重连
|
||||||
|
// System.out.println("连接断开,可以做重连");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void messageArrived(String topic, MqttMessage message) throws Exception {
|
||||||
|
// //subscribe后得到的消息会执行到这里面
|
||||||
|
// System.out.println("接收消息主题:"+topic);
|
||||||
|
// System.out.println("接收消息Qos:"+message.getQos());
|
||||||
|
// System.out.println("接收消息内容:"+new String(message.getPayload()));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void deliveryComplete(IMqttDeliveryToken token) {
|
||||||
|
// System.out.println("deliveryComplete----------"+token.isComplete());
|
||||||
|
// }
|
||||||
|
@Override
|
||||||
|
public void connectionLost(Throwable throwable){
|
||||||
|
//连接丢失后,一般在这里面进行重连
|
||||||
|
System.out.println("连接断开,可以做重连");
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception {
|
||||||
|
//subscribe后得到的消息会执行到这面
|
||||||
|
System.out.println("接收消息主题:"+topic);
|
||||||
|
System.out.println("接收消息Qos:"+mqttMessage.getQos());
|
||||||
|
System.out.println("接收消息内容:"+new String(mqttMessage.getPayload()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
||||||
|
System.out.println("deliveryComplete---------"+iMqttDeliveryToken.isComplete());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,187 @@
|
||||||
|
package com.muyu.enterprise.MQTT;
|
||||||
|
|
||||||
|
|
||||||
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
|
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户端类
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.enterprise.mqtt
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MyMqttClient
|
||||||
|
* @Date:2024/9/27 22:20
|
||||||
|
*/
|
||||||
|
public class MyMqttClient {
|
||||||
|
|
||||||
|
public static MqttClient mqttClient =null;
|
||||||
|
private static MemoryPersistence memoryPersistence=null;
|
||||||
|
private static MqttConnectOptions mqttConectOptions=null;
|
||||||
|
private static String ClinentName=""; //待填 将在服务端出现的名字
|
||||||
|
private static String IP=""; //待填 服务器IP
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
start(ClinentName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void start(String clientId){
|
||||||
|
//初始化连接设置对象
|
||||||
|
mqttConectOptions=new MqttConnectOptions();
|
||||||
|
//设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,
|
||||||
|
//这里设置为true表示每次连接到服务器都以新的身份连接
|
||||||
|
mqttConectOptions.setCleanSession(true);
|
||||||
|
//设置连接超时时间,单位是秒
|
||||||
|
mqttConectOptions.setConnectionTimeout(10);
|
||||||
|
//设置持久化方式
|
||||||
|
memoryPersistence=new MemoryPersistence();
|
||||||
|
if(null!=clientId){
|
||||||
|
try{
|
||||||
|
mqttClient =new MqttClient("tcp://"+IP+":1883", clientId,memoryPersistence);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO 自动生成的捕获块
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("连接状态:"+mqttClient.isConnected());
|
||||||
|
//设置连接和回调
|
||||||
|
if(null!=mqttClient){
|
||||||
|
if(!mqttClient.isConnected()){
|
||||||
|
//创建回调函数对象
|
||||||
|
MQTTReceiveCallback MQTTReceiveCallback = new MQTTReceiveCallback();
|
||||||
|
//客户端添加回调函数
|
||||||
|
mqttClient.setCallback(MQTTReceiveCallback);
|
||||||
|
//创建连接
|
||||||
|
try{
|
||||||
|
System.out.println("创建连接");
|
||||||
|
mqttClient.connect(mqttConectOptions);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO 自动生成的捕获块
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
System.out.println("mqttClient为空");
|
||||||
|
}
|
||||||
|
System.out.println("连接状态"+mqttClient.isConnected());
|
||||||
|
}
|
||||||
|
// 关闭连接
|
||||||
|
public void closeConnect(){
|
||||||
|
//关闭储存方式
|
||||||
|
if(null!=memoryPersistence){
|
||||||
|
try{
|
||||||
|
memoryPersistence.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO 自动生成的捕获块
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
System.out.println("memoryPersistence为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(null!=mqttClient){
|
||||||
|
if(mqttClient.isConnected()){
|
||||||
|
try{
|
||||||
|
mqttClient.disconnect();
|
||||||
|
mqttClient.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO 自动生成的捕获块
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
System.out.println("mqttClient未连接");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
System.out.println("mqttClient为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//发布消息
|
||||||
|
public static void publishMessage(String pubTopic,String message,int qos){
|
||||||
|
if(null!=mqttClient && mqttClient.isConnected()){
|
||||||
|
System.out.println("发布消息"+mqttClient.isConnected());
|
||||||
|
System.out.println("id"+mqttClient.isConnected());
|
||||||
|
MqttMessage mqttMessage = new MqttMessage();
|
||||||
|
mqttMessage.setQos(qos);
|
||||||
|
|
||||||
|
MqttTopic topic = mqttClient.getTopic(pubTopic);
|
||||||
|
|
||||||
|
if(null!=topic){
|
||||||
|
try{
|
||||||
|
MqttDeliveryToken publish = topic.publish(mqttMessage);
|
||||||
|
if(!publish.isComplete()){
|
||||||
|
System.out.println("消息发布成功");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO 自动生成的捕获块
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//重新连接
|
||||||
|
public static void reConnect(){
|
||||||
|
if(null!=mqttClient&&mqttClient.isConnected()){
|
||||||
|
if(!mqttClient.isConnected()){
|
||||||
|
if(null!=mqttConectOptions){
|
||||||
|
try{
|
||||||
|
mqttClient.connect(mqttConectOptions);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO 自动生成的捕获块
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
System.out.println("mqttConnectOptions为空");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
System.out.println("mqttClient为空或已连接");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
start(ClinentName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//订阅主题
|
||||||
|
public static void suvTopic(String topic){
|
||||||
|
if(null!=mqttClient && mqttClient.isConnected()){
|
||||||
|
try{
|
||||||
|
mqttClient.subscribe(topic,1);
|
||||||
|
} catch (MqttException e) {
|
||||||
|
// TODO 自动生成的捕获块
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
System.out.println("mqttClient出错");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//清空主题
|
||||||
|
public void cleanTopic(String topic){
|
||||||
|
if(null!=mqttClient && mqttClient.isConnected()){
|
||||||
|
try{
|
||||||
|
mqttClient.subscribe(topic);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO 自动生成的捕获块
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
System.out.println("mqttClient出错");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.muyu.enterprise.MQTT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布消息的回调类
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.enterprise.MQTT
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:PushCallback
|
||||||
|
* @Date:2024/9/28 14:35
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttCallback;
|
||||||
|
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布消息的回调类
|
||||||
|
*
|
||||||
|
* 必须实现MqttCallback的接口并实现对应的相关接口方法CallBack 类将实现 MqttCallBack。
|
||||||
|
* 每个客户机标识都需要一个回调实例。在此示例中,构造函数传递客户机标识以另存为实例数据。
|
||||||
|
* 在回调中,将它用来标识已经启动了该回调的哪个实例。
|
||||||
|
* 必须在回调类中实现三个方法:
|
||||||
|
*
|
||||||
|
* public void messageArrived(MqttTopic topic, MqttMessage message)接收已经预订的发布。
|
||||||
|
*
|
||||||
|
* public void connectionLost(Throwable cause)在断开连接时调用。
|
||||||
|
*
|
||||||
|
* public void deliveryComplete(MqttDeliveryToken token))
|
||||||
|
* 接收到已经发布的 QoS 1 或 QoS 2 消息的传递令牌时调用。
|
||||||
|
* 由 MqttClient.connect 激活此回调。
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PushCallback implements MqttCallback {
|
||||||
|
@Override
|
||||||
|
public void connectionLost(Throwable throwable) {
|
||||||
|
// 连接丢失后,一般在这里面进行重连
|
||||||
|
System.out.println("连接断开,可以做重连");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception {
|
||||||
|
// subscribe后得到的消息会执行到这里面
|
||||||
|
System.out.println("接收消息主题 : " + topic);
|
||||||
|
System.out.println("接收消息Qos : " + mqttMessage.getQos());
|
||||||
|
System.out.println("接收消息内容 : " + new String(mqttMessage.getPayload()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
||||||
|
System.out.println("deliveryComplete---------" + iMqttDeliveryToken.isComplete());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,113 @@
|
||||||
|
package com.muyu.enterprise.MQTT;
|
||||||
|
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
|
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 这是发送消息的服务端
|
||||||
|
* 服务器向多个客户端推送主题,即不同客户端可向服务器订阅相同主题
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.enterprise.MQTT
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:ServerMQTT
|
||||||
|
* @Date:2024/9/28 14:32
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
public class ServerMQTT {
|
||||||
|
|
||||||
|
//tcp://MQTT安装的服务器地址:MQTT定义的端口号
|
||||||
|
public static final String HOST = "tcp://127.0.0.1:1883";
|
||||||
|
//定义一个主题
|
||||||
|
public static final String TOPIC = "pos_message_all";
|
||||||
|
//定义MQTT的ID,可以在MQTT服务配置中指定
|
||||||
|
private static final String clientId = "server11";
|
||||||
|
|
||||||
|
private MqttClient client;
|
||||||
|
private static MqttTopic topic11;
|
||||||
|
|
||||||
|
// private String userName = "mqtt"; //非必须
|
||||||
|
// private String passWord = "mqtt"; //非必须
|
||||||
|
|
||||||
|
private static MqttMessage message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造方法
|
||||||
|
* @throws MqttException
|
||||||
|
*/
|
||||||
|
public ServerMQTT() throws MqttException {
|
||||||
|
// MemoryPersistence设置clientid的保存形式,默认为以内存保存
|
||||||
|
client=new MqttClient(HOST, clientId,new MemoryPersistence());
|
||||||
|
connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用来连接服务器
|
||||||
|
*/
|
||||||
|
private void connect()
|
||||||
|
{
|
||||||
|
MqttConnectOptions options = new MqttConnectOptions();
|
||||||
|
options.setCleanSession(false);
|
||||||
|
// options.setUserName(userName);
|
||||||
|
// options.setPassword(passWord.toCharArray());
|
||||||
|
// 设置超时时间
|
||||||
|
options.setConnectionTimeout(10);
|
||||||
|
// 设置会话心跳时间
|
||||||
|
options.setKeepAliveInterval(20);
|
||||||
|
try{
|
||||||
|
client.setCallback(new PushCallback());
|
||||||
|
client.connect(options);
|
||||||
|
topic11 = client.getTopic(TOPIC);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param topic
|
||||||
|
* @param message
|
||||||
|
* @throws MqttException
|
||||||
|
*/
|
||||||
|
public static void publish(MqttTopic topic , MqttMessage message) throws MqttPersistenceException,MqttException{
|
||||||
|
MqttDeliveryToken token= topic.publish(message);
|
||||||
|
|
||||||
|
token.waitForCompletion();
|
||||||
|
System.out.println("消息已完全发布!"+token.isComplete());
|
||||||
|
log.info("消息已完全发布!"+token.isComplete());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param clieId
|
||||||
|
* @param msg
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static void sendMessage(String clieId,String msg)throws Exception{
|
||||||
|
ServerMQTT server = new ServerMQTT();
|
||||||
|
server.message = new MqttMessage();
|
||||||
|
server.message.setQos(1); //保证消息能到达一次
|
||||||
|
server.message.setRetained(true);
|
||||||
|
String str="{\"clienId\":\""+clieId+"\",\"msg\":\""+msg+"\"}";
|
||||||
|
try{
|
||||||
|
publish(server.topic11 , server.message);
|
||||||
|
//断开连接
|
||||||
|
// server.client.disconnect();
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
sendMessage("123444","哈哈哈");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.enterprise.domain.dateBase.ElectronicFence;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectroicFenceAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectroicFenceListReq;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectroicFenceUpdReq;
|
||||||
|
import com.muyu.enterprise.domain.req.FenceWayReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.ElectronicFenceResp;
|
||||||
|
import com.muyu.enterprise.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 javax.annotation.Resource;
|
||||||
|
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 {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
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();
|
||||||
|
// }
|
||||||
|
/**
|
||||||
|
* 电子围栏表信息表删除
|
||||||
|
* @param electronicFenceId 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{electronicFenceId}")
|
||||||
|
@Operation(summary = "电子围栏表信息表删除",
|
||||||
|
description = "通过ID删除电子围栏表信息")
|
||||||
|
public Result<String> remove(@PathVariable("electronicFenceId") Long electronicFenceId)
|
||||||
|
{
|
||||||
|
boolean b = electronicFenceService.removeById(electronicFenceId);
|
||||||
|
return Result.success(null, "操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@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,132 @@
|
||||||
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.enterprise.domain.dateBase.ElectronicFenceGroup;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectronicFenceGroupAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectronicFenceGroupListReq;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectronicFenceGroupUpdReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.ElectronicFenceGroupResp;
|
||||||
|
import com.muyu.enterprise.domain.resp.GroupFenceListresp;
|
||||||
|
import com.muyu.enterprise.service.ElectronicFenceGroupService;
|
||||||
|
import com.muyu.enterprise.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.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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组表信息表删除
|
||||||
|
* @param findGroupId 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{findGroupId}")
|
||||||
|
@Operation(summary = "围栏组表信息表删除",
|
||||||
|
description = "通过ID删除围栏组表信息")
|
||||||
|
public Result<String> remove(@PathVariable("findGroupId") Long findGroupId)
|
||||||
|
{
|
||||||
|
boolean b = electronicFenceGroupService.removeById(findGroupId);
|
||||||
|
|
||||||
|
|
||||||
|
return Result.success(null, "操作成功");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 围栏链信息表删除
|
||||||
|
* @param findId 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/findId/{findId}")
|
||||||
|
@Operation(summary = "围栏链信息表删除",
|
||||||
|
description = "通过ID删除围栏链表信息")
|
||||||
|
public Result<String> findId(@PathVariable("findId") Long findId)
|
||||||
|
{
|
||||||
|
boolean b = fenceGroupMidService.removeById(findId);
|
||||||
|
|
||||||
|
|
||||||
|
return Result.success(null, "操作成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.muyu.enterprise.controller.car;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.enterprise.domain.car.MessageTemplate;
|
||||||
|
import com.muyu.enterprise.domain.req.car.MessageTemplateAddReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.car.MessageTemplateListResp;
|
||||||
|
import com.muyu.enterprise.service.car.MessageTemplateService;
|
||||||
|
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.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版控制层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.controller
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageTemplateController
|
||||||
|
* @Date:2024/9/26 22:08
|
||||||
|
* @Description: 报文模版控制层
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("messageTemplate")
|
||||||
|
@Tag(name = "报文模版控制层", description = "进行报文模版操作")
|
||||||
|
public class MessageTemplateController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private MessageTemplateService messageTemplateService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版列表查询
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
||||||
|
@Operation(summary = "报文模版列表查询", description = "报文模版列表查询")
|
||||||
|
public Result<List<MessageTemplateListResp>> findAll() {
|
||||||
|
List<MessageTemplate> list = messageTemplateService.list();
|
||||||
|
List<MessageTemplateListResp> messageTemplateListRespList = list.stream()
|
||||||
|
.map(template -> MessageTemplateListResp.messageTemplateBuild(
|
||||||
|
template
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
return Result.success(messageTemplateListRespList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增添加报文模版
|
||||||
|
* @param messageTemplateAddReq 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@PostMapping("/")
|
||||||
|
@Operation(summary = "新增添加报文模版", description = "新增添加报文模版")
|
||||||
|
public Result<String> save(@RequestBody MessageTemplateAddReq messageTemplateAddReq) {
|
||||||
|
messageTemplateService.save(MessageTemplate.addBuild(messageTemplateAddReq));
|
||||||
|
return Result.success("添加成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除报文模版
|
||||||
|
* @param messageTemplateId 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@DeleteMapping("/{messageTemplateId}")
|
||||||
|
@Operation(summary = "删除报文模版", description = "删除报文模版")
|
||||||
|
public Result<String> delete(@PathVariable("messageTemplateId") Long messageTemplateId) {
|
||||||
|
messageTemplateService.removeById(messageTemplateId);
|
||||||
|
return Result.success("删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
package com.muyu.enterprise.controller.car;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.enterprise.domain.car.MessageValue;
|
||||||
|
import com.muyu.enterprise.domain.req.car.MessageValueAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.car.MessageValueReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.car.MessageValueListResp;
|
||||||
|
import com.muyu.enterprise.service.car.MessageValueService;
|
||||||
|
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.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文数据控制层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.controller
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageValueController
|
||||||
|
* @Date:2024/9/26 22:11
|
||||||
|
* @Description: 报文数据控制层
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/messageValue")
|
||||||
|
@Tag(name = "报文数据控制层", description = "进行报文数据操作")
|
||||||
|
public class MessageValueController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private MessageValueService messageValueService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文数据列表查询
|
||||||
|
* @param messageValueReq 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
||||||
|
@Operation(summary = "报文数据列表", description = "根据报文类别, 报文模版筛选报文数据")
|
||||||
|
public Result<List<MessageValueListResp>> findAll(@RequestBody MessageValueReq messageValueReq) {
|
||||||
|
List<MessageValueListResp> list = messageValueService.findAll(messageValueReq);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提供预警和故障使用
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/allList")
|
||||||
|
@Operation(summary = "报文数据下拉框", description = "全部报文数据下拉框")
|
||||||
|
public Result<List<MessageValueListResp>> findAllList() {
|
||||||
|
List<MessageValueListResp> list = messageValueService.list().stream().map(
|
||||||
|
value -> MessageValueListResp.valueBuild(
|
||||||
|
value
|
||||||
|
)
|
||||||
|
).toList();
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增添加报文数据
|
||||||
|
* @param messageValueAddReq 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@PostMapping("/add")
|
||||||
|
@Operation(summary = "添加报文数据", description = "新增报文数据")
|
||||||
|
public Result<String> save(@RequestBody MessageValueAddReq messageValueAddReq) {
|
||||||
|
messageValueService.save(MessageValue.addBuild(messageValueAddReq));
|
||||||
|
return Result.success("添加成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过报文id删除数据
|
||||||
|
* @param messageId 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{messageId}")
|
||||||
|
@Operation(summary = "删除报文数据", description = "删除报文数据")
|
||||||
|
public Result<String> delete(@PathVariable Long messageId) {
|
||||||
|
messageValueService.removeById(messageId);
|
||||||
|
return Result.success("删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
//7E 56 49 4e 31 32 33 34 35 36 37 38 39 31 32 33 34 35 32 33 35 36 37 38 39 31 32 33 34 35 31 31 36 2e 36 36 34 30 35 33 30 33 39 2e 35 33 31 37 39 31 30 32 30 30 2e 30 30 35 38 36 37 38 33 37 2e 33 32 34 36 33 35 2e 31 32 33 39 2e 34 39 31 36 38 37 39 38 2e 35 36 50 30 39 30 38 31 39 2e 39 39 39 39 2e 38 36 30 39 39 39 39 39 31 30 30 30 31 33 39 2e 34 36 31 34 2e 36 38 31 31 33 36 39 2e 38 39 31 30 30 2e 30 30 31 30 30 2e 30 30 31 30 30 2e 30 30 31 33 31 34 2e 36 35 33 36 30 2e 35 38 34 2e 35 36 33 2e 32 35 31 30 30 2e 30 30 39 38 2e 32 33 30 33 36 2e 32 36 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 76 7E
|
||||||
|
/**
|
||||||
|
* 报文转换测试
|
||||||
|
* @param testStr 请求参数
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/analysis/{testStr}")
|
||||||
|
@Operation(summary = "测试解析报文", description = "解析报文测试")
|
||||||
|
public Result<JSONObject> analysis(@PathVariable("testStr") String testStr){
|
||||||
|
JSONObject messageValue = messageValueService.analysis(testStr);
|
||||||
|
return Result.success(messageValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,130 @@
|
||||||
|
package com.muyu.enterprise.controller.car;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.enterprise.domain.car.Vehicle;
|
||||||
|
import com.muyu.enterprise.domain.req.car.VehicleAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.car.VehicleManageReq;
|
||||||
|
import com.muyu.enterprise.domain.req.car.VehicleUpdReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.car.VehicleManageResp;
|
||||||
|
import com.muyu.enterprise.service.car.VehicleService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆管理控制层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.controller
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleController
|
||||||
|
* @Date:2024/9/26 22:17
|
||||||
|
* @Description: 车辆管理控制层
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/vehicleManage")
|
||||||
|
@Tag(name = "车辆管理控制层", description = "进行车辆管理操作")
|
||||||
|
public class VehicleController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private VehicleService vehicleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆管理列表
|
||||||
|
* @param vehicleManageReq 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@RequestMapping(path = "/list", method = RequestMethod.POST)
|
||||||
|
@Operation(summary = "车辆管理列表", description = "根据车牌号、VIN码、车辆状态筛选车辆")
|
||||||
|
public Result<TableDataInfo<VehicleManageResp>> getVehicleList(@RequestBody VehicleManageReq vehicleManageReq) {
|
||||||
|
startPage();
|
||||||
|
List<VehicleManageResp> list = vehicleService.getVehicleList(vehicleManageReq);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆录入(添加车辆)
|
||||||
|
* @param vehicleAddReq 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/")
|
||||||
|
@Operation(summary = "新增车辆", description = "录入车辆信息")
|
||||||
|
public Result<String> save(@RequestBody VehicleAddReq vehicleAddReq) {
|
||||||
|
vehicleService.save(Vehicle.addBuild(vehicleAddReq));
|
||||||
|
return Result.success("录入成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过车辆id获取车辆信息
|
||||||
|
* @param vehicleId 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/{vehicleId}")
|
||||||
|
@Operation(summary = "通过id查询车辆信息", description = "通过id查询车辆信息")
|
||||||
|
public Result<Vehicle> findById(@PathVariable("vehicleId") Long vehicleId) {
|
||||||
|
return Result.success(vehicleService.getById(vehicleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车辆信息
|
||||||
|
* @param vehicleId 请求对象
|
||||||
|
* @param vehicleUpdReq 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@PutMapping("/{vehicleId}")
|
||||||
|
@Operation(summary = "修改车辆信息", description = "修改车辆信息")
|
||||||
|
public Result<String> update(
|
||||||
|
@PathVariable("vehicleId") Long vehicleId,
|
||||||
|
@RequestBody @Validated VehicleUpdReq vehicleUpdReq) {
|
||||||
|
vehicleService.updateById(Vehicle.updBuild(vehicleUpdReq, () -> vehicleId));
|
||||||
|
return Result.success("修改成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过车辆id删除车辆信息
|
||||||
|
* @param vehicleId 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{vehicleId}")
|
||||||
|
@Operation(summary = "通过车辆id删除车辆信息", description = "通过车辆id删除车辆信息")
|
||||||
|
public Result<String> delete(@PathVariable("vehicleId") Long vehicleId) {
|
||||||
|
vehicleService.removeById(vehicleId);
|
||||||
|
return Result.success("删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除车辆
|
||||||
|
* @param vehicleIds 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/batchDelete")
|
||||||
|
@Operation(summary = "批量删除车辆")
|
||||||
|
public Result<String> batchDelete(@RequestBody List<Long> vehicleIds) {
|
||||||
|
vehicleService.removeBatchByIds(vehicleIds);
|
||||||
|
return Result.success("批量删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出所有车辆数据
|
||||||
|
* @param response 请求对象
|
||||||
|
*/
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response) {
|
||||||
|
List<Vehicle> list = vehicleService.list();
|
||||||
|
ExcelUtil<Vehicle> util = new ExcelUtil<>(Vehicle.class);
|
||||||
|
util.exportExcel(response, list, "车辆数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.muyu.enterprise.controller.car;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.enterprise.domain.car.VehicleType;
|
||||||
|
import com.muyu.enterprise.service.car.VehicleTypeService;
|
||||||
|
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.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型控制层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.controller
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleTypeController
|
||||||
|
* @Date:2024/9/26 22:23
|
||||||
|
* @Description: 车辆类型实体类
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/vehicleType")
|
||||||
|
@Tag(name = "车辆类型控制层", description = "车辆类型控制层")
|
||||||
|
public class VehicleTypeController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private VehicleTypeService vehicleTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型查询
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@RequestMapping(path = "/", method = RequestMethod.POST)
|
||||||
|
@Operation(summary = "车辆类型列表",description = "车辆类型列表")
|
||||||
|
public Result<List<VehicleType>> findAll(){
|
||||||
|
return Result.success(vehicleTypeService.list());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.enterprise.domain.dateBase.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,22 @@
|
||||||
|
package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.enterprise.domain.dateBase.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,20 @@
|
||||||
|
package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.enterprise.domain.dateBase.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,19 @@
|
||||||
|
package com.muyu.enterprise.mapper.car;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.enterprise.domain.car.MessageTemplate;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文类型持久层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.mapper
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageTemplateMapper
|
||||||
|
* @Date:2024/9/26 22:25
|
||||||
|
* @Description: 报文类型持久层
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MessageTemplateMapper extends BaseMapper<MessageTemplate>
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.muyu.enterprise.mapper.car;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.enterprise.domain.car.MessageValue;
|
||||||
|
import com.muyu.enterprise.domain.resp.car.MessageValueListResp;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文类型持久层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.mapper
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageValueMapper
|
||||||
|
* @Date:2024/9/26 22:26
|
||||||
|
* @Description: 报文类型持久层
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MessageValueMapper extends BaseMapper<MessageValue>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 根据车辆VIN获取车辆报文模版id
|
||||||
|
* @param vehicleVin
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Long getTemplateId(@Param("vehicleVin") String vehicleVin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取报文模版列表
|
||||||
|
* @param templateId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<MessageValueListResp> getTemplateList(@Param("templateId") Long templateId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.muyu.enterprise.mapper.car;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.muyu.enterprise.domain.car.Vehicle;
|
||||||
|
import com.muyu.enterprise.domain.req.car.VehicleManageReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.car.VehicleManageResp;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆管理持久层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.mapper
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleMapper
|
||||||
|
* @Date:2024/9/26 22:26
|
||||||
|
* @Description: 车辆管理持久层
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface VehicleMapper extends MPJBaseMapper<Vehicle>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询车辆管理列表
|
||||||
|
* @param vehicleManageReq 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
List<VehicleManageResp> findAll(VehicleManageReq vehicleManageReq);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.muyu.enterprise.mapper.car;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
import com.muyu.enterprise.domain.car.VehicleType;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型持久层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.mapper
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleTypeMapper
|
||||||
|
* @Date:2024/9/26 22:27
|
||||||
|
* @Description: 车辆类型持久层
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface VehicleTypeMapper extends BaseMapper<VehicleType>
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.enterprise.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.enterprise.domain.dateBase.ElectronicFenceGroup;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectronicFenceGroupListReq;
|
||||||
|
import com.muyu.enterprise.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,81 @@
|
||||||
|
package com.muyu.enterprise.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.enterprise.domain.dateBase.ElectronicFence;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectroicFenceAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectroicFenceListReq;
|
||||||
|
import com.muyu.enterprise.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,30 @@
|
||||||
|
package com.muyu.enterprise.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.enterprise.domain.dateBase.FenceGroupMid;
|
||||||
|
import com.muyu.enterprise.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,20 @@
|
||||||
|
package com.muyu.enterprise.service.car;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import com.muyu.enterprise.domain.car.MessageTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版接口业务层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.service
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageTemplateService
|
||||||
|
* @Date:2024/9/26 22:28
|
||||||
|
* @Description: 报文模版接口
|
||||||
|
*/
|
||||||
|
public interface MessageTemplateService
|
||||||
|
extends IService<MessageTemplate>
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.muyu.enterprise.service.car;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.enterprise.domain.req.car.MessageValueReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.car.MessageValueListResp;
|
||||||
|
import com.muyu.enterprise.domain.car.MessageValue;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文数据接口业务层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.service
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageValueService
|
||||||
|
* @Date:2024/9/26 22:29
|
||||||
|
* @Description: 报文数据接口
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface MessageValueService
|
||||||
|
extends IService<MessageValue>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 报文模版数据列表
|
||||||
|
* @param messageValueReq 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
List<MessageValueListResp> findAll(MessageValueReq messageValueReq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文解析
|
||||||
|
*
|
||||||
|
* @param testStr 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
JSONObject analysis(String testStr);
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.muyu.enterprise.service.car;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.enterprise.domain.car.Vehicle;
|
||||||
|
import com.muyu.enterprise.domain.req.car.VehicleManageReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.car.VehicleManageResp;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆管理接口业务层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.service
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleService
|
||||||
|
* @Date:2024/9/26 22:30
|
||||||
|
* @Description: 车辆管理接口
|
||||||
|
*/
|
||||||
|
public interface VehicleService
|
||||||
|
extends IService<Vehicle>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询车辆管理列表
|
||||||
|
* @param vehicleManageReq 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
List<VehicleManageResp> getVehicleList(VehicleManageReq vehicleManageReq);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.muyu.enterprise.service.car;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.enterprise.domain.car.VehicleType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型接口业务层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.service
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleTypeService
|
||||||
|
* @Date:2024/9/26 22:31
|
||||||
|
* @Description: 车辆类型接口
|
||||||
|
*/
|
||||||
|
public interface VehicleTypeService
|
||||||
|
extends IService<VehicleType>
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
|
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.enterprise.domain.dateBase.ElectronicFenceGroup;
|
||||||
|
import com.muyu.enterprise.domain.dateBase.FenceGroupMid;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectronicFenceGroupListReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.ElectronicFenceGroupResp;
|
||||||
|
import com.muyu.enterprise.domain.resp.ElectronicFenceResp;
|
||||||
|
import com.muyu.enterprise.mapper.ElectronicFenceGroupMapper;
|
||||||
|
import com.muyu.enterprise.service.ElectronicFenceGroupService;
|
||||||
|
import com.muyu.enterprise.service.ElectronicFenceService;
|
||||||
|
import com.muyu.enterprise.service.FenceGroupMidService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
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: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.isNotNull(req.getPriority()),ElectronicFenceGroup::getPriority,req.getPriority()
|
||||||
|
);
|
||||||
|
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,154 @@
|
||||||
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
|
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.enterprise.domain.dateBase.ElectronicFence;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectroicFenceAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectroicFenceListReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.ElectronicFenceResp;
|
||||||
|
import com.muyu.enterprise.mapper.ElectronicFenceMapper;
|
||||||
|
import com.muyu.enterprise.service.ElectronicFenceService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
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: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,60 @@
|
||||||
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.enterprise.domain.dateBase.FenceGroupMid;
|
||||||
|
import com.muyu.enterprise.domain.resp.ElectronicFenceResp;
|
||||||
|
import com.muyu.enterprise.mapper.FenceGroupMidMapper;
|
||||||
|
import com.muyu.enterprise.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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.muyu.enterprise.service.impl.carImpl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.enterprise.domain.car.MessageTemplate;
|
||||||
|
import com.muyu.enterprise.mapper.car.MessageTemplateMapper;
|
||||||
|
import com.muyu.enterprise.service.car.MessageTemplateService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.service.impl
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageTemplateServiceImpl
|
||||||
|
* @Date:2024/9/26 22:31
|
||||||
|
* @Description: 报文类型业务层
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@Service
|
||||||
|
//@Transactional
|
||||||
|
public class MessageTemplateServiceImpl
|
||||||
|
extends ServiceImpl<MessageTemplateMapper,
|
||||||
|
MessageTemplate> implements MessageTemplateService
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,141 @@
|
||||||
|
package com.muyu.enterprise.service.impl.carImpl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.enterprise.domain.car.MessageValue;
|
||||||
|
import com.muyu.enterprise.domain.req.car.MessageValueReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.car.MessageValueListResp;
|
||||||
|
import com.muyu.enterprise.mapper.car.MessageValueMapper;
|
||||||
|
import com.muyu.enterprise.service.car.MessageValueService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.service.impl
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageValueServiceImpl
|
||||||
|
* @Date:2024/9/26 22:32
|
||||||
|
* @Description: 报文数据业务层
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@Service
|
||||||
|
public class MessageValueServiceImpl
|
||||||
|
extends ServiceImpl<MessageValueMapper,
|
||||||
|
MessageValue> implements MessageValueService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 报文类型持久层
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private MessageValueMapper messageValueMapper;
|
||||||
|
/**
|
||||||
|
* Redis缓存
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
public MessageValueServiceImpl(MessageValueMapper messageValueMapper) {
|
||||||
|
this.messageValueMapper = messageValueMapper;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 报文数据列表查询
|
||||||
|
* @param messageValueReq 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<MessageValueListResp> findAll(MessageValueReq messageValueReq) {
|
||||||
|
LambdaQueryWrapper<MessageValue> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(
|
||||||
|
MessageValue::getTemplateId, messageValueReq.getMessageTemplateId()
|
||||||
|
);
|
||||||
|
queryWrapper.eq(
|
||||||
|
MessageValue::getMessageType, messageValueReq.getMessageType()
|
||||||
|
);
|
||||||
|
List<MessageValue> list = this.list(queryWrapper);
|
||||||
|
return list.stream()
|
||||||
|
.map(messageValue -> MessageValueListResp.valueBuild(
|
||||||
|
messageValue
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 报文转换测试
|
||||||
|
* @param testStr 请求参数
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JSONObject analysis(String testStr) {
|
||||||
|
|
||||||
|
if (testStr.length() < 18) {
|
||||||
|
throw new RuntimeException("报文格式不正确");
|
||||||
|
}
|
||||||
|
//根据空格切割数据
|
||||||
|
String[] hexArray = testStr.split(" ");
|
||||||
|
StringBuilder result = new StringBuilder();
|
||||||
|
for (String hex : hexArray) {
|
||||||
|
int decimal = Integer.parseInt(hex, 16);
|
||||||
|
result.append((char) decimal);
|
||||||
|
}
|
||||||
|
log.info(result);
|
||||||
|
//取出车辆VIN码
|
||||||
|
String vehicleVin = result.substring(1, 18);
|
||||||
|
log.info("车辆VIN:" + vehicleVin);
|
||||||
|
//根据车辆VIN码, 查找到报文模版id
|
||||||
|
Long templateId = messageValueMapper.getTemplateId(vehicleVin);
|
||||||
|
log.info("模版id:" + templateId);
|
||||||
|
//获取到报文模版的列表
|
||||||
|
List<MessageValueListResp> templateList = null;
|
||||||
|
if (redisTemplate.hasKey("messageTemplate" + templateId)) {
|
||||||
|
List<Object> list = redisTemplate.opsForList().range("messageTemplate" + templateId, 0, -1);
|
||||||
|
ArrayList<MessageValueListResp> arrayList = new ArrayList<>();
|
||||||
|
for (Object o : list) {
|
||||||
|
String obj = (String) o;
|
||||||
|
MessageValueListResp messageValue = JSON.parseObject(obj, MessageValueListResp.class);
|
||||||
|
arrayList.add(messageValue);
|
||||||
|
}
|
||||||
|
log.info("Redis查询成功");
|
||||||
|
templateList = arrayList;
|
||||||
|
} else {
|
||||||
|
List<MessageValueListResp> list = messageValueMapper.getTemplateList(templateId);
|
||||||
|
redisTemplate.opsForList().rightPushAll("messageTemplate" + templateId, list);
|
||||||
|
log.info("数据库查询成功");
|
||||||
|
templateList = list;
|
||||||
|
}
|
||||||
|
//判断报文模版列表不为空
|
||||||
|
if (templateList == null){
|
||||||
|
throw new RuntimeException("报文模板为空");
|
||||||
|
}
|
||||||
|
//存储报文模板解析后数据
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
for (MessageValueListResp messageValue : templateList) {
|
||||||
|
//起始位下标
|
||||||
|
Integer startIndex = messageValue.getMessageStartIndex() - 1;
|
||||||
|
//截止位下标
|
||||||
|
Integer endIndex = messageValue.getMessageEndIndex();
|
||||||
|
//根据报文模版截取数据
|
||||||
|
String value = result.substring(startIndex, endIndex);
|
||||||
|
//存入数据
|
||||||
|
jsonObject.put(messageValue.getMessageLabel(), value);
|
||||||
|
}
|
||||||
|
for (Map.Entry<String, Object> stringObjectEntry : jsonObject) {
|
||||||
|
log.info(stringObjectEntry.getKey() + ":" + stringObjectEntry.getValue());
|
||||||
|
}
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.enterprise.service.impl.carImpl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.enterprise.domain.car.Vehicle;
|
||||||
|
import com.muyu.enterprise.domain.car.VehicleType;
|
||||||
|
import com.muyu.enterprise.domain.req.car.VehicleManageReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.car.VehicleManageResp;
|
||||||
|
import com.muyu.enterprise.mapper.car.VehicleMapper;
|
||||||
|
import com.muyu.enterprise.service.car.VehicleService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.service.impl
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleServiceImpl
|
||||||
|
* @Date:2024/9/26 22:35
|
||||||
|
* @Description: 车辆管理业务层
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@Service
|
||||||
|
public class VehicleServiceImpl
|
||||||
|
extends ServiceImpl<VehicleMapper,
|
||||||
|
Vehicle> implements VehicleService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private VehicleMapper vehicleMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆管理列表
|
||||||
|
* @param vehicleManageReq 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<VehicleManageResp> getVehicleList(VehicleManageReq vehicleManageReq) {
|
||||||
|
MPJLambdaWrapper<Vehicle> wrapper = new MPJLambdaWrapper<>();
|
||||||
|
wrapper.selectAll(Vehicle.class)
|
||||||
|
.selectAs(VehicleType::getVehicleTypeName, VehicleManageResp::getVehicleTypeName)
|
||||||
|
.leftJoin(VehicleType.class, VehicleType::getVehicleTypeId, Vehicle::getVehicleTypeId)
|
||||||
|
.like(
|
||||||
|
StringUtils.isNotEmpty(vehicleManageReq.getLicenceNumber()),
|
||||||
|
Vehicle::getLicenceNumber, vehicleManageReq.getLicenceNumber()
|
||||||
|
)
|
||||||
|
.like(
|
||||||
|
StringUtils.isNotEmpty(vehicleManageReq.getVehicleVin()),
|
||||||
|
Vehicle::getVehicleVin, vehicleManageReq.getVehicleVin()
|
||||||
|
)
|
||||||
|
.eq(
|
||||||
|
StringUtils.isNotBlank(vehicleManageReq.getVehicleStatus()),
|
||||||
|
Vehicle::getVehicleStatus, vehicleManageReq.getVehicleStatus()
|
||||||
|
);
|
||||||
|
List<VehicleManageResp> list = vehicleMapper.selectJoinList(VehicleManageResp.class, wrapper);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.muyu.enterprise.service.impl.carImpl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.enterprise.domain.car.VehicleType;
|
||||||
|
import com.muyu.enterprise.mapper.car.VehicleTypeMapper;
|
||||||
|
import com.muyu.enterprise.service.car.VehicleTypeService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.service.impl
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleTypeServiceImpl
|
||||||
|
* @Date:2024/9/26 22:36
|
||||||
|
* @Description: 车辆类型实现层
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@Service
|
||||||
|
public class VehicleTypeServiceImpl
|
||||||
|
extends ServiceImpl<VehicleTypeMapper, VehicleType>
|
||||||
|
implements VehicleTypeService
|
||||||
|
{
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ nacos:
|
||||||
addr: 106.15.136.7:8848
|
addr: 106.15.136.7:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: dev
|
namespace: lqs
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?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.muyu.enterprise.mapper.car.VehicleMapper">
|
||||||
|
|
||||||
|
<select id="findAll" resultType="com.muyu.enterprise.domain.resp.car.VehicleManageResp">
|
||||||
|
SELECT
|
||||||
|
v.vehicle_id,
|
||||||
|
v.licence_number,
|
||||||
|
v.vehicle_color,
|
||||||
|
v.vehicle_vin,
|
||||||
|
v.vehicle_brand,
|
||||||
|
v.vehicle_model,
|
||||||
|
v.vehicle_license_due_date,
|
||||||
|
v.vehicle_status,
|
||||||
|
t.vehicle_type_name
|
||||||
|
FROM
|
||||||
|
vehicle v
|
||||||
|
LEFT JOIN vehicle_type t ON v.vehicle_type_id = t.vehicle_type_id
|
||||||
|
<where>
|
||||||
|
<if test="null != licenceNumber and '' != licenceNumber">
|
||||||
|
and v.licence_number like '%${licenceNumber}%'
|
||||||
|
</if>
|
||||||
|
<if test="null != vehicleVin and '' != vehicleVin">
|
||||||
|
and v.vehicle_vin like '%${vehicleVin}%'
|
||||||
|
</if>
|
||||||
|
<if test="null != vehicleStatus and '' != vehicleStatus">
|
||||||
|
and v.vehicle_status = #{vehicleStatus}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?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.muyu.enterprise.mapper.car.MessageValueMapper">
|
||||||
|
|
||||||
|
<select id="getTemplateId" resultType="java.lang.Long">
|
||||||
|
SELECT
|
||||||
|
t.message_template_id
|
||||||
|
FROM
|
||||||
|
vehicle v
|
||||||
|
LEFT JOIN vehicle_type t ON v.vehicle_type_id = t.vehicle_type_id
|
||||||
|
WHERE
|
||||||
|
v.vehicle_vin = #{vehicleVin}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getTemplateList" resultType="com.muyu.enterprise.domain.resp.car.MessageValueListResp">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
message_value m
|
||||||
|
WHERE
|
||||||
|
m.template_id = #{templateId}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,117 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-modules-enterprise</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-modules-protocol-analysis</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
cloud-modules-protocol-analysis协议解析模块
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataSource -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-datasource</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataScope -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-datascope</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common Log -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 接口模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 企业业务平台 - 公共依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-modules-enterprise-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- 协议解析 - 公共依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-modules-enterprise-server</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.yulichang</groupId>
|
||||||
|
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||||
|
<version>1.4.11</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.muyu.analysis.parsing.MQTT;
|
||||||
|
|
||||||
|
import com.muyu.analysis.parsing.controller.ParsingController;
|
||||||
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试MQTT
|
||||||
|
* @ClassName demo
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 李庆帅
|
||||||
|
* @Date 2024/9/28
|
||||||
|
*/
|
||||||
|
public class DemoMQTT {
|
||||||
|
|
||||||
|
public void main(String[] args) {
|
||||||
|
|
||||||
|
String topic = "vehicle";
|
||||||
|
String content = "Message from MqttPublishSample";
|
||||||
|
int qos = 2;
|
||||||
|
String broker = "tcp://106.15.136.7:1883";
|
||||||
|
String clientId = "JavaSample";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 第三个参数为空,默认持久化策略
|
||||||
|
MqttClient sampleClient = new MqttClient(broker, clientId);
|
||||||
|
MqttConnectOptions connOpts = new MqttConnectOptions();
|
||||||
|
connOpts.setCleanSession(true);
|
||||||
|
System.out.println("Connecting to broker: "+broker);
|
||||||
|
sampleClient.connect(connOpts);
|
||||||
|
sampleClient.subscribe(topic,0);
|
||||||
|
sampleClient.setCallback(new MqttCallback() {
|
||||||
|
// 连接丢失
|
||||||
|
@Override
|
||||||
|
public void connectionLost(Throwable throwable) {
|
||||||
|
|
||||||
|
}
|
||||||
|
// 连接成功
|
||||||
|
@Override
|
||||||
|
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
|
||||||
|
System.out.println(new String(mqttMessage.getPayload()));
|
||||||
|
}
|
||||||
|
// 接收信息
|
||||||
|
@Override
|
||||||
|
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch(MqttException me) {
|
||||||
|
System.out.println("reason "+me.getReasonCode());
|
||||||
|
System.out.println("msg "+me.getMessage());
|
||||||
|
System.out.println("loc "+me.getLocalizedMessage());
|
||||||
|
System.out.println("cause "+me.getCause());
|
||||||
|
System.out.println("excep "+me);
|
||||||
|
me.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.muyu.analysis.parsing;
|
||||||
|
|
||||||
|
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: 李庆帅
|
||||||
|
* @Package: com.muyu.cloud.protocol.parsing
|
||||||
|
* @Project: 2112-car-cloud-server
|
||||||
|
* @name: ProtocolParsingApplication
|
||||||
|
* @Date: 2024/9/28 11:54
|
||||||
|
* @Description: 协议解析启动类
|
||||||
|
*/
|
||||||
|
@EnableCustomConfig
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
public class ProtocolParsingApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(ProtocolParsingApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
package com.muyu.analysis.parsing.controller;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.muyu.analysis.parsing.MQTT.DemoMQTT;
|
||||||
|
import com.muyu.analysis.parsing.service.ParsingService;
|
||||||
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议解析控制层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.analysis.parsing.controller
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:ParsingController
|
||||||
|
* @Date:2024/9/28 20:36
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/parsing")
|
||||||
|
public class ParsingController
|
||||||
|
{
|
||||||
|
private static final String topic = "vehicle";
|
||||||
|
private static final String content = "Message from MqttPublishSample";
|
||||||
|
private static final int qos = 2;
|
||||||
|
private static final String broker = "tcp://106.15.136.7:1883";
|
||||||
|
private static final String clientId = "JavaSample";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ParsingService parsingService;
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 协议解析
|
||||||
|
// * @param messageStr
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// @PostMapping("/protocolParsing")
|
||||||
|
// public JSONObject protocolParsing(@RequestParam("messageStr") String messageStr) {
|
||||||
|
// try {
|
||||||
|
// // 第三个参数为空,默认持久化策略
|
||||||
|
// MqttClient sampleClient = new MqttClient(broker, clientId);
|
||||||
|
// MqttConnectOptions connOpts = new MqttConnectOptions();
|
||||||
|
// connOpts.setCleanSession(true);
|
||||||
|
// System.out.println("Connecting to broker: "+broker);
|
||||||
|
// sampleClient.connect(connOpts);
|
||||||
|
// sampleClient.subscribe(topic,0);
|
||||||
|
// sampleClient.setCallback(new MqttCallback() {
|
||||||
|
// // 连接丢失
|
||||||
|
// @Override
|
||||||
|
// public void connectionLost(Throwable throwable) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// // 连接成功
|
||||||
|
// @Override
|
||||||
|
// public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
|
||||||
|
// System.out.println(new String(mqttMessage.getPayload()));
|
||||||
|
// }
|
||||||
|
// // 接收信息
|
||||||
|
// @Override
|
||||||
|
// public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// } catch(MqttException me) {
|
||||||
|
// System.out.println("reason "+me.getReasonCode());
|
||||||
|
// System.out.println("msg "+me.getMessage());
|
||||||
|
// System.out.println("loc "+me.getLocalizedMessage());
|
||||||
|
// System.out.println("cause "+me.getCause());
|
||||||
|
// System.out.println("excep "+me);
|
||||||
|
// me.printStackTrace();
|
||||||
|
// }
|
||||||
|
// JSONObject messageValue = parsingService.protocolParsing(messageStr);
|
||||||
|
// return messageValue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议解析
|
||||||
|
*/
|
||||||
|
@PostMapping("/mqttClient")
|
||||||
|
public void mqttClient() {
|
||||||
|
parsingService.mqtt();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.muyu.analysis.parsing.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.enterprise.domain.car.MessageValue;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议解析持久层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.analysis.parsing.mapper
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:ParsingMapper
|
||||||
|
* @Date:2024/9/28 20:54
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ParsingMapper extends BaseMapper<MessageValue> {
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.muyu.analysis.parsing.remote;
|
||||||
|
|
||||||
|
import com.muyu.analysis.parsing.remote.factory.RemoteClientServiceFactory;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.enterprise.domain.resp.car.MessageValueListResp;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版远程调用接口
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.analysis.parsing.feign
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:RemoteServiceClient
|
||||||
|
* @Date:2024/9/28 20:38
|
||||||
|
*/
|
||||||
|
@FeignClient(name = "remoteClientService"
|
||||||
|
,fallbackFactory= RemoteClientServiceFactory.class)
|
||||||
|
public interface RemoteClientService {
|
||||||
|
/**
|
||||||
|
* 根据报文模版id查询报文数据
|
||||||
|
* @param vehicleVin 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/vehicleManage/findByVehicleVin/{vehicleVin}")
|
||||||
|
// @Operation(description = "通过车辆vin码查询模板id")
|
||||||
|
public Result<Long> findByVehicleVin(@PathVariable("vehicleVin") String vehicleVin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据报文模版id查询报文数据
|
||||||
|
* @param templateId 请求对象
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/messageValue/findByTemplateId/{templateId}")
|
||||||
|
// @Operation(summary = "根据报文模版id查询报文数据", description = "根据报文模版id查询报文数据")
|
||||||
|
public Result<List<MessageValueListResp>> findByTemplateId(@PathVariable("templateId") Long templateId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.muyu.analysis.parsing.remote.factory;
|
||||||
|
|
||||||
|
import com.muyu.analysis.parsing.remote.RemoteClientService;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.enterprise.domain.resp.car.MessageValueListResp;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版对象服务降级处理
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.analysis.parsing.remote.factory
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:RemoteServiceClientFactory
|
||||||
|
* @Date:2024/9/28 21:16
|
||||||
|
*/
|
||||||
|
public class RemoteClientServiceFactory implements FallbackFactory<RemoteClientService>
|
||||||
|
{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(RemoteClientServiceFactory.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteClientService create(Throwable throwable) {
|
||||||
|
log.error("报文模版传参调用失败:{}", throwable.getMessage());
|
||||||
|
return new RemoteClientService(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<Long> findByVehicleVin(String vehicleVin) {
|
||||||
|
return Result.error("报文模版传参调用失败" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<MessageValueListResp>> findByTemplateId(Long templateId) {
|
||||||
|
return Result.error("报文模版传参调用失败" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.muyu.analysis.parsing.service;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.enterprise.domain.car.MessageValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议解析业务层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.analysis.parsing.service
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:ParsingService
|
||||||
|
* @Date:2024/9/28 20:50
|
||||||
|
*/
|
||||||
|
public interface ParsingService extends IService<MessageValue>
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议解析
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void mqtt();
|
||||||
|
}
|
|
@ -0,0 +1,151 @@
|
||||||
|
package com.muyu.analysis.parsing.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.analysis.parsing.controller.ParsingController;
|
||||||
|
import com.muyu.analysis.parsing.remote.RemoteClientService;
|
||||||
|
import com.muyu.analysis.parsing.mapper.ParsingMapper;
|
||||||
|
import com.muyu.analysis.parsing.service.ParsingService;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.enterprise.domain.car.MessageValue;
|
||||||
|
import com.muyu.enterprise.domain.resp.car.MessageValueListResp;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议解析实现层
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.analysis.parsing.service.impl
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:ParsingServiceImpl
|
||||||
|
* @Date:2024/9/28 20:53
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@Service
|
||||||
|
public class ParsingServiceImpl extends ServiceImpl<ParsingMapper, MessageValue>
|
||||||
|
implements ParsingService
|
||||||
|
{
|
||||||
|
@Resource
|
||||||
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RemoteClientService remoteServiceClientService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mqtt() {
|
||||||
|
String topic = "vehicle";
|
||||||
|
String content = "Message from MqttPublishSample";
|
||||||
|
int qos = 2;
|
||||||
|
String broker = "tcp://106.15.136.7:1883";
|
||||||
|
String clientId = "JavaSample";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 第三个参数为空,默认持久化策略
|
||||||
|
MqttClient sampleClient = new MqttClient(broker, clientId);
|
||||||
|
MqttConnectOptions connOpts = new MqttConnectOptions();
|
||||||
|
connOpts.setCleanSession(true);
|
||||||
|
System.out.println("Connecting to broker: "+broker);
|
||||||
|
sampleClient.connect(connOpts);
|
||||||
|
sampleClient.subscribe(topic,0);
|
||||||
|
sampleClient.setCallback(new MqttCallback() {
|
||||||
|
// 连接丢失
|
||||||
|
@Override
|
||||||
|
public void connectionLost(Throwable throwable) {
|
||||||
|
|
||||||
|
}
|
||||||
|
// 连接成功
|
||||||
|
@Override
|
||||||
|
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
|
||||||
|
System.out.println(new String(mqttMessage.getPayload()));
|
||||||
|
String mqtt= new String(mqttMessage.getPayload());
|
||||||
|
JSONObject jsonObject = this.protocolParsing(mqtt);
|
||||||
|
System.out.println("转换后:"+jsonObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject protocolParsing(String messageStr) {
|
||||||
|
//根据空格切割数据
|
||||||
|
String[] hexArray = messageStr.split(" ");
|
||||||
|
StringBuilder result = new StringBuilder();
|
||||||
|
//遍历十六进制数据转换为字符
|
||||||
|
for (String hex : hexArray) {
|
||||||
|
int decimal = Integer.parseInt(hex, 16);
|
||||||
|
result.append((char) decimal);
|
||||||
|
}
|
||||||
|
//取出车辆VIN码
|
||||||
|
String vehicleVin = result.substring(1, 18);
|
||||||
|
log.info("车辆VIN码: " + vehicleVin);
|
||||||
|
//根据车辆VIN码查询报文模板ID
|
||||||
|
Result<Long> byVehicleVin = remoteServiceClientService.findByVehicleVin(vehicleVin);
|
||||||
|
Long templateId = byVehicleVin.getData();
|
||||||
|
List<MessageValueListResp> templateList;
|
||||||
|
//从redis缓存中获取报文模板数据
|
||||||
|
try {
|
||||||
|
String redisKey = "messageTemplate" + templateId;
|
||||||
|
if (redisTemplate.hasKey(redisKey)) {
|
||||||
|
List<Object> list = redisTemplate.opsForList().range(redisKey, 0, -1);
|
||||||
|
templateList = list.stream()
|
||||||
|
.map(obj -> JSON.parseObject(obj.toString(), MessageValueListResp.class))
|
||||||
|
.toList();
|
||||||
|
log.info("Redis缓存查询成功");
|
||||||
|
} else {
|
||||||
|
Result<List<MessageValueListResp>> byTemplateId = remoteServiceClientService.findByTemplateId(templateId);
|
||||||
|
templateList = byTemplateId.getData();
|
||||||
|
templateList.forEach(
|
||||||
|
listResp ->
|
||||||
|
redisTemplate.opsForList().rightPush(
|
||||||
|
redisKey, JSON.toJSONString(listResp)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
log.info("数据库查询成功");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("获取报文模板失败");
|
||||||
|
}
|
||||||
|
//判断报文模板列表不为空
|
||||||
|
if (templateList.isEmpty()) {
|
||||||
|
throw new RuntimeException("报文模版为空");
|
||||||
|
}
|
||||||
|
//存储报文模版解析后的数据
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
for (MessageValueListResp messageValue : templateList) {
|
||||||
|
//起始位下标
|
||||||
|
Integer startIndex = messageValue.getMessageStartIndex() - 1;
|
||||||
|
//结束位下标
|
||||||
|
Integer endIndex = messageValue.getMessageEndIndex();
|
||||||
|
//根据报文模版截取数据
|
||||||
|
String value = result.substring(startIndex, endIndex);
|
||||||
|
//存入数据
|
||||||
|
jsonObject.put(messageValue.getMessageLabel(), value);
|
||||||
|
}
|
||||||
|
System.out.println("发发呆沙发斯蒂芬萨达:"+jsonObject.toString());
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
// 接收信息
|
||||||
|
@Override
|
||||||
|
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch(MqttException me) {
|
||||||
|
System.out.println("reason "+me.getReasonCode());
|
||||||
|
System.out.println("msg "+me.getMessage());
|
||||||
|
System.out.println("loc "+me.getLocalizedMessage());
|
||||||
|
System.out.println("cause "+me.getCause());
|
||||||
|
System.out.println("excep "+me);
|
||||||
|
me.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
com.muyu.analysis.parsing.remote.factory.RemoteClientServiceFactory
|
|
@ -0,0 +1,2 @@
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
|
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,46 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 10166
|
||||||
|
|
||||||
|
# nacos线上地址
|
||||||
|
nacos:
|
||||||
|
addr: 106.15.136.7:8848
|
||||||
|
user-name: nacos
|
||||||
|
password: nacos
|
||||||
|
namespace: lqs
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: cloud-enterprise
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: ${nacos.addr}
|
||||||
|
# nacos用户名
|
||||||
|
username: ${nacos.user-name}
|
||||||
|
# nacos密码
|
||||||
|
password: ${nacos.password}
|
||||||
|
# 命名空间
|
||||||
|
namespace: ${nacos.namespace}
|
||||||
|
config:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: ${nacos.addr}
|
||||||
|
# nacos用户名
|
||||||
|
username: ${nacos.user-name}
|
||||||
|
# nacos密码
|
||||||
|
password: ${nacos.password}
|
||||||
|
# 命名空间
|
||||||
|
namespace: ${nacos.namespace}
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
# 系统共享配置
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
# 系统环境Config共享配置
|
||||||
|
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/cloud-vehicle-gateway"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.muyu" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,81 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/cloud-vehicle-gateway"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.sky.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||||
|
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||||
|
<Pattern>${log.sky.pattern}</Pattern>
|
||||||
|
</layout>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.muyu" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="GRPC_LOG"/>
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,81 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/cloud-vehicle-gateway"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.sky.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
||||||
|
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
||||||
|
<Pattern>${log.sky.pattern}</Pattern>
|
||||||
|
</layout>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.muyu" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="GRPC_LOG"/>
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -15,6 +15,7 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>cloud-modules-enterprise-server</module>
|
<module>cloud-modules-enterprise-server</module>
|
||||||
<module>cloud-modules-enterprise-common</module>
|
<module>cloud-modules-enterprise-common</module>
|
||||||
|
<module>cloud-modules-protocol-analysis</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
|
|
|
@ -6,7 +6,7 @@ nacos:
|
||||||
addr: 106.15.136.7:8848
|
addr: 106.15.136.7:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: dev
|
namespace: lqs
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -6,7 +6,7 @@ nacos:
|
||||||
addr: 106.15.136.7:8848
|
addr: 106.15.136.7:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: dev
|
namespace: lqs
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -6,7 +6,7 @@ nacos:
|
||||||
addr: 106.15.136.7:8848
|
addr: 106.15.136.7:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: dev
|
namespace: lqs
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
|
|
|
@ -6,7 +6,7 @@ nacos:
|
||||||
addr: 106.15.136.7:8848
|
addr: 106.15.136.7:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: dev
|
namespace: lqs
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
Loading…
Reference in New Issue