feat(): 车辆报文配置
parent
ea9876fed9
commit
be878ef01a
|
@ -1,13 +1,14 @@
|
||||||
package com.muyu.customer.business.domain;
|
package com.muyu.customer.business.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.muyu.customer.business.domain.req.FaultRecordSaveReq;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.customer.business.domain.req.FaultRecordEditReq;
|
import com.muyu.customer.business.domain.req.FaultRecordEditReq;
|
||||||
import com.muyu.customer.business.domain.req.FaultRecordQueryReq;
|
import com.muyu.customer.business.domain.req.FaultRecordQueryReq;
|
||||||
import com.muyu.customer.business.domain.req.FaultRecordSaveReq;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
|
@ -3,6 +3,9 @@ package com.muyu.customer.business.domain;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.FenceSaveReq;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -10,9 +13,6 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import com.muyu.customer.business.domain.req.FenceQueryReq;
|
|
||||||
import com.muyu.customer.business.domain.req.FenceSaveReq;
|
|
||||||
import com.muyu.customer.business.domain.req.FenceEditReq;
|
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,51 +1,104 @@
|
||||||
package com.muyu.customer.business.domain;
|
package com.muyu.customer.business.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.customer.business.domain.req.MessageDetailEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.MessageDetailQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.MessageDetailSaveReq;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报文详情对象 MessageDetail
|
* 报文详情对象 message_detail
|
||||||
*
|
*
|
||||||
* @author DeKangLiu
|
* @author muyu
|
||||||
* Date 2024/6/26 20:48
|
* @date 2024-06-28
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class MessageDetail {
|
@TableName("message_detail")
|
||||||
|
@ApiModel(value = "MessageDetail", description = "报文详情")
|
||||||
|
public class MessageDetail {
|
||||||
|
|
||||||
/**
|
|
||||||
* 报文id
|
|
||||||
*/
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
/** 报文id */
|
||||||
* 报文key
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
*/
|
@ApiModelProperty(name = "报文id", value = "报文id")
|
||||||
private String key;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/** 数据项key */
|
||||||
* 报文起始位
|
@Excel(name = "数据项key")
|
||||||
*/
|
@ApiModelProperty(name = "数据项key", value = "数据项key")
|
||||||
private Integer startBit;
|
private String keyCode;
|
||||||
|
|
||||||
/**
|
/** 起始位 */
|
||||||
* 报文结束位
|
@Excel(name = "起始位")
|
||||||
*/
|
@ApiModelProperty(name = "起始位", value = "起始位")
|
||||||
private Integer stopBit;
|
private String startBit;
|
||||||
|
|
||||||
/**
|
/** 结束位 */
|
||||||
* 报文标签
|
@Excel(name = "结束位")
|
||||||
*/
|
@ApiModelProperty(name = "结束位", value = "结束位")
|
||||||
private String lable;
|
private String stopBit;
|
||||||
|
|
||||||
/**
|
/** 标签 */
|
||||||
* 报文类型
|
@Excel(name = "标签")
|
||||||
*/
|
@ApiModelProperty(name = "标签", value = "标签")
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
/** 类型 */
|
||||||
|
@Excel(name = "类型")
|
||||||
|
@ApiModelProperty(name = "类型", value = "类型")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
// private String vin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询构造器
|
||||||
|
*/
|
||||||
|
public static MessageDetail queryBuild( MessageDetailQueryReq messageDetailQueryReq){
|
||||||
|
return MessageDetail.builder()
|
||||||
|
.keyCode(messageDetailQueryReq.getKeyCode())
|
||||||
|
.startBit(messageDetailQueryReq.getStartBit())
|
||||||
|
.stopBit(messageDetailQueryReq.getStopBit())
|
||||||
|
.label(messageDetailQueryReq.getLabel())
|
||||||
|
.type(messageDetailQueryReq.getType())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加构造器
|
||||||
|
*/
|
||||||
|
public static MessageDetail saveBuild(MessageDetailSaveReq messageDetailSaveReq){
|
||||||
|
return MessageDetail.builder()
|
||||||
|
.keyCode(messageDetailSaveReq.getKeyCode())
|
||||||
|
.startBit(messageDetailSaveReq.getStartBit())
|
||||||
|
.stopBit(messageDetailSaveReq.getStopBit())
|
||||||
|
.label(messageDetailSaveReq.getLabel())
|
||||||
|
.type(messageDetailSaveReq.getType())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改构造器
|
||||||
|
*/
|
||||||
|
public static MessageDetail editBuild(Long id, MessageDetailEditReq messageDetailEditReq){
|
||||||
|
return MessageDetail.builder()
|
||||||
|
.id(id)
|
||||||
|
.keyCode(messageDetailEditReq.getKeyCode())
|
||||||
|
.startBit(messageDetailEditReq.getStartBit())
|
||||||
|
.stopBit(messageDetailEditReq.getStopBit())
|
||||||
|
.label(messageDetailEditReq.getLabel())
|
||||||
|
.type(messageDetailEditReq.getType())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,15 @@ package com.muyu.customer.business.domain;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.muyu.customer.business.domain.req.VehicleQueryReq;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.customer.business.domain.req.VehicleEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.VehicleSaveReq;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -14,9 +18,6 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import com.muyu.customer.business.domain.req.VehicleQueryReq;
|
|
||||||
import com.muyu.customer.business.domain.req.VehicleSaveReq;
|
|
||||||
import com.muyu.customer.business.domain.req.VehicleEditReq;
|
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.customer.business.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MessDetaiModel
|
||||||
|
*
|
||||||
|
* @author DeKangLiu
|
||||||
|
* Date 2024/6/28 21:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class MessageDetailModel {
|
||||||
|
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
private List<Integer> ids;
|
||||||
|
}
|
|
@ -1,16 +1,8 @@
|
||||||
package com.muyu.customer.business.domain.model;
|
package com.muyu.customer.business.domain.model;
|
||||||
|
|
||||||
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.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
|
||||||
import com.muyu.customer.business.domain.MessageDetail;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
@ -84,5 +76,5 @@ public class VehicleModel {
|
||||||
private String vehicleType;
|
private String vehicleType;
|
||||||
|
|
||||||
/** 报文详情对象 */
|
/** 报文详情对象 */
|
||||||
private String[] messageDetail;
|
private List<Integer> messageDetail;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文详情对象 message_detail
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "MessageDetailEditReq", description = "报文详情")
|
||||||
|
public class MessageDetailEditReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 数据项key */
|
||||||
|
@ApiModelProperty(name = "数据项key", value = "数据项key")
|
||||||
|
private String keyCode;
|
||||||
|
|
||||||
|
/** 起始位 */
|
||||||
|
@ApiModelProperty(name = "起始位", value = "起始位")
|
||||||
|
private String startBit;
|
||||||
|
|
||||||
|
/** 结束位 */
|
||||||
|
@ApiModelProperty(name = "结束位", value = "结束位")
|
||||||
|
private String stopBit;
|
||||||
|
|
||||||
|
/** 标签 */
|
||||||
|
@ApiModelProperty(name = "标签", value = "标签")
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
/** 类型 */
|
||||||
|
@ApiModelProperty(name = "类型", value = "类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文详情对象 message_detail
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "MessageDetailQueryReq", description = "报文详情")
|
||||||
|
public class MessageDetailQueryReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 数据项key */
|
||||||
|
@ApiModelProperty(name = "数据项key", value = "数据项key")
|
||||||
|
private String keyCode;
|
||||||
|
|
||||||
|
/** 起始位 */
|
||||||
|
@ApiModelProperty(name = "起始位", value = "起始位")
|
||||||
|
private String startBit;
|
||||||
|
|
||||||
|
/** 结束位 */
|
||||||
|
@ApiModelProperty(name = "结束位", value = "结束位")
|
||||||
|
private String stopBit;
|
||||||
|
|
||||||
|
/** 标签 */
|
||||||
|
@ApiModelProperty(name = "标签", value = "标签")
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
/** 类型 */
|
||||||
|
@ApiModelProperty(name = "类型", value = "类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.muyu.customer.business.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文详情对象 message_detail
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ApiModel(value = "MessageDetailSaveReq", description = "报文详情")
|
||||||
|
public class MessageDetailSaveReq extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 报文id */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "报文id", value = "报文id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 数据项key */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "数据项key", value = "数据项key")
|
||||||
|
private String keyCode;
|
||||||
|
|
||||||
|
/** 起始位 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "起始位", value = "起始位")
|
||||||
|
private String startBit;
|
||||||
|
|
||||||
|
/** 结束位 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "结束位", value = "结束位")
|
||||||
|
private String stopBit;
|
||||||
|
|
||||||
|
/** 标签 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "标签", value = "标签")
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
/** 类型 */
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "类型", value = "类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
package com.muyu.customer.business.consumer;
|
package com.muyu.customer.business.consumer;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
|
||||||
import com.muyu.customer.business.domain.FaultRecord;
|
import com.muyu.customer.business.domain.FaultRecord;
|
||||||
import com.muyu.customer.business.saas.holder.DynamicDataSourceHolder;
|
import com.muyu.customer.business.saas.holder.DynamicDataSourceHolder;
|
||||||
import com.muyu.customer.business.service.FaultRecordService;
|
import com.muyu.customer.business.service.FaultRecordService;
|
||||||
|
|
|
@ -6,7 +6,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import com.muyu.customer.business.domain.Vehicle;
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
|
|
@ -0,0 +1,122 @@
|
||||||
|
package com.muyu.customer.business.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.muyu.customer.business.domain.model.MessageDetailModel;
|
||||||
|
import com.muyu.customer.business.domain.req.MessageDetailEditReq;
|
||||||
|
import com.muyu.customer.business.domain.req.MessageDetailQueryReq;
|
||||||
|
import com.muyu.customer.business.domain.req.MessageDetailSaveReq;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
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.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.customer.business.domain.MessageDetail;
|
||||||
|
import com.muyu.customer.business.service.MessageDetailService;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文详情Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Api(tags = "报文详情")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/detail")
|
||||||
|
public class MessageDetailController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private MessageDetailService messageDetailService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报文详情列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取报文详情列表")
|
||||||
|
@RequiresPermissions("customerBusiness:detail:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<MessageDetail>> list(MessageDetailQueryReq messageDetailQueryReq) {
|
||||||
|
startPage();
|
||||||
|
List<MessageDetail> list = messageDetailService.list(MessageDetail.queryBuild(messageDetailQueryReq));
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出报文详情列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出报文详情列表")
|
||||||
|
@RequiresPermissions("customerBusiness:detail:export")
|
||||||
|
@Log(title = "报文详情", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, MessageDetail messageDetail) {
|
||||||
|
List<MessageDetail> list = messageDetailService.list(messageDetail);
|
||||||
|
ExcelUtil<MessageDetail> util = new ExcelUtil<MessageDetail>(MessageDetail.class);
|
||||||
|
util.exportExcel(response, list, "报文详情数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/selectByVin/{vin}")
|
||||||
|
public Result<List<MessageDetail>> selectByVin(@PathVariable String vin) {
|
||||||
|
return Result.success(messageDetailService.selectMessage(vin));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取报文详情详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取报文详情详细信息")
|
||||||
|
@RequiresPermissions("customerBusiness:detail:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||||
|
public Result<MessageDetail> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(messageDetailService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增报文详情
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:detail:add")
|
||||||
|
@Log(title = "报文详情", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
@ApiOperation("新增报文详情")
|
||||||
|
public Result<String> add(@RequestBody MessageDetailModel messageDetailModel) {
|
||||||
|
return messageDetailService.add(messageDetailModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改报文详情
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:detail:edit")
|
||||||
|
@Log(title = "报文详情", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
@ApiOperation("修改报文详情")
|
||||||
|
public Result<String> edit(@PathVariable Long id, @RequestBody MessageDetailEditReq messageDetailEditReq) {
|
||||||
|
return toAjax(messageDetailService.updateById(MessageDetail.editBuild(id,messageDetailEditReq)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/updateMessage")
|
||||||
|
public Result<String> updateMessage(@RequestBody MessageDetailModel messageDetailModel) {
|
||||||
|
return messageDetailService.updateVehicle(messageDetailModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除报文详情
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("customerBusiness:detail:remove")
|
||||||
|
@Log(title = "报文详情", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
@ApiOperation("删除报文详情")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||||
|
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||||
|
return toAjax(messageDetailService.removeBatchByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,14 +7,10 @@ import java.util.concurrent.TimeUnit;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.muyu.common.core.utils.ServletUtils;
|
|
||||||
import com.muyu.common.redis.service.RedisService;
|
import com.muyu.common.redis.service.RedisService;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.customer.business.domain.MessageDetail;
|
import com.muyu.customer.business.domain.MessageDetail;
|
||||||
import com.muyu.customer.business.domain.model.VehicleModel;
|
import com.muyu.customer.business.domain.model.VehicleModel;
|
||||||
import com.muyu.customer.business.mapper.VehicleMapper;
|
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
@ -27,11 +23,8 @@ import com.muyu.common.log.enums.BusinessType;
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.customer.business.domain.Vehicle;
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
import com.muyu.customer.business.domain.req.VehicleQueryReq;
|
import com.muyu.customer.business.domain.req.VehicleQueryReq;
|
||||||
import com.muyu.customer.business.domain.req.VehicleSaveReq;
|
|
||||||
import com.muyu.customer.business.domain.req.VehicleEditReq;
|
|
||||||
import com.muyu.customer.business.service.VehicleService;
|
import com.muyu.customer.business.service.VehicleService;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import springfox.documentation.spring.web.json.Json;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆录入Controller
|
* 车辆录入Controller
|
||||||
|
@ -76,11 +69,6 @@ public class VehicleController extends BaseController {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Integer enterpriseId = SecurityUtils.getLoginUser().getSysUser().getEnterpriseId();
|
|
||||||
for (Vehicle vehicle : list) {
|
|
||||||
List<MessageDetail> messageList = vehicleService.selectMessage(vehicle.getId());
|
|
||||||
redisTemplate.opsForHash().put(enterpriseId+"", vehicle.getVin(), JSON.toJSONString(messageList));
|
|
||||||
}
|
|
||||||
|
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
@ -128,8 +116,8 @@ public class VehicleController extends BaseController {
|
||||||
@Log(title = "车辆录入", businessType = BusinessType.UPDATE)
|
@Log(title = "车辆录入", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
@ApiOperation("修改车辆录入")
|
@ApiOperation("修改车辆录入")
|
||||||
public Result<String> edit(@PathVariable Long id, @RequestBody VehicleEditReq vehicleEditReq) {
|
public Result<String> edit(@PathVariable Long id, @RequestBody VehicleModel vehicleModel) {
|
||||||
return toAjax(vehicleService.updateById(Vehicle.editBuild(id,vehicleEditReq)));
|
return vehicleService.updateVehicle(id, vehicleModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.muyu.customer.business.mapper;
|
package com.muyu.customer.business.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.customer.business.domain.FaultCode;
|
import com.muyu.customer.business.domain.FaultCode;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.muyu.customer.business.mapper;
|
package com.muyu.customer.business.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.customer.business.domain.Fence;
|
import com.muyu.customer.business.domain.Fence;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.muyu.customer.business.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.customer.business.domain.MessageDetail;
|
||||||
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
|
import com.muyu.customer.business.domain.model.VehicleMiddle;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文详情Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
public interface MessageDetailMapper extends BaseMapper<MessageDetail> {
|
||||||
|
|
||||||
|
Vehicle selectByVin(@Param("vin") String vin);
|
||||||
|
|
||||||
|
List<Integer> selectByVehicleId(@Param("id") Long id);
|
||||||
|
|
||||||
|
List<MessageDetail> selectMessage(@Param("list") List<Integer> vehicleMiddleList);
|
||||||
|
}
|
|
@ -4,7 +4,6 @@ import java.util.List;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.customer.business.domain.MessageDetail;
|
import com.muyu.customer.business.domain.MessageDetail;
|
||||||
import com.muyu.customer.business.domain.Vehicle;
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
import com.muyu.customer.business.domain.model.VehicleMiddle;
|
|
||||||
import com.muyu.customer.business.domain.model.VehicleModel;
|
import com.muyu.customer.business.domain.model.VehicleModel;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@ -22,9 +21,15 @@ public interface VehicleMapper extends BaseMapper<Vehicle> {
|
||||||
|
|
||||||
void addMiddle(@Param("id") Long id, @Param("integer") Integer integer);
|
void addMiddle(@Param("id") Long id, @Param("integer") Integer integer);
|
||||||
|
|
||||||
List<VehicleMiddle> selectMessageList(@Param("id") Long id);
|
List<Integer> selectMessageList(@Param("id") Long id);
|
||||||
|
|
||||||
VehicleModel selectId(@Param("id") Long id);
|
VehicleModel selectId(@Param("id") Long id);
|
||||||
|
|
||||||
List<MessageDetail> selectMessage(@Param("id") Long id);
|
List<MessageDetail> selectMessage(@Param("id") Long id);
|
||||||
|
|
||||||
|
int updateVehicle(@Param("id") Long id, @Param("vehicleModel") VehicleModel vehicleModel);
|
||||||
|
|
||||||
|
MessageDetail selectDetail(@Param("s") Integer s);
|
||||||
|
|
||||||
|
void deleteMiddle(@Param("id") Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.muyu.customer.business.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.customer.business.domain.MessageDetail;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.customer.business.domain.model.MessageDetailModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文详情Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
public interface MessageDetailService extends IService<MessageDetail> {
|
||||||
|
/**
|
||||||
|
* 查询报文详情列表
|
||||||
|
*
|
||||||
|
* @param messageDetail 报文详情
|
||||||
|
* @return 报文详情集合
|
||||||
|
*/
|
||||||
|
public List<MessageDetail> list(MessageDetail messageDetail);
|
||||||
|
|
||||||
|
List<MessageDetail> selectMessage(String vin);
|
||||||
|
|
||||||
|
Result<String> add(MessageDetailModel messageDetailModel);
|
||||||
|
|
||||||
|
Result<String> updateVehicle(MessageDetailModel messageDetailModel);
|
||||||
|
}
|
|
@ -2,11 +2,11 @@ package com.muyu.customer.business.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.customer.business.domain.MessageDetail;
|
import com.muyu.customer.business.domain.MessageDetail;
|
||||||
import com.muyu.customer.business.domain.Vehicle;
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.customer.business.domain.model.VehicleModel;
|
import com.muyu.customer.business.domain.model.VehicleModel;
|
||||||
import com.muyu.customer.business.domain.req.VehicleQueryReq;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆录入Service接口
|
* 车辆录入Service接口
|
||||||
|
@ -31,4 +31,6 @@ public interface VehicleService extends IService<Vehicle> {
|
||||||
VehicleModel selectById(Long id);
|
VehicleModel selectById(Long id);
|
||||||
|
|
||||||
List<MessageDetail> selectMessage(Long id);
|
List<MessageDetail> selectMessage(Long id);
|
||||||
|
|
||||||
|
Result updateVehicle(Long id, VehicleModel vehicleModel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import com.muyu.common.core.utils.ObjUtils;
|
||||||
import com.muyu.customer.business.domain.Vehicle;
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.muyu.customer.business.mapper.FenceMapper;
|
import com.muyu.customer.business.mapper.FenceMapper;
|
||||||
|
|
|
@ -0,0 +1,117 @@
|
||||||
|
package com.muyu.customer.business.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.ObjUtils;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
|
import com.muyu.customer.business.domain.model.MessageDetailModel;
|
||||||
|
import com.muyu.customer.business.domain.model.VehicleMiddle;
|
||||||
|
import com.muyu.customer.business.mapper.VehicleMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.customer.business.mapper.MessageDetailMapper;
|
||||||
|
import com.muyu.customer.business.domain.MessageDetail;
|
||||||
|
import com.muyu.customer.business.service.MessageDetailService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文详情Service业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-28
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class MessageDetailServiceImpl extends ServiceImpl<MessageDetailMapper, MessageDetail> implements MessageDetailService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MessageDetailMapper messageDetailMapper;
|
||||||
|
@Autowired
|
||||||
|
private VehicleMapper vehicleMapper;
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报文详情列表
|
||||||
|
*
|
||||||
|
* @param messageDetail 报文详情
|
||||||
|
* @return 报文详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<MessageDetail> list(MessageDetail messageDetail) {
|
||||||
|
LambdaQueryWrapper<MessageDetail> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
|
||||||
|
if (ObjUtils.notNull(messageDetail.getKeyCode())){
|
||||||
|
queryWrapper.eq(MessageDetail::getKeyCode, messageDetail.getKeyCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjUtils.notNull(messageDetail.getStartBit())){
|
||||||
|
queryWrapper.eq(MessageDetail::getStartBit, messageDetail.getStartBit());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjUtils.notNull(messageDetail.getStopBit())){
|
||||||
|
queryWrapper.eq(MessageDetail::getStopBit, messageDetail.getStopBit());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjUtils.notNull(messageDetail.getLabel())){
|
||||||
|
queryWrapper.eq(MessageDetail::getLabel, messageDetail.getLabel());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjUtils.notNull(messageDetail.getType())){
|
||||||
|
queryWrapper.eq(MessageDetail::getType, messageDetail.getType());
|
||||||
|
}
|
||||||
|
return list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MessageDetail> selectMessage(String vin) {
|
||||||
|
|
||||||
|
Vehicle vehicle=messageDetailMapper.selectByVin(vin);
|
||||||
|
List<Integer> vehicleMiddleList=messageDetailMapper.selectByVehicleId(vehicle.getId());
|
||||||
|
if (vehicleMiddleList.isEmpty()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return messageDetailMapper.selectMessage(vehicleMiddleList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<String> add(MessageDetailModel messageDetailModel) {
|
||||||
|
Integer enterpriseId = SecurityUtils.getLoginUser().getSysUser().getEnterpriseId();
|
||||||
|
Vehicle vehicle=messageDetailMapper.selectByVin(messageDetailModel.getVin());
|
||||||
|
ArrayList<MessageDetail> messageDetails = new ArrayList<>();
|
||||||
|
for (Integer s : messageDetailModel.getIds()) {
|
||||||
|
vehicleMapper.addMiddle(vehicle.getId(), s);
|
||||||
|
MessageDetail messageDetail = vehicleMapper.selectDetail(s);
|
||||||
|
messageDetails.add(messageDetail);
|
||||||
|
}
|
||||||
|
redisTemplate.opsForHash().put(enterpriseId+"", messageDetailModel.getVin(), JSON.toJSONString(messageDetails));
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<String> updateVehicle(MessageDetailModel messageDetailModel) {
|
||||||
|
Integer enterpriseId = SecurityUtils.getLoginUser().getSysUser().getEnterpriseId();
|
||||||
|
Vehicle vehicle=messageDetailMapper.selectByVin(messageDetailModel.getVin());
|
||||||
|
vehicleMapper.deleteMiddle(vehicle.getId());
|
||||||
|
ArrayList<MessageDetail> messageList = new ArrayList<>();
|
||||||
|
for (Integer s : messageDetailModel.getIds()) {
|
||||||
|
vehicleMapper.addMiddle(vehicle.getId(), s);
|
||||||
|
MessageDetail messageDetail = vehicleMapper.selectDetail(s);
|
||||||
|
messageList.add(messageDetail);
|
||||||
|
}
|
||||||
|
redisTemplate.opsForHash().put(enterpriseId+"", messageDetailModel.getVin(), JSON.toJSONString(messageList));
|
||||||
|
rabbitTemplate.convertAndSend("eventMonitor",messageDetailModel.getVin()+"_"+enterpriseId);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +1,18 @@
|
||||||
package com.muyu.customer.business.service.impl;
|
package com.muyu.customer.business.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.ObjUtils;
|
import com.muyu.common.core.utils.ObjUtils;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.customer.business.domain.MessageDetail;
|
import com.muyu.customer.business.domain.MessageDetail;
|
||||||
import com.muyu.customer.business.domain.model.VehicleMiddle;
|
|
||||||
import com.muyu.customer.business.domain.model.VehicleModel;
|
import com.muyu.customer.business.domain.model.VehicleModel;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.muyu.customer.business.mapper.VehicleMapper;
|
import com.muyu.customer.business.mapper.VehicleMapper;
|
||||||
import com.muyu.customer.business.domain.Vehicle;
|
import com.muyu.customer.business.domain.Vehicle;
|
||||||
|
@ -50,51 +55,51 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> imp
|
||||||
queryWrapper.eq(Vehicle::getModel, vehicle.getModel());
|
queryWrapper.eq(Vehicle::getModel, vehicle.getModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjUtils.notNull(vehicle.getProductionDate())){
|
if (ObjUtils.notNull(vehicle.getProductionDate())) {
|
||||||
queryWrapper.eq(Vehicle::getProductionDate, vehicle.getProductionDate());
|
queryWrapper.eq(Vehicle::getProductionDate, vehicle.getProductionDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjUtils.notNull(vehicle.getBodyType())){
|
if (ObjUtils.notNull(vehicle.getBodyType())) {
|
||||||
queryWrapper.eq(Vehicle::getBodyType, vehicle.getBodyType());
|
queryWrapper.eq(Vehicle::getBodyType, vehicle.getBodyType());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjUtils.notNull(vehicle.getColor())){
|
if (ObjUtils.notNull(vehicle.getColor())) {
|
||||||
queryWrapper.eq(Vehicle::getColor, vehicle.getColor());
|
queryWrapper.eq(Vehicle::getColor, vehicle.getColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjUtils.notNull(vehicle.getEngineCapacity())){
|
if (ObjUtils.notNull(vehicle.getEngineCapacity())) {
|
||||||
queryWrapper.eq(Vehicle::getEngineCapacity, vehicle.getEngineCapacity());
|
queryWrapper.eq(Vehicle::getEngineCapacity, vehicle.getEngineCapacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjUtils.notNull(vehicle.getFuelType())){
|
if (ObjUtils.notNull(vehicle.getFuelType())) {
|
||||||
queryWrapper.eq(Vehicle::getFuelType, vehicle.getFuelType());
|
queryWrapper.eq(Vehicle::getFuelType, vehicle.getFuelType());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjUtils.notNull(vehicle.getTransmission())){
|
if (ObjUtils.notNull(vehicle.getTransmission())) {
|
||||||
queryWrapper.eq(Vehicle::getTransmission, vehicle.getTransmission());
|
queryWrapper.eq(Vehicle::getTransmission, vehicle.getTransmission());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjUtils.notNull(vehicle.getDriveType())){
|
if (ObjUtils.notNull(vehicle.getDriveType())) {
|
||||||
queryWrapper.eq(Vehicle::getDriveType, vehicle.getDriveType());
|
queryWrapper.eq(Vehicle::getDriveType, vehicle.getDriveType());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjUtils.notNull(vehicle.getMileage())){
|
if (ObjUtils.notNull(vehicle.getMileage())) {
|
||||||
queryWrapper.eq(Vehicle::getMileage, vehicle.getMileage());
|
queryWrapper.eq(Vehicle::getMileage, vehicle.getMileage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjUtils.notNull(vehicle.getRegistrationDate())){
|
if (ObjUtils.notNull(vehicle.getRegistrationDate())) {
|
||||||
queryWrapper.eq(Vehicle::getRegistrationDate, vehicle.getRegistrationDate());
|
queryWrapper.eq(Vehicle::getRegistrationDate, vehicle.getRegistrationDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjUtils.notNull(vehicle.getLicenseNumber())){
|
if (ObjUtils.notNull(vehicle.getLicenseNumber())) {
|
||||||
queryWrapper.eq(Vehicle::getLicenseNumber, vehicle.getLicenseNumber());
|
queryWrapper.eq(Vehicle::getLicenseNumber, vehicle.getLicenseNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjUtils.notNull(vehicle.getHolder())){
|
if (ObjUtils.notNull(vehicle.getHolder())) {
|
||||||
queryWrapper.eq(Vehicle::getHolder, vehicle.getHolder());
|
queryWrapper.eq(Vehicle::getHolder, vehicle.getHolder());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjUtils.notNull(vehicle.getVehicleType())){
|
if (ObjUtils.notNull(vehicle.getVehicleType())) {
|
||||||
queryWrapper.eq(Vehicle::getVehicleType, vehicle.getVehicleType());
|
queryWrapper.eq(Vehicle::getVehicleType, vehicle.getVehicleType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,20 +116,16 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> imp
|
||||||
@Override
|
@Override
|
||||||
public String add(VehicleModel vehicleModel) {
|
public String add(VehicleModel vehicleModel) {
|
||||||
vehicleMapper.add(vehicleModel);
|
vehicleMapper.add(vehicleModel);
|
||||||
for (String s : vehicleModel.getMessageDetail()) {
|
|
||||||
vehicleMapper.addMiddle(vehicleModel.getId(),Integer.valueOf(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println(vehicleModel.getId());
|
|
||||||
// MessageDetail messageDetail = vehicleModel.getMessageDetail();
|
|
||||||
|
|
||||||
return "成功";
|
return "成功";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VehicleModel selectById(Long id) {
|
public VehicleModel selectById(Long id) {
|
||||||
List<VehicleMiddle> vehicleMiddleList= vehicleMapper.selectMessageList(id);
|
// List<Integer> vehicleMiddleList= vehicleMapper.selectMessageList(id);
|
||||||
VehicleModel vehicleModel= vehicleMapper.selectId(id);
|
VehicleModel vehicleModel= vehicleMapper.selectId(id);
|
||||||
|
// vehicleModel.setMessageDetail(vehicleMiddleList);
|
||||||
|
System.out.println(vehicleModel.getMessageDetail());
|
||||||
return vehicleModel;
|
return vehicleModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,4 +134,17 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> imp
|
||||||
return vehicleMapper.selectMessage(id);
|
return vehicleMapper.selectMessage(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
@Override
|
||||||
|
public Result updateVehicle(Long id, VehicleModel vehicleModel) {
|
||||||
|
int i = vehicleMapper.updateVehicle(id, vehicleModel);
|
||||||
|
// vehicleMapper.deleteMiddle(id);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?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.customer.business.mapper.MessageDetailMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.muyu.customer.business.domain.MessageDetail" id="MessageDetailResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="keyCode" column="key_code" />
|
||||||
|
<result property="startBit" column="start_bit" />
|
||||||
|
<result property="stopBit" column="stop_bit" />
|
||||||
|
<result property="label" column="label" />
|
||||||
|
<result property="type" column="type" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectMessageDetailVo">
|
||||||
|
select id, `key_code`, start_bit, stop_bit, label, `type` from message_detail
|
||||||
|
</sql>
|
||||||
|
<select id="selectByVin" resultType="com.muyu.customer.business.domain.Vehicle">
|
||||||
|
select * from vehicle where vin = #{vin}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMessage" resultType="com.muyu.customer.business.domain.MessageDetail">
|
||||||
|
select * from message_detail where id in(
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</select>
|
||||||
|
<select id="selectByVehicleId" resultType="java.lang.Integer">
|
||||||
|
select message_id from vehicle_middle where vehicle_id = #{id}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -43,12 +43,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
values
|
values
|
||||||
(#{id}, #{integer})
|
(#{id}, #{integer})
|
||||||
</insert>
|
</insert>
|
||||||
|
<update id="updateVehicle">
|
||||||
|
update vehicle set
|
||||||
|
vin = #{vehicleModel.vin},
|
||||||
|
brand = #{vehicleModel.brand},
|
||||||
|
model = #{vehicleModel.model},
|
||||||
|
production_date = #{vehicleModel.productionDate},
|
||||||
|
body_type = #{vehicleModel.bodyType},
|
||||||
|
color = #{vehicleModel.color},
|
||||||
|
engine_capacity = #{vehicleModel.engineCapacity},
|
||||||
|
fuel_type = #{vehicleModel.fuelType},
|
||||||
|
transmission = #{vehicleModel.transmission},
|
||||||
|
drive_type = #{vehicleModel.driveType},
|
||||||
|
mileage = #{vehicleModel.mileage},
|
||||||
|
registration_date = #{vehicleModel.registrationDate},
|
||||||
|
license_number = #{vehicleModel.licenseNumber},
|
||||||
|
holder = #{vehicleModel.holder},
|
||||||
|
vehicle_type = #{vehicleModel.vehicleType} where id = #{id}
|
||||||
|
</update>
|
||||||
|
<delete id="deleteMiddle">
|
||||||
|
delete from vehicle_middle where vehicle_id = #{id}
|
||||||
|
</delete>
|
||||||
<select id="MessageList" resultType="com.muyu.customer.business.domain.MessageDetail">
|
<select id="MessageList" resultType="com.muyu.customer.business.domain.MessageDetail">
|
||||||
select * from message_detail
|
select * from message_detail
|
||||||
</select>
|
</select>
|
||||||
<select id="selectMessageList" resultType="com.muyu.customer.business.domain.model.VehicleMiddle">
|
|
||||||
select * from vehicle_middle where vehicle_id = #{id}
|
|
||||||
</select>
|
|
||||||
<select id="selectId" resultType="com.muyu.customer.business.domain.model.VehicleModel">
|
<select id="selectId" resultType="com.muyu.customer.business.domain.model.VehicleModel">
|
||||||
select * from vehicle where id = #{id}
|
select * from vehicle where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
@ -56,4 +74,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select m.id,m.key,m.lable,m.start_bit,m.stop_bit,m.type
|
select m.id,m.key,m.lable,m.start_bit,m.stop_bit,m.type
|
||||||
from message_detail m,vehicle_middle v where m.id = v.message_id and v.vehicle_id = #{id}
|
from message_detail m,vehicle_middle v where m.id = v.message_id and v.vehicle_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectMessageList" resultType="java.lang.Integer">
|
||||||
|
select message_id from vehicle_middle where vehicle_id = #{id}
|
||||||
|
</select>
|
||||||
|
<select id="selectDetail" resultType="com.muyu.customer.business.domain.MessageDetail">
|
||||||
|
select * from message_detail where id = #{s}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue